integ/iri/js/vs.0.1-min.js
changeset 66 a77532772aa4
parent 65 b13a409f01dc
child 67 cff3bbe9e539
equal deleted inserted replaced
65:b13a409f01dc 66:a77532772aa4
     1 /*
     1 /*!
     2  * Visual Sedimentation Library v0.01
     2  * Visual Sedimentation Library v0.01
     3  * http://www.visualsedimentation.org/
     3  * http://www.visualsedimentation.org/
     4  *
     4  *
     5  * Copyright 2013, Samuel Huron & Romain Vuillemont
     5  * Copyright 2013, Samuel Huron & Romain Vuillemont
     6  * Licensed under the CeCILL-B or GPL Version 2 licenses.
     6  * Licensed under the CeCILL-B or GPL Version 2 licenses.
     7  * http://jquery.org/license
     7  * http://jquery.org/license
     8  *
     8  *
     9  *
     9  */ 
    10  *
    10 
    11  *
    11 if (!window.jQuery || parseFloat(window.jQuery().jquery) < 1.3) {
    12  *
    12     /*
    13  * Includes jquery.js
    13      * Including jquery.js
    14  * http://jquery.com/
    14      * http://jquery.com/
    15  * Copyright 2010, John Resig
    15      * Copyright 2010, John Resig
    16  * Released under Dual licensed under the MIT or GPL Version 2 licenses.
    16      * Released under Dual licensed under the MIT or GPL Version 2 licenses.
    17  * 
    17      * 
    18  * Includes d3.js
    18      * Including Sizzle.js
       
    19      * http://sizzlejs.com/
       
    20      * Copyright 2010, The Dojo Foundation
       
    21      * Released under the MIT, BSD, and GPL Licenses.
       
    22      */
       
    23 /*! jQuery v2.0.0 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
       
    24 //@ sourceMappingURL=jquery.min.map
       
    25 */
       
    26 (function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],f="2.0.0",p=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=f.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=j(e);if(n){if(s){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],o=0,s=e.length;for(n=!!n;s>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s=j(e),a=[];if(s)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(a[a.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(a[a.length]=r);return p.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===x.type(n)){i=!0;for(a in n)x.access(e,t,a,n[a],!0,o,s)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(x(e),n)})),t))for(;u>a;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=s[o];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}t=x(o),function(e,undefined){var t,n,r,i,o,s,a,u,l,c,f,p,h,d,g,m,y="sizzle"+-new Date,v=e.document,b={},w=0,T=0,C=ot(),k=ot(),N=ot(),E=!1,S=function(){return 0},j=typeof undefined,D=1<<31,A=[],L=A.pop,q=A.push,H=A.push,O=A.slice,F=A.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",R="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=M.replace("w","w#"),$="\\["+R+"*("+M+")"+R+"*(?:([*^$|!~]?=)"+R+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+R+"*\\]",B=":("+M+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",I=RegExp("^"+R+"+|((?:^|[^\\\\])(?:\\\\.)*)"+R+"+$","g"),z=RegExp("^"+R+"*,"+R+"*"),_=RegExp("^"+R+"*([>+~]|"+R+")"+R+"*"),X=RegExp(R+"*[+~]"),U=RegExp("="+R+"*([^\\]'\"]*)"+R+"*\\]","g"),Y=RegExp(B),V=RegExp("^"+W+"$"),G={ID:RegExp("^#("+M+")"),CLASS:RegExp("^\\.("+M+")"),TAG:RegExp("^("+M.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+B),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+R+"*(even|odd|(([+-]|)(\\d*)n|)"+R+"*(?:([+-]|)"+R+"*(\\d+)|))"+R+"*\\)|)","i"),"boolean":RegExp("^(?:"+P+")$","i"),needsContext:RegExp("^"+R+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+R+"*((?:-\\d)?\\d*)"+R+"*\\)|)(?=[^-]|$)","i")},J=/^[^{]+\{\s*\[native \w/,Q=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,et=/'|\\/g,tt=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,nt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{H.apply(A=O.call(v.childNodes),v.childNodes),A[v.childNodes.length].nodeType}catch(rt){H={apply:A.length?function(e,t){q.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function it(e){return J.test(e+"")}function ot(){var e,t=[];return e=function(n,i){return t.push(n+=" ")>r.cacheLength&&delete e[t.shift()],e[n]=i}}function st(e){return e[y]=!0,e}function at(e){var t=c.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ut(e,t,n,r){var i,o,s,a,u,f,d,g,x,w;if((t?t.ownerDocument||t:v)!==c&&l(t),t=t||c,n=n||[],!e||"string"!=typeof e)return n;if(1!==(a=t.nodeType)&&9!==a)return[];if(p&&!r){if(i=Q.exec(e))if(s=i[1]){if(9===a){if(o=t.getElementById(s),!o||!o.parentNode)return n;if(o.id===s)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(s))&&m(t,o)&&o.id===s)return n.push(o),n}else{if(i[2])return H.apply(n,t.getElementsByTagName(e)),n;if((s=i[3])&&b.getElementsByClassName&&t.getElementsByClassName)return H.apply(n,t.getElementsByClassName(s)),n}if(b.qsa&&(!h||!h.test(e))){if(g=d=y,x=t,w=9===a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){f=gt(e),(d=t.getAttribute("id"))?g=d.replace(et,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=f.length;while(u--)f[u]=g+mt(f[u]);x=X.test(e)&&t.parentNode||t,w=f.join(",")}if(w)try{return H.apply(n,x.querySelectorAll(w)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(I,"$1"),t,n,r)}o=ut.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},l=ut.setDocument=function(e){var t=e?e.ownerDocument||e:v;return t!==c&&9===t.nodeType&&t.documentElement?(c=t,f=t.documentElement,p=!o(t),b.getElementsByTagName=at(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),b.attributes=at(function(e){return e.className="i",!e.getAttribute("className")}),b.getElementsByClassName=at(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),b.sortDetached=at(function(e){return 1&e.compareDocumentPosition(c.createElement("div"))}),b.getById=at(function(e){return f.appendChild(e).id=y,!t.getElementsByName||!t.getElementsByName(y).length}),b.getById?(r.find.ID=function(e,t){if(typeof t.getElementById!==j&&p){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){return e.getAttribute("id")===t}}):(r.find.ID=function(e,t){if(typeof t.getElementById!==j&&p){var n=t.getElementById(e);return n?n.id===e||typeof n.getAttributeNode!==j&&n.getAttributeNode("id").value===e?[n]:undefined:[]}},r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=b.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==j?t.getElementsByTagName(e):undefined}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=b.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==j&&p?t.getElementsByClassName(e):undefined},d=[],h=[],(b.qsa=it(t.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+R+"*(?:value|"+P+")"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){var t=c.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&h.push("[*^$]="+R+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(b.matchesSelector=it(g=f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){b.disconnectedMatch=g.call(e,"div"),g.call(e,"[s!='']:x"),d.push("!=",B)}),h=h.length&&RegExp(h.join("|")),d=d.length&&RegExp(d.join("|")),m=it(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},S=f.compareDocumentPosition?function(e,n){if(e===n)return E=!0,0;var r=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);return r?1&r||!b.sortDetached&&n.compareDocumentPosition(e)===r?e===t||m(v,e)?-1:n===t||m(v,n)?1:u?F.call(u,e)-F.call(u,n):0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],l=[n];if(e===n)return E=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:u?F.call(u,e)-F.call(u,n):0;if(o===s)return lt(e,n);r=e;while(r=r.parentNode)a.unshift(r);r=n;while(r=r.parentNode)l.unshift(r);while(a[i]===l[i])i++;return i?lt(a[i],l[i]):a[i]===v?-1:l[i]===v?1:0},c):c},ut.matches=function(e,t){return ut(e,null,null,t)},ut.matchesSelector=function(e,t){if((e.ownerDocument||e)!==c&&l(e),t=t.replace(U,"='$1']"),!(!b.matchesSelector||!p||d&&d.test(t)||h&&h.test(t)))try{var n=g.call(e,t);if(n||b.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return ut(t,c,null,[e]).length>0},ut.contains=function(e,t){return(e.ownerDocument||e)!==c&&l(e),m(e,t)},ut.attr=function(e,t){(e.ownerDocument||e)!==c&&l(e);var n=r.attrHandle[t.toLowerCase()],i=n&&n(e,t,!p);return i===undefined?b.attributes||!p?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null:i},ut.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ut.uniqueSort=function(e){var t,n=[],r=0,i=0;if(E=!b.detectDuplicates,u=!b.sortStable&&e.slice(0),e.sort(S),E){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return e};function lt(e,t){var n=t&&e,r=n&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ct(e,t,n){var r;return n?undefined:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}function ft(e,t,n){var r;return n?undefined:r=e.getAttribute(t,"type"===t.toLowerCase()?1:2)}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function dt(e){return st(function(t){return t=+t,st(function(n,r){var i,o=e([],n.length,t),s=o.length;while(s--)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}i=ut.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r];r++)n+=i(t);return n},r=ut.selectors={cacheLength:50,createPseudo:st,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(tt,nt),e[3]=(e[4]||e[5]||"").replace(tt,nt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ut.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ut.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return G.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&Y.test(n)&&(t=gt(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(tt,nt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=RegExp("(^|"+R+")"+e+"("+R+"|$)"))&&C(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ut.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,h,d,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,v=a&&t.nodeName.toLowerCase(),x=!u&&!a;if(m){if(o){while(g){f=t;while(f=f[g])if(a?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&x){c=m[y]||(m[y]={}),l=c[e]||[],h=l[0]===w&&l[1],p=l[0]===w&&l[2],f=h&&m.childNodes[h];while(f=++h&&f&&f[g]||(p=h=0)||d.pop())if(1===f.nodeType&&++p&&f===t){c[e]=[w,h,p];break}}else if(x&&(l=(t[y]||(t[y]={}))[e])&&l[0]===w)p=l[1];else while(f=++h&&f&&f[g]||(p=h=0)||d.pop())if((a?f.nodeName.toLowerCase()===v:1===f.nodeType)&&++p&&(x&&((f[y]||(f[y]={}))[e]=[w,p]),f===t))break;return p-=i,p===r||0===p%r&&p/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ut.error("unsupported pseudo: "+e);return i[y]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?st(function(e,n){var r,o=i(e,t),s=o.length;while(s--)r=F.call(e,o[s]),e[r]=!(n[r]=o[s])}):function(e){return i(e,0,n)}):i}},pseudos:{not:st(function(e){var t=[],n=[],r=s(e.replace(I,"$1"));return r[y]?st(function(e,t,n,i){var o,s=r(e,null,i,[]),a=e.length;while(a--)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:st(function(e){return function(t){return ut(e,t).length>0}}),contains:st(function(e){return function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:st(function(e){return V.test(e||"")||ut.error("unsupported lang: "+e),e=e.replace(tt,nt).toLowerCase(),function(t){var n;do if(n=p?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===c.activeElement&&(!c.hasFocus||c.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Z.test(e.nodeName)},input:function(e){return K.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:dt(function(){return[0]}),last:dt(function(e,t){return[t-1]}),eq:dt(function(e,t,n){return[0>n?n+t:n]}),even:dt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:dt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:dt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:dt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=pt(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=ht(t);function gt(e,t){var n,i,o,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);a=e,u=[],l=r.preFilter;while(a){(!n||(i=z.exec(a)))&&(i&&(a=a.slice(i[0].length)||a),u.push(o=[])),n=!1,(i=_.exec(a))&&(n=i.shift(),o.push({value:n,type:i[0].replace(I," ")}),a=a.slice(n.length));for(s in r.filter)!(i=G[s].exec(a))||l[s]&&!(i=l[s](i))||(n=i.shift(),o.push({value:n,type:s,matches:i}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ut.error(e):k(e,u).slice(0)}function mt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,r){var i=t.dir,o=r&&"parentNode"===i,s=T++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,r,a){var u,l,c,f=w+" "+s;if(a){while(t=t[i])if((1===t.nodeType||o)&&e(t,r,a))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[y]||(t[y]={}),(l=c[i])&&l[0]===f){if((u=l[1])===!0||u===n)return u===!0}else if(l=c[i]=[f],l[1]=e(t,r,a)||n,l[1]===!0)return!0}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,s=[],a=0,u=e.length,l=null!=t;for(;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function bt(e,t,n,r,i,o){return r&&!r[y]&&(r=bt(r)),i&&!i[y]&&(i=bt(i,o)),st(function(o,s,a,u){var l,c,f,p=[],h=[],d=s.length,g=o||Ct(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xt(g,p,e,a,u),y=n?i||(o?e:d||r)?[]:s:m;if(n&&n(m,y,a,u),r){l=xt(y,h),r(l,[],a,u),c=l.length;while(c--)(f=l[c])&&(y[h[c]]=!(m[h[c]]=f))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(f=y[c])&&l.push(m[c]=f);i(null,y=[],l,u)}c=y.length;while(c--)(f=y[c])&&(l=i?F.call(o,f):p[c])>-1&&(o[l]=!(s[l]=f))}}else y=xt(y===s?y.splice(d,y.length):y),i?i(null,s,y,u):H.apply(s,y)})}function wt(e){var t,n,i,o=e.length,s=r.relative[e[0].type],u=s||r.relative[" "],l=s?1:0,c=yt(function(e){return e===t},u,!0),f=yt(function(e){return F.call(t,e)>-1},u,!0),p=[function(e,n,r){return!s&&(r||n!==a)||((t=n).nodeType?c(e,n,r):f(e,n,r))}];for(;o>l;l++)if(n=r.relative[e[l].type])p=[yt(vt(p),n)];else{if(n=r.filter[e[l].type].apply(null,e[l].matches),n[y]){for(i=++l;o>i;i++)if(r.relative[e[i].type])break;return bt(l>1&&vt(p),l>1&&mt(e.slice(0,l-1)).replace(I,"$1"),n,i>l&&wt(e.slice(l,i)),o>i&&wt(e=e.slice(i)),o>i&&mt(e))}p.push(n)}return vt(p)}function Tt(e,t){var i=0,o=t.length>0,s=e.length>0,u=function(u,l,f,p,h){var d,g,m,y=[],v=0,x="0",b=u&&[],T=null!=h,C=a,k=u||s&&r.find.TAG("*",h&&l.parentNode||l),N=w+=null==C?1:Math.random()||.1;for(T&&(a=l!==c&&l,n=i);null!=(d=k[x]);x++){if(s&&d){g=0;while(m=e[g++])if(m(d,l,f)){p.push(d);break}T&&(w=N,n=++i)}o&&((d=!m&&d)&&v--,u&&b.push(d))}if(v+=x,o&&x!==v){g=0;while(m=t[g++])m(b,y,l,f);if(u){if(v>0)while(x--)b[x]||y[x]||(y[x]=L.call(p));y=xt(y)}H.apply(p,y),T&&!u&&y.length>0&&v+t.length>1&&ut.uniqueSort(p)}return T&&(w=N,a=C),b};return o?st(u):u}s=ut.compile=function(e,t){var n,r=[],i=[],o=N[e+" "];if(!o){t||(t=gt(e)),n=t.length;while(n--)o=wt(t[n]),o[y]?r.push(o):i.push(o);o=N(e,Tt(i,r))}return o};function Ct(e,t,n){var r=0,i=t.length;for(;i>r;r++)ut(e,t[r],n);return n}function kt(e,t,n,i){var o,a,u,l,c,f=gt(e);if(!i&&1===f.length){if(a=f[0]=f[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&p&&r.relative[a[1].type]){if(t=(r.find.ID(u.matches[0].replace(tt,nt),t)||[])[0],!t)return n;e=e.slice(a.shift().value.length)}o=G.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],r.relative[l=u.type])break;if((c=r.find[l])&&(i=c(u.matches[0].replace(tt,nt),X.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=i.length&&mt(a),!e)return H.apply(n,i),n;break}}}return s(e,f)(i,t,!p,n,X.test(e)),n}r.pseudos.nth=r.pseudos.eq;function Nt(){}Nt.prototype=r.filters=r.pseudos,r.setFilters=new Nt,b.sortStable=y.split("").sort(S).join("")===y,l(),[0,0].sort(S),b.detectDuplicates=E,at(function(e){if(e.innerHTML="<a href='#'></a>","#"!==e.firstChild.getAttribute("href")){var t="type|href|height|width".split("|"),n=t.length;while(n--)r.attrHandle[t[n]]=ft}}),at(function(e){if(null!=e.getAttribute("disabled")){var t=P.split("|"),n=t.length;while(n--)r.attrHandle[t[n]]=ct}}),x.find=ut,x.expr=ut.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ut.uniqueSort,x.text=ut.getText,x.isXMLDoc=ut.isXML,x.contains=ut.contains}(e);var D={};function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,o,s,a=[],u=!e.once&&[],l=function(f){for(t=e.memory&&f,n=!0,s=i||0,i=0,o=a.length,r=!0;a&&o>s;s++)if(a[s].apply(f[0],f[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,a&&(u?u.length&&l(u.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var n=a.length;(function s(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&c.has(n)||a.push(n):n&&n.length&&"string"!==r&&s(n)})})(arguments),r?o=a.length:t&&(i=n,l(t))}return this},remove:function(){return a&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,a,n))>-1)a.splice(n,1),r&&(o>=n&&o--,s>=n&&s--)}),this},has:function(e){return e?x.inArray(e,a)>-1:!(!a||!a.length)},empty:function(){return a=[],o=0,this},disable:function(){return a=u=t=undefined,this},disabled:function(){return!a},lock:function(){return u=undefined,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!a||n&&!u||(r?u.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var s=o[0],a=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),s=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},a,u,l;if(r>1)for(a=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),a=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=a.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",a=o.getElementsByTagName("body")[0];a&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(x.isEmptyObject(o))this.cache[i]=t;else for(r in t)o[r]=t[r]},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){return t===undefined||t&&"string"==typeof t&&n===undefined?this.get(e,t):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i=this.key(e),o=this.cache[i];if(t===undefined)this.cache[i]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):t in o?r=[t]:(r=x.camelCase(t),r=r in o?[r]:r.match(w)||[]),n=r.length;while(n--)delete o[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){delete this.cache[this.key(e)]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],o=0,s=null;if(e===undefined){if(this.length&&(s=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=x.camelCase(r.substring(5)),P(i,r,s[r]));q.set(i,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),s=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t);
       
    27 x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(s--)n=q.get(o[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var R,M,W=/[\t\r\n]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,i="boolean"==typeof t;return x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,s=0,a=x(this),u=t,l=e.match(w)||[];while(o=l[s++])u=i?u:!a.hasClass(o),a[u?"addClass":"removeClass"](o)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i,o=x(this);1===this.nodeType&&(i=r?e.call(this,n,o.val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,s=o?null:[],a=o?i+1:r.length,u=0>i?a:o?i:0;for(;a>u;u++)if(n=r[u],!(!n.selected&&u!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),s=i.length;while(s--)r=i[s],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,t,n){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===r?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.boolean.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=x.find.attr(e,t),null==o?undefined:o):null!==n?i&&"set"in i&&(o=i.set(e,n,t))!==undefined?o:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.boolean.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!x.isXMLDoc(e),o&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.boolean.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],o=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,o}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}x.event={global:{},add:function(e,t,n,i,o){var s,a,u,l,c,f,p,h,d,g,m,y=q.get(e);if(y){n.handler&&(s=n,n=s.handler,o=s.selector),n.guid||(n.guid=x.guid++),(l=y.events)||(l=y.events={}),(a=y.handle)||(a=y.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(a.elem,arguments)},a.elem=e),t=(t||"").match(w)||[""],c=t.length;while(c--)u=X.exec(t[c])||[],d=m=u[1],g=(u[2]||"").split(".").sort(),d&&(p=x.event.special[d]||{},d=(o?p.delegateType:p.bindType)||d,p=x.event.special[d]||{},f=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&x.expr.match.needsContext.test(o),namespace:g.join(".")},s),(h=l[d])||(h=l[d]=[],h.delegateCount=0,p.setup&&p.setup.call(e,i,g,a)!==!1||e.addEventListener&&e.addEventListener(d,a,!1)),p.add&&(p.add.call(e,f),f.handler.guid||(f.handler.guid=n.guid)),o?h.splice(h.delegateCount++,0,f):h.push(f),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,h,d,g,m=q.hasData(e)&&q.get(e);if(m&&(u=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(a=X.exec(t[l])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){f=x.event.special[h]||{},h=(r?f.delegateType:f.bindType)||h,p=u[h]||[],a=a[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&f.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)x.event.remove(e,h+t[l],n,r,!0);x.isEmptyObject(u)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,a,u,l,c,f,p,h=[r||o],d=y.call(t,"type")?t.type:t,g=y.call(t,"namespace")?t.namespace.split("."):[];if(a=u=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(g=d.split("."),d=g.shift(),g.sort()),c=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),p=x.event.special[d]||{},i||!p.trigger||p.trigger.apply(r,n)!==!1)){if(!i&&!p.noBubble&&!x.isWindow(r)){for(l=p.delegateType||d,_.test(l+d)||(a=a.parentNode);a;a=a.parentNode)h.push(a),u=a;u===(r.ownerDocument||o)&&h.push(u.defaultView||u.parentWindow||e)}s=0;while((a=h[s++])&&!t.isPropagationStopped())t.type=s>1?l:p.bindType||d,f=(q.get(a,"events")||{})[t.type]&&q.get(a,"handle"),f&&f.apply(a,n),f=c&&a[c],f&&x.acceptData(a)&&f.apply&&f.apply(a,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||p._default&&p._default.apply(h.pop(),n)!==!1||!x.acceptData(r)||c&&x.isFunction(r[d])&&!x.isWindow(r)&&(u=r[c],u&&(r[c]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,u&&(r[c]=u)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,o,s=[],a=d.call(arguments),u=(q.get(this,"events")||{})[e.type]||[],l=x.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),t=0;while((i=s[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((x.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;a>n;n++)o=t[n],i=o.selector+" ",r[i]===undefined&&(r[i]=o.needsContext?x(i,this).index(u)>=0:x.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return t.length>a&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return 3===e.target.nodeType&&(e.target=e.target.parentNode),s.filter?s.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=x.expr.match.needsContext,Q={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return t=this,this.pushStack(x(e).filter(function(){for(r=0;i>r;r++)if(x.contains(t[r],this))return!0}));for(n=[],r=0;i>r;r++)x.find(e,this[r],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(Z(this,e||[],!0))},filter:function(e){return this.pushStack(Z(this,e||[],!1))},is:function(e){return!!e&&("string"==typeof e?J.test(e)?x(e,this.context).index(this[0])>=0:x.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],s=J.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(s?s.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function K(e,t){while((e=e[t])&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return K(e,"nextSibling")},prev:function(e){return K(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(Q[e]||x.unique(i),"p"===e[0]&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function Z(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}var et=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,tt=/<([\w:]+)/,nt=/<|&#?\w+;/,rt=/<(?:script|style|link)/i,it=/^(?:checkbox|radio)$/i,ot=/checked\s*(?:[^=]|=\s*.checked.)/i,st=/^$|\/(?:java|ecma)script/i,at=/^true\/(.*)/,ut=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,lt={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};lt.optgroup=lt.option,lt.tbody=lt.tfoot=lt.colgroup=lt.caption=lt.col=lt.thead,lt.th=lt.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===undefined?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=ct(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=ct(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(gt(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&ht(gt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(gt(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!rt.test(e)&&!lt[(tt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(et,"<$1></$2>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(x.cleanData(gt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=p.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,f=this,h=c-1,d=e[0],g=x.isFunction(d);if(g||!(1>=c||"string"!=typeof d||x.support.checkClone)&&ot.test(d))return this.each(function(r){var i=f.eq(r);g&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(r=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),i=r.firstChild,1===r.childNodes.length&&(r=i),i)){for(o=x.map(gt(r,"script"),ft),s=o.length;c>l;l++)a=r,l!==h&&(a=x.clone(a,!0,!0),s&&x.merge(o,gt(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,x.map(o,pt),l=0;s>l;l++)a=o[l],st.test(a.type||"")&&!q.access(a,"globalEval")&&x.contains(u,a)&&(a.src?x._evalUrl(a.src):x.globalEval(a.textContent.replace(ut,"")))}return this}}),x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=[],i=x(e),o=i.length-1,s=0;for(;o>=s;s++)n=s===o?this:this.clone(!0),x(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}}),x.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=x.contains(e.ownerDocument,e);if(!(x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(s=gt(a),o=gt(e),r=0,i=o.length;i>r;r++)mt(o[r],s[r]);if(t)if(n)for(o=o||gt(e),s=s||gt(a),r=0,i=o.length;i>r;r++)dt(o[r],s[r]);else dt(e,a);return s=gt(a,"script"),s.length>0&&ht(s,!u&&gt(e,"script")),a},buildFragment:function(e,t,n,r){var i,o,s,a,u,l,c=0,f=e.length,p=t.createDocumentFragment(),h=[];for(;f>c;c++)if(i=e[c],i||0===i)if("object"===x.type(i))x.merge(h,i.nodeType?[i]:i);else if(nt.test(i)){o=o||p.appendChild(t.createElement("div")),s=(tt.exec(i)||["",""])[1].toLowerCase(),a=lt[s]||lt._default,o.innerHTML=a[1]+i.replace(et,"<$1></$2>")+a[2],l=a[0];while(l--)o=o.firstChild;x.merge(h,o.childNodes),o=p.firstChild,o.textContent=""}else h.push(t.createTextNode(i));p.textContent="",c=0;while(i=h[c++])if((!r||-1===x.inArray(i,r))&&(u=x.contains(i.ownerDocument,i),o=gt(p.appendChild(i),"script"),u&&ht(o),n)){l=0;while(i=o[l++])st.test(i.type||"")&&n.push(i)}return p},cleanData:function(e){var t,n,r,i=e.length,o=0,s=x.event.special;for(;i>o;o++){if(n=e[o],x.acceptData(n)&&(t=q.access(n)))for(r in t.events)s[r]?x.event.remove(n,r):x.removeEvent(n,r,t.handle);L.discard(n),q.discard(n)}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"text",async:!1,global:!1,success:x.globalEval})}});function ct(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function pt(e){var t=at.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function ht(e,t){var n=e.length,r=0;for(;n>r;r++)q.set(e[r],"globalEval",!t||q.get(t[r],"globalEval"))}function dt(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(q.hasData(e)&&(o=q.access(e),s=x.extend({},o),l=o.events,q.set(t,s),l)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)x.event.add(t,i,l[i][n])}L.hasData(e)&&(a=L.access(e),u=x.extend({},a),L.set(t,u))}}function gt(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x.nodeName(e,t)?x.merge([e],n):n}function mt(e,t){var n=t.nodeName.toLowerCase();"input"===n&&it.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}x.fn.extend({wrapAll:function(e){var t;return x.isFunction(e)?this.each(function(t){x(this).wrapAll(e.call(this,t))}):(this[0]&&(t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var yt,vt,xt=/^(none|table(?!-c[ea]).+)/,bt=/^margin/,wt=RegExp("^("+b+")(.*)$","i"),Tt=RegExp("^("+b+")(?!px)[a-z%]+$","i"),Ct=RegExp("^([+-])=("+b+")","i"),kt={BODY:"block"},Nt={position:"absolute",visibility:"hidden",display:"block"},Et={letterSpacing:0,fontWeight:400},St=["Top","Right","Bottom","Left"],jt=["Webkit","O","Moz","ms"];function Dt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=jt.length;while(i--)if(t=jt[i]+n,t in e)return t;return r}function At(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function Lt(t){return e.getComputedStyle(t,null)}function qt(e,t){var n,r,i,o=[],s=0,a=e.length;for(;a>s;s++)r=e[s],r.style&&(o[s]=q.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&At(r)&&(o[s]=q.access(r,"olddisplay",Pt(r.nodeName)))):o[s]||(i=At(r),(n&&"none"!==n||!i)&&q.set(r,"olddisplay",i?n:x.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}x.fn.extend({css:function(e,t){return x.access(this,function(e,t,n){var r,i,o={},s=0;if(x.isArray(t)){for(r=Lt(e),i=t.length;i>s;s++)o[t[s]]=x.css(e,t[s],!1,r);return o}return n!==undefined?x.style(e,t,n):x.css(e,t)},e,t,arguments.length>1)},show:function(){return qt(this,!0)},hide:function(){return qt(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:At(this))?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=yt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=x.camelCase(t),u=e.style;return t=x.cssProps[a]||(x.cssProps[a]=Dt(u,a)),s=x.cssHooks[t]||x.cssHooks[a],n===undefined?s&&"get"in s&&(i=s.get(e,!1,r))!==undefined?i:u[t]:(o=typeof n,"string"===o&&(i=Ct.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(x.css(e,t)),o="number"),null==n||"number"===o&&isNaN(n)||("number"!==o||x.cssNumber[a]||(n+="px"),x.support.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&(n=s.set(e,n,r))===undefined||(u[t]=n)),undefined)}},css:function(e,t,n,r){var i,o,s,a=x.camelCase(t);return t=x.cssProps[a]||(x.cssProps[a]=Dt(e.style,a)),s=x.cssHooks[t]||x.cssHooks[a],s&&"get"in s&&(i=s.get(e,!0,n)),i===undefined&&(i=yt(e,t,r)),"normal"===i&&t in Et&&(i=Et[t]),""===n||n?(o=parseFloat(i),n===!0||x.isNumeric(o)?o||0:i):i}}),yt=function(e,t,n){var r,i,o,s=n||Lt(e),a=s?s.getPropertyValue(t)||s[t]:undefined,u=e.style;return s&&(""!==a||x.contains(e.ownerDocument,e)||(a=x.style(e,t)),Tt.test(a)&&bt.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=s.width,u.width=r,u.minWidth=i,u.maxWidth=o)),a};function Ht(e,t,n){var r=wt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Ot(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;for(;4>o;o+=2)"margin"===n&&(s+=x.css(e,n+St[o],!0,i)),r?("content"===n&&(s-=x.css(e,"padding"+St[o],!0,i)),"margin"!==n&&(s-=x.css(e,"border"+St[o]+"Width",!0,i))):(s+=x.css(e,"padding"+St[o],!0,i),"padding"!==n&&(s+=x.css(e,"border"+St[o]+"Width",!0,i)));return s}function Ft(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Lt(e),s=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=yt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Tt.test(i))return i;r=s&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+Ot(e,t,n||(s?"border":"content"),r,o)+"px"}function Pt(e){var t=o,n=kt[e];return n||(n=Rt(e,t),"none"!==n&&n||(vt=(vt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(vt[0].contentWindow||vt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=Rt(e,t),vt.detach()),kt[e]=n),n}function Rt(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,t){x.cssHooks[t]={get:function(e,n,r){return n?0===e.offsetWidth&&xt.test(x.css(e,"display"))?x.swap(e,Nt,function(){return Ft(e,t,r)}):Ft(e,t,r):undefined},set:function(e,n,r){var i=r&&Lt(e);return Ht(e,n,r?Ot(e,t,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,t){return t?x.swap(e,{display:"inline-block"},yt,[e,"marginRight"]):undefined}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,t){x.cssHooks[t]={get:function(e,n){return n?(n=yt(e,t),Tt.test(n)?x(e).position()[t]+"px":n):undefined}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+St[r]+t]=o[r]||o[r-2]||o[0];return i}},bt.test(e)||(x.cssHooks[e+t].set=Ht)});var Mt=/%20/g,Wt=/\[\]$/,$t=/\r?\n/g,Bt=/^(?:submit|button|image|reset|file)$/i,It=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&It.test(this.nodeName)&&!Bt.test(e)&&(this.checked||!it.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace($t,"\r\n")}}):{name:t.name,value:n.replace($t,"\r\n")}}).get()}}),x.param=function(e,t){var n,r=[],i=function(e,t){t=x.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(t===undefined&&(t=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){i(this.name,this.value)});else for(n in e)zt(n,e[n],t,i);return r.join("&").replace(Mt,"+")};function zt(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||Wt.test(e)?r(e,i):zt(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)zt(e+"["+i+"]",t[i],n,r)}x.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(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var _t,Xt,Ut=x.now(),Yt=/\?/,Vt=/#.*$/,Gt=/([?&])_=[^&]*/,Jt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Qt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Kt=/^(?:GET|HEAD)$/,Zt=/^\/\//,en=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,tn=x.fn.load,nn={},rn={},on="*/".concat("*");try{Xt=i.href}catch(sn){Xt=o.createElement("a"),Xt.href="",Xt=Xt.href}_t=en.exec(Xt.toLowerCase())||[];function an(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];
       
    28 if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function un(e,t,n,r){var i={},o=e===rn;function s(a){var u;return i[a]=!0,x.each(e[a]||[],function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):undefined:(t.dataTypes.unshift(l),s(l),!1)}),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function ln(e,t){var n,r,i=x.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,t,n){if("string"!=typeof e&&tn)return tn.apply(this,arguments);var r,i,o,s=this,a=e.indexOf(" ");return a>=0&&(r=e.slice(a),e=e.slice(0,a)),x.isFunction(t)?(n=t,t=undefined):t&&"object"==typeof t&&(i="POST"),s.length>0&&x.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){o=arguments,s.html(r?x("<div>").append(x.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){s.each(n,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Xt,type:"GET",isLocal:Qt.test(_t[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":on,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ln(ln(e,x.ajaxSettings),t):ln(x.ajaxSettings,e)},ajaxPrefilter:an(nn),ajaxTransport:an(rn),ajax:function(e,t){"object"==typeof e&&(t=e,e=undefined),t=t||{};var n,r,i,o,s,a,u,l,c=x.ajaxSetup({},t),f=c.context||c,p=c.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),d=x.Callbacks("once memory"),g=c.statusCode||{},m={},y={},v=0,b="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===v){if(!o){o={};while(t=Jt.exec(i))o[t[1].toLowerCase()]=t[2]}t=o[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===v?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return v||(e=y[n]=y[n]||e,m[e]=t),this},overrideMimeType:function(e){return v||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>v)for(t in e)g[t]=[g[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),k(0,t),this}};if(h.promise(T).complete=d.add,T.success=T.done,T.error=T.fail,c.url=((e||c.url||Xt)+"").replace(Vt,"").replace(Zt,_t[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=x.trim(c.dataType||"*").toLowerCase().match(w)||[""],null==c.crossDomain&&(a=en.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===_t[1]&&a[2]===_t[2]&&(a[3]||("http:"===a[1]?"80":"443"))===(_t[3]||("http:"===_t[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=x.param(c.data,c.traditional)),un(nn,c,t,T),2===v)return T;u=c.global,u&&0===x.active++&&x.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!Kt.test(c.type),r=c.url,c.hasContent||(c.data&&(r=c.url+=(Yt.test(r)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=Gt.test(r)?r.replace(Gt,"$1_="+Ut++):r+(Yt.test(r)?"&":"?")+"_="+Ut++)),c.ifModified&&(x.lastModified[r]&&T.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&T.setRequestHeader("If-None-Match",x.etag[r])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&T.setRequestHeader("Content-Type",c.contentType),T.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+on+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)T.setRequestHeader(l,c.headers[l]);if(c.beforeSend&&(c.beforeSend.call(f,T,c)===!1||2===v))return T.abort();b="abort";for(l in{success:1,error:1,complete:1})T[l](c[l]);if(n=un(rn,c,t,T)){T.readyState=1,u&&p.trigger("ajaxSend",[T,c]),c.async&&c.timeout>0&&(s=setTimeout(function(){T.abort("timeout")},c.timeout));try{v=1,n.send(m,k)}catch(C){if(!(2>v))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,t,o,a){var l,m,y,b,w,C=t;2!==v&&(v=2,s&&clearTimeout(s),n=undefined,i=a||"",T.readyState=e>0?4:0,l=e>=200&&300>e||304===e,o&&(b=cn(c,T,o)),b=fn(c,b,T,l),l?(c.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(x.lastModified[r]=w),w=T.getResponseHeader("etag"),w&&(x.etag[r]=w)),204===e?C="nocontent":304===e?C="notmodified":(C=b.state,m=b.data,y=b.error,l=!y)):(y=C,(e||!C)&&(C="error",0>e&&(e=0))),T.status=e,T.statusText=(t||C)+"",l?h.resolveWith(f,[m,C,T]):h.rejectWith(f,[T,C,y]),T.statusCode(g),g=undefined,u&&p.trigger(l?"ajaxSuccess":"ajaxError",[T,c,l?m:y]),d.fireWith(f,[T,C]),u&&(p.trigger("ajaxComplete",[T,c]),--x.active||x.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,undefined,t,"script")}}),x.each(["get","post"],function(e,t){x[t]=function(e,n,r,i){return x.isFunction(n)&&(i=i||r,r=n,n=undefined),x.ajax({url:e,type:t,dataType:i,data:n,success:r})}});function cn(e,t,n){var r,i,o,s,a=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in a)if(a[i]&&a[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}s||(s=i)}o=o||s}return o?(o!==u[0]&&u.unshift(o),n[o]):undefined}function fn(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(s=l[u+" "+o]||l["* "+o],!s)for(i in l)if(a=i.split(" "),a[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){s===!0?s=l[i]:l[i]!==!0&&(o=a[0],c.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(f){return{state:"parsererror",error:s?f:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),x.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=x("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),o.head.appendChild(t[0])},abort:function(){n&&n()}}}});var pn=[],hn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=pn.pop()||x.expando+"_"+Ut++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,s,a=t.jsonp!==!1&&(hn.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&hn.test(t.data)&&"data");return a||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=x.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(hn,"$1"+i):t.jsonp!==!1&&(t.url+=(Yt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return s||x.error(i+" was not called"),s[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){s=arguments},r.always(function(){e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,pn.push(i)),s&&x.isFunction(o)&&o(s[0]),s=o=undefined}),"script"):undefined}),x.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var dn=x.ajaxSettings.xhr(),gn={0:200,1223:204},mn=0,yn={};e.ActiveXObject&&x(e).on("unload",function(){for(var e in yn)yn[e]();yn=undefined}),x.support.cors=!!dn&&"withCredentials"in dn,x.support.ajax=dn=!!dn,x.ajaxTransport(function(e){var t;return x.support.cors||dn&&!e.crossDomain?{send:function(n,r){var i,o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete yn[o],t=s.onload=s.onerror=null,"abort"===e?s.abort():"error"===e?r(s.status||404,s.statusText):r(gn[s.status]||s.status,s.statusText,"string"==typeof s.responseText?{text:s.responseText}:undefined,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=yn[o=mn++]=t("abort"),s.send(e.hasContent&&e.data||null)},abort:function(){t&&t()}}:undefined});var vn,xn,bn=/^(?:toggle|show|hide)$/,wn=RegExp("^(?:([+-])=|)("+b+")([a-z%]*)$","i"),Tn=/queueHooks$/,Cn=[Dn],kn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=wn.exec(t),s=i.cur(),a=+s||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(x.cssNumber[e]?"":"px"),"px"!==r&&a){a=x.css(i.elem,e,!0)||n||1;do u=u||".5",a/=u,x.style(i.elem,e,a+r);while(u!==(u=i.cur()/s)&&1!==u&&--l)}i.unit=r,i.start=a,i.end=o[1]?a+(o[1]+1)*n:n}return i}]};function Nn(){return setTimeout(function(){vn=undefined}),vn=x.now()}function En(e,t){x.each(t,function(t,n){var r=(kn[t]||[]).concat(kn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function Sn(e,t,n){var r,i,o=0,s=Cn.length,a=x.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=vn||Nn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,s=0,u=l.tweens.length;for(;u>s;s++)l.tweens[s].run(o);return a.notifyWith(e,[l,o,n]),1>o&&u?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:vn||Nn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(jn(c,l.opts.specialEasing);s>o;o++)if(r=Cn[o].call(l,e,c,l.opts))return r;return En(l,c),x.isFunction(l.opts.start)&&l.opts.start.call(e,l),x.fx.timer(x.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function jn(e,t){var n,r,i,o,s;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),s=x.cssHooks[r],s&&"expand"in s){o=s.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(Sn,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],kn[n]=kn[n]||[],kn[n].unshift(t)},prefilter:function(e,t){t?Cn.unshift(e):Cn.push(e)}});function Dn(e,t,n){var r,i,o,s,a,u,l,c,f,p=this,h=e.style,d={},g=[],m=e.nodeType&&At(e);n.queue||(c=x._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,f=c.empty.fire,c.empty.fire=function(){c.unqueued||f()}),c.unqueued++,p.always(function(){p.always(function(){c.unqueued--,x.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),a=q.get(e,"fxshow");for(r in t)if(o=t[r],bn.exec(o)){if(delete t[r],u=u||"toggle"===o,o===(m?"hide":"show")){if("show"!==o||a===undefined||a[r]===undefined)continue;m=!0}g.push(r)}if(s=g.length){a=q.get(e,"fxshow")||q.access(e,"fxshow",{}),"hidden"in a&&(m=a.hidden),u&&(a.hidden=!m),m?x(e).show():p.done(function(){x(e).hide()}),p.done(function(){var t;q.remove(e,"fxshow");for(t in d)x.style(e,t,d[t])});for(r=0;s>r;r++)i=g[r],l=p.createTween(i,m?a[i]:0),d[i]=a[i]||x.style(e,i),i in a||(a[i]=l.start,m&&(l.end=l.start,l.start="width"===i||"height"===i?1:0))}}function An(e,t,n,r,i){return new An.prototype.init(e,t,n,r,i)}x.Tween=An,An.prototype={constructor:An,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=An.propHooks[this.prop];return e&&e.get?e.get(this):An.propHooks._default.get(this)},run:function(e){var t,n=An.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):An.propHooks._default.set(this),this}},An.prototype.init.prototype=An.prototype,An.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},An.propHooks.scrollTop=An.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(Ln(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(At).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),s=function(){var t=Sn(this,x.extend({},e),o);s.finish=function(){t.stop(!0)},(i||q.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||o.queue===!1?this.each(s):this.queue(o.queue,s)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=x.timers,s=q.get(this);if(i)s[i]&&s[i].stop&&r(s[i]);else for(i in s)s[i]&&s[i].stop&&Tn.test(i)&&r(s[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));(t||!n)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=q.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,s=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;s>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function Ln(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=St[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:Ln("show"),slideUp:Ln("hide"),slideToggle:Ln("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=An.prototype.init,x.fx.tick=function(){var e,t=x.timers,n=0;for(vn=x.now();t.length>n;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||x.fx.stop(),vn=undefined},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){xn||(xn=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(xn),xn=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===undefined?this:this.each(function(t){x.offset.setOffset(this,e,t)});var t,n,i=this[0],o={top:0,left:0},s=i&&i.ownerDocument;if(s)return t=s.documentElement,x.contains(t,i)?(typeof i.getBoundingClientRect!==r&&(o=i.getBoundingClientRect()),n=qn(s),{top:o.top+n.pageYOffset-t.clientTop,left:o.left+n.pageXOffset-t.clientLeft}):o},x.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l,c=x.css(e,"position"),f=x(e),p={};"static"===c&&(e.style.position="relative"),a=f.offset(),o=x.css(e,"top"),u=x.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1,l?(r=f.position(),s=r.top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),x.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(p.top=t.top-a.top+s),null!=t.left&&(p.left=t.left-a.left+i),"using"in t?t.using.call(e,p):f.css(p)}},x.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===x.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(r=e.offset()),r.top+=x.css(e[0],"borderTopWidth",!0),r.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-x.css(n,"marginTop",!0),left:t.left-r.left-x.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var r="pageYOffset"===n;x.fn[t]=function(i){return x.access(this,function(t,i,o){var s=qn(t);return o===undefined?s?s[n]:t[i]:(s?s.scrollTo(r?e.pageXOffset:o,r?o:e.pageYOffset):t[i]=o,undefined)},t,i,arguments.length,null)}});function qn(e){return x.isWindow(e)?e:9===e.nodeType&&e.defaultView}x.each({Height:"height",Width:"width"},function(e,t){x.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){x.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),s=n||(r===!0||i===!0?"margin":"border");return x.access(this,function(t,n,r){var i;return x.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?x.css(t,n,s):x.style(t,n,r,s)},t,o?r:undefined,o,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&"object"==typeof module.exports?module.exports=x:"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=x)})(window);
       
    29 }
       
    30 
       
    31 /*
       
    32  * Including d3.js
    19  * http://d3js.org/
    33  * http://d3js.org/
    20  * Copyright 2012, Michael Bostock
    34  * Copyright 2012, Michael Bostock
    21  * Released under BSD licenses.
    35  * Released under BSD licenses.
    22  * 
    36  */ 
    23  * Includes Box2DWeb
    37 
       
    38 (function(){if(!Date.now){Date.now=function(){return +new Date}}try{document.createElement("div").style.setProperty("opacity",0,"")}catch(C7){var Bn=CSSStyleDeclaration.prototype,Dw=Bn.setProperty;Bn.setProperty=function(e,Eo,En){Dw.call(this,e,Eo+"",En)}}d3={version:"2.8.1"};function Eh(Ep,Eo){try{for(var En in Eo){Object.defineProperty(Ep.prototype,En,{value:Eo[En],enumerable:false})}}catch(Eq){Ep.prototype=Eo}}var Bu=Al;function Ef(En){var e=-1,Ep=En.length,Eo=[];while(++e<Ep){Eo.push(En[e])}return Eo}function Al(e){return Array.prototype.slice.call(e)}try{Bu(document.documentElement.childNodes)[0].nodeType}catch(EE){Bu=Ef}var Ca=[].__proto__?function(En,e){En.__proto__=e}:function(Eo,e){for(var En in e){Eo[En]=e[En]}};d3.map=function(e){var Eo=new AC;for(var En in e){Eo.set(En,e[En])}return Eo};function AC(){}Eh(AC,{has:function(e){return Ej+e in this},get:function(e){return this[Ej+e]},set:function(e,En){return this[Ej+e]=En},remove:function(e){e=Ej+e;return e in this&&delete this[e]},keys:function(){var e=[];this.forEach(function(En){e.push(En)});return e},values:function(){var e=[];this.forEach(function(En,Eo){e.push(Eo)});return e},entries:function(){var e=[];this.forEach(function(En,Eo){e.push({key:En,value:Eo})});return e},forEach:function(En){for(var e in this){if(e.charCodeAt(0)===Bp){En.call(this,e.substring(1),this[e])}}}});var Ej="\0",Bp=Ej.charCodeAt(0);function m(){return this}d3.functor=function(e){return typeof e==="function"?e:function(){return e}};d3.rebind=function(Eo,En){var e=1,Eq=arguments.length,Ep;while(++e<Eq){Eo[Ep=arguments[e]]=CL(Eo,En,En[Ep])}return Eo};function CL(En,e,Eo){return function(){var Ep=Eo.apply(e,arguments);return arguments.length?En:Ep}}d3.ascending=function(En,e){return En<e?-1:En>e?1:En>=e?0:NaN};d3.descending=function(En,e){return e<En?-1:e>En?1:e>=En?0:NaN};d3.mean=function(Es,Eq){var Er=Es.length,En,e=0,Ep=-1,Eo=0;if(arguments.length===1){while(++Ep<Er){if(EL(En=Es[Ep])){e+=(En-e)/++Eo}}}else{while(++Ep<Er){if(EL(En=Eq.call(Es,Es[Ep],Ep))){e+=(En-e)/++Eo}}}return Eo?e:undefined};d3.median=function(En,e){if(arguments.length>1){En=En.map(e)}En=En.filter(EL);return En.length?d3.quantile(En.sort(d3.ascending),0.5):undefined};d3.min=function(Er,Ep){var Eo=-1,Eq=Er.length,En,e;if(arguments.length===1){while(++Eo<Eq&&((En=Er[Eo])==null||En!=En)){En=undefined}while(++Eo<Eq){if((e=Er[Eo])!=null&&En>e){En=e}}}else{while(++Eo<Eq&&((En=Ep.call(Er,Er[Eo],Eo))==null||En!=En)){En=undefined}while(++Eo<Eq){if((e=Ep.call(Er,Er[Eo],Eo))!=null&&En>e){En=e}}}return En};d3.max=function(Er,Ep){var Eo=-1,Eq=Er.length,En,e;if(arguments.length===1){while(++Eo<Eq&&((En=Er[Eo])==null||En!=En)){En=undefined}while(++Eo<Eq){if((e=Er[Eo])!=null&&e>En){En=e}}}else{while(++Eo<Eq&&((En=Ep.call(Er,Er[Eo],Eo))==null||En!=En)){En=undefined}while(++Eo<Eq){if((e=Ep.call(Er,Er[Eo],Eo))!=null&&e>En){En=e}}}return En};d3.extent=function(Es,Ep){var Eo=-1,Er=Es.length,En,e,Eq;if(arguments.length===1){while(++Eo<Er&&((En=Eq=Es[Eo])==null||En!=En)){En=Eq=undefined}while(++Eo<Er){if((e=Es[Eo])!=null){if(En>e){En=e}if(Eq<e){Eq=e}}}}else{while(++Eo<Er&&((En=Eq=Ep.call(Es,Es[Eo],Eo))==null||En!=En)){En=undefined}while(++Eo<Er){if((e=Ep.call(Es,Es[Eo],Eo))!=null){if(En>e){En=e}if(Eq<e){Eq=e}}}}return[En,Eq]};d3.random={normal:function(e,En){if(arguments.length<2){En=1}if(arguments.length<1){e=0}return function(){var Eo,Eq,Ep;do{Eo=Math.random()*2-1;Eq=Math.random()*2-1;Ep=Eo*Eo+Eq*Eq}while(!Ep||Ep>1);return e+En*Eo*Math.sqrt(-2*Math.log(Ep)/Ep)}}};function EL(e){return e!=null&&!isNaN(e)}d3.sum=function(Er,Ep){var Eo=0,Eq=Er.length,e,En=-1;if(arguments.length===1){while(++En<Eq){if(!isNaN(e=+Er[En])){Eo+=e}}}else{while(++En<Eq){if(!isNaN(e=+Ep.call(Er,Er[En],En))){Eo+=e}}}return Eo};d3.quantile=function(Eo,Es){var Ep=(Eo.length-1)*Es+1,Eq=Math.floor(Ep),En=Eo[Eq-1],Er=Ep-Eq;return Er?En+Er*(Eo[Eq]-En):En};d3.transpose=function(e){return d3.zip.apply(d3,e)};d3.zip=function(){if(!(Er=arguments.length)){return[]}for(var Ep=-1,e=d3.min(arguments,Cr),Eo=new Array(e);++Ep<e;){for(var En=-1,Er,Eq=Eo[Ep]=new Array(Er);++En<Er;){Eq[En]=arguments[En][Ep]}}return Eo};function Cr(e){return e.length}d3.bisector=function(e){return{left:function(Eo,En,Er,Eq){if(arguments.length<3){Er=0}if(arguments.length<4){Eq=Eo.length}while(Er<Eq){var Ep=Er+Eq>>1;if(e.call(Eo,Eo[Ep],Ep)<En){Er=Ep+1}else{Eq=Ep}}return Er},right:function(Eo,En,Er,Eq){if(arguments.length<3){Er=0}if(arguments.length<4){Eq=Eo.length}while(Er<Eq){var Ep=Er+Eq>>1;if(En<e.call(Eo,Eo[Ep],Ep)){Eq=Ep}else{Er=Ep+1}}return Er}}};var Dg=d3.bisector(function(e){return e});d3.bisectLeft=Dg.left;d3.bisect=d3.bisectRight=Dg.right;d3.first=function(Er,Ep){var Eo=0,Eq=Er.length,En=Er[0],e;if(arguments.length===1){Ep=d3.ascending}while(++Eo<Eq){if(Ep.call(Er,En,e=Er[Eo])>0){En=e}}return En};d3.last=function(Er,Ep){var Eo=0,Eq=Er.length,En=Er[0],e;if(arguments.length===1){Ep=d3.ascending}while(++Eo<Eq){if(Ep.call(Er,En,e=Er[Eo])<=0){En=e}}return En};d3.nest=function(){var Ep={},Eo=[],Es=[],En,Eq;function Er(E0,Ey){if(Ey>=Eo.length){return Eq?Eq.call(Ep,E0):(En?E0.sort(En):E0)}var Ez=-1,Eu=E0.length,E2=Eo[Ey++],Ex,Ew,Ev=new AC,E1,Et={};while(++Ez<Eu){if(E1=Ev.get(Ex=E2(Ew=E0[Ez]))){E1.push(Ew)}else{Ev.set(Ex,[Ew])}}Ev.forEach(function(E3){Et[E3]=Er(Ev.get(E3),Ey)});return Et}function e(Ew,Ex){if(Ex>=Eo.length){return Ew}var Et=[],Eu=Es[Ex++],Ev;for(Ev in Ew){Et.push({key:Ev,values:e(Ew[Ev],Ex)})}if(Eu){Et.sort(function(Ez,Ey){return Eu(Ez.key,Ey.key)})}return Et}Ep.map=function(Et){return Er(Et,0)};Ep.entries=function(Et){return e(Er(Et,0),0)};Ep.key=function(Et){Eo.push(Et);return Ep};Ep.sortKeys=function(Et){Es[Eo.length-1]=Et;return Ep};Ep.sortValues=function(Et){En=Et;return Ep};Ep.rollup=function(Et){Eq=Et;return Ep};return Ep};d3.keys=function(Eo){var En=[];for(var e in Eo){En.push(e)}return En};d3.values=function(Eo){var e=[];for(var En in Eo){e.push(Eo[En])}return e};d3.entries=function(Eo){var e=[];for(var En in Eo){e.push({key:En,value:Eo[En]})}return e};d3.permute=function(Eq,En){var e=[],Eo=-1,Ep=En.length;while(++Eo<Ep){e[Eo]=Eq[En[Eo]]}return e};d3.merge=function(e){return Array.prototype.concat.apply([],e)};d3.split=function(Es,Eq){var Ep=[],e=[],Eo,En=-1,Er=Es.length;if(arguments.length<2){Eq=CY}while(++En<Er){if(Eq.call(e,Eo=Es[En],En)){e=[]}else{if(!e.length){Ep.push(e)}e.push(Eo)}}return Ep};function CY(e){return e==null}function BJ(e){return e.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}d3.range=function(Es,Eq,Er){if(arguments.length<3){Er=1;if(arguments.length<2){Eq=Es;Es=0}}if((Eq-Es)/Er===Infinity){throw new Error("infinite range")}var En=[],e=Dd(Math.abs(Er)),Ep=-1,Eo;Es*=e,Eq*=e,Er*=e;if(Er<0){while((Eo=Es+Er*++Ep)>Eq){En.push(Eo/e)}}else{while((Eo=Es+Er*++Ep)<Eq){En.push(Eo/e)}}return En};function Dd(e){var En=1;while(e*En%1){En*=10}return En}d3.requote=function(e){return e.replace(BY,"\\$&")};var BY=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(e,En){return En?Math.round(e*(En=Math.pow(10,En)))/En:Math.round(e)};d3.xhr=function(e,Eo,Ep){var En=new XMLHttpRequest;if(arguments.length<3){Ep=Eo,Eo=null}else{if(Eo&&En.overrideMimeType){En.overrideMimeType(Eo)}}En.open("GET",e,true);if(Eo){En.setRequestHeader("Accept",Eo)}En.onreadystatechange=function(){if(En.readyState===4){Ep(En.status<300?En:null)}};En.send(null)};d3.text=function(e,Eo,Ep){function En(Eq){Ep(Eq&&Eq.responseText)}if(arguments.length<3){Ep=Eo;Eo=null}d3.xhr(e,Eo,En)};d3.json=function(e,En){d3.text(e,"application/json",function(Eo){En(Eo?JSON.parse(Eo):null)})};d3.html=function(e,En){d3.text(e,"text/html",function(Ep){if(Ep!=null){var Eo=document.createRange();Eo.selectNode(document.body);Ep=Eo.createContextualFragment(Ep)}En(Ep)})};d3.xml=function(e,Eo,Ep){function En(Eq){Ep(Eq&&Eq.responseXML)}if(arguments.length<3){Ep=Eo;Eo=null}d3.xhr(e,Eo,En)};var CB={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:CB,qualify:function(e){var En=e.indexOf(":"),Eo=e;if(En>=0){Eo=e.substring(0,En);e=e.substring(En+1)}return CB.hasOwnProperty(Eo)?{space:CB[Eo],local:e}:e}};d3.dispatch=function(){var e=new CW,En=-1,Eo=arguments.length;while(++En<Eo){e[arguments[En]]=Cu(e)}return e};function CW(){}CW.prototype.on=function(Eo,Ep){var En=Eo.indexOf("."),e="";if(En>0){e=Eo.substring(En+1);Eo=Eo.substring(0,En)}return arguments.length<2?this[Eo].on(e):this[Eo].on(e,Ep)};function Cu(e){var Eo=[],En=new AC;function Ep(){var Es=Eo,Er=-1,Et=Es.length,Eq;while(++Er<Et){if(Eq=Es[Er].on){Eq.apply(this,arguments)}}return e}Ep.on=function(Er,Et){var Eq=En.get(Er),Es;if(arguments.length<2){return Eq&&Eq.on}if(Eq){Eq.on=null;Eo=Eo.slice(0,Es=Eo.indexOf(Eq)).concat(Eo.slice(Es+1));En.remove(Er)}if(Et){Eo.push(En.set(Er,{on:Et}))}return e};return Ep}d3.format=function(Eu){var Er=BC.exec(Eu),Ew=Er[1]||" ",En=Er[3]||"",Ep=Er[5],e=+Er[6],Ex=Er[7],Es=Er[8],Et=Er[9],Eo=1,Ev="",Eq=false;if(Es){Es=+Es.substring(1)}if(Ep){Ew="0";if(Ex){e-=Math.floor((e-1)/4)}}switch(Et){case"n":Ex=true;Et="g";break;case"%":Eo=100;Ev="%";Et="f";break;case"p":Eo=100;Ev="%";Et="r";break;case"d":Eq=true;Es=0;break;case"s":Eo=-1;Et="r";break}if(Et=="r"&&!Es){Et="g"}Et=R.get(Et)||AY;return function(E1){if(Eq&&(E1%1)){return""}var Ey=(E1<0)&&(E1=-E1)?"\u2212":En;if(Eo<0){var E0=d3.formatPrefix(E1,Es);E1*=E0.scale;Ev=E0.symbol}else{E1*=Eo}E1=Et(E1,Es);if(Ep){var Ez=E1.length+Ey.length;if(Ez<e){E1=new Array(e-Ez+1).join(Ew)+E1}if(Ex){E1=Bb(E1)}E1=Ey+E1}else{if(Ex){E1=Bb(E1)}E1=Ey+E1;var Ez=E1.length;if(Ez<e){E1=new Array(e-Ez+1).join(Ew)+E1}}return E1+Ev}};var BC=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;var R=d3.map({g:function(e,En){return e.toPrecision(En)},e:function(e,En){return e.toExponential(En)},f:function(e,En){return e.toFixed(En)},r:function(e,En){return d3.round(e,En=CD(e,En)).toFixed(Math.max(0,Math.min(20,En)))}});function CD(e,En){return En-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-En))/Math.LN10):1)}function AY(e){return e+""}function Bb(Ep){var En=Ep.lastIndexOf("."),Eo=En>=0?Ep.substring(En):(En=Ep.length,""),e=[];while(En>0){e.push(Ep.substring(En-=3,En+3))}return e.reverse().join(",")+Eo}var A9=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(Bt);d3.formatPrefix=function(Eo,e){var En=0;if(Eo){if(Eo<0){Eo*=-1}if(e){Eo=d3.round(Eo,CD(Eo,e))}En=1+Math.floor(1e-12+Math.log(Eo)/Math.LN10);En=Math.max(-24,Math.min(24,Math.floor((En<=0?En+1:En-1)/3)*3))}return A9[8+En/3]};function Bt(En,e){return{scale:Math.pow(10,(8-e)*3),symbol:En}}var Au=AH(2),Y=AH(3),EG=function(){return Ba};var l=d3.map({linear:EG,poly:AH,quad:function(){return Au},cubic:function(){return Y},sin:function(){return DX},exp:function(){return C4},circle:function(){return B9},elastic:k,back:D5,bounce:function(){return A3}});var I=d3.map({"in":Ba,out:U,"in-out":AO,"out-in":function(e){return AO(U(e))}});d3.ease=function(En){var Ep=En.indexOf("-"),Eo=Ep>=0?En.substring(0,Ep):En,e=Ep>=0?En.substring(Ep+1):"in";Eo=l.get(Eo)||EG;e=I.get(e)||Ba;return DB(e(Eo.apply(null,Array.prototype.slice.call(arguments,1))))};function DB(e){return function(En){return En<=0?0:En>=1?1:e(En)}}function U(e){return function(En){return 1-e(1-En)}}function AO(e){return function(En){return 0.5*(En<0.5?e(2*En):(2-e(2-2*En)))}}function Ba(e){return e}function AH(En){return function(e){return Math.pow(e,En)}}function DX(e){return 1-Math.cos(e*Math.PI/2)}function C4(e){return Math.pow(2,10*(e-1))}function B9(e){return 1-Math.sqrt(1-e*e)}function k(e,Eo){var En;if(arguments.length<2){Eo=0.45}if(arguments.length<1){e=1;En=Eo/4}else{En=Eo/(2*Math.PI)*Math.asin(1/e)}return function(Ep){return 1+e*Math.pow(2,10*-Ep)*Math.sin((Ep-En)*2*Math.PI/Eo)}}function D5(e){if(!e){e=1.70158}return function(En){return En*En*((e+1)*En-e)}}function A3(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+0.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+0.9375:7.5625*(e-=2.625/2.75)*e+0.984375}d3.event=null;function EW(){d3.event.stopPropagation();d3.event.preventDefault()}function n(){var Eo=d3.event,En;while(En=Eo.sourceEvent){Eo=En}return Eo}function EF(Eo){var e=new CW,En=0,Ep=arguments.length;while(++En<Ep){e[arguments[En]]=Cu(e)}e.of=function(Er,Eq){return function(Es){try{var Et=Es.sourceEvent=d3.event;Es.target=Eo;d3.event=Es;e[Es.type].apply(Er,Eq)}finally{d3.event=Et}}};return e}d3.interpolate=function(En,e){var Eo=d3.interpolators.length,Ep;while(--Eo>=0&&!(Ep=d3.interpolators[Eo](En,e))){}return Ep};d3.interpolateNumber=function(En,e){e-=En;return function(Eo){return En+e*Eo}};d3.interpolateRound=function(En,e){e-=En;return function(Eo){return Math.round(En+e*Eo)}};d3.interpolateString=function(Et,Es){var Ep,Er,Eq,Ev=0,Eu=0,Ew=[],e=[],Eo,En;DK.lastIndex=0;for(Er=0;Ep=DK.exec(Es);++Er){if(Ep.index){Ew.push(Es.substring(Ev,Eu=Ep.index))}e.push({i:Ew.length,x:Ep[0]});Ew.push(null);Ev=DK.lastIndex}if(Ev<Es.length){Ew.push(Es.substring(Ev))}for(Er=0,Eo=e.length;(Ep=DK.exec(Et))&&Er<Eo;++Er){En=e[Er];if(En.x==Ep[0]){if(En.i){if(Ew[En.i+1]==null){Ew[En.i-1]+=En.x;Ew.splice(En.i,1);for(Eq=Er+1;Eq<Eo;++Eq){e[Eq].i--}}else{Ew[En.i-1]+=En.x+Ew[En.i+1];Ew.splice(En.i,2);for(Eq=Er+1;Eq<Eo;++Eq){e[Eq].i-=2}}}else{if(Ew[En.i+1]==null){Ew[En.i]=En.x}else{Ew[En.i]=En.x+Ew[En.i+1];Ew.splice(En.i+1,1);for(Eq=Er+1;Eq<Eo;++Eq){e[Eq].i--}}}e.splice(Er,1);Eo--;Er--}else{En.x=d3.interpolateNumber(parseFloat(Ep[0]),parseFloat(En.x))}}while(Er<Eo){En=e.pop();if(Ew[En.i+1]==null){Ew[En.i]=En.x}else{Ew[En.i]=En.x+Ew[En.i+1];Ew.splice(En.i+1,1)}Eo--}if(Ew.length===1){return Ew[0]==null?e[0].x:function(){return Es}}return function(Ex){for(Er=0;Er<Eo;++Er){Ew[(En=e[Er]).i]=En.x(Ex)}return Ew.join("")}};d3.interpolateTransform=function(Ez,Ey){var E0=[],En=[],Er,Eq=d3.transform(Ez),Ep=d3.transform(Ey),Ev=Eq.translate,Eu=Ep.translate,Eo=Eq.rotate,e=Ep.rotate,Et=Eq.skew,Es=Ep.skew,Ex=Eq.scale,Ew=Ep.scale;if(Ev[0]!=Eu[0]||Ev[1]!=Eu[1]){E0.push("translate(",null,",",null,")");En.push({i:1,x:d3.interpolateNumber(Ev[0],Eu[0])},{i:3,x:d3.interpolateNumber(Ev[1],Eu[1])})}else{if(Eu[0]||Eu[1]){E0.push("translate("+Eu+")")}else{E0.push("")}}if(Eo!=e){En.push({i:E0.push(E0.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(Eo,e)})}else{if(e){E0.push(E0.pop()+"rotate("+e+")")}}if(Et!=Es){En.push({i:E0.push(E0.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(Et,Es)})}else{if(Es){E0.push(E0.pop()+"skewX("+Es+")")}}if(Ex[0]!=Ew[0]||Ex[1]!=Ew[1]){Er=E0.push(E0.pop()+"scale(",null,",",null,")");En.push({i:Er-4,x:d3.interpolateNumber(Ex[0],Ew[0])},{i:Er-2,x:d3.interpolateNumber(Ex[1],Ew[1])})}else{if(Ew[0]!=1||Ew[1]!=1){E0.push(E0.pop()+"scale("+Ew+")")}}Er=En.length;return function(E2){var E1=-1,E3;while(++E1<Er){E0[(E3=En[E1]).i]=E3.x(E2)}return E0.join("")}};d3.interpolateRgb=function(En,e){En=d3.rgb(En);e=d3.rgb(e);var Ep=En.r,Eo=En.g,Es=En.b,Er=e.r-Ep,Eq=e.g-Eo,Et=e.b-Es;return function(Eu){return"#"+BA(Math.round(Ep+Er*Eu))+BA(Math.round(Eo+Eq*Eu))+BA(Math.round(Es+Et*Eu))}};d3.interpolateHsl=function(Eo,e){Eo=d3.hsl(Eo);e=d3.hsl(e);var Et=Eo.h,Es=Eo.s,Ep=Eo.l,Er=e.h-Et,Eq=e.s-Es,En=e.l-Ep;return function(Eu){return AU(Et+Er*Eu,Es+Eq*Eu,Ep+En*Eu).toString()}};d3.interpolateArray=function(Eq,Eo){var En=[],Et=[],Ep=Eq.length,e=Eo.length,Es=Math.min(Eq.length,Eo.length),Er;for(Er=0;Er<Es;++Er){En.push(d3.interpolate(Eq[Er],Eo[Er]))}for(;Er<Ep;++Er){Et[Er]=Eq[Er]}for(;Er<e;++Er){Et[Er]=Eo[Er]}return function(Eu){for(Er=0;Er<Es;++Er){Et[Er]=En[Er](Eu)}return Et}};d3.interpolateObject=function(En,e){var Ep={},Eq={},Eo;for(Eo in En){if(Eo in e){Ep[Eo]=C5(Eo)(En[Eo],e[Eo])}else{Eq[Eo]=En[Eo]}}for(Eo in e){if(!(Eo in En)){Eq[Eo]=e[Eo]}}return function(Er){for(Eo in Ep){Eq[Eo]=Ep[Eo](Er)}return Eq}};var DK=/[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;function C5(e){return e=="transform"?d3.interpolateTransform:d3.interpolate}d3.interpolators=[d3.interpolateObject,function(En,e){return(e instanceof Array)&&d3.interpolateArray(En,e)},function(En,e){return(typeof En==="string"||typeof e==="string")&&d3.interpolateString(En+"",e+"")},function(En,e){return(typeof e==="string"?p.has(e)||/^(#|rgb\(|hsl\()/.test(e):e instanceof Cl||e instanceof C3)&&d3.interpolateRgb(En,e)},function(En,e){return !isNaN(En=+En)&&!isNaN(e=+e)&&d3.interpolateNumber(En,e)}];function EO(En,e){e=e-(En=+En)?1/(e-En):0;return function(Eo){return(Eo-En)*e}}function x(En,e){e=e-(En=+En)?1/(e-En):0;return function(Eo){return Math.max(0,Math.min(1,(Eo-En)*e))}}d3.rgb=function(Eo,En,e){return arguments.length===1?(Eo instanceof Cl?CG(Eo.r,Eo.g,Eo.b):AJ(""+Eo,CG,AU)):CG(~~Eo,~~En,~~e)};function CG(Eo,En,e){return new Cl(Eo,En,e)}function Cl(Eo,En,e){this.r=Eo;this.g=En;this.b=e}Cl.prototype.brighter=function(En){En=Math.pow(0.7,arguments.length?En:1);var Eq=this.r,Ep=this.g,e=this.b,Eo=30;if(!Eq&&!Ep&&!e){return CG(Eo,Eo,Eo)}if(Eq&&Eq<Eo){Eq=Eo}if(Ep&&Ep<Eo){Ep=Eo}if(e&&e<Eo){e=Eo}return CG(Math.min(255,Math.floor(Eq/En)),Math.min(255,Math.floor(Ep/En)),Math.min(255,Math.floor(e/En)))};Cl.prototype.darker=function(e){e=Math.pow(0.7,arguments.length?e:1);return CG(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))};Cl.prototype.hsl=function(){return Dk(this.r,this.g,this.b)};Cl.prototype.toString=function(){return"#"+BA(this.r)+BA(this.g)+BA(this.b)};function BA(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function AJ(Er,Ep,Es){var e=0,Eo=0,Eq=0,Eu,Et,En;Eu=/([a-z]+)\((.*)\)/i.exec(Er);if(Eu){Et=Eu[2].split(",");switch(Eu[1]){case"hsl":return Es(parseFloat(Et[0]),parseFloat(Et[1])/100,parseFloat(Et[2])/100);case"rgb":return Ep(CZ(Et[0]),CZ(Et[1]),CZ(Et[2]))}}if(En=p.get(Er)){return Ep(En.r,En.g,En.b)}if(Er!=null&&Er.charAt(0)==="#"){if(Er.length===4){e=Er.charAt(1);e+=e;Eo=Er.charAt(2);Eo+=Eo;Eq=Er.charAt(3);Eq+=Eq}else{if(Er.length===7){e=Er.substring(1,3);Eo=Er.substring(3,5);Eq=Er.substring(5,7)}}e=parseInt(e,16);Eo=parseInt(Eo,16);Eq=parseInt(Eq,16)}return Ep(e,Eo,Eq)}function Dk(e,Eq,Es){var Eo=Math.min(e/=255,Eq/=255,Es/=255),Et=Math.max(e,Eq,Es),Er=Et-Eo,Ep,Eu,En=(Et+Eo)/2;if(Er){Eu=En<0.5?Er/(Et+Eo):Er/(2-Et-Eo);if(e==Et){Ep=(Eq-Es)/Er+(Eq<Es?6:0)}else{if(Eq==Et){Ep=(Es-e)/Er+2}else{Ep=(e-Eq)/Er+4}}Ep*=60}else{Eu=Ep=0}return CP(Ep,Eu,En)}function CZ(En){var e=parseFloat(En);return En.charAt(En.length-1)==="%"?Math.round(e*2.55):e}var p=d3.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});p.forEach(function(e,En){p.set(e,AJ(En,CG,AU))});d3.hsl=function(Eo,En,e){return arguments.length===1?(Eo instanceof C3?CP(Eo.h,Eo.s,Eo.l):AJ(""+Eo,Dk,CP)):CP(+Eo,+En,+e)};function CP(Eo,En,e){return new C3(Eo,En,e)}function C3(Eo,En,e){this.h=Eo;this.s=En;this.l=e}C3.prototype.brighter=function(e){e=Math.pow(0.7,arguments.length?e:1);return CP(this.h,this.s,this.l/e)};C3.prototype.darker=function(e){e=Math.pow(0.7,arguments.length?e:1);return CP(this.h,this.s,e*this.l)};C3.prototype.rgb=function(){return AU(this.h,this.s,this.l)};C3.prototype.toString=function(){return this.rgb().toString()};function AU(Er,Eq,e){var Ep,Eo;Er=Er%360;if(Er<0){Er+=360}Eq=Eq<0?0:Eq>1?1:Eq;e=e<0?0:e>1?1:e;Eo=e<=0.5?e*(1+Eq):e+Eq-e*Eq;Ep=2*e-Eo;function En(Et){if(Et>360){Et-=360}else{if(Et<0){Et+=360}}if(Et<60){return Ep+(Eo-Ep)*Et/60}if(Et<180){return Eo}if(Et<240){return Ep+(Eo-Ep)*(240-Et)/60}return Ep}function Es(Et){return Math.round(En(Et)*255)}return CG(Es(Er+120),Es(Er),Es(Er-120))}function B2(e){Ca(e,B1);return e}var Bf=function(e,En){return En.querySelector(e)},DT=function(e,En){return En.querySelectorAll(e)},CO=document.documentElement,B=CO.matchesSelector||CO.webkitMatchesSelector||CO.mozMatchesSelector||CO.msMatchesSelector||CO.oMatchesSelector,A=function(En,e){return B.call(En,e)};if(typeof Sizzle==="function"){Bf=function(e,En){return Sizzle(e,En)[0]};DT=function(e,En){return Sizzle.uniqueSort(Sizzle(e,En))};A=Sizzle.matchesSelector}var B1=[];d3.selection=function(){return Dz};d3.selection.prototype=B1;B1.select=function(Er){var Eo=[],Ev,e,Eu,Ep;if(typeof Er!=="function"){Er=S(Er)}for(var Es=-1,Eq=this.length;++Es<Eq;){Eo.push(Ev=[]);Ev.parentNode=(Eu=this[Es]).parentNode;for(var Et=-1,En=Eu.length;++Et<En;){if(Ep=Eu[Et]){Ev.push(e=Er.call(Ep,Ep.__data__,Et));if(e&&"__data__" in Ep){e.__data__=Ep.__data__}}else{Ev.push(null)}}}return B2(Eo)};function S(e){return function(){return Bf(e,this)}}B1.selectAll=function(Eq){var En=[],Eu,Eo;if(typeof Eq!=="function"){Eq=BU(Eq)}for(var Er=-1,Ep=this.length;++Er<Ep;){for(var Et=this[Er],Es=-1,e=Et.length;++Es<e;){if(Eo=Et[Es]){En.push(Eu=Bu(Eq.call(Eo,Eo.__data__,Es)));Eu.parentNode=Eo}}}return B2(En)};function BU(e){return function(){return DT(e,this)}}B1.attr=function(En,Et){En=d3.ns.qualify(En);if(arguments.length<2){var Er=this.node();return En.local?Er.getAttributeNS(En.space,En.local):Er.getAttribute(En)}function Eo(){this.removeAttribute(En)}function Eq(){this.removeAttributeNS(En.space,En.local)}function Eu(){this.setAttribute(En,Et)}function Ep(){this.setAttributeNS(En.space,En.local,Et)}function Es(){var Ev=Et.apply(this,arguments);if(Ev==null){this.removeAttribute(En)}else{this.setAttribute(En,Ev)}}function e(){var Ev=Et.apply(this,arguments);if(Ev==null){this.removeAttributeNS(En.space,En.local)}else{this.setAttributeNS(En.space,En.local,Ev)}}return this.each(Et==null?(En.local?Eq:Eo):(typeof Et==="function"?(En.local?e:Es):(En.local?Ep:Eu)))};B1.classed=function(e,Eo){var Ep=e.split(G),Eq=Ep.length,En=-1;if(arguments.length>1){while(++En<Eq){Dq.call(this,Ep[En],Eo)}return this}else{while(++En<Eq){if(!Dq.call(this,Ep[En])){return false}}return true}};var G=/\s+/g;function Dq(e,Eq){var En=new RegExp("(^|\\s+)"+d3.requote(e)+"(\\s+|$)","g");if(arguments.length<2){var Ep=this.node();if(Et=Ep.classList){return Et.contains(e)}var Et=Ep.className;En.lastIndex=0;return En.test(Et.baseVal!=null?Et.baseVal:Et)}function Es(){if(Ew=this.classList){return Ew.add(e)}var Ew=this.className,Eu=Ew.baseVal!=null,Ev=Eu?Ew.baseVal:Ew;En.lastIndex=0;if(!En.test(Ev)){Ev=BJ(Ev+" "+e);if(Eu){Ew.baseVal=Ev}else{this.className=Ev}}}function Er(){if(Ew=this.classList){return Ew.remove(e)}var Ew=this.className,Eu=Ew.baseVal!=null,Ev=Eu?Ew.baseVal:Ew;Ev=BJ(Ev.replace(En," "));if(Eu){Ew.baseVal=Ev}else{this.className=Ev}}function Eo(){(Eq.apply(this,arguments)?Es:Er).call(this)}return this.each(typeof Eq==="function"?Eo:Eq?Es:Er)}B1.style=function(Eo,Er,Ep){if(arguments.length<3){Ep=""}if(arguments.length<2){return window.getComputedStyle(this.node(),null).getPropertyValue(Eo)}function En(){this.style.removeProperty(Eo)}function Eq(){this.style.setProperty(Eo,Er,Ep)}function e(){var Es=Er.apply(this,arguments);if(Es==null){this.style.removeProperty(Eo)}else{this.style.setProperty(Eo,Es,Ep)}}return this.each(Er==null?En:(typeof Er==="function"?e:Eq))};B1.property=function(En,Ep){if(arguments.length<2){return this.node()[En]}function e(){delete this[En]}function Eo(){this[En]=Ep}function Eq(){var Er=Ep.apply(this,arguments);if(Er==null){delete this[En]}else{this[En]=Er}}return this.each(Ep==null?e:(typeof Ep==="function"?Eq:Eo))};B1.text=function(e){return arguments.length<1?this.node().textContent:this.each(typeof e==="function"?function(){var En=e.apply(this,arguments);this.textContent=En==null?"":En}:e==null?function(){this.textContent=""}:function(){this.textContent=e})};B1.html=function(e){return arguments.length<1?this.node().innerHTML:this.each(typeof e==="function"?function(){var En=e.apply(this,arguments);this.innerHTML=En==null?"":En}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e})};B1.append=function(En){En=d3.ns.qualify(En);function e(){return this.appendChild(document.createElementNS(this.namespaceURI,En))}function Eo(){return this.appendChild(document.createElementNS(En.space,En.local))}return this.select(En.local?Eo:e)};B1.insert=function(e,Eo){e=d3.ns.qualify(e);function En(){return this.insertBefore(document.createElementNS(this.namespaceURI,e),Bf(Eo,this))}function Ep(){return this.insertBefore(document.createElementNS(e.space,e.local),Bf(Eo,this))}return this.select(e.local?Ep:En)};B1.remove=function(){return this.each(function(){var e=this.parentNode;if(e){e.removeChild(this)}})};B1.data=function(Et,Ev){var Eq=-1,En=this.length,Eu,Eo;if(!arguments.length){Et=new Array(En=(Eu=this[0]).length);while(++Eq<En){if(Eo=Eu[Eq]){Et[Eq]=Eo.__data__}}return Et}function Er(E8,E0){var E3,Ex=E8.length,Ez=E0.length,E6=Math.min(Ex,Ez),E5=Math.max(Ex,Ez),FA=[],E7=[],E4=[],Ey,Ew;if(Ev){var FB=new AC,E9=[],E2,E1=E0.length;for(E3=-1;++E3<Ex;){E2=Ev.call(Ey=E8[E3],Ey.__data__,E3);if(FB.has(E2)){E4[E1++]=Ey}else{FB.set(E2,Ey)}E9.push(E2)}for(E3=-1;++E3<Ez;){E2=Ev.call(E0,Ew=E0[E3],E3);if(FB.has(E2)){FA[E3]=Ey=FB.get(E2);Ey.__data__=Ew;E7[E3]=E4[E3]=null}else{E7[E3]=a(Ew);FA[E3]=E4[E3]=null}FB.remove(E2)}for(E3=-1;++E3<Ex;){if(FB.has(E9[E3])){E4[E3]=E8[E3]}}}else{for(E3=-1;++E3<E6;){Ey=E8[E3];Ew=E0[E3];if(Ey){Ey.__data__=Ew;FA[E3]=Ey;E7[E3]=E4[E3]=null}else{E7[E3]=a(Ew);FA[E3]=E4[E3]=null}}for(;E3<Ez;++E3){E7[E3]=a(E0[E3]);FA[E3]=E4[E3]=null}for(;E3<E5;++E3){E4[E3]=E8[E3];E7[E3]=FA[E3]=null}}E7.update=FA;E7.parentNode=FA.parentNode=E4.parentNode=E8.parentNode;Es.push(E7);Ep.push(FA);e.push(E4)}var Es=Ar([]),Ep=B2([]),e=B2([]);if(typeof Et==="function"){while(++Eq<En){Er(Eu=this[Eq],Et.call(Eu,Eu.parentNode.__data__,Eq))}}else{while(++Eq<En){Er(Eu=this[Eq],Et)}}Ep.enter=function(){return Es};Ep.exit=function(){return e};return Ep};function a(e){return{__data__:e}}B1.datum=B1.map=function(e){return arguments.length<1?this.property("__data__"):this.property("__data__",e)};B1.filter=function(e){var Eo=[],Eu,Et,Ep;if(typeof e!=="function"){e=AQ(e)}for(var Er=0,Eq=this.length;Er<Eq;Er++){Eo.push(Eu=[]);Eu.parentNode=(Et=this[Er]).parentNode;for(var Es=0,En=Et.length;Es<En;Es++){if((Ep=Et[Es])&&e.call(Ep,Ep.__data__,Es)){Eu.push(Ep)}}}return B2(Eo)};function AQ(e){return function(){return A(this,e)}}B1.order=function(){for(var En=-1,e=this.length;++En<e;){for(var Er=this[En],Eo=Er.length-1,Ep=Er[Eo],Eq;--Eo>=0;){if(Eq=Er[Eo]){if(Ep&&Ep!==Eq.nextSibling){Ep.parentNode.insertBefore(Eq,Ep)}Ep=Eq}}}return this};B1.sort=function(En){En=Dv.apply(this,arguments);for(var Eo=-1,e=this.length;++Eo<e;){this[Eo].sort(En)}return this.order()};function Dv(e){if(!arguments.length){e=d3.ascending}return function(Eo,En){return e(Eo&&Eo.__data__,En&&En.__data__)}}B1.on=function(Ep,Eq,e){if(arguments.length<3){e=false}var En="__on"+Ep,Eo=Ep.indexOf(".");if(Eo>0){Ep=Ep.substring(0,Eo)}if(arguments.length<2){return(Eo=this.node()[En])&&Eo._}return this.each(function(Ev,Es){var Et=this,Eu=Et[En];if(Eu){Et.removeEventListener(Ep,Eu,Eu.$);delete Et[En]}if(Eq){Et.addEventListener(Ep,Et[En]=Er,Er.$=e);Er._=Eq}function Er(Ew){var Ex=d3.event;d3.event=Ew;try{Eq.call(Et,Et.__data__,Es)}finally{d3.event=Ex}}})};B1.each=function(Es){for(var En=-1,e=this.length;++En<e;){for(var Eq=this[En],Eo=-1,Er=Eq.length;++Eo<Er;){var Ep=Eq[Eo];if(Ep){Es.call(Ep,Ep.__data__,Eo,En)}}}return this};B1.call=function(e){e.apply(this,(arguments[0]=this,arguments));return this};B1.empty=function(){return !this.node()};B1.node=function(Es){for(var En=0,e=this.length;En<e;En++){for(var Eq=this[En],Eo=0,Er=Eq.length;Eo<Er;Eo++){var Ep=Eq[Eo];if(Ep){return Ep}}}return null};B1.transition=function(){var En=[],Eo,Er;for(var Ep=-1,e=this.length;++Ep<e;){En.push(Eo=[]);for(var Es=this[Ep],Eq=-1,Et=Es.length;++Eq<Et;){Eo.push((Er=Es[Eq])?{node:Er,delay:Cf,duration:D6}:null)}}return Dx(En,ED||++ER,Date.now())};var Dz=B2([[document]]);Dz[0].parentNode=CO;d3.select=function(e){return typeof e==="string"?Dz.select(e):B2([[e]])};d3.selectAll=function(e){return typeof e==="string"?Dz.selectAll(e):B2([Bu(e)])};function Ar(e){Ca(e,Ci);return e}var Ci=[];d3.selection.enter=Ar;d3.selection.enter.prototype=Ci;Ci.append=B1.append;Ci.insert=B1.insert;Ci.empty=B1.empty;Ci.node=B1.node;Ci.select=function(Er){var Eo=[],Ew,e,Eu,Ev,Eq;for(var Es=-1,Ep=this.length;++Es<Ep;){Eu=(Ev=this[Es]).update;Eo.push(Ew=[]);Ew.parentNode=Ev.parentNode;for(var Et=-1,En=Ev.length;++Et<En;){if(Eq=Ev[Et]){Ew.push(Eu[Et]=e=Er.call(Ev.parentNode,Eq.__data__,Et));e.__data__=Eq.__data__}else{Ew.push(null)}}}return B2(Eo)};function Dx(e,Er,Ep){Ca(e,CJ);var Eo=new AC,En=d3.dispatch("start","end"),Eq=AV;e.id=Er;e.time=Ep;e.tween=function(Es,Et){if(arguments.length<2){return Eo.get(Es)}if(Et==null){Eo.remove(Es)}else{Eo.set(Es,Et)}return e};e.ease=function(Es){if(!arguments.length){return Eq}Eq=typeof Es==="function"?Es:d3.ease.apply(d3,arguments);return e};e.each=function(Es,Et){if(arguments.length<2){return Bv.call(e,Es)}En.on(Es,Et);return e};d3.timer(function(Es){e.each(function(E0,Ex,Ew){var E2=[],Eu=this,Ey=e[Ew][Ex].delay,Ev=e[Ew][Ex].duration,E3=Eu.__transition__||(Eu.__transition__={active:0,count:0});++E3.count;Ey<=Es?Et(Es):d3.timer(Et,Ey,Ep);function Et(E4){if(E3.active>Er){return E1()}E3.active=Er;Eo.forEach(function(E5,E6){if(tween=E6.call(Eu,E0,Ex)){E2.push(tween)}});En.start.call(Eu,E0,Ex);if(!Ez(E4)){d3.timer(Ez,0,Ep)}return 1}function Ez(E4){if(E3.active!==Er){return E1()}var E5=(E4-Ey)/Ev,E6=Eq(E5),E7=E2.length;while(E7>0){E2[--E7].call(Eu,E6)}if(E5>=1){E1();ED=Er;En.end.call(Eu,E0,Ex);ED=0;return 1}}function E1(){if(!--E3.count){delete Eu.__transition__}return 1}});return 1},0,Ep);return e}var Q={};function D4(Eo,En,e){return e!=""&&Q}function E(Ep,e){var Eo=C5(Ep);function En(Eu,Et,Er){var Es=e.call(this,Eu,Et);return Es==null?Er!=""&&Q:Er!=Es&&Eo(Er,Es)}function Eq(Et,Es,Er){return Er!=e&&Eo(Er,e)}return typeof e==="function"?En:e==null?D4:(e+="",Eq)}var CJ=[],ER=0,ED=0,D=0,D2=250,Cv=d3.ease("cubic-in-out"),Cf=D,D6=D2,AV=Cv;CJ.call=B1.call;d3.transition=function(e){return arguments.length?(ED?e.transition():e):Dz.transition()};d3.transition.prototype=CJ;CJ.select=function(Er){var Eo=[],Ev,e,Ep;if(typeof Er!=="function"){Er=S(Er)}for(var Es=-1,Eq=this.length;++Es<Eq;){Eo.push(Ev=[]);for(var Eu=this[Es],Et=-1,En=Eu.length;++Et<En;){if((Ep=Eu[Et])&&(e=Er.call(Ep.node,Ep.node.__data__,Et))){if("__data__" in Ep.node){e.__data__=Ep.node.__data__}Ev.push({node:e,delay:Ep.delay,duration:Ep.duration})}else{Ev.push(null)}}}return Dx(Eo,this.id,this.time).ease(this.ease())};CJ.selectAll=function(Es){var Ep=[],Ex,e,Eq;if(typeof Es!=="function"){Es=BU(Es)}for(var Eu=-1,Er=this.length;++Eu<Er;){for(var Ew=this[Eu],Ev=-1,Eo=Ew.length;++Ev<Eo;){if(Eq=Ew[Ev]){e=Es.call(Eq.node,Eq.node.__data__,Ev);Ep.push(Ex=[]);for(var Et=-1,En=e.length;++Et<En;){Ex.push({node:e[Et],delay:Eq.delay,duration:Eq.duration})}}}}return Dx(Ep,this.id,this.time).ease(this.ease())};CJ.attr=function(e,En){return this.attrTween(e,E(e,En))};CJ.attrTween=function(e,Eo){var En=d3.ns.qualify(e);function Ep(Et,Er){var Es=Eo.call(this,Et,Er,this.getAttribute(En));return Es===Q?(this.removeAttribute(En),null):Es&&function(Eu){this.setAttribute(En,Es(Eu))}}function Eq(Et,Er){var Es=Eo.call(this,Et,Er,this.getAttributeNS(En.space,En.local));return Es===Q?(this.removeAttributeNS(En.space,En.local),null):Es&&function(Eu){this.setAttributeNS(En.space,En.local,Es(Eu))}}return this.tween("attr."+e,En.local?Eq:Ep)};CJ.style=function(e,Eo,En){if(arguments.length<3){En=""}return this.styleTween(e,E(e,Eo),En)};CJ.styleTween=function(e,Eo,En){if(arguments.length<3){En=""}return this.tween("style."+e,function(Er,Ep){var Eq=Eo.call(this,Er,Ep,window.getComputedStyle(this,null).getPropertyValue(e));return Eq===Q?(this.style.removeProperty(e),null):Eq&&function(Es){this.style.setProperty(e,Eq(Es),En)}})};CJ.text=function(e){return this.tween("text",function(Eo,En){this.textContent=typeof e==="function"?e.call(this,Eo,En):e})};CJ.remove=function(){return this.each("end.transition",function(){var e;if(!this.__transition__&&(e=this.parentNode)){e.removeChild(this)}})};CJ.delay=function(En){var e=this;return e.each(typeof En==="function"?function(Eq,Ep,Eo){e[Eo][Ep].delay=En.apply(this,arguments)|0}:(En=En|0,function(Eq,Ep,Eo){e[Eo][Ep].delay=En}))};CJ.duration=function(En){var e=this;return e.each(typeof En==="function"?function(Eq,Ep,Eo){e[Eo][Ep].duration=Math.max(1,En.apply(this,arguments)|0)}:(En=Math.max(1,En|0),function(Eq,Ep,Eo){e[Eo][Ep].duration=En}))};function Bv(Ew){var e=ED,Eq=AV,Eu=Cf,Er=D6;ED=this.id;AV=this.ease();for(var Es=0,Ep=this.length;Es<Ep;Es++){for(var Ev=this[Es],Et=0,En=Ev.length;Et<En;Et++){var Eo=Ev[Et];if(Eo){Cf=this[Es][Et].delay;D6=this[Es][Et].duration;Ew.call(Eo=Eo.node,Eo.__data__,Et,Es)}}}ED=e;AV=Eq;Cf=Eu;D6=Er;return this}CJ.transition=function(){return this.select(m)};var Ay=null,A6,Ct;d3.timer=function(Er,e,Eq){var Ep=false,Eo,En=Ay;if(arguments.length<3){if(arguments.length<2){e=0}else{if(!isFinite(e)){return}}Eq=Date.now()}while(En){if(En.callback===Er){En.then=Eq;En.delay=e;Ep=true;break}Eo=En;En=En.next}if(!Ep){Ay={callback:Er,then:Eq,delay:e,next:Ay}}if(!A6){Ct=clearTimeout(Ct);A6=1;EM(EN)}};function EN(){var e,Eo=Date.now(),Ep=Ay;while(Ep){e=Eo-Ep.then;if(e>=Ep.delay){Ep.flush=Ep.callback(e)}Ep=Ep.next}var En=Ck()-Eo;if(En>24){if(isFinite(En)){clearTimeout(Ct);Ct=setTimeout(EN,En)}A6=0}else{A6=1;EM(EN)}}d3.timer.flush=function(){var e,En=Date.now(),Eo=Ay;while(Eo){e=En-Eo.then;if(!Eo.delay){Eo.flush=Eo.callback(e)}Eo=Eo.next}Ck()};function Ck(){var En=null,e=Ay,Eo=Infinity;while(e){if(e.flush){e=En?En.next=e.next:Ay=e.next}else{Eo=Math.min(Eo,e.then+e.delay);e=(En=e).next}}return Eo}var EM=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.transform=function(En){var Eo=document.createElementNS(d3.ns.prefix.svg,"g"),e={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(Ep){Eo.setAttribute("transform",Ep);var Eq=Eo.transform.baseVal.consolidate();return new N(Eq?Eq.matrix:e)})(En)};function N(e){var Ep=[e.a,e.b],En=[e.c,e.d],Er=C2(Ep),Eo=Cb(Ep,En),Eq=C2(Ap(En,Ep,-Eo))||0;if(Ep[0]*En[1]<En[0]*Ep[1]){Ep[0]*=-1;Ep[1]*=-1;Er*=-1;Eo*=-1}this.rotate=(Er?Math.atan2(Ep[1],Ep[0]):Math.atan2(-En[0],En[1]))*CQ;this.translate=[e.e,e.f];this.scale=[Er,Eq];this.skew=Eq?Math.atan2(Eo,Eq)*CQ:0}N.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};function Cb(En,e){return En[0]*e[0]+En[1]*e[1]}function C2(e){var En=Math.sqrt(Cb(e,e));if(En){e[0]/=En;e[1]/=En}return En}function Ap(En,e,Eo){En[0]+=Eo*e[0];En[1]+=Eo*e[1];return En}var CQ=180/Math.PI;d3.mouse=function(e){return AK(e,n())};var BH=/WebKit/.test(navigator.userAgent)?-1:0;function AK(Ep,Es){var Eq=Ep.ownerSVGElement||Ep;if(Eq.createSVGPoint){var En=Eq.createSVGPoint();if((BH<0)&&(window.scrollX||window.scrollY)){Eq=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var Eo=Eq[0][0].getScreenCTM();BH=!(Eo.f||Eo.e);Eq.remove()}if(BH){En.x=Es.pageX;En.y=Es.pageY}else{En.x=Es.clientX;En.y=Es.clientY}En=En.matrixTransform(Ep.getScreenCTM().inverse());return[En.x,En.y]}var Er=Ep.getBoundingClientRect();return[Es.clientX-Er.left-Ep.clientLeft,Es.clientY-Er.top-Ep.clientTop]}d3.touches=function(e,En){if(arguments.length<2){En=n().touches}return En?Bu(En).map(function(Ep){var Eo=AK(e,Ep);Eo.identifier=Ep.identifier;return Eo}):[]};function AB(){}d3.scale={};function CH(En){var Eo=En[0],e=En[En.length-1];return Eo<e?[Eo,e]:[e,Eo]}function AL(e){return e.rangeExtent?e.rangeExtent():CH(e.range())}function Dc(Es,Eq){var Er=0,Ep=Es.length-1,Eo=Es[Er],En=Es[Ep],e;if(En<Eo){e=Er;Er=Ep;Ep=e;e=Eo;Eo=En;En=e}if(e=En-Eo){Eq=Eq(e);Es[Er]=Eq.floor(Eo);Es[Ep]=Eq.ceil(En)}return Es}function CU(){return Math}d3.scale.linear=function(){return CE([0,1],[0,1],d3.interpolate,false)};function CE(Er,Ep,Eq,Et){var Eo,En;function e(){var Eu=Math.min(Er.length,Ep.length)>2?b:AA,Ev=Et?x:EO;Eo=Eu(Er,Ep,Ev,Eq);En=Eu(Ep,Er,Ev,d3.interpolate);return Es}function Es(Eu){return Eo(Eu)}Es.invert=function(Eu){return En(Eu)};Es.domain=function(Eu){if(!arguments.length){return Er}Er=Eu.map(Number);return e()};Es.range=function(Eu){if(!arguments.length){return Ep}Ep=Eu;return e()};Es.rangeRound=function(Eu){return Es.range(Eu).interpolate(d3.interpolateRound)};Es.clamp=function(Eu){if(!arguments.length){return Et}Et=Eu;return e()};Es.interpolate=function(Eu){if(!arguments.length){return Eq}Eq=Eu;return e()};Es.ticks=function(Eu){return Ce(Er,Eu)};Es.tickFormat=function(Eu){return Co(Er,Eu)};Es.nice=function(){Dc(Er,AE);return e()};Es.copy=function(){return CE(Er,Ep,Eq,Et)};return e()}function DU(En,e){return d3.rebind(En,e,"range","rangeRound","interpolate","clamp")}function AE(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return{floor:function(En){return Math.floor(En/e)*e},ceil:function(En){return Math.ceil(En/e)*e}}}function O(Er,e){var Eo=CH(Er),En=Eo[1]-Eo[0],Eq=Math.pow(10,Math.floor(Math.log(En/e)/Math.LN10)),Ep=e/En*Eq;if(Ep<=0.15){Eq*=10}else{if(Ep<=0.35){Eq*=5}else{if(Ep<=0.75){Eq*=2}}}Eo[0]=Math.ceil(Eo[0]/Eq)*Eq;Eo[1]=Math.floor(Eo[1]/Eq)*Eq+Eq*0.5;Eo[2]=Eq;return Eo}function Ce(En,e){return d3.range.apply(d3,O(En,e))}function Co(En,e){return d3.format(",."+Math.max(0,-Math.floor(Math.log(O(En,e)[2])/Math.LN10+0.01))+"f")}function AA(Eq,e,Er,Eo){var En=Er(Eq[0],Eq[1]),Ep=Eo(e[0],e[1]);return function(Es){return Ep(En(Es))}}function b(Es,En,Et,Eq){var Ep=[],Er=[],Eo=0,e=Math.min(Es.length,En.length)-1;if(Es[e]<Es[0]){Es=Es.slice().reverse();En=En.slice().reverse()}while(++Eo<=e){Ep.push(Et(Es[Eo-1],Es[Eo]));Er.push(Eq(En[Eo-1],En[Eo]))}return function(Eu){var Ev=d3.bisect(Es,Eu,1,e)-1;return Er[Ev](Ep[Ev](Eu))}}d3.scale.log=function(){return Dt(d3.scale.linear(),DV)};function Dt(e,En){var Eo=En.pow;function Ep(Eq){return e(En(Eq))}Ep.invert=function(Eq){return Eo(e.invert(Eq))};Ep.domain=function(Eq){if(!arguments.length){return e.domain().map(Eo)}En=Eq[0]<0?DY:DV;Eo=En.pow;e.domain(Eq.map(En));return Ep};Ep.nice=function(){e.domain(Dc(e.domain(),CU));return Ep};Ep.ticks=function(){var Ev=CH(e.domain()),Ew=[];if(Ev.every(isFinite)){var Eu=Math.floor(Ev[0]),Et=Math.ceil(Ev[1]),Es=Eo(Ev[0]),Er=Eo(Ev[1]);if(En===DY){Ew.push(Eo(Eu));for(;Eu++<Et;){for(var Eq=9;Eq>0;Eq--){Ew.push(Eo(Eu)*Eq)}}}else{for(;Eu<Et;Eu++){for(var Eq=1;Eq<10;Eq++){Ew.push(Eo(Eu)*Eq)}}Ew.push(Eo(Eu))}for(Eu=0;Ew[Eu]<Es;Eu++){}for(Et=Ew.length;Ew[Et-1]>Er;Et--){}Ew=Ew.slice(Eu,Et)}return Ew};Ep.tickFormat=function(Eu,Et){if(arguments.length<2){Et=Bg}if(arguments.length<1){return Et}var Eq=Eu/Ep.ticks().length,Er=En===DY?(Es=-1e-12,Math.floor):(Es=1e-12,Math.ceil),Es;return function(Ev){return Ev/Eo(Er(En(Ev)+Es))<Eq?Et(Ev):""}};Ep.copy=function(){return Dt(e.copy(),En)};return DU(Ep,e)}var Bg=d3.format(".0e");function DV(e){return Math.log(e<0?0:e)/Math.LN10}function DY(e){return -Math.log(e>0?0:-e)/Math.LN10}DV.pow=function(e){return Math.pow(10,e)};DY.pow=function(e){return -Math.pow(10,-e)};d3.scale.pow=function(){return Dh(d3.scale.linear(),1)};function Dh(e,Eo){var En=DM(Eo),Ep=DM(1/Eo);function Eq(Er){return e(En(Er))}Eq.invert=function(Er){return Ep(e.invert(Er))};Eq.domain=function(Er){if(!arguments.length){return e.domain().map(Ep)}e.domain(Er.map(En));return Eq};Eq.ticks=function(Er){return Ce(Eq.domain(),Er)};Eq.tickFormat=function(Er){return Co(Eq.domain(),Er)};Eq.nice=function(){return Eq.domain(Dc(Eq.domain(),AE))};Eq.exponent=function(Er){if(!arguments.length){return Eo}var Es=Eq.domain();En=DM(Eo=Er);Ep=DM(1/Eo);return Eq.domain(Es)};Eq.copy=function(){return Dh(e.copy(),Eo)};return DU(Eq,e)}function DM(En){return function(e){return e<0?-Math.pow(-e,En):Math.pow(e,En)}}d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){return A7([],{t:"range",x:[]})};function A7(Er,Eo){var Eq,En,Ep;function Es(Et){return En[((Eq.get(Et)||Eq.set(Et,Er.push(Et)))-1)%En.length]}function e(Eu,Et){return d3.range(Er.length).map(function(Ev){return Eu+Et*Ev})}Es.domain=function(Et){if(!arguments.length){return Er}Er=[];Eq=new AC;var Ev=-1,Ew=Et.length,Eu;while(++Ev<Ew){if(!Eq.has(Eu=Et[Ev])){Eq.set(Eu,Er.push(Eu))}}return Es[Eo.t](Eo.x,Eo.p)};Es.range=function(Et){if(!arguments.length){return En}En=Et;Ep=0;Eo={t:"range",x:Et};return Es};Es.rangePoints=function(Et,Ew){if(arguments.length<2){Ew=0}var Ex=Et[0],Eu=Et[1],Ev=(Eu-Ex)/(Er.length-1+Ew);En=e(Er.length<2?(Ex+Eu)/2:Ex+Ev*Ew/2,Ev);Ep=0;Eo={t:"rangePoints",x:Et,p:Ew};return Es};Es.rangeBands=function(Et,Ex){if(arguments.length<2){Ex=0}var Eu=Et[1]<Et[0],Ey=Et[Eu-0],Ev=Et[1-Eu],Ew=(Ev-Ey)/(Er.length+Ex);En=e(Ey+Ew*Ex,Ew);if(Eu){En.reverse()}Ep=Ew*(1-Ex);Eo={t:"rangeBands",x:Et,p:Ex};return Es};Es.rangeRoundBands=function(Et,Ey){if(arguments.length<2){Ey=0}var Ev=Et[1]<Et[0],Ez=Et[Ev-0],Ew=Et[1-Ev],Ex=Math.floor((Ew-Ez)/(Er.length+Ey)),Eu=Ew-Ez-(Er.length-Ey)*Ex;En=e(Ez+Math.round(Eu/2),Ex);if(Ev){En.reverse()}Ep=Math.round(Ex*(1-Ey));Eo={t:"rangeRoundBands",x:Et,p:Ey};return Es};Es.rangeBand=function(){return Ep};Es.rangeExtent=function(){return CH(Eo.x)};Es.copy=function(){return A7(Er,Eo)};return Es.domain(Er)}d3.scale.category10=function(){return d3.scale.ordinal().range(BE)};d3.scale.category20=function(){return d3.scale.ordinal().range(A2)};d3.scale.category20b=function(){return d3.scale.ordinal().range(EC)};d3.scale.category20c=function(){return d3.scale.ordinal().range(EB)};var BE=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var A2=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];var EC=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"];var EB=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return V([],[])};function V(Eo,En){var Ep;function e(){var Er=0,Et=Eo.length,Es=En.length;Ep=[];while(++Er<Es){Ep[Er-1]=d3.quantile(Eo,Er/Es)}return Eq}function Eq(Er){if(isNaN(Er=+Er)){return NaN}return En[d3.bisect(Ep,Er)]}Eq.domain=function(Er){if(!arguments.length){return Eo}Eo=Er.filter(function(Es){return !isNaN(Es)}).sort(d3.ascending);return e()};Eq.range=function(Er){if(!arguments.length){return En}En=Er;return e()};Eq.quantiles=function(){return Ep};Eq.copy=function(){return V(Eo,En)};return e()}d3.scale.quantize=function(){return Bq(0,1,[0,1])};function Bq(Eq,Eo,En){var Er,Ep;function Es(Et){return En[Math.max(0,Math.min(Ep,Math.floor(Er*(Et-Eq))))]}function e(){Er=En.length/(Eo-Eq);Ep=En.length-1;return Es}Es.domain=function(Et){if(!arguments.length){return[Eq,Eo]}Eq=+Et[0];Eo=+Et[Et.length-1];return e()};Es.range=function(Et){if(!arguments.length){return En}En=Et;return e()};Es.copy=function(){return Bq(Eq,Eo,En)};return e()}d3.scale.identity=function(){return CV([0,1])};function CV(En){function e(Eo){return +Eo}e.invert=e;e.domain=e.range=function(Eo){if(!arguments.length){return En}En=Eo.map(e);return e};e.ticks=function(Eo){return Ce(En,Eo)};e.tickFormat=function(Eo){return Co(En,Eo)};e.copy=function(){return CV(En)};return e}d3.svg={};d3.svg.arc=function(){var Eq=Af,Ep=BN,Eo=DZ,e=s;function En(){var Eu=Eq.apply(this,arguments),Et=Ep.apply(this,arguments),Es=Eo.apply(this,arguments)+EU,Er=e.apply(this,arguments)+EU,E0=(Er<Es&&(E0=Es,Es=Er,Er=E0),Er-Es),Ex=E0<Math.PI?"0":"1",Ew=Math.cos(Es),Ez=Math.sin(Es),Ev=Math.cos(Er),Ey=Math.sin(Er);return E0>=EZ?(Eu?"M0,"+Et+"A"+Et+","+Et+" 0 1,1 0,"+(-Et)+"A"+Et+","+Et+" 0 1,1 0,"+Et+"M0,"+Eu+"A"+Eu+","+Eu+" 0 1,0 0,"+(-Eu)+"A"+Eu+","+Eu+" 0 1,0 0,"+Eu+"Z":"M0,"+Et+"A"+Et+","+Et+" 0 1,1 0,"+(-Et)+"A"+Et+","+Et+" 0 1,1 0,"+Et+"Z"):(Eu?"M"+Et*Ew+","+Et*Ez+"A"+Et+","+Et+" 0 "+Ex+",1 "+Et*Ev+","+Et*Ey+"L"+Eu*Ev+","+Eu*Ey+"A"+Eu+","+Eu+" 0 "+Ex+",0 "+Eu*Ew+","+Eu*Ez+"Z":"M"+Et*Ew+","+Et*Ez+"A"+Et+","+Et+" 0 "+Ex+",1 "+Et*Ev+","+Et*Ey+"L0,0Z")}En.innerRadius=function(Er){if(!arguments.length){return Eq}Eq=d3.functor(Er);return En};En.outerRadius=function(Er){if(!arguments.length){return Ep}Ep=d3.functor(Er);return En};En.startAngle=function(Er){if(!arguments.length){return Eo}Eo=d3.functor(Er);return En};En.endAngle=function(Er){if(!arguments.length){return e}e=d3.functor(Er);return En};En.centroid=function(){var Es=(Eq.apply(this,arguments)+Ep.apply(this,arguments))/2,Er=(Eo.apply(this,arguments)+e.apply(this,arguments))/2+EU;return[Math.cos(Er)*Es,Math.sin(Er)*Es]};return En};var EU=-Math.PI/2,EZ=2*Math.PI-0.000001;function Af(e){return e.innerRadius}function BN(e){return e.outerRadius}function DZ(e){return e.startAngle}function s(e){return e.endAngle}function Cn(En){var e=D1,Es=D0,Ep=B6,Er=Az.get(Ep),Eq=0.7;function Eo(Et){return Et.length<1?null:"M"+Er(En(z(this,Et,e,Es)),Eq)}Eo.x=function(Et){if(!arguments.length){return e}e=Et;return Eo};Eo.y=function(Et){if(!arguments.length){return Es}Es=Et;return Eo};Eo.interpolate=function(Et){if(!arguments.length){return Ep}if(!Az.has(Et+="")){Et=B6}Er=Az.get(Ep=Et);return Eo};Eo.tension=function(Et){if(!arguments.length){return Eq}Eq=Et;return Eo};return Eo}d3.svg.line=function(){return Cn(Object)};function z(Ev,Eq,Es,Er){var Eu=[],Ep=-1,e=Eq.length,Eo=typeof Es==="function",En=typeof Er==="function",Et;if(Eo&&En){while(++Ep<e){Eu.push([Es.call(Ev,Et=Eq[Ep],Ep),Er.call(Ev,Et,Ep)])}}else{if(Eo){while(++Ep<e){Eu.push([Es.call(Ev,Eq[Ep],Ep),Er])}}else{if(En){while(++Ep<e){Eu.push([Es,Er.call(Ev,Eq[Ep],Ep)])}}else{while(++Ep<e){Eu.push([Es,Er])}}}}return Eu}function D1(e){return e[0]}function D0(e){return e[1]}var B6="linear";var Az=d3.map({linear:Ec,"step-before":AZ,"step-after":EQ,basis:Cs,"basis-open":AW,"basis-closed":BL,bundle:BM,cardinal:Bz,"cardinal-open":Aw,"cardinal-closed":P,monotone:Bd});function Ec(En){var e=0,Eq=En.length,Ep=En[0],Eo=[Ep[0],",",Ep[1]];while(++e<Eq){Eo.push("L",(Ep=En[e])[0],",",Ep[1])}return Eo.join("")}function AZ(En){var e=0,Eq=En.length,Ep=En[0],Eo=[Ep[0],",",Ep[1]];while(++e<Eq){Eo.push("V",(Ep=En[e])[1],"H",Ep[0])}return Eo.join("")}function EQ(En){var e=0,Eq=En.length,Ep=En[0],Eo=[Ep[0],",",Ep[1]];while(++e<Eq){Eo.push("H",(Ep=En[e])[0],"V",Ep[1])}return Eo.join("")}function Aw(En,e){return En.length<4?Ec(En):En[1]+BR(En.slice(1,En.length-1),As(En,e))}function P(En,e){return En.length<3?Ec(En):En[0]+BR((En.push(En[0]),En),As([En[En.length-2]].concat(En,[En[1]]),e))}function Bz(Eo,En,e){return Eo.length<3?Ec(Eo):Eo[0]+BR(Eo,As(Eo,En))}function BR(Es,Er){if(Er.length<1||(Es.length!=Er.length&&Es.length!=Er.length+2)){return Ec(Es)}var Et=Es.length!=Er.length,Ew="",Eu=Es[0],e=Es[1],Eq=Er[0],Ev=Eq,Eo=1;if(Et){Ew+="Q"+(e[0]-Eq[0]*2/3)+","+(e[1]-Eq[1]*2/3)+","+e[0]+","+e[1];Eu=Es[1];Eo=2}if(Er.length>1){Ev=Er[1];e=Es[Eo];Eo++;Ew+="C"+(Eu[0]+Eq[0])+","+(Eu[1]+Eq[1])+","+(e[0]-Ev[0])+","+(e[1]-Ev[1])+","+e[0]+","+e[1];for(var En=2;En<Er.length;En++,Eo++){e=Es[Eo];Ev=Er[En];Ew+="S"+(e[0]-Ev[0])+","+(e[1]-Ev[1])+","+e[0]+","+e[1]}}if(Et){var Ep=Es[Eo];Ew+="Q"+(e[0]+Ev[0]*2/3)+","+(e[1]+Ev[1]*2/3)+","+Ep[0]+","+Ep[1]}return Ew}function As(Es,Eq){var Eo=[],Ep=(1-Eq)/2,Eu,Et=Es[0],Er=Es[1],En=1,e=Es.length;while(++En<e){Eu=Et;Et=Er;Er=Es[En];Eo.push([Ep*(Er[0]-Eu[0]),Ep*(Er[1]-Eu[1])])}return Eo}function Cs(Et){if(Et.length<3){return Ec(Et)}var Eo=1,En=Et.length,Ep=Et[0],e=Ep[0],Er=Ep[1],Es=[e,e,e,(Ep=Et[1])[0]],Eq=[Er,Er,Er,Ep[1]],Eu=[e,",",Er];Am(Eu,Es,Eq);while(++Eo<En){Ep=Et[Eo];Es.shift();Es.push(Ep[0]);Eq.shift();Eq.push(Ep[1]);Am(Eu,Es,Eq)}Eo=-1;while(++Eo<2){Es.shift();Es.push(Ep[0]);Eq.shift();Eq.push(Ep[1]);Am(Eu,Es,Eq)}return Eu.join("")}function AW(Ep){if(Ep.length<4){return Ec(Ep)}var Er=[],Eo=-1,Es=Ep.length,Eq,En=[0],e=[0];while(++Eo<3){Eq=Ep[Eo];En.push(Eq[0]);e.push(Eq[1])}Er.push(Df(EH,En)+","+Df(EH,e));--Eo;while(++Eo<Es){Eq=Ep[Eo];En.shift();En.push(Eq[0]);e.shift();e.push(Eq[1]);Am(Er,En,e)}return Er.join("")}function BL(Eq){var Es,Ep=-1,Et=Eq.length,e=Et+4,Er,Eo=[],En=[];while(++Ep<4){Er=Eq[Ep%Et];Eo.push(Er[0]);En.push(Er[1])}Es=[Df(EH,Eo),",",Df(EH,En)];--Ep;while(++Ep<e){Er=Eq[Ep%Et];Eo.shift();Eo.push(Er[0]);En.shift();En.push(Er[1]);Am(Es,Eo,En)}return Es.join("")}function BM(Es,Er){var Eo=Es.length-1,En=Es[0][0],Eq=Es[0][1],Ev=Es[Eo][0]-En,Eu=Es[Eo][1]-Eq,Ep=-1,e,Et;while(++Ep<=Eo){e=Es[Ep];Et=Ep/Eo;e[0]=Er*e[0]+(1-Er)*(En+Et*Ev);e[1]=Er*e[1]+(1-Er)*(Eq+Et*Eu)}return Cs(Es)}function Df(En,e){return En[0]*e[0]+En[1]*e[1]+En[2]*e[2]+En[3]*e[3]}var EK=[0,2/3,1/3,0],EI=[0,1/3,2/3,0],EH=[0,1/6,2/3,1/6];function Am(En,e,Eo){En.push("C",Df(EK,e),",",Df(EK,Eo),",",Df(EI,e),",",Df(EI,Eo),",",Df(EH,e),",",Df(EH,Eo))}function Ei(En,e){return(e[1]-En[1])/(e[0]-En[0])}function CA(Ep){var Eo=0,En=Ep.length-1,e=[],Es=Ep[0],Er=Ep[1],Eq=e[0]=Ei(Es,Er);while(++Eo<En){e[Eo]=Eq+(Eq=Ei(Es=Er,Er=Ep[Eo+1]))}e[Eo]=Eq;return e}function u(Et){var Eq=[],Ep,Es,Er,Eu,e=CA(Et),Eo=-1,En=Et.length-1;while(++Eo<En){Ep=Ei(Et[Eo],Et[Eo+1]);if(Math.abs(Ep)<0.000001){e[Eo]=e[Eo+1]=0}else{Es=e[Eo]/Ep;Er=e[Eo+1]/Ep;Eu=Es*Es+Er*Er;if(Eu>9){Eu=Ep*3/Math.sqrt(Eu);e[Eo]=Eu*Es;e[Eo+1]=Eu*Er}}}Eo=-1;while(++Eo<=En){Eu=(Et[Math.min(En,Eo+1)][0]-Et[Math.max(0,Eo-1)][0])/(6*(1+e[Eo]*e[Eo]));Eq.push([Eu||0,e[Eo]*Eu||0])}return Eq}function Bd(e){return e.length<3?Ec(e):e[0]+BR(e,u(e))}d3.svg.line.radial=function(){var e=Cn(f);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};function f(Ep){var e,Eo=-1,Er=Ep.length,Eq,En;while(++Eo<Er){e=Ep[Eo];Eq=e[0];En=e[1]+EU;e[0]=Eq*Math.cos(En);e[1]=Eq*Math.sin(En)}return Ep}function Ek(Er){var Eo=D1,En=D1,Ev=0,Et=D0,Es,Eq,Ep,Eu=0.7;function e(Ey){if(Ey.length<1){return null}var Ex=z(this,Ey,Eo,Ev),Ew=z(this,Ey,Eo===En?Bi(Ex):En,Ev===Et?Bh(Ex):Et);return"M"+Eq(Er(Ew),Eu)+"L"+Ep(Er(Ex.reverse()),Eu)+"Z"}e.x=function(Ew){if(!arguments.length){return En}Eo=En=Ew;return e};e.x0=function(Ew){if(!arguments.length){return Eo}Eo=Ew;return e};e.x1=function(Ew){if(!arguments.length){return En}En=Ew;return e};e.y=function(Ew){if(!arguments.length){return Et}Ev=Et=Ew;return e};e.y0=function(Ew){if(!arguments.length){return Ev}Ev=Ew;return e};e.y1=function(Ew){if(!arguments.length){return Et}Et=Ew;return e};e.interpolate=function(Ew){if(!arguments.length){return Es}if(!Az.has(Ew+="")){Ew=B6}Eq=Az.get(Es=Ew);Ep=Eq.reverse||Eq;return e};e.tension=function(Ew){if(!arguments.length){return Eu}Eu=Ew;return e};return e.interpolate("linear")}AZ.reverse=EQ;EQ.reverse=AZ;d3.svg.area=function(){return Ek(Object)};function Bi(e){return function(Eo,En){return e[En][0]}}function Bh(e){return function(Eo,En){return e[En][1]}}d3.svg.area.radial=function(){var e=Ek(f);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};d3.svg.chord=function(){var e=t,Et=AD,Es=X,Eu=DZ,Eq=s;function Er(Ez,Ex){var Ey=Ev(this,e,Ez,Ex),Ew=Ev(this,Et,Ez,Ex);return"M"+Ey.p0+En(Ey.r,Ey.p1,Ey.a1-Ey.a0)+(Eo(Ey,Ew)?Ep(Ey.r,Ey.p1,Ey.r,Ey.p0):Ep(Ey.r,Ey.p1,Ew.r,Ew.p0)+En(Ew.r,Ew.p1,Ew.a1-Ew.a0)+Ep(Ew.r,Ew.p1,Ey.r,Ey.p0))+"Z"}function Ev(Ez,E2,E3,E0){var Ey=E2.call(Ez,E3,E0),E1=Es.call(Ez,Ey,E0),Ex=Eu.call(Ez,Ey,E0)+EU,Ew=Eq.call(Ez,Ey,E0)+EU;return{r:E1,a0:Ex,a1:Ew,p0:[E1*Math.cos(Ex),E1*Math.sin(Ex)],p1:[E1*Math.cos(Ew),E1*Math.sin(Ew)]}}function Eo(Ex,Ew){return Ex.a0==Ew.a0&&Ex.a1==Ew.a1}function En(Ex,Ey,Ew){return"A"+Ex+","+Ex+" 0 "+ +(Ew>Math.PI)+",1 "+Ey}function Ep(Ex,Ez,Ew,Ey){return"Q 0,0 "+Ey}Er.radius=function(Ew){if(!arguments.length){return Es}Es=d3.functor(Ew);return Er};Er.source=function(Ew){if(!arguments.length){return e}e=d3.functor(Ew);return Er};Er.target=function(Ew){if(!arguments.length){return Et}Et=d3.functor(Ew);return Er};Er.startAngle=function(Ew){if(!arguments.length){return Eu}Eu=d3.functor(Ew);return Er};Er.endAngle=function(Ew){if(!arguments.length){return Eq}Eq=d3.functor(Ew);return Er};return Er};function t(e){return e.source}function AD(e){return e.target}function X(e){return e.radius}function Dp(e){return e.startAngle}function CI(e){return e.endAngle}d3.svg.diagonal=function(){var Eo=t,Ep=AD,e=L;function En(Eu,Er){var Ev=Eo.call(this,Eu,Er),Es=Ep.call(this,Eu,Er),Eq=(Ev.y+Es.y)/2,Et=[Ev,{x:Ev.x,y:Eq},{x:Es.x,y:Eq},Es];Et=Et.map(e);return"M"+Et[0]+"C"+Et[1]+" "+Et[2]+" "+Et[3]}En.source=function(Eq){if(!arguments.length){return Eo}Eo=d3.functor(Eq);return En};En.target=function(Eq){if(!arguments.length){return Ep}Ep=d3.functor(Eq);return En};En.projection=function(Eq){if(!arguments.length){return e}e=Eq;return En};return En};function L(e){return[e.x,e.y]}d3.svg.diagonal.radial=function(){var Eo=d3.svg.diagonal(),e=L,En=Eo.projection;Eo.projection=function(Ep){return arguments.length?En(M(e=Ep)):e};return Eo};function M(e){return function(){var Ep=e.apply(this,arguments),Eo=Ep[0],En=Ep[1]+EU;return[Eo*Math.cos(En),Eo*Math.sin(En)]}}d3.svg.mouse=d3.mouse;d3.svg.touches=d3.touches;d3.svg.symbol=function(){var En=AI,e=Cj;function Eo(Eq,Ep){return(Ea.get(En.call(this,Eq,Ep))||A0)(e.call(this,Eq,Ep))}Eo.type=function(Ep){if(!arguments.length){return En}En=d3.functor(Ep);return Eo};Eo.size=function(Ep){if(!arguments.length){return e}e=d3.functor(Ep);return Eo};return Eo};function Cj(){return 64}function AI(){return"circle"}function A0(e){var En=Math.sqrt(e/Math.PI);return"M0,"+En+"A"+En+","+En+" 0 1,1 0,"+(-En)+"A"+En+","+En+" 0 1,1 0,"+En+"Z"}var Ea=d3.map({circle:A0,cross:function(e){var En=Math.sqrt(e/5)/2;return"M"+-3*En+","+-En+"H"+-En+"V"+-3*En+"H"+En+"V"+-En+"H"+3*En+"V"+En+"H"+En+"V"+3*En+"H"+-En+"V"+En+"H"+-3*En+"Z"},diamond:function(e){var En=Math.sqrt(e/(2*A4)),Eo=En*A4;return"M0,"+-En+"L"+Eo+",0 0,"+En+" "+-Eo+",0Z"},square:function(e){var En=Math.sqrt(e)/2;return"M"+-En+","+-En+"L"+En+","+-En+" "+En+","+En+" "+-En+","+En+"Z"},"triangle-down":function(e){var Eo=Math.sqrt(e/Ax),En=Eo*Ax/2;return"M0,"+En+"L"+Eo+","+-En+" "+-Eo+","+-En+"Z"},"triangle-up":function(e){var Eo=Math.sqrt(e/Ax),En=Eo*Ax/2;return"M0,"+-En+"L"+Eo+","+En+" "+-Eo+","+En+"Z"}});d3.svg.symbolTypes=Ea.keys();var Ax=Math.sqrt(3),A4=Math.tan(30*Math.PI/180);d3.svg.axis=function(){var Ep=d3.scale.linear(),Es="bottom",Eq=6,e=6,En=6,Ew=3,Ev=[10],Er=null,Eu,Et=0;function Eo(Ex){Ex.each(function(){var FG=d3.select(this);var FH=Er==null?(Ep.ticks?Ep.ticks.apply(Ep,Ev):Ep.domain()):Er,FA=Eu==null?(Ep.tickFormat?Ep.tickFormat.apply(Ep,Ev):String):Eu;var E2=BO(Ep,FH,Et),E1=FG.selectAll(".minor").data(E2,String),FD=E1.enter().insert("line","g").attr("class","tick minor").style("opacity",0.000001),FB=d3.transition(E1.exit()).style("opacity",0.000001).remove(),Ez=d3.transition(E1).style("opacity",1);var FF=FG.selectAll("g").data(FH,String),E7=FF.enter().insert("g","path").style("opacity",0.000001),E9=d3.transition(FF.exit()).style("opacity",0.000001).remove(),E3=d3.transition(FF).style("opacity",1),Ey;var E6=AL(Ep),E8=FG.selectAll(".domain").data([0]),E0=E8.enter().append("path").attr("class","domain"),FI=d3.transition(E8);var FC=Ep.copy(),FE=this.__chart__||FC;this.__chart__=FC;E7.append("line").attr("class","tick");E7.append("text");E3.select("text").text(FA);switch(Es){case"bottom":Ey=Cz;FD.attr("y2",e);Ez.attr("x2",0).attr("y2",e);E7.select("line").attr("y2",Eq);E7.select("text").attr("y",Math.max(Eq,0)+Ew);E3.select("line").attr("x2",0).attr("y2",Eq);E3.select("text").attr("x",0).attr("y",Math.max(Eq,0)+Ew).attr("dy",".71em").attr("text-anchor","middle");FI.attr("d","M"+E6[0]+","+En+"V0H"+E6[1]+"V"+En);break;case"top":Ey=Cz;FD.attr("y2",-e);Ez.attr("x2",0).attr("y2",-e);E7.select("line").attr("y2",-Eq);E7.select("text").attr("y",-(Math.max(Eq,0)+Ew));E3.select("line").attr("x2",0).attr("y2",-Eq);E3.select("text").attr("x",0).attr("y",-(Math.max(Eq,0)+Ew)).attr("dy","0em").attr("text-anchor","middle");FI.attr("d","M"+E6[0]+","+-En+"V0H"+E6[1]+"V"+-En);break;case"left":Ey=Cx;FD.attr("x2",-e);Ez.attr("x2",-e).attr("y2",0);E7.select("line").attr("x2",-Eq);E7.select("text").attr("x",-(Math.max(Eq,0)+Ew));E3.select("line").attr("x2",-Eq).attr("y2",0);E3.select("text").attr("x",-(Math.max(Eq,0)+Ew)).attr("y",0).attr("dy",".32em").attr("text-anchor","end");FI.attr("d","M"+-En+","+E6[0]+"H0V"+E6[1]+"H"+-En);break;case"right":Ey=Cx;FD.attr("x2",e);Ez.attr("x2",e).attr("y2",0);E7.select("line").attr("x2",Eq);E7.select("text").attr("x",Math.max(Eq,0)+Ew);E3.select("line").attr("x2",Eq).attr("y2",0);E3.select("text").attr("x",Math.max(Eq,0)+Ew).attr("y",0).attr("dy",".32em").attr("text-anchor","start");FI.attr("d","M"+En+","+E6[0]+"H0V"+E6[1]+"H"+En);break}if(Ep.ticks){E7.call(Ey,FE);E3.call(Ey,FC);E9.call(Ey,FC);FD.call(Ey,FE);Ez.call(Ey,FC);FB.call(Ey,FC)}else{var E5=FC.rangeBand()/2,E4=function(FJ){return FC(FJ)+E5};E7.call(Ey,E4);E3.call(Ey,E4)}})}Eo.scale=function(Ex){if(!arguments.length){return Ep}Ep=Ex;return Eo};Eo.orient=function(Ex){if(!arguments.length){return Es}Es=Ex;return Eo};Eo.ticks=function(){if(!arguments.length){return Ev}Ev=arguments;return Eo};Eo.tickValues=function(Ex){if(!arguments.length){return Er}Er=Ex;return Eo};Eo.tickFormat=function(Ex){if(!arguments.length){return Eu}Eu=Ex;return Eo};Eo.tickSize=function(Ex,E0,Ey){if(!arguments.length){return Eq}var Ez=arguments.length-1;Eq=+Ex;e=Ez>1?+E0:Eq;En=Ez>0?+arguments[Ez]:Eq;return Eo};Eo.tickPadding=function(Ex){if(!arguments.length){return Ew}Ew=+Ex;return Eo};Eo.tickSubdivide=function(Ex){if(!arguments.length){return Et}Et=+Ex;return Eo};return Eo};function Cz(En,e){En.attr("transform",function(Eo){return"translate("+e(Eo)+",0)"})}function Cx(e,En){e.attr("transform",function(Eo){return"translate(0,"+En(Eo)+")"})}function BO(Eo,Es,En){Et=[];if(En&&Es.length>1){var Ev=CH(Eo.domain()),Et,Eq=-1,e=Es.length,Er=(Es[1]-Es[0])/++En,Ep,Eu;while(++Eq<e){for(Ep=En;--Ep>0;){if((Eu=+Es[Eq]-Ep*Er)>=Ev[0]){Et.push(Eu)}}}for(--Eq,Ep=0;++Ep<En&&(Eu=+Es[Eq]+Ep*Er)<Ev[1];){Et.push(Eu)}}return Et}d3.svg.brush=function(){var e=EF(Eq,"brushstart","brush","brushend"),Es=null,Er=null,Et=v[0],Ew=[[0,0],[0,0]],En;function Eq(Ex){Ex.each(function(){var E0=d3.select(this),Ez=E0.selectAll(".background").data([0]),Ey=E0.selectAll(".extent").data([0]),E2=E0.selectAll(".resize").data(Et,String),E1;E0.style("pointer-events","all").on("mousedown.brush",Eu).on("touchstart.brush",Eu);Ez.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");Ey.enter().append("rect").attr("class","extent").style("cursor","move");E2.enter().append("g").attr("class",function(E3){return"resize "+E3}).style("cursor",function(E3){return CX[E3]}).append("rect").attr("x",function(E3){return/[ew]$/.test(E3)?-3:null}).attr("y",function(E3){return/^[ns]/.test(E3)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");E2.style("display",Eq.empty()?"none":null);E2.exit().remove();if(Es){E1=AL(Es);Ez.attr("x",E1[0]).attr("width",E1[1]-E1[0]);Ep(E0)}if(Er){E1=AL(Er);Ez.attr("y",E1[0]).attr("height",E1[1]-E1[0]);Eo(E0)}Ev(E0)})}function Ev(Ex){Ex.selectAll(".resize").attr("transform",function(Ey){return"translate("+Ew[+/e$/.test(Ey)][0]+","+Ew[+/^s/.test(Ey)][1]+")"})}function Ep(Ex){Ex.select(".extent").attr("x",Ew[0][0]);Ex.selectAll(".extent,.n>rect,.s>rect").attr("width",Ew[1][0]-Ew[0][0])}function Eo(Ex){Ex.select(".extent").attr("y",Ew[0][1]);Ex.selectAll(".extent,.e>rect,.w>rect").attr("height",Ew[1][1]-Ew[0][1])}function Eu(){var FG=this,Ey=d3.select(d3.event.target),E4=e.of(FG,arguments),FB=d3.select(FG),FD=Ey.datum(),E9=!/^(n|s)$/.test(FD)&&Es,E7=!/^(e|w)$/.test(FD)&&Er,E8=Ey.classed("extent"),FE,FF=E5(),Ez;var E2=d3.select(window).on("mousemove.brush",E3).on("mouseup.brush",Ex).on("touchmove.brush",E3).on("touchend.brush",Ex).on("keydown.brush",E6).on("keyup.brush",E1);if(E8){FF[0]=Ew[0][0]-FF[0];FF[1]=Ew[0][1]-FF[1]}else{if(FD){var FC=+/w$/.test(FD),FA=+/^n/.test(FD);Ez=[Ew[1-FC][0]-FF[0],Ew[1-FA][1]-FF[1]];FF[0]=Ew[FC][0];FF[1]=Ew[FA][1]}else{if(d3.event.altKey){FE=FF.slice()}}}FB.style("pointer-events","none").selectAll(".resize").style("display",null);d3.select("body").style("cursor",Ey.style("cursor"));E4({type:"brushstart"});E3();EW();function E5(){var FH=d3.event.changedTouches;return FH?d3.touches(FG,FH)[0]:d3.mouse(FG)}function E6(){if(d3.event.keyCode==32){if(!E8){FE=null;FF[0]-=Ew[1][0];FF[1]-=Ew[1][1];E8=2}EW()}}function E1(){if(d3.event.keyCode==32&&E8==2){FF[0]+=Ew[1][0];FF[1]+=Ew[1][1];E8=0;EW()}}function E3(){var FH=E5(),FI=false;if(Ez){FH[0]+=Ez[0];FH[1]+=Ez[1]}if(!E8){if(d3.event.altKey){if(!FE){FE=[(Ew[0][0]+Ew[1][0])/2,(Ew[0][1]+Ew[1][1])/2]}FF[0]=Ew[+(FH[0]<FE[0])][0];FF[1]=Ew[+(FH[1]<FE[1])][1]}else{FE=null}}if(E9&&E0(FH,Es,0)){Ep(FB);FI=true}if(E7&&E0(FH,Er,1)){Eo(FB);FI=true}if(FI){Ev(FB);E4({type:"brush",mode:E8?"move":"resize"})}}function E0(FP,FJ,FL){var FM=AL(FJ),FI=FM[0],FH=FM[1],FN=FF[FL],FQ=Ew[1][FL]-Ew[0][FL],FK,FO;if(E8){FI-=FN;FH-=FQ+FN}FK=Math.max(FI,Math.min(FH,FP[FL]));if(E8){FO=(FK+=FN)+FQ}else{if(FE){FN=Math.max(FI,Math.min(FH,2*FE[FL]-FK))}if(FN<FK){FO=FK;FK=FN}else{FO=FN}}if(Ew[0][FL]!==FK||Ew[1][FL]!==FO){En=null;Ew[0][FL]=FK;Ew[1][FL]=FO;return true}}function Ex(){E3();FB.style("pointer-events","all").selectAll(".resize").style("display",Eq.empty()?"none":null);d3.select("body").style("cursor",null);E2.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);E4({type:"brushend"});EW()}}Eq.x=function(Ex){if(!arguments.length){return Es}Es=Ex;Et=v[!Es<<1|!Er];return Eq};Eq.y=function(Ex){if(!arguments.length){return Er}Er=Ex;Et=v[!Es<<1|!Er];return Eq};Eq.extent=function(E2){var Ez,Ex,E1,E0,Ey;if(!arguments.length){E2=En||Ew;if(Es){Ez=E2[0][0],Ex=E2[1][0];if(!En){Ez=Ew[0][0],Ex=Ew[1][0];if(Es.invert){Ez=Es.invert(Ez),Ex=Es.invert(Ex)}if(Ex<Ez){Ey=Ez,Ez=Ex,Ex=Ey}}}if(Er){E1=E2[0][1],E0=E2[1][1];if(!En){E1=Ew[0][1],E0=Ew[1][1];if(Er.invert){E1=Er.invert(E1),E0=Er.invert(E0)}if(E0<E1){Ey=E1,E1=E0,E0=Ey}}}return Es&&Er?[[Ez,E1],[Ex,E0]]:Es?[Ez,Ex]:Er&&[E1,E0]}En=[[0,0],[0,0]];if(Es){Ez=E2[0],Ex=E2[1];if(Er){Ez=Ez[0],Ex=Ex[0]}En[0][0]=Ez,En[1][0]=Ex;if(Es.invert){Ez=Es(Ez),Ex=Es(Ex)}if(Ex<Ez){Ey=Ez,Ez=Ex,Ex=Ey}Ew[0][0]=Ez|0,Ew[1][0]=Ex|0}if(Er){E1=E2[0],E0=E2[1];if(Es){E1=E1[1],E0=E0[1]}En[0][1]=E1,En[1][1]=E0;if(Er.invert){E1=Er(E1),E0=Er(E0)}if(E0<E1){Ey=E1,E1=E0,E0=Ey}Ew[0][1]=E1|0,Ew[1][1]=E0|0}return Eq};Eq.clear=function(){En=null;Ew[0][0]=Ew[0][1]=Ew[1][0]=Ew[1][1]=0;return Eq};Eq.empty=function(){return(Es&&Ew[0][0]===Ew[1][0])||(Er&&Ew[0][1]===Ew[1][1])};return d3.rebind(Eq,e,"on")};var CX={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};var v=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={};d3.behavior.drag=function(){var Ep=EF(Eo,"drag","dragstart","dragend"),e=null;function Eo(){this.on("mousedown.drag",En).on("touchstart.drag",En)}function En(){var Es=this,Ew=Ep.of(Es,arguments),Ev=d3.event.target,Er,Et=Ey(),Eu=0;var Ex=d3.select(window).on("mousemove.drag",Ez).on("touchmove.drag",Ez).on("mouseup.drag",Eq,true).on("touchend.drag",Eq,true);if(e){Er=e.apply(Es,arguments);Er=[Er.x-Et[0],Er.y-Et[1]]}else{Er=[0,0]}Ew({type:"dragstart"});function Ey(){var E2=Es.parentNode,E1=d3.event.changedTouches;return E1?d3.touches(E2,E1)[0]:d3.mouse(E2)}function Ez(){if(!Es.parentNode){return Eq()}var E3=Ey(),E2=E3[0]-Et[0],E1=E3[1]-Et[1];Eu|=E2|E1;Et=E3;EW();Ew({type:"drag",x:E3[0]+Er[0],y:E3[1]+Er[1],dx:E2,dy:E1})}function Eq(){Ew({type:"dragend"});if(Eu){EW();if(d3.event.target===Ev){Ex.on("click.drag",E0,true)}}Ex.on("mousemove.drag",null).on("touchmove.drag",null).on("mouseup.drag",null).on("touchend.drag",null)}function E0(){EW();Ex.on("click.drag",null)}}Eo.origin=function(Eq){if(!arguments.length){return e}e=Eq;return Eo};return d3.rebind(Eo,Ep,"on")};d3.behavior.zoom=function(){var Et=[0,0],E4,E8=1,E0,Eo=DN,Ez=EF(e,"zoom"),E3,E1,Eq,Ep,Es;function e(){this.on("mousedown.zoom",Ex).on("mousewheel.zoom",Ew).on("mousemove.zoom",E5).on("DOMMouseScroll.zoom",Ew).on("dblclick.zoom",Eu).on("touchstart.zoom",E2).on("touchmove.zoom",Ev).on("touchend.zoom",E2)}e.translate=function(E9){if(!arguments.length){return Et}Et=E9.map(Number);return e};e.scale=function(E9){if(!arguments.length){return E8}E8=+E9;return e};e.scaleExtent=function(E9){if(!arguments.length){return Eo}Eo=E9==null?DN:E9.map(Number);return e};e.x=function(E9){if(!arguments.length){return E1}E1=E9;E3=E9.copy();return e};e.y=function(E9){if(!arguments.length){return Ep}Ep=E9;Eq=E9.copy();return e};function En(E9){return[(E9[0]-Et[0])/E8,(E9[1]-Et[1])/E8]}function Ey(E9){return[E9[0]*E8+Et[0],E9[1]*E8+Et[1]]}function Er(E9){E8=Math.max(Eo[0],Math.min(Eo[1],E9))}function E6(FA,E9){E9=Ey(E9);Et[0]+=FA[0]-E9[0];Et[1]+=FA[1]-E9[1]}function E7(E9){if(E1){E1.domain(E3.range().map(function(FA){return(FA-Et[0])/E8}).map(E3.invert))}if(Ep){Ep.domain(Eq.range().map(function(FA){return(FA-Et[1])/E8}).map(Eq.invert))}d3.event.preventDefault();E9({type:"zoom",scale:E8,translate:Et})}function Ex(){var FC=this,FF=Ez.of(FC,arguments),FE=d3.event.target,FD=0,FG=d3.select(window).on("mousemove.zoom",FB).on("mouseup.zoom",FA),E9=En(d3.mouse(FC));window.focus();EW();function FB(){FD=1;E6(d3.mouse(FC),E9);E7(FF)}function FA(){if(FD){EW()}FG.on("mousemove.zoom",null).on("mouseup.zoom",null);if(FD&&d3.event.target===FE){FG.on("click.zoom",FH)}}function FH(){EW();FG.on("click.zoom",null)}}function Ew(){if(!E4){E4=En(d3.mouse(this))}Er(Math.pow(2,BB()*0.002)*E8);E6(d3.mouse(this),E4);E7(Ez.of(this,arguments))}function E5(){E4=null}function Eu(){var FA=d3.mouse(this),E9=En(FA);Er(d3.event.shiftKey?E8/2:E8*2);E6(FA,E9);E7(Ez.of(this,arguments))}function E2(){var FC=d3.touches(this),FA=Date.now();E0=E8;E4={};FC.forEach(function(FD){E4[FD.identifier]=En(FD)});EW();if((FC.length===1)&&(FA-Es<500)){var FB=FC[0],E9=En(FC[0]);Er(E8*2);E6(FB,E9);E7(Ez.of(this,arguments))}Es=FA}function Ev(){var FB=d3.touches(this),FD=FB[0],FA=E4[FD.identifier];if(FC=FB[1]){var FC,E9=E4[FC.identifier];FD=[(FD[0]+FC[0])/2,(FD[1]+FC[1])/2];FA=[(FA[0]+E9[0])/2,(FA[1]+E9[1])/2];Er(d3.event.scale*E0)}E6(FD,FA);E7(Ez.of(this,arguments))}return d3.rebind(e,Ez,"on")};var B5,DN=[0,Infinity];function BB(){if(!B5){B5=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode}var Eo=d3.event,Ep;try{B5.scrollTop=1000;B5.dispatchEvent(Eo);Ep=1000-B5.scrollTop}catch(En){Ep=Eo.wheelDelta||(-Eo.detail*5)}return Ep}d3.layout={};d3.layout.bundle=function(){return function(e){var Eo=[],En=-1,Ep=e.length;while(++En<Ep){Eo.push(CR(e[En]))}return Eo}};function CR(Ep){var Er=Ep.source,e=Ep.target,Eq=DI(Er,e),Eo=[Er];while(Er!==Eq){Er=Er.parent;Eo.push(Er)}var En=Eo.length;while(e!==Eq){Eo.splice(En,0,e);e=e.parent}return Eo}function C1(Eo){var En=[],e=Eo.parent;while(e!=null){En.push(Eo);Eo=e;e=e.parent}En.push(Eo);return En}function DI(Ep,En){if(Ep===En){return Ep}var Eo=C1(Ep),e=C1(En),Eq=Eo.pop(),Er=e.pop(),Es=null;while(Eq===Er){Es=Eq;Eq=Eo.pop();Er=e.pop()}return Es}d3.layout.chord=function(){var Er={},Es,Ep,Ew,Eo,Ev=0,e,En,Eq;function Eu(){var E1={},E4=[],FC=d3.range(Eo),E8=[],E2,FA,E0,E5,E3;Es=[];Ep=[];E2=0,E5=-1;while(++E5<Eo){FA=0,E3=-1;while(++E3<Eo){FA+=Ew[E5][E3]}E4.push(FA);E8.push(d3.range(Eo));E2+=FA}if(e){FC.sort(function(FE,FD){return e(E4[FE],E4[FD])})}if(En){E8.forEach(function(FE,FD){FE.sort(function(FG,FF){return En(Ew[FD][FG],Ew[FD][FF])})})}E2=(2*Math.PI-Ev*Eo)/E2;FA=0,E5=-1;while(++E5<Eo){E0=FA,E3=-1;while(++E3<Eo){var E9=FC[E5],E7=E8[E9][E3],FB=Ew[E9][E7],Ez=FA,Ey=FA+=FB*E2;E1[E9+"-"+E7]={index:E9,subindex:E7,startAngle:Ez,endAngle:Ey,value:FB}}Ep.push({index:E9,startAngle:E0,endAngle:FA,value:(FA-E0)/E2});FA+=Ev}E5=-1;while(++E5<Eo){E3=E5-1;while(++E3<Eo){var Ex=E1[E5+"-"+E3],E6=E1[E3+"-"+E5];if(Ex.value||E6.value){Es.push(Ex.value<E6.value?{source:E6,target:Ex}:{source:Ex,target:E6})}}}if(Eq){Et()}}function Et(){Es.sort(function(Ey,Ex){return Eq((Ey.source.value+Ey.target.value)/2,(Ex.source.value+Ex.target.value)/2)})}Er.matrix=function(Ex){if(!arguments.length){return Ew}Eo=(Ew=Ex)&&Ew.length;Es=Ep=null;return Er};Er.padding=function(Ex){if(!arguments.length){return Ev}Ev=Ex;Es=Ep=null;return Er};Er.sortGroups=function(Ex){if(!arguments.length){return e}e=Ex;Es=Ep=null;return Er};Er.sortSubgroups=function(Ex){if(!arguments.length){return En}En=Ex;Es=null;return Er};Er.sortChords=function(Ex){if(!arguments.length){return Eq}Eq=Ex;if(Es){Et()}return Er};Er.chords=function(){if(!Es){Eu()}return Es};Er.groups=function(){if(!Ep){Eu()}return Ep};return Er};d3.layout.force=function(){var En={},E0=d3.dispatch("start","tick","end"),Ew=[1,1],E2,Eq,Et=0.9,E4=DJ,Ep=A8,Ez=-30,Er=0.1,Eu=0.8,E3,Ey=[],Eo=[],Es,e,Ev;function E1(E5){return function(FC,E7,FB,E6,FA){if(FC.point!==E5){var FE=FC.cx-E5.x,FD=FC.cy-E5.y,E9=1/Math.sqrt(FE*FE+FD*FD);if((E6-E7)*E9<Eu){var E8=FC.charge*E9*E9;E5.px-=FE*E8;E5.py-=FD*E8;return true}if(FC.point&&isFinite(E9)){var E8=FC.pointCharge*E9*E9;E5.px-=FE*E8;E5.py-=FD*E8}}return !FC.charge}}En.tick=function(){if((Eq*=0.99)<0.005){E0.end({type:"end",alpha:Eq=0});return true}var E7=Ey.length,E8=Eo.length,E5,FB,E6,FF,FE,E9,FA,FD,FC;for(FB=0;FB<E8;++FB){E6=Eo[FB];FF=E6.source;FE=E6.target;FD=FE.x-FF.x;FC=FE.y-FF.y;if(E9=(FD*FD+FC*FC)){E9=Eq*e[FB]*((E9=Math.sqrt(E9))-Es[FB])/E9;FD*=E9;FC*=E9;FE.x-=FD*(FA=FF.weight/(FE.weight+FF.weight));FE.y-=FC*FA;FF.x+=FD*(FA=1-FA);FF.y+=FC*FA}}if(FA=Eq*Er){FD=Ew[0]/2;FC=Ew[1]/2;FB=-1;if(FA){while(++FB<E7){E6=Ey[FB];E6.x+=(FD-E6.x)*FA;E6.y+=(FC-E6.y)*FA}}}if(Ez){Dn(E5=d3.geom.quadtree(Ey),Eq,Ev);FB=-1;while(++FB<E7){if(!(E6=Ey[FB]).fixed){E5.visit(E1(E6))}}}FB=-1;while(++FB<E7){E6=Ey[FB];if(E6.fixed){E6.x=E6.px;E6.y=E6.py}else{E6.x-=(E6.px-(E6.px=E6.x))*Et;E6.y-=(E6.py-(E6.py=E6.y))*Et}}E0.tick({type:"tick",alpha:Eq})};En.nodes=function(E5){if(!arguments.length){return Ey}Ey=E5;return En};En.links=function(E5){if(!arguments.length){return Eo}Eo=E5;return En};En.size=function(E5){if(!arguments.length){return Ew}Ew=E5;return En};En.linkDistance=function(E5){if(!arguments.length){return E4}E4=d3.functor(E5);return En};En.distance=En.linkDistance;En.linkStrength=function(E5){if(!arguments.length){return Ep}Ep=d3.functor(E5);return En};En.friction=function(E5){if(!arguments.length){return Et}Et=E5;return En};En.charge=function(E5){if(!arguments.length){return Ez}Ez=typeof E5==="function"?E5:+E5;return En};En.gravity=function(E5){if(!arguments.length){return Er}Er=E5;return En};En.theta=function(E5){if(!arguments.length){return Eu}Eu=E5;return En};En.alpha=function(E5){if(!arguments.length){return Eq}if(Eq){if(E5>0){Eq=E5}else{Eq=0}}else{if(E5>0){E0.start({type:"start",alpha:Eq=E5});d3.timer(En.tick)}}return En};En.start=function(){var E9,E8,E6=Ey.length,E7=Eo.length,FC=Ew[0],FB=Ew[1],FE,E5;for(E9=0;E9<E6;++E9){(E5=Ey[E9]).index=E9;E5.weight=0}Es=[];e=[];for(E9=0;E9<E7;++E9){E5=Eo[E9];if(typeof E5.source=="number"){E5.source=Ey[E5.source]}if(typeof E5.target=="number"){E5.target=Ey[E5.target]}Es[E9]=E4.call(this,E5,E9);e[E9]=Ep.call(this,E5,E9);++E5.source.weight;++E5.target.weight}for(E9=0;E9<E6;++E9){E5=Ey[E9];if(isNaN(E5.x)){E5.x=FA("x",FC)}if(isNaN(E5.y)){E5.y=FA("y",FB)}if(isNaN(E5.px)){E5.px=E5.x}if(isNaN(E5.py)){E5.py=E5.y}}Ev=[];if(typeof Ez==="function"){for(E9=0;E9<E6;++E9){Ev[E9]=+Ez.call(this,Ey[E9],E9)}}else{for(E9=0;E9<E6;++E9){Ev[E9]=Ez}}function FA(FK,FJ){var FI=FD(E9),FH=-1,FG=FI.length,FF;while(++FH<FG){if(!isNaN(FF=FI[FH][FK])){return FF}}return Math.random()*FJ}function FD(){if(!FE){FE=[];for(E8=0;E8<E6;++E8){FE[E8]=[]}for(E8=0;E8<E7;++E8){var FF=Eo[E8];FE[FF.source.index].push(FF.target);FE[FF.target.index].push(FF.source)}}return FE[E9]}return En.resume()};En.resume=function(){return En.alpha(0.1)};En.stop=function(){return En.alpha(0)};En.drag=function(){if(!E2){E2=d3.behavior.drag().origin(Object).on("dragstart",Ex).on("drag",C6).on("dragend",Cc)}this.on("mouseover.force",J).on("mouseout.force",Dm).call(E2)};function Ex(E5){J(DC=E5);Cy=En}return d3.rebind(En,E0,"on")};var Cy,DC;function J(e){e.fixed|=2}function Dm(e){if(e!==DC){e.fixed&=1}}function Cc(){DC.fixed&=1;Cy=DC=null}function C6(){DC.px=d3.event.x;DC.py=d3.event.y;Cy.resume()}function Dn(Ev,Eq,Eu){var Er=0,Eo=0;Ev.charge=0;if(!Ev.leaf){var e=Ev.nodes,En=e.length,Es=-1,Et;while(++Es<En){Et=e[Es];if(Et==null){continue}Dn(Et,Eq,Eu);Ev.charge+=Et.charge;Er+=Et.charge*Et.cx;Eo+=Et.charge*Et.cy}}if(Ev.point){if(!Ev.leaf){Ev.point.x+=Math.random()-0.5;Ev.point.y+=Math.random()-0.5}var Ep=Eq*Eu[Ev.point.index];Ev.charge+=Ev.pointCharge=Ep;Er+=Ep*Ev.point.x;Eo+=Ep*Ev.point.y}Ev.cx=Er/Ev.charge;Ev.cy=Eo/Ev.charge}function DJ(e){return 20}function A8(e){return 1}d3.layout.partition=function(){var Eo=d3.layout.hierarchy(),Ep=[1,1];function e(Et,Ex,Ez,Ey){var Er=Et.children;Et.x=Ex;Et.y=Et.depth*Ey;Et.dx=Ez;Et.dy=Ey;if(Er&&(Es=Er.length)){var Eu=-1,Es,Ew,Ev;Ez=Et.value?Ez/Et.value:0;while(++Eu<Es){e(Ew=Er[Eu],Ex,Ev=Ew.value*Ez,Ey);Ex+=Ev}}}function Eq(Et){var Es=Et.children,Eu=0;if(Es&&(Ev=Es.length)){var Er=-1,Ev;while(++Er<Ev){Eu=Math.max(Eu,Eq(Es[Er]))}}return 1+Eu}function En(Et,Es){var Er=Eo.call(this,Et,Es);e(Er[0],0,Ep[0],Ep[1]/Eq(Er[0]));return Er}En.size=function(Er){if(!arguments.length){return Ep}Ep=Er;return En};return Di(En,Eo)};d3.layout.pie=function(){var Eq=Number,Ep=j,Eo=0,En=2*Math.PI;function e(Ex,Ev){var Et=Ex.map(function(Ez,Ey){return +Eq.call(e,Ez,Ey)});var Er=+(typeof Eo==="function"?Eo.apply(this,arguments):Eo);var Es=((typeof En==="function"?En.apply(this,arguments):En)-Eo)/d3.sum(Et);var Eu=d3.range(Ex.length);if(Ep!=null){Eu.sort(Ep===j?function(Ez,Ey){return Et[Ey]-Et[Ez]}:function(Ez,Ey){return Ep(Ex[Ez],Ex[Ey])})}var Ew=[];Eu.forEach(function(Ey){Ew[Ey]={data:Ex[Ey],value:d=Et[Ey],startAngle:Er,endAngle:Er+=d*Es}});return Ew}e.value=function(Er){if(!arguments.length){return Eq}Eq=Er;return e};e.sort=function(Er){if(!arguments.length){return Ep}Ep=Er;return e};e.startAngle=function(Er){if(!arguments.length){return Eo}Eo=Er;return e};e.endAngle=function(Er){if(!arguments.length){return En}En=Er;return e};return e};var j={};d3.layout.stack=function(){var Ep=Object,Eo=An,Er=DE,Eq=DF,En=r,Es=q;function e(E0,E2){var E1=E0.map(function(E5,E4){return Ep.call(e,E5,E4)});var E3=E1.map(function(E5,E4){return E5.map(function(E6,E7){return[En.call(e,E6,E7),Es.call(e,E6,E7)]})});var Ex=Eo.call(e,E3,E2);E1=d3.permute(E1,Ex);E3=d3.permute(E3,Ex);var Ew=Er.call(e,E3,E2);var Eu=E1.length,Ev=E1[0].length,Ez,Ey,Et;for(Ey=0;Ey<Ev;++Ey){Eq.call(e,E1[0][Ey],Et=Ew[Ey],E3[0][Ey][1]);for(Ez=1;Ez<Eu;++Ez){Eq.call(e,E1[Ez][Ey],Et+=E3[Ez-1][Ey][1],E3[Ez][Ey][1])}}return E0}e.values=function(Et){if(!arguments.length){return Ep}Ep=Et;return e};e.order=function(Et){if(!arguments.length){return Eo}Eo=typeof Et==="function"?Et:AP.get(Et)||An;return e};e.offset=function(Et){if(!arguments.length){return Er}Er=typeof Et==="function"?Et:o.get(Et)||DE;return e};e.x=function(Et){if(!arguments.length){return En}En=Et;return e};e.y=function(Et){if(!arguments.length){return Es}Es=Et;return e};e.out=function(Et){if(!arguments.length){return Eq}Eq=Et;return e};return e};function r(e){return e.x}function q(e){return e.y}function DF(En,e,Eo){En.y0=e;En.y=Eo}var AP=d3.map({"inside-out":function(Eq){var Eo=Eq.length,Er,Ep,Ev=Eq.map(At),Es=Eq.map(Bj),Et=d3.range(Eo).sort(function(Ey,Ex){return Ev[Ey]-Ev[Ex]}),Eu=0,e=0,Ew=[],En=[];for(Er=0;Er<Eo;++Er){Ep=Et[Er];if(Eu<e){Eu+=Es[Ep];Ew.push(Ep)}else{e+=Es[Ep];En.push(Ep)}}return En.reverse().concat(Ew)},reverse:function(e){return d3.range(e.length).reverse()},"default":An});var o=d3.map({silhouette:function(Eq){var En=Eq.length,Eo=Eq[0].length,Es=[],Et=0,Er,Ep,e,Eu=[];for(Ep=0;Ep<Eo;++Ep){for(Er=0,e=0;Er<En;Er++){e+=Eq[Er][Ep][1]}if(e>Et){Et=e}Es.push(e)}for(Ep=0;Ep<Eo;++Ep){Eu[Ep]=(Et-Es[Ep])/2}return Eu},wiggle:function(Es){var En=Es.length,Ew=Es[0],Eo=Ew.length,Eu=0,Et,Er,Eq,Ez,Ey,Ev,E0,e,Ep,Ex=[];Ex[0]=e=Ep=0;for(Er=1;Er<Eo;++Er){for(Et=0,Ez=0;Et<En;++Et){Ez+=Es[Et][Er][1]}for(Et=0,Ey=0,E0=Ew[Er][0]-Ew[Er-1][0];Et<En;++Et){for(Eq=0,Ev=(Es[Et][Er][1]-Es[Et][Er-1][1])/(2*E0);Eq<Et;++Eq){Ev+=(Es[Eq][Er][1]-Es[Eq][Er-1][1])/E0}Ey+=Ev*Es[Et][Er][1]}Ex[Er]=e-=Ez?Ey/Ez*E0:0;if(e<Ep){Ep=e}}for(Er=0;Er<Eo;++Er){Ex[Er]-=Ep}return Ex},expand:function(Er){var Et=Er.length,e=Er[0].length,En=1/Et,Ep,Eo,Es,Eq=[];for(Eo=0;Eo<e;++Eo){for(Ep=0,Es=0;Ep<Et;Ep++){Es+=Er[Ep][Eo][1]}if(Es){for(Ep=0;Ep<Et;Ep++){Er[Ep][Eo][1]/=Es}}else{for(Ep=0;Ep<Et;Ep++){Er[Ep][Eo][1]=En}}}for(Eo=0;Eo<e;++Eo){Eq[Eo]=0}return Eq},zero:DE});function An(e){return d3.range(e.length)}function DE(Ep){var En=-1,e=Ep[0].length,Eo=[];while(++En<e){Eo[En]=0}return Eo}function At(Er){var Ep=1,Eo=0,En=Er[0][1],e,Eq=Er.length;for(;Ep<Eq;++Ep){if((e=Er[Ep][1])>En){Eo=Ep;En=e}}return Eo}function Bj(e){return e.reduce(DD,0)}function DD(e,En){return e+En[1]}d3.layout.histogram=function(){var Eq=true,En=Number,e=AX,Eo=EP;function Ep(Eu,Ev){var E0=[],Ey=Eu.map(En,this),Ew=e.call(this,Ey,Ev),Ez=Eo.call(this,Ew,Ey,Ev),E1,Ev=-1,Er=Ey.length,Es=Ez.length-1,Et=Eq?1:1/Er,Ex;while(++Ev<Es){E1=E0[Ev]=[];E1.dx=Ez[Ev+1]-(E1.x=Ez[Ev]);E1.y=0}Ev=-1;while(++Ev<Er){Ex=Ey[Ev];if((Ex>=Ew[0])&&(Ex<=Ew[1])){E1=E0[d3.bisect(Ez,Ex,1,Es)-1];E1.y+=Et;E1.push(Eu[Ev])}}return E0}Ep.value=function(Er){if(!arguments.length){return En}En=Er;return Ep};Ep.range=function(Er){if(!arguments.length){return e}e=d3.functor(Er);return Ep};Ep.bins=function(Er){if(!arguments.length){return Eo}Eo=typeof Er==="number"?function(Es){return F(Es,Er)}:d3.functor(Er);return Ep};Ep.frequency=function(Er){if(!arguments.length){return Eq}Eq=!!Er;return Ep};return Ep};function EP(En,e){return F(En,Math.ceil(Math.log(e.length)/Math.LN2+1))}function F(Ep,Er){var Eo=-1,En=+Ep[0],e=(Ep[1]-En)/Er,Eq=[];while(++Eo<=Er){Eq[Eo]=e*Eo+En}return Eq}function AX(e){return[d3.min(e),d3.max(e)]}d3.layout.hierarchy=function(){var Eo=Bx,En=AR,Eq=EY;function Ep(Ex,Ew,Es){var Ez=En.call(e,Ex,Ew),Eu=H?Ex:{data:Ex};Eu.depth=Ew;Es.push(Eu);if(Ez&&(Et=Ez.length)){var Ey=-1,Et,E0=Eu.children=[],E1=0,Ev=Ew+1;while(++Ey<Et){d=Ep(Ez[Ey],Ev,Es);d.parent=Eu;E0.push(d);E1+=d.value}if(Eo){E0.sort(Eo)}if(Eq){Eu.value=E1}}else{if(Eq){Eu.value=+Eq.call(e,Ex,Ew)||0}}return Eu}function Er(Ew,Ex){var Ev=Ew.children,Es=0;if(Ev&&(Ey=Ev.length)){var Eu=-1,Ey,Et=Ex+1;while(++Eu<Ey){Es+=Er(Ev[Eu],Et)}}else{if(Eq){Es=+Eq.call(e,H?Ew:Ew.data,Ex)||0}}if(Eq){Ew.value=Es}return Es}function e(Et){var Es=[];Ep(Et,0,Es);return Es}e.sort=function(Es){if(!arguments.length){return Eo}Eo=Es;return e};e.children=function(Es){if(!arguments.length){return En}En=Es;return e};e.value=function(Es){if(!arguments.length){return Eq}Eq=Es;return e};e.revalue=function(Es){Er(Es,0);return Es};return e};function Di(En,e){d3.rebind(En,e,"sort","children","value");En.links=Dj;En.nodes=function(Eo){H=true;return(En.nodes=En)(Eo)};return En}function AR(e){return e.children}function EY(e){return e.value}function Bx(En,e){return e.value-En.value}function Dj(e){return d3.merge(e.map(function(En){return(En.children||[]).map(function(Eo){return{source:En,target:Eo}})}))}var H=false;d3.layout.pack=function(){var e=d3.layout.hierarchy().sort(CM),Eo=[1,1];function En(Ev,Et){var Es=e.call(this,Ev,Et),Eq=Es[0];Eq.x=0;Eq.y=0;B7(Eq);var Ep=Eo[0],Eu=Eo[1],Er=1/Math.max(2*Eq.r/Ep,2*Eq.r/Eu);C0(Eq,Ep/2,Eu/2,Er);return Es}En.size=function(Ep){if(!arguments.length){return Eo}Eo=Ep;return En};return Di(En,e)};function CM(En,e){return En.value-e.value}function Ao(En,e){var Eo=En._pack_next;En._pack_next=e;e._pack_prev=En;e._pack_next=Eo;Eo._pack_prev=e}function AT(En,e){En._pack_next=e;e._pack_prev=En}function CF(Eo,e){var Ep=e.x-Eo.x,En=e.y-Eo.y,Eq=Eo.r+e.r;return Eq*Eq-Ep*Ep-En*En>0.001}function g(Ew){var E1=Infinity,E5=-Infinity,e=Infinity,Eq=-Infinity,Ev=Ew.length,E4,E3,E2,Ez,Ey;function Eo(E6){E1=Math.min(E6.x-E6.r,E1);E5=Math.max(E6.x+E6.r,E5);e=Math.min(E6.y-E6.r,e);Eq=Math.max(E6.y+E6.r,Eq)}Ew.forEach(AG);E4=Ew[0];E4.x=-E4.r;E4.y=0;Eo(E4);if(Ev>1){E3=Ew[1];E3.x=E3.r;E3.y=0;Eo(E3);if(Ev>2){E2=Ew[2];AS(E4,E3,E2);Eo(E2);Ao(E4,E2);E4._pack_prev=E2;Ao(E2,E3);E3=E4._pack_next;for(var E0=3;E0<Ev;E0++){AS(E4,E3,E2=Ew[E0]);var En=0,Er=1,Ep=1;for(Ez=E3._pack_next;Ez!==E3;Ez=Ez._pack_next,Er++){if(CF(Ez,E2)){En=1;break}}if(En==1){for(Ey=E4._pack_prev;Ey!==Ez._pack_prev;Ey=Ey._pack_prev,Ep++){if(CF(Ey,E2)){break}}}if(En){if(Er<Ep||(Er==Ep&&E3.r<E4.r)){AT(E4,E3=Ez)}else{AT(E4=Ey,E3)}E0--}else{Ao(E4,E2);E3=E2;Eo(E2)}}}}var Et=(E1+E5)/2,Es=(e+Eq)/2,Eu=0;for(var E0=0;E0<Ev;E0++){var Ex=Ew[E0];Ex.x-=Et;Ex.y-=Es;Eu=Math.max(Eu,Ex.r+Math.sqrt(Ex.x*Ex.x+Ex.y*Ex.y))}Ew.forEach(CS);return Eu}function AG(e){e._pack_next=e._pack_prev=e}function CS(e){delete e._pack_next;delete e._pack_prev}function B7(En){var e=En.children;if(e&&e.length){e.forEach(B7);En.r=g(e)}else{En.r=Math.sqrt(En.value)}}function C0(Eq,e,Es,En){var Ep=Eq.children;Eq.x=(e+=En*Eq.x);Eq.y=(Es+=En*Eq.y);Eq.r*=En;if(Ep){var Eo=-1,Er=Ep.length;while(++Eo<Er){C0(Ep[Eo],e,Es,En)}}}function AS(Er,Ep,En){var Eu=Er.r+En.r,Ex=Ep.x-Er.x,Ev=Ep.y-Er.y;if(Eu&&(Ex||Ev)){var Ew=Ep.r+En.r,Et=Math.sqrt(Ex*Ex+Ev*Ev),Es=Math.max(-1,Math.min(1,(Eu*Eu+Et*Et-Ew*Ew)/(2*Eu*Et))),e=Math.acos(Es),Eq=Es*(Eu/=Et),Eo=Math.sin(e)*Eu;En.x=Er.x+Eq*Ex+Eo*Ev;En.y=Er.y+Eq*Ev-Eo*Ex}else{En.x=Er.x+Eu;En.y=Er.y}}d3.layout.cluster=function(){var En=d3.layout.hierarchy().sort(null).value(null),Ep=Bm,Eo=[1,1];function e(Ex,Eu){var Eq=En.call(this,Ex,Eu),Ey=Eq[0],Ez,E0=0,Ew,Ev;ET(Ey,function(E3){var E2=E3.children;if(E2&&E2.length){E3.x=Ad(E2);E3.y=Ac(E2)}else{E3.x=Ez?E0+=Ep(E3,Ez):0;E3.y=0;Ez=E3}});var Et=CN(Ey),E1=Br(Ey),Es=Et.x-Ep(Et,E1)/2,Er=E1.x+Ep(E1,Et)/2;ET(Ey,function(E2){E2.x=(E2.x-Es)/(Er-Es)*Eo[0];E2.y=(1-(Ey.y?E2.y/Ey.y:1))*Eo[1]});return Eq}e.separation=function(Eq){if(!arguments.length){return Ep}Ep=Eq;return e};e.size=function(Eq){if(!arguments.length){return Eo}Eo=Eq;return e};return Di(e,En)};function Ac(e){return 1+d3.max(e,function(En){return En.y})}function Ad(e){return e.reduce(function(En,Eo){return En+Eo.x},0)/e.length}function CN(En){var e=En.children;return e&&e.length?CN(e[0]):En}function Br(En){var e=En.children,Eo;return e&&(Eo=e.length)?Br(e[Eo-1]):En}d3.layout.tree=function(){var En=d3.layout.hierarchy().sort(null).value(null),Ep=Bm,Eo=[1,1];function e(Ex,Ev){var Er=En.call(this,Ex,Ev),Ez=Er[0];function Ew(E7,E3){var E5=E7.children,FA=E7._tree;if(E5&&(E6=E5.length)){var E6,FC=E5[0],FB,E9=FC,E4,E8=-1;while(++E8<E6){E4=E5[E8];Ew(E4,FB);E9=Eq(E4,FB,E9);FB=E4}Bo(E7);var FD=0.5*(FC._tree.prelim+E4._tree.prelim);if(E3){FA.prelim=E3._tree.prelim+Ep(E7,E3);FA.mod=FA.prelim-FD}else{FA.prelim=FD}}else{if(E3){FA.prelim=E3._tree.prelim+Ep(E7,E3)}}}function Ey(E6,E3){E6.x=E6._tree.prelim+E3;var E5=E6.children;if(E5&&(E7=E5.length)){var E4=-1,E7;E3+=E6._tree.mod;while(++E4<E7){Ey(E5[E4],E3)}}}function Eq(E7,E3,FA){if(E3){var E6=E7,E5=E7,E9=E3,E8=E7.parent.children[0],FC=E6._tree.mod,FB=E5._tree.mod,FE=E9._tree.mod,FD=E8._tree.mod,E4;while(E9=y(E9),E6=Ee(E6),E9&&E6){E8=Ee(E8);E5=y(E5);E5._tree.ancestor=E7;E4=E9._tree.prelim+FE-E6._tree.prelim-FC+Ep(E9,E6);if(E4>0){Eg(DP(E9,E7,FA),E7,E4);FC+=E4;FB+=E4}FE+=E9._tree.mod;FC+=E6._tree.mod;FD+=E8._tree.mod;FB+=E5._tree.mod}if(E9&&!y(E5)){E5._tree.thread=E9;E5._tree.mod+=FE-FB}if(E6&&!Ee(E8)){E8._tree.thread=E6;E8._tree.mod+=FC-FD;FA=E7}}return FA}ET(Ez,function(E4,E3){E4._tree={ancestor:E4,prelim:0,mod:0,change:0,shift:0,number:E3?E3._tree.number+1:0}});Ew(Ez);Ey(Ez,-Ez._tree.prelim);var Eu=B4(Ez,Ah),E2=B4(Ez,BT),E1=B4(Ez,W),Et=Eu.x-Ep(Eu,E2)/2,Es=E2.x+Ep(E2,Eu)/2,E0=E1.depth||1;ET(Ez,function(E3){E3.x=(E3.x-Et)/(Es-Et)*Eo[0];E3.y=E3.depth/E0*Eo[1];delete E3._tree});return Er}e.separation=function(Eq){if(!arguments.length){return Ep}Ep=Eq;return e};e.size=function(Eq){if(!arguments.length){return Eo}Eo=Eq;return e};return Di(e,En)};function Bm(En,e){return En.parent==e.parent?1:2}function Ee(En){var e=En.children;return e&&e.length?e[0]:En._tree.thread}function y(En){var e=En.children,Eo;return e&&(Eo=e.length)?e[Eo-1]:En._tree.thread}function B4(Eo,Ep){var En=Eo.children;if(En&&(Eq=En.length)){var Er,Eq,e=-1;while(++e<Eq){if(Ep(Er=B4(En[e],Ep),Eo)>0){Eo=Er}}}return Eo}function BT(En,e){return En.x-e.x}function Ah(En,e){return e.x-En.x}function W(En,e){return En.depth-e.depth}function ET(En,Eo){function e(Et,Es){var Er=Et.children;if(Er&&(Eu=Er.length)){var Ev,Eq=null,Ep=-1,Eu;while(++Ep<Eu){Ev=Er[Ep];e(Ev,Eq);Eq=Ev}}Eo(Et,Es)}e(En,null)}function Bo(Ep){var e=0,Er=0,Eo=Ep.children,En=Eo.length,Eq;while(--En>=0){Eq=Eo[En]._tree;Eq.prelim+=e;Eq.mod+=e;e+=Eq.shift+(Er+=Eq.change)}}function Eg(En,Eo,e){En=En._tree;Eo=Eo._tree;var Ep=e/(Eo.number-En.number);En.change+=Ep;Eo.change-=Ep;Eo.shift+=e;Eo.prelim+=e;Eo.mod+=e}function DP(e,Eo,En){return e._tree.ancestor.parent==Eo.parent?e._tree.ancestor:En}d3.layout.treemap=function(){var Et=d3.layout.hierarchy(),Ex=Math.round,Ez=[1,1],Eu=null,e=Cm,Ev=false,Er,Es=0.5*(1+Math.sqrt(5));function En(E2,E0){var E1=-1,E5=E2.length,E4,E3;while(++E1<E5){E3=(E4=E2[E1]).value*(E0<0?0:E0);E4.area=isNaN(E3)||E3<=0?0:E3}}function Ep(E4){var E1=E4.children;if(E1&&E1.length){var E7=e(E4),E9=[],E6=E1.slice(),E0,E5=Infinity,E3,E8=Math.min(E7.dx,E7.dy),E2;En(E6,E7.dx*E7.dy/E4.value);E9.area=0;while((E2=E6.length)>0){E9.push(E0=E6[E2-1]);E9.area+=E0.area;if((E3=Eo(E9,E8))<=E5){E6.pop();E5=E3}else{E9.area-=E9.pop().area;Eq(E9,E8,E7,false);E8=Math.min(E7.dx,E7.dy);E9.length=E9.area=0;E5=Infinity}}if(E9.length){Eq(E9,E8,E7,true);E9.length=E9.area=0}E1.forEach(Ep)}}function Ey(E3){var E0=E3.children;if(E0&&E0.length){var E2=e(E3),E1=E0.slice(),E5,E4=[];En(E1,E2.dx*E2.dy/E3.value);E4.area=0;while(E5=E1.pop()){E4.push(E5);E4.area+=E5.area;if(E5.z!=null){Eq(E4,E5.z?E2.dx:E2.dy,E2,!E1.length);E4.length=E4.area=0}}E0.forEach(Ey)}}function Eo(E5,E1){var E3=E5.area,E4,E7=0,E0=Infinity,E2=-1,E6=E5.length;while(++E2<E6){if(!(E4=E5[E2].area)){continue}if(E4<E0){E0=E4}if(E4>E7){E7=E4}}E3*=E3;E1*=E1;return E3?Math.max((E1*E7*Es)/E3,E3/(E1*E0*Es)):Infinity}function Eq(E9,E8,E4,E7){var E2=-1,E1=E9.length,E5=E4.x,E3=E4.y,E6=E8?Ex(E9.area/E8):0,E0;if(E8==E4.dx){if(E7||E6>E4.dy){E6=E4.dy}while(++E2<E1){E0=E9[E2];E0.x=E5;E0.y=E3;E0.dy=E6;E5+=E0.dx=Math.min(E4.x+E4.dx-E5,E6?Ex(E0.area/E6):0)}E0.z=true;E0.dx+=E4.x+E4.dx-E5;E4.y+=E6;E4.dy-=E6}else{if(E7||E6>E4.dx){E6=E4.dx}while(++E2<E1){E0=E9[E2];E0.x=E5;E0.y=E3;E0.dx=E6;E3+=E0.dy=Math.min(E4.y+E4.dy-E3,E6?Ex(E0.area/E6):0)}E0.z=false;E0.dy+=E4.y+E4.dy-E3;E4.x+=E6;E4.dx-=E6}}function Ew(E2){var E1=Er||Et(E2),E0=E1[0];E0.x=0;E0.y=0;E0.dx=Ez[0];E0.dy=Ez[1];if(Er){Et.revalue(E0)}En([E0],E0.dx*E0.dy/E0.value);(Er?Ey:Ep)(E0);if(Ev){Er=E1}return E1}Ew.size=function(E0){if(!arguments.length){return Ez}Ez=E0;return Ew};Ew.padding=function(E0){if(!arguments.length){return Eu}function E3(E4){var E5=E0.call(Ew,E4,E4.depth);return E5==null?Cm(E4):AM(E4,typeof E5==="number"?[E5,E5,E5,E5]:E5)}function E2(E4){return AM(E4,E0)}var E1;e=(Eu=E0)==null?Cm:(E1=typeof E0)==="function"?E3:E1==="number"?(E0=[E0,E0,E0,E0],E2):E2;return Ew};Ew.round=function(E0){if(!arguments.length){return Ex!=Number}Ex=E0?Math.round:Number;return Ew};Ew.sticky=function(E0){if(!arguments.length){return Ev}Ev=E0;Er=null;return Ew};Ew.ratio=function(E0){if(!arguments.length){return Es}Es=E0;return Ew};return Di(Ew,Et)};function Cm(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function AM(Ep,Eq){var e=Ep.x+Eq[3],Er=Ep.y+Eq[0],Eo=Ep.dx-Eq[1]-Eq[3],En=Ep.dy-Eq[0]-Eq[2];if(Eo<0){e+=Eo/2;Eo=0}if(En<0){Er+=En/2;En=0}return{x:e,y:Er,dx:Eo,dy:En}}d3.csv=function(e,En){d3.text(e,"text/csv",function(Eo){En(Eo&&d3.csv.parse(Eo))})};d3.csv.parse=function(e){var En;return d3.csv.parseRows(e,function(Es,Eq){if(Eq){var Er={},Ep=-1,Eo=En.length;while(++Ep<Eo){Er[En[Ep]]=Es[Ep]}return Er}else{En=Es;return null}})};d3.csv.parseRows=function(Et,Eq){var En={},Ep={},Ew=[],Eu=/\r\n|[,\r\n]/g,e=0,Ev,Er;Eu.lastIndex=0;function Eo(){if(Eu.lastIndex>=Et.length){return Ep}if(Er){Er=false;return En}var Ey=Eu.lastIndex;if(Et.charCodeAt(Ey)===34){var Ez=Ey;while(Ez++<Et.length){if(Et.charCodeAt(Ez)===34){if(Et.charCodeAt(Ez+1)!==34){break}Ez++}}Eu.lastIndex=Ez+2;var E0=Et.charCodeAt(Ez+1);if(E0===13){Er=true;if(Et.charCodeAt(Ez+2)===10){Eu.lastIndex++}}else{if(E0===10){Er=true}}return Et.substring(Ey+1,Ez).replace(/""/g,'"')}var Ex=Eu.exec(Et);if(Ex){Er=Ex[0].charCodeAt(0)!==44;return Et.substring(Ey,Ex.index)}Eu.lastIndex=Et.length;return Et.substring(Ey)}while((Ev=Eo())!==Ep){var Es=[];while((Ev!==En)&&(Ev!==Ep)){Es.push(Ev);Ev=Eo()}if(Eq&&!(Es=Eq(Es,e++))){continue}Ew.push(Es)}return Ew};d3.csv.format=function(e){return e.map(CC).join("\n")};function CC(e){return e.map(w).join(",")}function w(e){return/[",\n]/.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}d3.geo={};var CT=Math.PI/180;d3.geo.azimuthal=function(){var Er="orthographic",Eu,Ep=200,Eo=[480,250],e,Et,Eq,Es;function En(E6){var Ew=E6[0]*CT-e,E5=E6[1]*CT,E0=Math.cos(Ew),Ev=Math.sin(Ew),Ey=Math.cos(E5),E4=Math.sin(E5),Ex=Er!=="orthographic"?Es*E4+Eq*Ey*E0:null,E1,Ez=Er==="stereographic"?1/(1+Ex):Er==="gnomonic"?1/Ex:Er==="equidistant"?(E1=Math.acos(Ex),E1?E1/Math.sin(E1):0):Er==="equalarea"?Math.sqrt(2/(1+Ex)):1,E3=Ez*Ey*Ev,E2=Ez*(Es*Ey*E0-Eq*E4);return[Ep*E3+Eo[0],Ep*E2+Eo[1]]}En.invert=function(Ey){var Ev=(Ey[0]-Eo[0])/Ep,E1=(Ey[1]-Eo[1])/Ep,Ew=Math.sqrt(Ev*Ev+E1*E1),E0=Er==="stereographic"?2*Math.atan(Ew):Er==="gnomonic"?Math.atan(Ew):Er==="equidistant"?Ew:Er==="equalarea"?2*Math.asin(0.5*Ew):Math.asin(Ew),Ex=Math.sin(E0),Ez=Math.cos(E0);return[(e+Math.atan2(Ev*Ex,Ew*Eq*Ez+E1*Es*Ex))/CT,Math.asin(Ez*Es-(Ew?(E1*Ex*Eq)/Ew:0))/CT]};En.mode=function(Ev){if(!arguments.length){return Er}Er=Ev+"";return En};En.origin=function(Ev){if(!arguments.length){return Eu}Eu=Ev;e=Eu[0]*CT;Et=Eu[1]*CT;Eq=Math.cos(Et);Es=Math.sin(Et);return En};En.scale=function(Ev){if(!arguments.length){return Ep}Ep=+Ev;return En};En.translate=function(Ev){if(!arguments.length){return Eo}Eo=[+Ev[0],+Ev[1]];return En};return En.origin([0,0])};d3.geo.albers=function(){var Eu=[-98,38],Es=[29.5,45.5],Er=1000,Eq=[480,250],Et,Ep,En,Ev;function Eo(Ey){var Ew=Ep*(CT*Ey[0]-Et),Ex=Math.sqrt(En-2*Ep*Math.sin(CT*Ey[1]))/Ep;return[Er*Ex*Math.sin(Ew)+Eq[0],Er*(Ex*Math.cos(Ew)-Ev)+Eq[1]]}Eo.invert=function(Ez){var Ew=(Ez[0]-Eq[0])/Er,E1=(Ez[1]-Eq[1])/Er,E0=Ev+E1,Ex=Math.atan2(Ew,E0),Ey=Math.sqrt(Ew*Ew+E0*E0);return[(Et+Ex/Ep)/CT,Math.asin((En-Ey*Ey*Ep*Ep)/(2*Ep))/CT]};function e(){var Ex=CT*Es[0],Ew=CT*Es[1],E0=CT*Eu[1],Ey=Math.sin(Ex),Ez=Math.cos(Ex);Et=CT*Eu[0];Ep=0.5*(Ey+Math.sin(Ew));En=Ez*Ez+2*Ep*Ey;Ev=Math.sqrt(En-2*Ep*Math.sin(E0))/Ep;return Eo}Eo.origin=function(Ew){if(!arguments.length){return Eu}Eu=[+Ew[0],+Ew[1]];return e()};Eo.parallels=function(Ew){if(!arguments.length){return Es}Es=[+Ew[0],+Ew[1]];return e()};Eo.scale=function(Ew){if(!arguments.length){return Er}Er=+Ew;return Eo};Eo.translate=function(Ew){if(!arguments.length){return Eq}Eq=[+Ew[0],+Ew[1]];return Eo};return e()};d3.geo.albersUsa=function(){var e=d3.geo.albers();var Eq=d3.geo.albers().origin([-160,60]).parallels([55,65]);var Ep=d3.geo.albers().origin([-160,20]).parallels([8,18]);var Eo=d3.geo.albers().origin([-60,10]).parallels([8,18]);function En(Et){var Es=Et[0],Er=Et[1];return(Er>50?Eq:Es<-140?Ep:Er<21?Eo:e)(Et)}En.scale=function(Er){if(!arguments.length){return e.scale()}e.scale(Er);Eq.scale(Er*0.6);Ep.scale(Er);Eo.scale(Er*1.5);return En.translate(e.translate())};En.translate=function(Es){if(!arguments.length){return e.translate()}var Er=e.scale()/1000,Eu=Es[0],Et=Es[1];e.translate(Es);Eq.translate([Eu-400*Er,Et+170*Er]);Ep.translate([Eu-190*Er,Et+200*Er]);Eo.translate([Eu+580*Er,Et+430*Er]);return En};return En.scale(e.scale())};d3.geo.bonne=function(){var Er=200,Eq=[480,250],e,Ep,Eo,En;function Es(Ew){var Et=Ew[0]*CT-e,Ex=Ew[1]*CT-Ep;if(Eo){var Ev=En+Eo-Ex,Eu=Et*Math.cos(Ex)/Ev;Et=Ev*Math.sin(Eu);Ex=Ev*Math.cos(Eu)-En}else{Et*=Math.cos(Ex);Ex*=-1}return[Er*Et+Eq[0],Er*Ex+Eq[1]]}Es.invert=function(Ev){var Et=(Ev[0]-Eq[0])/Er,Ex=(Ev[1]-Eq[1])/Er;if(Eo){var Ew=En+Ex,Eu=Math.sqrt(Et*Et+Ew*Ew);Ex=En+Eo-Eu;Et=e+Eu*Math.atan2(Et,Ew)/Math.cos(Ex)}else{Ex*=-1;Et/=Math.cos(Ex)}return[Et/CT,Ex/CT]};Es.parallel=function(Et){if(!arguments.length){return Eo/CT}En=1/Math.tan(Eo=Et*CT);return Es};Es.origin=function(Et){if(!arguments.length){return[e/CT,Ep/CT]}e=Et[0]*CT;Ep=Et[1]*CT;return Es};Es.scale=function(Et){if(!arguments.length){return Er}Er=+Et;return Es};Es.translate=function(Et){if(!arguments.length){return Eq}Eq=[+Et[0],+Et[1]];return Es};return Es.origin([0,0]).parallel(45)};d3.geo.equirectangular=function(){var Eo=500,En=[480,250];function e(Eq){var Ep=Eq[0]/360,Er=-Eq[1]/360;return[Eo*Ep+En[0],Eo*Er+En[1]]}e.invert=function(Eq){var Ep=(Eq[0]-En[0])/Eo,Er=(Eq[1]-En[1])/Eo;return[360*Ep,-360*Er]};e.scale=function(Ep){if(!arguments.length){return Eo}Eo=+Ep;return e};e.translate=function(Ep){if(!arguments.length){return En}En=[+Ep[0],+Ep[1]];return e};return e};d3.geo.mercator=function(){var Eo=500,En=[480,250];function e(Eq){var Ep=Eq[0]/360,Er=-(Math.log(Math.tan(Math.PI/4+Eq[1]*CT/2))/CT)/360;return[Eo*Ep+En[0],Eo*Math.max(-0.5,Math.min(0.5,Er))+En[1]]}e.invert=function(Eq){var Ep=(Eq[0]-En[0])/Eo,Er=(Eq[1]-En[1])/Eo;return[360*Ep,2*Math.atan(Math.exp(-360*Er*CT))/CT-90]};e.scale=function(Ep){if(!arguments.length){return Eo}Eo=+Ep;return e};e.translate=function(Ep){if(!arguments.length){return En}En=[+Ep[0],+Ep[1]];return e};return e};function DA(En,e){return function(Eo){return Eo&&En.hasOwnProperty(Eo.type)?En[Eo.type](Eo):e}}d3.geo.path=function(){var Es=4.5,Ew=Z(Es),Er=d3.geo.albersUsa();function Ev(Ey,Ex){if(typeof Es==="function"){Ew=Z(Es.apply(this,arguments))}return En(Ey)||null}function Et(Ex){return Er(Ex).join(",")}var En=DA({FeatureCollection:function(E0){var Ez=[],Ey=E0.features,Ex=-1,E1=Ey.length;while(++Ex<E1){Ez.push(En(Ey[Ex].geometry))}return Ez.join("")},Feature:function(Ex){return En(Ex.geometry)},Point:function(Ex){return"M"+Et(Ex.coordinates)+Ew},MultiPoint:function(E0){var Ey=[],Ez=E0.coordinates,Ex=-1,E1=Ez.length;while(++Ex<E1){Ey.push("M",Et(Ez[Ex]),Ew)}return Ey.join("")},LineString:function(E0){var Ey=["M"],Ez=E0.coordinates,Ex=-1,E1=Ez.length;while(++Ex<E1){Ey.push(Et(Ez[Ex]),"L")}Ey.pop();return Ey.join("")},MultiLineString:function(E3){var E1=[],E2=E3.coordinates,E0=-1,E4=E2.length,Ey,Ez,Ex;while(++E0<E4){Ey=E2[E0];Ez=-1;Ex=Ey.length;E1.push("M");while(++Ez<Ex){E1.push(Et(Ey[Ez]),"L")}E1.pop()}return E1.join("")},Polygon:function(E3){var E1=[],E2=E3.coordinates,E0=-1,E4=E2.length,Ey,Ez,Ex;while(++E0<E4){Ey=E2[E0];Ez=-1;if((Ex=Ey.length-1)>0){E1.push("M");while(++Ez<Ex){E1.push(Et(Ey[Ez]),"L")}E1[E1.length-1]="Z"}}return E1.join("")},MultiPolygon:function(Ey){var E7=[],E6=Ey.coordinates,E5=-1,Ez=E6.length,E2,E4,E0,E3,E1,Ex;while(++E5<Ez){E2=E6[E5];E4=-1;E0=E2.length;while(++E4<E0){E3=E2[E4];E1=-1;if((Ex=E3.length-1)>0){E7.push("M");while(++E1<Ex){E7.push(Et(E3[E1]),"L")}E7[E7.length-1]="Z"}}}return E7.join("")},GeometryCollection:function(E0){var Ez=[],Ey=E0.geometries,Ex=-1,E1=Ey.length;while(++Ex<E1){Ez.push(En(Ey[Ex]))}return Ez.join("")}});var Eo=Ev.area=DA({FeatureCollection:function(E0){var Ez=0,Ey=E0.features,Ex=-1,E1=Ey.length;while(++Ex<E1){Ez+=Eo(Ey[Ex])}return Ez},Feature:function(Ex){return Eo(Ex.geometry)},Polygon:function(Ex){return Eq(Ex.coordinates)},MultiPolygon:function(E0){var Ey=0,Ez=E0.coordinates,Ex=-1,E1=Ez.length;while(++Ex<E1){Ey+=Eq(Ez[Ex])}return Ey},GeometryCollection:function(E0){var Ez=0,Ey=E0.geometries,Ex=-1,E1=Ey.length;while(++Ex<E1){Ez+=Eo(Ey[Ex])}return Ez}},0);function Eq(Ez){var Ey=Ep(Ez[0]),Ex=0,E0=Ez.length;while(++Ex<E0){Ey-=Ep(Ez[Ex])}return Ey}function e(E5){var E3=d3.geom.polygon(E5[0].map(Er)),Ex=E3.area(),Ey=E3.centroid(Ex<0?(Ex*=-1,1):-1),E4=Ey[0],E2=Ey[1],E1=Ex,E0=0,Ez=E5.length;while(++E0<Ez){E3=d3.geom.polygon(E5[E0].map(Er));Ex=E3.area();Ey=E3.centroid(Ex<0?(Ex*=-1,1):-1);E4-=Ey[0];E2-=Ey[1];E1-=Ex}return[E4,E2,6*E1]}var Eu=Ev.centroid=DA({Feature:function(Ex){return Eu(Ex.geometry)},Polygon:function(Ey){var Ex=e(Ey.coordinates);return[Ex[0]/Ex[2],Ex[1]/Ex[2]]},MultiPolygon:function(Ey){var Ex=0,E5=Ey.coordinates,Ez,E4=0,E3=0,E2=0,E1=-1,E0=E5.length;while(++E1<E0){Ez=e(E5[E1]);E4+=Ez[0];E3+=Ez[1];E2+=Ez[2]}return[E4/E2,E3/E2]}});function Ep(Ex){return Math.abs(d3.geom.polygon(Ex.map(Er)).area())}Ev.projection=function(Ex){Er=Ex;return Ev};Ev.pointRadius=function(Ex){if(typeof Ex==="function"){Es=Ex}else{Es=+Ex;Ew=Z(Es)}return Ev};return Ev};function Z(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+(-2*e)+"a"+e+","+e+" 0 1,1 0,"+(+2*e)+"z"}d3.geo.bounds=function(Eo){var Eq=Infinity,e=Infinity,En=-Infinity,Ep=-Infinity;Bc(Eo,function(Er,Es){if(Er<Eq){Eq=Er}if(Er>En){En=Er}if(Es<e){e=Es}if(Es>Ep){Ep=Es}});return[[Eq,e],[En,Ep]]};function Bc(En,e){if(Ds.hasOwnProperty(En.type)){Ds[En.type](En,e)}}var Ds={Feature:EX,FeatureCollection:DW,GeometryCollection:Cq,LineString:Db,MultiLineString:Do,MultiPoint:Db,MultiPolygon:EV,Point:EJ,Polygon:BI};function EX(En,e){Bc(En.geometry,e)}function DW(Ep,Eo){for(var e=Ep.features,En=0,Eq=e.length;En<Eq;En++){Bc(e[En].geometry,Eo)}}function Cq(Ep,Eo){for(var e=Ep.geometries,En=0,Eq=e.length;En<Eq;En++){Bc(e[En],Eo)}}function Db(Ep,Eo){for(var e=Ep.coordinates,En=0,Eq=e.length;En<Eq;En++){Eo.apply(null,e[En])}}function Do(Es,Er){for(var Eo=Es.coordinates,Eq=0,Et=Eo.length;Eq<Et;Eq++){for(var En=Eo[Eq],Ep=0,e=En.length;Ep<e;Ep++){Er.apply(null,En[Ep])}}}function EV(Es,Er){for(var Eo=Es.coordinates,Eq=0,Et=Eo.length;Eq<Et;Eq++){for(var En=Eo[Eq][0],Ep=0,e=En.length;Ep<e;Ep++){Er.apply(null,En[Ep])}}}function EJ(En,e){e.apply(null,En.coordinates)}function BI(Ep,Eo){for(var e=Ep.coordinates[0],En=0,Eq=e.length;En<Eq;En++){Eo.apply(null,e[En])}}d3.geo.circle=function(){var Eu=[0,0],Er=90-0.01,Es=Er*CT,Eo=d3.geo.greatArc().target(Object);function En(){}function Ep(Ev){return Eo.distance(Ev)<Es}En.clip=function(Ev){Eo.source(typeof Eu==="function"?Eu.apply(this,arguments):Eu);return Et(Ev)};var Et=DA({FeatureCollection:function(Ew){var Ev=Ew.features.map(Et).filter(Object);return Ev&&(Ew=Object.create(Ew),Ew.features=Ev,Ew)},Feature:function(Ew){var Ev=Et(Ew.geometry);return Ev&&(Ew=Object.create(Ew),Ew.geometry=Ev,Ew)},Point:function(Ev){return Ep(Ev.coordinates)&&Ev},MultiPoint:function(Ew){var Ev=Ew.coordinates.filter(Ep);return Ev.length&&{type:Ew.type,coordinates:Ev}},LineString:function(Ew){var Ev=Eq(Ew.coordinates);return Ev.length&&(Ew=Object.create(Ew),Ew.coordinates=Ev,Ew)},MultiLineString:function(Ew){var Ev=Ew.coordinates.map(Eq).filter(function(Ex){return Ex.length});return Ev.length&&(Ew=Object.create(Ew),Ew.coordinates=Ev,Ew)},Polygon:function(Ew){var Ev=Ew.coordinates.map(Eq);return Ev[0].length&&(Ew=Object.create(Ew),Ew.coordinates=Ev,Ew)},MultiPolygon:function(Ew){var Ev=Ew.coordinates.map(function(Ex){return Ex.map(Eq)}).filter(function(Ex){return Ex[0].length});return Ev.length&&(Ew=Object.create(Ew),Ew.coordinates=Ev,Ew)},GeometryCollection:function(Ew){var Ev=Ew.geometries.map(Et).filter(Object);return Ev.length&&(Ew=Object.create(Ew),Ew.geometries=Ev,Ew)}});function Eq(E0){var Ez=-1,Ex=E0.length,Ey=[],E3,E2,E1,Ew,Ev;while(++Ez<Ex){Ev=Eo.distance(E1=E0[Ez]);if(Ev<Es){if(E2){Ey.push(Em(E2,E1)((Ew-Es)/(Ew-Ev)))}Ey.push(E1);E3=E2=null}else{E2=E1;if(!E3&&Ey.length){Ey.push(Em(Ey[Ey.length-1],E2)((Es-Ew)/(Ev-Ew)));E3=E2}}Ew=Ev}if(E2&&Ey.length){Ev=Eo.distance(E1=Ey[0]);Ey.push(Em(E2,E1)((Ew-Es)/(Ew-Ev)))}return e(Ey)}function e(E1){var Ez=0,E2=E1.length,Ey,Ev,Ew=E2?[E1[0]]:E1,E0,Ex=Eo.source();while(++Ez<E2){E0=Eo.source(E1[Ez-1])(E1[Ez]).coordinates;for(Ey=0,Ev=E0.length;++Ey<Ev;){Ew.push(E0[Ey])}}Eo.source(Ex);return Ew}En.origin=function(Ev){if(!arguments.length){return Eu}Eu=Ev;return En};En.angle=function(Ev){if(!arguments.length){return Er}Es=(Er=+Ev)*CT;return En};En.precision=function(Ev){if(!arguments.length){return Eo.precision()}Eo.precision(Ev);return En};return En};d3.geo.greatArc=function(){var Eo=BZ,Ep=Be,En=6*CT;function e(){var Er=typeof Eo==="function"?Eo.apply(this,arguments):Eo,Eq=typeof Ep==="function"?Ep.apply(this,arguments):Ep,Et=Em(Er,Eq),Eu=En/Et.d,Es=0,Ev=[Er];while((Es+=Eu)<1){Ev.push(Et(Es))}Ev.push(Eq);return{type:"LineString",coordinates:Ev}}e.distance=function(){var Er=typeof Eo==="function"?Eo.apply(this,arguments):Eo,Eq=typeof Ep==="function"?Ep.apply(this,arguments):Ep;return Em(Er,Eq).d};e.source=function(Eq){if(!arguments.length){return Eo}Eo=Eq;return e};e.target=function(Eq){if(!arguments.length){return Ep}Ep=Eq;return e};e.precision=function(Eq){if(!arguments.length){return En/CT}En=Eq*CT;return e};return e};function BZ(e){return e.source}function Be(e){return e.target}function Em(E0,Ex){var Ep=E0[0]*CT,Ew=Math.cos(Ep),Eo=Math.sin(Ep),E2=E0[1]*CT,Er=Math.cos(E2),E1=Math.sin(E2),En=Ex[0]*CT,Ev=Math.cos(En),e=Math.sin(En),Ez=Ex[1]*CT,Eq=Math.cos(Ez),Ey=Math.sin(Ez),Eu=Es.d=Math.acos(Math.max(-1,Math.min(1,E1*Ey+Er*Eq*Math.cos(En-Ep)))),Et=Math.sin(Eu);function Es(E5){var E4=Math.sin(Eu-(E5*=Eu))/Et,E8=Math.sin(E5)/Et,E3=E4*Er*Ew+E8*Eq*Ev,E7=E4*Er*Eo+E8*Eq*e,E6=E4*E1+E8*Ey;return[Math.atan2(E7,E3)/CT,Math.atan2(E6,Math.sqrt(E3*E3+E7*E7))/CT]}return Es}d3.geo.greatCircle=d3.geo.circle;d3.geom={};d3.geom.contour=function(e,En){var Ev=En||K(e),Er=[],Et=Ev[0],Es=Ev[1],Ew=0,Eu=0,Ep=NaN,Eo=NaN,Eq=0;do{Eq=0;if(e(Et-1,Es-1)){Eq+=1}if(e(Et,Es-1)){Eq+=2}if(e(Et-1,Es)){Eq+=4}if(e(Et,Es)){Eq+=8}if(Eq===6){Ew=Eo===-1?-1:1;Eu=0}else{if(Eq===9){Ew=0;Eu=Ep===1?-1:1}else{Ew=BX[Eq];Eu=BV[Eq]}}if(Ew!=Ep&&Eu!=Eo){Er.push([Et,Es]);Ep=Ew;Eo=Eu}Et+=Ew;Es+=Eu}while(Ev[0]!=Et||Ev[1]!=Es);return Er};var BX=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],BV=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];function K(En){var e=0,Eo=0;while(true){if(En(e,Eo)){return[e,Eo]}if(e===0){e=Eo+1;Eo=0}else{e=e-1;Eo=Eo+1}}}d3.geom.hull=function(Ev){if(Ev.length<3){return[]}var Eu=Ev.length,Eq=Eu-1,E1=[],Ex=[],Es,Er,Et=0,Ep,Ez,En,Ew,E2,E0,Ey,Eo;for(Es=1;Es<Eu;++Es){if(Ev[Es][1]<Ev[Et][1]){Et=Es}else{if(Ev[Es][1]==Ev[Et][1]){Et=(Ev[Es][0]<Ev[Et][0]?Es:Et)}}}for(Es=0;Es<Eu;++Es){if(Es===Et){continue}Ez=Ev[Es][1]-Ev[Et][1];Ep=Ev[Es][0]-Ev[Et][0];E1.push({angle:Math.atan2(Ez,Ep),index:Es})}E1.sort(function(E4,E3){return E4.angle-E3.angle});Ey=E1[0].angle;E0=E1[0].index;E2=0;for(Es=1;Es<Eq;++Es){Er=E1[Es].index;if(Ey==E1[Es].angle){Ep=Ev[E0][0]-Ev[Et][0];Ez=Ev[E0][1]-Ev[Et][1];En=Ev[Er][0]-Ev[Et][0];Ew=Ev[Er][1]-Ev[Et][1];if((Ep*Ep+Ez*Ez)>=(En*En+Ew*Ew)){E1[Es].index=-1}else{E1[E2].index=-1;Ey=E1[Es].angle;E2=Es;E0=Er}}else{Ey=E1[Es].angle;E2=Es;E0=Er}}Ex.push(Et);for(Es=0,Er=0;Es<2;++Er){if(E1[Er].index!==-1){Ex.push(E1[Er].index);Es++}}Eo=Ex.length;for(;Er<Eq;++Er){if(E1[Er].index===-1){continue}while(!Bs(Ex[Eo-2],Ex[Eo-1],E1[Er].index,Ev)){--Eo}Ex[Eo++]=E1[Er].index}var e=[];for(Es=0;Es<Eo;++Es){e.push(Ev[Ex[Es]])}return e};function Bs(Ep,Eo,En,Ew){var Ex,Ev,Eu,Et,Es,Er,Eq;Ex=Ew[Ep];Ev=Ex[0];Eu=Ex[1];Ex=Ew[Eo];Et=Ex[0];Es=Ex[1];Ex=Ew[En];Er=Ex[0];Eq=Ex[1];return((Eq-Eu)*(Et-Ev)-(Es-Eu)*(Er-Ev))>0}d3.geom.polygon=function(e){e.area=function(){var Ep=0,Eq=e.length,Eo=e[Eq-1][0]*e[0][1],En=e[Eq-1][1]*e[0][0];while(++Ep<Eq){Eo+=e[Ep-1][0]*e[Ep][1];En+=e[Ep-1][1]*e[Ep][0]}return(En-Eo)*0.5};e.centroid=function(Eq){var Er=-1,Eu=e.length,Eo=0,Et=0,Ep,En=e[Eu-1],Es;if(!arguments.length){Eq=-1/(6*e.area())}while(++Er<Eu){Ep=En;En=e[Er];Es=Ep[0]*En[1]-En[0]*Ep[1];Eo+=(Ep[0]+En[0])*Es;Et+=(Ep[1]+En[1])*Es}return[Eo*Eq,Et*Eq]};e.clip=function(Et){var Ev,Eq=-1,En=e.length,Ep,Eo,Ew=e[En-1],Eu,Es,Er;while(++Eq<En){Ev=Et.slice();Et.length=0;Eu=e[Eq];Es=Ev[(Eo=Ev.length)-1];Ep=-1;while(++Ep<Eo){Er=Ev[Ep];if(T(Er,Ew,Eu)){if(!T(Es,Ew,Eu)){Et.push(De(Es,Er,Ew,Eu))}Et.push(Er)}else{if(T(Es,Ew,Eu)){Et.push(De(Es,Er,Ew,Eu))}}Es=Er}Ew=Eu}return Et};return e};function T(Eo,En,e){return(e[0]-En[0])*(Eo[1]-En[1])<(e[1]-En[1])*(Eo[0]-En[0])}function De(Ez,Ey,E2,E1){var Ex=Ez[0],Ew=Ey[0],Ev=E2[0],Et=E1[0],Ep=Ez[1],Eo=Ey[1],En=E2[1],e=E1[1],E3=Ex-Ev,Eq=Ew-Ex,E4=Et-Ev,Er=Ep-En,E0=Eo-Ep,Es=e-En,Eu=(E4*Er-Es*E3)/(Es*Eq-E4*E0);return[Ex+Eu*Eq,Ep+Eu*E0]}d3.geom.voronoi=function(En){var e=En.map(function(){return[]});Dy(En,function(Eq){var Ew,Ev,Ep,Eo,Et,Er;if(Eq.a===1&&Eq.b>=0){Ew=Eq.ep.r;Ev=Eq.ep.l}else{Ew=Eq.ep.l;Ev=Eq.ep.r}if(Eq.a===1){Et=Ew?Ew.y:-1000000;Ep=Eq.c-Eq.b*Et;Er=Ev?Ev.y:1000000;Eo=Eq.c-Eq.b*Er}else{Ep=Ew?Ew.x:-1000000;Et=Eq.c-Eq.a*Ep;Eo=Ev?Ev.x:1000000;Er=Eq.c-Eq.a*Eo}var Eu=[Ep,Et],Es=[Eo,Er];e[Eq.region.l.index].push(Eu,Es);e[Eq.region.r.index].push(Eu,Es)});return e.map(function(Eq,Ep){var Eo=En[Ep][0],Er=En[Ep][1];Eq.forEach(function(Es){Es.angle=Math.atan2(Es[0]-Eo,Es[1]-Er)});return Eq.sort(function(Et,Es){return Et.angle-Es.angle}).filter(function(Et,Es){return !Es||(Et.angle-Eq[Es-1].angle>1e-10)})})};var Bk={l:"r",r:"l"};function Dy(Er,Ep){var E5={list:Er.map(function(e,E7){return{index:E7,x:e[0],y:e[1]}}).sort(function(E7,e){return E7.y<e.y?-1:E7.y>e.y?1:E7.x<e.x?-1:E7.x>e.x?1:0}),bottomSite:null};var Eo={list:[],leftEnd:null,rightEnd:null,init:function(){Eo.leftEnd=Eo.createHalfEdge(null,"l");Eo.rightEnd=Eo.createHalfEdge(null,"l");Eo.leftEnd.r=Eo.rightEnd;Eo.rightEnd.l=Eo.leftEnd;Eo.list.unshift(Eo.leftEnd,Eo.rightEnd)},createHalfEdge:function(E7,e){return{edge:E7,side:e,vertex:null,l:null,r:null}},insert:function(E7,e){e.l=E7;e.r=E7.r;E7.r.l=e;E7.r=e},leftBound:function(E7){var e=Eo.leftEnd;do{e=e.r}while(e!=Eo.rightEnd&&E4.rightOf(e,E7));e=e.l;return e},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?E5.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?E5.bottomSite:e.edge.region[Bk[e.side]]}};var E4={bisect:function(FA,E8){var E9={region:{l:FA,r:E8},ep:{l:null,r:null}};var E7=E8.x-FA.x,e=E8.y-FA.y,FC=E7>0?E7:-E7,FB=e>0?e:-e;E9.c=FA.x*E7+FA.y*e+(E7*E7+e*e)*0.5;if(FC>FB){E9.a=1;E9.b=e/E7;E9.c/=E7}else{E9.b=1;E9.a=E7/e;E9.c/=e}return E9},intersect:function(FA,E9){var FF=FA.edge,FE=E9.edge;if(!FF||!FE||(FF.region.r==FE.region.r)){return null}var FD=(FF.a*FE.b)-(FF.b*FE.a);if(Math.abs(FD)<1e-10){return null}var E8=(FF.c*FE.b-FE.c*FF.b)/FD,FI=(FE.c*FF.a-FF.c*FE.a)/FD,FH=FF.region.r,FC=FE.region.r,E7,FB;if((FH.y<FC.y)||(FH.y==FC.y&&FH.x<FC.x)){E7=FA;FB=FF}else{E7=E9;FB=FE}var FG=(E8>=FB.region.r.x);if((FG&&(E7.side==="l"))||(!FG&&(E7.side==="r"))){return null}return{x:E8,y:FI}},rightOf:function(FC,E7){var FG=FC.edge,FA=FG.region.r,FJ=(E7.x>FA.x);if(FJ&&(FC.side==="l")){return 1}if(!FJ&&(FC.side==="r")){return 0}if(FG.a===1){var FI=E7.y-FA.y,E8=E7.x-FA.x,FD=0,FH=0;if((!FJ&&(FG.b<0))||(FJ&&(FG.b>=0))){FH=FD=(FI>=FG.b*E8)}else{FH=((E7.x+E7.y*FG.b)>FG.c);if(FG.b<0){FH=!FH}if(!FH){FD=1}}if(!FD){var FK=FA.x-FG.region.l.x;FH=(FG.b*(E8*E8-FI*FI))<(FK*FI*(1+2*E8/FK+FG.b*FG.b));if(FG.b<0){FH=!FH}}}else{var E9=FG.c-FG.a*E7.x,FF=E7.y-E9,FE=E7.x-FA.x,FB=E9-FA.y;FH=(FF*FF)>(FE*FE+FB*FB)}return FC.side==="l"?FH:!FH},endPoint:function(E8,E7,e){E8.ep[E7]=e;if(!E8.ep[Bk[E7]]){return}Ep(E8)},distance:function(E9,E8){var E7=E9.x-E8.x,e=E9.y-E8.y;return Math.sqrt(E7*E7+e*e)}};var En={list:[],insert:function(FB,E7,FC){FB.vertex=E7;FB.ystar=E7.y+FC;for(var E8=0,FA=En.list,e=FA.length;E8<e;E8++){var E9=FA[E8];if(FB.ystar>E9.ystar||(FB.ystar==E9.ystar&&E7.x>E9.vertex.x)){continue}else{break}}FA.splice(E8,0,FB)},del:function(E9){for(var E8=0,E7=En.list,e=E7.length;E8<e&&(E7[E8]!=E9);++E8){}E7.splice(E8,1)},empty:function(){return En.list.length===0},nextEvent:function(E9){for(var E8=0,E7=En.list,e=E7.length;E8<e;++E8){if(E7[E8]==E9){return E7[E8+1]}}return null},min:function(){var e=En.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return En.list.shift()}};Eo.init();E5.bottomSite=E5.list.shift();var E6=E5.list.shift(),Et;var Ey,Ev,Eq,E2,Es;var Ew,Ex,E3,Ez,Eu;var E1,E0;while(true){if(!En.empty()){Et=En.min()}if(E6&&(En.empty()||E6.y<Et.y||(E6.y==Et.y&&E6.x<Et.x))){Ey=Eo.leftBound(E6);Ev=Eo.right(Ey);Ew=Eo.rightRegion(Ey);E1=E4.bisect(Ew,E6);Es=Eo.createHalfEdge(E1,"l");Eo.insert(Ey,Es);Ez=E4.intersect(Ey,Es);if(Ez){En.del(Ey);En.insert(Ey,Ez,E4.distance(Ez,E6))}Ey=Es;Es=Eo.createHalfEdge(E1,"r");Eo.insert(Ey,Es);Ez=E4.intersect(Es,Ev);if(Ez){En.insert(Es,Ez,E4.distance(Ez,E6))}E6=E5.list.shift()}else{if(!En.empty()){Ey=En.extractMin();Eq=Eo.left(Ey);Ev=Eo.right(Ey);E2=Eo.right(Ev);Ew=Eo.leftRegion(Ey);Ex=Eo.rightRegion(Ev);Eu=Ey.vertex;E4.endPoint(Ey.edge,Ey.side,Eu);E4.endPoint(Ev.edge,Ev.side,Eu);Eo.del(Ey);En.del(Ev);Eo.del(Ev);E0="l";if(Ew.y>Ex.y){E3=Ew;Ew=Ex;Ex=E3;E0="r"}E1=E4.bisect(Ew,Ex);Es=Eo.createHalfEdge(E1,E0);Eo.insert(Eq,Es);E4.endPoint(E1,Bk[E0],Eu);Ez=E4.intersect(Eq,Es);if(Ez){En.del(Eq);En.insert(Eq,Ez,E4.distance(Ez,Ew))}Ez=E4.intersect(Es,E2);if(Ez){En.insert(Es,Ez,E4.distance(Ez,Ew))}}else{break}}}for(Ey=Eo.right(Eo.leftEnd);Ey!=Eo.rightEnd;Ey=Eo.right(Ey)){Ep(Ey.edge)}}d3.geom.delaunay=function(En){var e=En.map(function(){return[]}),Eo=[];Dy(En,function(Ep){e[Ep.region.l.index].push(En[Ep.region.r.index])});e.forEach(function(Eu,Et){var Er=En[Et],Eq=Er[0],Ev=Er[1];Eu.forEach(function(Ew){Ew.angle=Math.atan2(Ew[0]-Eq,Ew[1]-Ev)});Eu.sort(function(Ex,Ew){return Ex.angle-Ew.angle});for(var Es=0,Ep=Eu.length-1;Es<Ep;Es++){Eo.push([Er,Eu[Es],Eu[Es+1]])}});return Eo};d3.geom.quadtree=function(Ev,Eo,Eu,e,Et){var En,Eq=-1,Ep=Ev.length;if(Ep&&isNaN(Ev[0].x)){Ev=Ev.map(h)}if(arguments.length<5){if(arguments.length===3){Et=e=Eu;Eu=Eo}else{Eo=Eu=Infinity;e=Et=-Infinity;while(++Eq<Ep){En=Ev[Eq];if(En.x<Eo){Eo=En.x}if(En.y<Eu){Eu=En.y}if(En.x>e){e=En.x}if(En.y>Et){Et=En.y}}var Ey=e-Eo,Ex=Et-Eu;if(Ey>Ex){Et=Eu+Ey}else{e=Eo+Ex}}}function Ew(E5,E4,E1,E3,E0,E2){if(isNaN(E4.x)||isNaN(E4.y)){return}if(E5.leaf){var Ez=E5.point;if(Ez){if((Math.abs(Ez.x-E4.x)+Math.abs(Ez.y-E4.y))<0.01){Er(E5,E4,E1,E3,E0,E2)}else{E5.point=null;Er(E5,Ez,E1,E3,E0,E2);Er(E5,E4,E1,E3,E0,E2)}}else{E5.point=E4}}else{Er(E5,E4,E1,E3,E0,E2)}}function Er(E3,E1,E2,E8,E0,E6){var E7=(E2+E0)*0.5,E5=(E8+E6)*0.5,E9=E1.x>=E7,Ez=E1.y>=E5,E4=(Ez<<1)+E9;E3.leaf=false;E3=E3.nodes[E4]||(E3.nodes[E4]=DH());if(E9){E2=E7}else{E0=E7}if(Ez){E8=E5}else{E6=E5}Ew(E3,E1,E2,E8,E0,E6)}var Es=DH();Es.add=function(Ez){Ew(Es,Ez,Eo,Eu,e,Et)};Es.visit=function(Ez){BK(Ez,Es,Eo,Eu,e,Et)};Ev.forEach(Es.add);return Es};function DH(){return{leaf:true,nodes:[],point:null}}function BK(Eq,Ep,En,Eu,e,Es){if(!Eq(Ep,En,Eu,e,Es)){var Et=(En+e)*0.5,Er=(Eu+Es)*0.5,Eo=Ep.nodes;if(Eo[0]){BK(Eq,Eo[0],En,Eu,Et,Er)}if(Eo[1]){BK(Eq,Eo[1],Et,Eu,e,Er)}if(Eo[2]){BK(Eq,Eo[2],En,Er,Et,Es)}if(Eo[3]){BK(Eq,Eo[3],Et,Er,e,Es)}}}function h(e){return{x:e[0],y:e[1]}}d3.time={};var DG=Date;function D8(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}D8.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){DR.setUTCDate.apply(this._,arguments)},setDay:function(){DR.setUTCDay.apply(this._,arguments)},setFullYear:function(){DR.setUTCFullYear.apply(this._,arguments)},setHours:function(){DR.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){DR.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){DR.setUTCMinutes.apply(this._,arguments)},setMonth:function(){DR.setUTCMonth.apply(this._,arguments)},setSeconds:function(){DR.setUTCSeconds.apply(this._,arguments)},setTime:function(){DR.setTime.apply(this._,arguments)}};var DR=Date.prototype;d3.time.format=function(e){var Eo=e.length;function En(Er){var Eq=[],Es=-1,Ep=0,Eu,Et;while(++Es<Eo){if(e.charCodeAt(Es)==37){Eq.push(e.substring(Ep,Es),(Et=Dl[Eu=e.charAt(++Es)])?Et(Er):Eu);Ep=Es+1}}Eq.push(e.substring(Ep,Es));return Eq.join("")}En.parse=function(Eq){var Es={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},Er=B8(Es,e,Eq,0);if(Er!=Eq.length){return null}if("p" in Es){Es.H=Es.H%12+Es.p*12}var Ep=new DG();Ep.setFullYear(Es.y,Es.m,Es.d);Ep.setHours(Es.H,Es.M,Es.S,Es.L);return Ep};En.toString=function(){return e};return En};function B8(Ep,Eu,Es,Eq){var Et,e,Er=0,En=Eu.length,Eo=Es.length;while(Er<En){if(Eq>=Eo){return -1}Et=Eu.charCodeAt(Er++);if(Et==37){e=Eb[Eu.charAt(Er++)];if(!e||((Eq=e(Ep,Es,Eq))<0)){return -1}}else{if(Et!=Es.charCodeAt(Eq++)){return -1}}}return Eq}var Ak=d3.format("02d"),Aj=d3.format("03d"),Ai=d3.format("04d"),Ag=d3.format("2d");var Dl={a:function(e){return d3_time_weekdays[e.getDay()].substring(0,3)},A:function(e){return d3_time_weekdays[e.getDay()]},b:function(e){return A5[e.getMonth()].substring(0,3)},B:function(e){return A5[e.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(e){return Ak(e.getDate())},e:function(e){return Ag(e.getDate())},H:function(e){return Ak(e.getHours())},I:function(e){return Ak(e.getHours()%12||12)},j:function(e){return Aj(1+d3.time.dayOfYear(e))},L:function(e){return Aj(e.getMilliseconds())},m:function(e){return Ak(e.getMonth()+1)},M:function(e){return Ak(e.getMinutes())},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e){return Ak(e.getSeconds())},U:function(e){return Ak(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return Ak(d3.time.mondayOfYear(e))},x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(e){return Ak(e.getFullYear()%100)},Y:function(e){return Ai(e.getFullYear()%10000)},Z:DO,"%":function(e){return"%"}};var Eb={a:D7,A:BG,b:AN,B:Cd,c:CK,d:Av,e:Av,H:AF,I:AF,L:D3,m:Du,M:BQ,p:ES,S:B0,x:El,X:Dr,y:c,Y:Ae};function D7(En,e,Eo){return Cw.test(e.substring(Eo,Eo+=3))?Eo:-1}function BG(En,e,Eo){Aq.lastIndex=0;var Ep=Aq.exec(e.substring(Eo,Eo+10));return Ep?Eo+=Ep[0].length:-1}var Cw=/^(?:sun|mon|tue|wed|thu|fri|sat)/i,Aq=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i;d3_time_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function AN(En,e,Eo){var Ep=Ch.get(e.substring(Eo,Eo+=3).toLowerCase());return Ep==null?-1:(En.m=Ep,Eo)}var Ch=d3.map({jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11});function Cd(En,e,Eo){EA.lastIndex=0;var Ep=EA.exec(e.substring(Eo,Eo+12));return Ep?(En.m=C8.get(Ep[0].toLowerCase()),Eo+=Ep[0].length):-1}var EA=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;var C8=d3.map({january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11});var A5=["January","February","March","April","May","June","July","August","September","October","November","December"];function CK(En,e,Eo){return B8(En,Dl.c.toString(),e,Eo)}function El(En,e,Eo){return B8(En,Dl.x.toString(),e,Eo)}function Dr(En,e,Eo){return B8(En,Dl.X.toString(),e,Eo)}function Ae(En,e,Eo){DS.lastIndex=0;var Ep=DS.exec(e.substring(Eo,Eo+4));return Ep?(En.y=+Ep[0],Eo+=Ep[0].length):-1}function c(En,e,Eo){DS.lastIndex=0;var Ep=DS.exec(e.substring(Eo,Eo+2));return Ep?(En.y=Ab()+ +Ep[0],Eo+=Ep[0].length):-1}function Ab(){return ~~(new Date().getFullYear()/1000)*1000}function Du(En,e,Eo){DS.lastIndex=0;var Ep=DS.exec(e.substring(Eo,Eo+2));return Ep?(En.m=Ep[0]-1,Eo+=Ep[0].length):-1}function Av(En,e,Eo){DS.lastIndex=0;var Ep=DS.exec(e.substring(Eo,Eo+2));return Ep?(En.d=+Ep[0],Eo+=Ep[0].length):-1}function AF(En,e,Eo){DS.lastIndex=0;var Ep=DS.exec(e.substring(Eo,Eo+2));return Ep?(En.H=+Ep[0],Eo+=Ep[0].length):-1}function BQ(En,e,Eo){DS.lastIndex=0;var Ep=DS.exec(e.substring(Eo,Eo+2));return Ep?(En.M=+Ep[0],Eo+=Ep[0].length):-1}function B0(En,e,Eo){DS.lastIndex=0;var Ep=DS.exec(e.substring(Eo,Eo+2));return Ep?(En.S=+Ep[0],Eo+=Ep[0].length):-1}function D3(En,e,Eo){DS.lastIndex=0;var Ep=DS.exec(e.substring(Eo,Eo+3));return Ep?(En.L=+Ep[0],Eo+=Ep[0].length):-1}var DS=/\s*\d+/;function ES(En,e,Eo){var Ep=C.get(e.substring(Eo,Eo+=2).toLowerCase());return Ep==null?-1:(En.p=Ep,Eo)}var C=d3.map({am:0,pm:1});function DO(Eq){var Ep=Eq.getTimezoneOffset(),Eo=Ep>0?"-":"+",En=~~(Math.abs(Ep)/60),e=Math.abs(Ep)%60;return Eo+Ak(En)+Ak(e)}d3.time.format.utc=function(En){var e=d3.time.format(En);function Eo(Ep){try{DG=D8;var Eq=new DG();Eq._=Ep;return e(Eq)}finally{DG=Date}}Eo.parse=function(Eq){try{DG=D8;var Ep=e.parse(Eq);return Ep&&Ep._}finally{DG=Date}};Eo.toString=e.toString;return Eo};var Bw=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Bl:Bw;function Bl(e){return e.toISOString()}Bl.parse=function(e){return new Date(e)};Bl.toString=Bw.toString;function BS(Er,e,En){function Eu(Ev){var Ex=Er(Ev),Ew=Ep(Ex,1);return Ev-Ex<Ew-Ev?Ex:Ew}function Et(Ev){e(Ev=Er(new DG(Ev-1)),1);return Ev}function Ep(Ew,Ev){e(Ew=new DG(+Ew),Ev);return Ew}function Eq(Ex,Ew,Ev){var Ey=Et(Ex),Ez=[];if(Ev>1){while(Ey<Ew){if(!(En(Ey)%Ev)){Ez.push(new Date(+Ey))}e(Ey,1)}}else{while(Ey<Ew){Ez.push(new Date(+Ey)),e(Ey,1)}}return Ez}function Eo(Ey,Ex,Ew){try{DG=D8;var Ev=new D8();Ev._=Ey;return Eq(Ev,Ex,Ew)}finally{DG=Date}}Er.floor=Er;Er.round=Eu;Er.ceil=Et;Er.offset=Ep;Er.range=Eq;var Es=Er.utc=By(Er);Es.floor=Es;Es.round=By(Eu);Es.ceil=By(Et);Es.offset=By(Ep);Es.range=Eo;return Er}function By(e){return function(Eo,En){try{DG=D8;var Ep=new D8();Ep._=Eo;return e(Ep,En)._}finally{DG=Date}}}d3.time.second=BS(function(e){return new DG(Math.floor(e/1000)*1000)},function(e,En){e.setTime(e.getTime()+Math.floor(En)*1000)},function(e){return e.getSeconds()});d3.time.seconds=d3.time.second.range;d3.time.seconds.utc=d3.time.second.utc.range;d3.time.minute=BS(function(e){return new DG(Math.floor(e/60000)*60000)},function(e,En){e.setTime(e.getTime()+Math.floor(En)*60000)},function(e){return e.getMinutes()});d3.time.minutes=d3.time.minute.range;d3.time.minutes.utc=d3.time.minute.utc.range;d3.time.hour=BS(function(e){var En=e.getTimezoneOffset()/60;return new DG((Math.floor(e/3600000-En)+En)*3600000)},function(e,En){e.setTime(e.getTime()+Math.floor(En)*3600000)},function(e){return e.getHours()});d3.time.hours=d3.time.hour.range;d3.time.hours.utc=d3.time.hour.utc.range;d3.time.day=BS(function(e){return new DG(e.getFullYear(),e.getMonth(),e.getDate())},function(e,En){e.setDate(e.getDate()+En)},function(e){return e.getDate()-1});d3.time.days=d3.time.day.range;d3.time.days.utc=d3.time.day.utc.range;d3.time.dayOfYear=function(e){var En=d3.time.year(e);return Math.floor((e-En)/86400000-(e.getTimezoneOffset()-En.getTimezoneOffset())/1440)};d3_time_weekdays.forEach(function(En,Eo){En=En.toLowerCase();Eo=7-Eo;var e=d3.time[En]=BS(function(Ep){(Ep=d3.time.day(Ep)).setDate(Ep.getDate()-(Ep.getDay()+Eo)%7);return Ep},function(Ep,Eq){Ep.setDate(Ep.getDate()+Math.floor(Eq)*7)},function(Eq){var Ep=d3.time.year(Eq).getDay();return Math.floor((d3.time.dayOfYear(Eq)+(Ep+Eo)%7)/7)-(Ep!==Eo)});d3.time[En+"s"]=e.range;d3.time[En+"s"].utc=e.utc.range;d3.time[En+"OfYear"]=function(Eq){var Ep=d3.time.year(Eq).getDay();return Math.floor((d3.time.dayOfYear(Eq)+(Ep+Eo)%7)/7)}});d3.time.week=d3.time.sunday;d3.time.weeks=d3.time.sunday.range;d3.time.weeks.utc=d3.time.sunday.utc.range;d3.time.weekOfYear=d3.time.sundayOfYear;d3.time.month=BS(function(e){return new DG(e.getFullYear(),e.getMonth(),1)},function(e,En){e.setMonth(e.getMonth()+En)},function(e){return e.getMonth()});d3.time.months=d3.time.month.range;d3.time.months.utc=d3.time.month.utc.range;d3.time.year=BS(function(e){return new DG(e.getFullYear(),0,1)},function(e,En){e.setFullYear(e.getFullYear()+En)},function(e){return e.getFullYear()});d3.time.years=d3.time.year.range;d3.time.years.utc=d3.time.year.utc.range;function Aa(e,En,Eo){function Ep(Eq){return e(Eq)}Ep.invert=function(Eq){return DQ(e.invert(Eq))};Ep.domain=function(Eq){if(!arguments.length){return e.domain().map(DQ)}e.domain(Eq);return Ep};Ep.nice=function(Eq){var Er=DL(Ep.domain());return Ep.domain([Eq.floor(Er[0]),Eq.ceil(Er[1])])};Ep.ticks=function(Eq,Er){var Eu=DL(Ep.domain());if(typeof Eq!=="function"){var Et=Eu[1]-Eu[0],Ev=Et/Eq,Es=d3.bisect(Cp,Ev);if(Es==Cp.length){return En.year(Eu,Eq)}if(!Es){return e.ticks(Eq).map(DQ)}if(Math.log(Ev/Cp[Es-1])<Math.log(Cp[Es]/Ev)){--Es}Eq=En[Es];Er=Eq[1];Eq=Eq[0].range}return Eq(Eu[0],new Date(+Eu[1]+1),Er)};Ep.tickFormat=function(){return Eo};Ep.copy=function(){return Aa(e.copy(),En,Eo)};return d3.rebind(Ep,e,"range","rangeRound","interpolate","clamp")}function DL(En){var Eo=En[0],e=En[En.length-1];return Eo<e?[Eo,e]:[e,Eo]}function DQ(e){return new Date(e)}function BP(e){return function(En){var Eo=e.length-1,Ep=e[Eo];while(!Ep[1](En)){Ep=e[--Eo]}return Ep[0](En)}}function B3(En){var e=new Date(En,0,1);e.setFullYear(En);return e}function D9(Eo){var Ep=Eo.getFullYear(),En=B3(Ep),e=B3(Ep+1);return Ep+(Eo-En)/(e-En)}var Cp=[1000,5000,15000,30000,60000,300000,900000,1800000,3600000,10800000,21600000,43200000,86400000,172800000,604800000,2592000000,7776000000,31536000000];var BF=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]];var C9=[[d3.time.format("%Y"),function(e){return true}],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]];var BD=d3.scale.linear(),i=BP(C9);BF.year=function(En,e){return BD.domain(En.map(D9)).ticks(e).map(B3)};d3.time.scale=function(){return Aa(d3.scale.linear(),BF,i)};var Ed=BF.map(function(e){return[e[0].utc,e[1]]});var A1=[[d3.time.format.utc("%Y"),function(e){return true}],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Cg=BP(A1);function BW(En){var e=new Date(Date.UTC(En,0,1));e.setUTCFullYear(En);return e}function Da(Eo){var Ep=Eo.getUTCFullYear(),En=BW(Ep),e=BW(Ep+1);return Ep+(Eo-En)/(e-En)}Ed.year=function(En,e){return BD.domain(En.map(Da)).ticks(e).map(BW)};d3.time.scale.utc=function(){return Aa(d3.scale.linear(),Ed,Cg)}})();
       
    39 /*
       
    40  * Including Box2DWeb
    24  * http://www.gphysics.com
    41  * http://www.gphysics.com
    25  * Copyright 2006, Erin Catto 
    42  * Copyright 2006, Erin Catto 
    26  * Released under zlib License.
    43  * Released under zlib License.
    27  * 
    44  * 
    28  * Includes Sizzle.js
       
    29  * http://sizzlejs.com/
       
    30  * Copyright 2010, The Dojo Foundation
       
    31  * Released under the MIT, BSD, and GPL Licenses.
       
    32  *
       
    33  * Date: Tue Jan 01 14:25:48 2010 -0500
       
    34  */
    45  */
    35 (function(Au,AD){function A6(){if(!AM.isReady){try{AE.documentElement.doScroll("left")}catch(A){setTimeout(A6,1);return}AM.ready()}}function AB(F,A){A.src?AM.ajax({url:A.src,async:false,dataType:"script"}):AM.globalEval(A.text||A.textContent||A.innerHTML||"");A.parentNode&&A.parentNode.removeChild(A)}function AU(F,A,O,K,L,G){var J=F.length;if(typeof A==="object"){for(var N in A){AU(F,N,A[N],K,L,O)}return F}if(O!==AD){K=!G&&K&&AM.isFunction(O);for(N=0;N<J;N++){L(F[N],A,K?O.call(F[N],N,L(F[N],A)):O,G)}return F}return J?L(F[0],A):AD}function Al(){return(new Date).getTime()}function AT(){return false}function AR(){return true}function Aq(F,A,G){G[0].type=F;return AM.event.handle.apply(A,G)}function AL(R){var Q,P=[],N=[],O=arguments,K,L,F,J,G,A;L=AM.data(this,"events");if(!(R.liveFired===this||!L||!L.live||R.button&&R.type==="click")){R.liveFired=this;var T=L.live.slice(0);for(J=0;J<T.length;J++){L=T[J];L.origType.replace(Af,"")===R.type?N.push(L.selector):T.splice(J--,1)}K=AM(R.target).closest(N,R.currentTarget);G=0;for(A=K.length;G<A;G++){for(J=0;J<T.length;J++){L=T[J];if(K[G].selector===L.selector){F=K[G].elem;N=null;if(L.preType==="mouseenter"||L.preType==="mouseleave"){N=AM(R.relatedTarget).closest(L.selector)[0]}if(!N||N!==F){P.push({elem:F,handleObj:L})}}}}G=0;for(A=P.length;G<A;G++){K=P[G];R.currentTarget=K.elem;R.data=K.handleObj.data;R.handleObj=K.handleObj;if(K.handleObj.origHandler.apply(K.elem,O)===false){Q=false;break}}return Q}}function x(F,A){return"live."+(F&&F!=="*"?F+".":"")+A.replace(/\./g,"`").replace(/ /g,"&")}function e(A){return !A||!A.parentNode||A.parentNode.nodeType===11}function BN(F,A){var G=0;A.each(function(){if(this.nodeName===(F[G]&&F[G].nodeName)){var L=AM.data(F[G++]),N=AM.data(this,L);if(L=L&&L.events){delete N.handle;N.events={};for(var J in L){for(var K in L[J]){AM.event.add(this,J,L[J][K],L[J][K].data)}}}}})}function A9(F,A,L){var J,K,G;A=A&&A[0]?A[0].ownerDocument||A[0]:AE;if(F.length===1&&typeof F[0]==="string"&&F[0].length<512&&A===AE&&!Av.test(F[0])&&(AM.support.checkClone||!AP.test(F[0]))){K=true;if(G=AM.fragments[F[0]]){if(G!==1){J=G}}}if(!J){J=A.createDocumentFragment();AM.clean(F,A,J,L)}if(K){AM.fragments[F[0]]=G?J:1}return{fragment:J,cacheable:K}}function Ai(F,A){var G={};AM.each(AA.concat.apply([],AA.slice(0,A)),function(){G[this]=F});return G}function h(A){return"scrollTo" in A&&A.document?A:A.nodeType===9?A.defaultView||A.parentWindow:false}var AM=function(F,A){return new AM.fn.init(F,A)},k=Au.jQuery,D=Au.$,AE=Au.document,AX,BD=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Az=/^.[^:#\[\.,]*$/,AS=/\S/,AC=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,l=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Ad=navigator.userAgent,C=false,AZ=[],Ah,A7=Object.prototype.toString,A1=Object.prototype.hasOwnProperty,Ae=Array.prototype.push,AY=Array.prototype.slice,BC=Array.prototype.indexOf;AM.fn=AM.prototype={init:function(F,A){var J,G;if(!F){return this}if(F.nodeType){this.context=this[0]=F;this.length=1;return this}if(F==="body"&&!A){this.context=AE;this[0]=AE.body;this.selector="body";this.length=1;return this}if(typeof F==="string"){if((J=BD.exec(F))&&(J[1]||!A)){if(J[1]){G=A?A.ownerDocument||A:AE;if(F=l.exec(F)){if(AM.isPlainObject(A)){F=[AE.createElement(F[1])];AM.fn.attr.call(F,A,true)}else{F=[G.createElement(F[1])]}}else{F=A9([J[1]],[G]);F=(F.cacheable?F.fragment.cloneNode(true):F.fragment).childNodes}return AM.merge(this,F)}else{if(A=AE.getElementById(J[2])){if(A.id!==J[2]){return AX.find(F)}this.length=1;this[0]=A}this.context=AE;this.selector=F;return this}}else{if(!A&&/^\w+$/.test(F)){this.selector=F;this.context=AE;F=AE.getElementsByTagName(F);return AM.merge(this,F)}else{return !A||A.jquery?(A||AX).find(F):AM(A).find(F)}}}else{if(AM.isFunction(F)){return AX.ready(F)}}if(F.selector!==AD){this.selector=F.selector;this.context=F.context}return AM.makeArray(F,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return AY.call(this,0)},get:function(A){return A==null?this.toArray():A<0?this.slice(A)[0]:this[A]},pushStack:function(F,A,J){var G=AM();AM.isArray(F)?Ae.apply(G,F):AM.merge(G,F);G.prevObject=this;G.context=this.context;if(A==="find"){G.selector=this.selector+(this.selector?" ":"")+J}else{if(A){G.selector=this.selector+"."+A+"("+J+")"}}return G},each:function(F,A){return AM.each(this,F,A)},ready:function(A){AM.bindReady();if(AM.isReady){A.call(AE,AM)}else{AZ&&AZ.push(A)}return this},eq:function(A){return A===-1?this.slice(A):this.slice(A,+A+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(AY.apply(this,arguments),"slice",AY.call(arguments).join(","))},map:function(A){return this.pushStack(AM.map(this,function(F,G){return A.call(F,G,F)}))},end:function(){return this.prevObject||AM(null)},push:Ae,sort:[].sort,splice:[].splice};AM.fn.init.prototype=AM.fn;AM.extend=AM.fn.extend=function(){var F=arguments[0]||{},A=1,O=arguments.length,K=false,L,G,J,N;if(typeof F==="boolean"){K=F;F=arguments[1]||{};A=2}if(typeof F!=="object"&&!AM.isFunction(F)){F={}}if(O===A){F=this;--A}for(;A<O;A++){if((L=arguments[A])!=null){for(G in L){J=F[G];N=L[G];if(F!==N){if(K&&N&&(AM.isPlainObject(N)||AM.isArray(N))){J=J&&(AM.isPlainObject(J)||AM.isArray(J))?J:AM.isArray(N)?[]:{};F[G]=AM.extend(K,J,N)}else{if(N!==AD){F[G]=N}}}}}}return F};AM.extend({noConflict:function(A){Au.$=D;if(A){Au.jQuery=k}return AM},isReady:false,ready:function(){if(!AM.isReady){if(!AE.body){return setTimeout(AM.ready,13)}AM.isReady=true;if(AZ){for(var F,A=0;F=AZ[A++];){F.call(AE,AM)}AZ=null}AM.fn.triggerHandler&&AM(AE).triggerHandler("ready")}},bindReady:function(){if(!C){C=true;if(AE.readyState==="complete"){return AM.ready()}if(AE.addEventListener){AE.addEventListener("DOMContentLoaded",Ah,false);Au.addEventListener("load",AM.ready,false)}else{if(AE.attachEvent){AE.attachEvent("onreadystatechange",Ah);Au.attachEvent("onload",AM.ready);var F=false;try{F=Au.frameElement==null}catch(A){}AE.documentElement.doScroll&&F&&A6()}}}},isFunction:function(A){return A7.call(A)==="[object Function]"},isArray:function(A){return A7.call(A)==="[object Array]"},isPlainObject:function(F){if(!F||A7.call(F)!=="[object Object]"||F.nodeType||F.setInterval){return false}if(F.constructor&&!A1.call(F,"constructor")&&!A1.call(F.constructor.prototype,"isPrototypeOf")){return false}var A;for(A in F){}return A===AD||A1.call(F,A)},isEmptyObject:function(F){for(var A in F){return false}return true},error:function(A){throw A},parseJSON:function(A){if(typeof A!=="string"||!A){return null}A=AM.trim(A);if(/^[\],:{}\s]*$/.test(A.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return Au.JSON&&Au.JSON.parse?Au.JSON.parse(A):(new Function("return "+A))()}else{AM.error("Invalid JSON: "+A)}},noop:function(){},globalEval:function(F){if(F&&AS.test(F)){var A=AE.getElementsByTagName("head")[0]||AE.documentElement,G=AE.createElement("script");G.type="text/javascript";if(AM.support.scriptEval){G.appendChild(AE.createTextNode(F))}else{G.text=F}A.insertBefore(G,A.firstChild);A.removeChild(G)}},nodeName:function(F,A){return F.nodeName&&F.nodeName.toUpperCase()===A.toUpperCase()},each:function(F,A,N){var K,L=0,G=F.length,J=G===AD||AM.isFunction(F);if(N){if(J){for(K in F){if(A.apply(F[K],N)===false){break}}}else{for(;L<G;){if(A.apply(F[L++],N)===false){break}}}}else{if(J){for(K in F){if(A.call(F[K],K,F[K])===false){break}}}else{for(N=F[0];L<G&&A.call(N,L,N)!==false;N=F[++L]){}}}return F},trim:function(A){return(A||"").replace(AC,"")},makeArray:function(F,A){A=A||[];if(F!=null){F.length==null||typeof F==="string"||AM.isFunction(F)||typeof F!=="function"&&F.setInterval?Ae.call(A,F):AM.merge(A,F)}return A},inArray:function(F,A){if(A.indexOf){return A.indexOf(F)}for(var J=0,G=A.length;J<G;J++){if(A[J]===F){return J}}return -1},merge:function(F,A){var K=F.length,G=0;if(typeof A.length==="number"){for(var J=A.length;G<J;G++){F[K++]=A[G]}}else{for(;A[G]!==AD;){F[K++]=A[G++]}}F.length=K;return F},grep:function(F,A,L){for(var J=[],K=0,G=F.length;K<G;K++){!L!==!A(F[K],K)&&J.push(F[K])}return J},map:function(F,A,N){for(var K=[],L,G=0,J=F.length;G<J;G++){L=A(F[G],G,N);if(L!=null){K[K.length]=L}}return K.concat.apply([],K)},guid:1,proxy:function(F,A,G){if(arguments.length===2){if(typeof A==="string"){G=F;F=G[A];A=AD}else{if(A&&!AM.isFunction(A)){G=A;A=AD}}}if(!A&&F){A=function(){return F.apply(G||this,arguments)}}if(F){A.guid=F.guid=F.guid||A.guid||AM.guid++}return A},uaMatch:function(A){A=A.toLowerCase();A=/(webkit)[ \/]([\w.]+)/.exec(A)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(A)||/(msie) ([\w.]+)/.exec(A)||!/compatible/.test(A)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(A)||[];return{browser:A[1]||"",version:A[2]||"0"}},browser:{}});Ad=AM.uaMatch(Ad);if(Ad.browser){AM.browser[Ad.browser]=true;AM.browser.version=Ad.version}if(AM.browser.webkit){AM.browser.safari=true}if(BC){AM.inArray=function(F,A){return BC.call(A,F)}}AX=AM(AE);if(AE.addEventListener){Ah=function(){AE.removeEventListener("DOMContentLoaded",Ah,false);AM.ready()}}else{if(AE.attachEvent){Ah=function(){if(AE.readyState==="complete"){AE.detachEvent("onreadystatechange",Ah);AM.ready()}}}}(function(){AM.support={};var P=AE.documentElement,O=AE.createElement("script"),N=AE.createElement("div"),K="script"+Al();N.style.display="none";N.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var L=N.getElementsByTagName("*"),G=N.getElementsByTagName("a")[0];if(!(!L||!L.length||!G)){AM.support={leadingWhitespace:N.firstChild.nodeType===3,tbody:!N.getElementsByTagName("tbody").length,htmlSerialize:!!N.getElementsByTagName("link").length,style:/red/.test(G.getAttribute("style")),hrefNormalized:G.getAttribute("href")==="/a",opacity:/^0.55$/.test(G.style.opacity),cssFloat:!!G.style.cssFloat,checkOn:N.getElementsByTagName("input")[0].value==="on",optSelected:AE.createElement("select").appendChild(AE.createElement("option")).selected,parentNode:N.removeChild(N.appendChild(AE.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};O.type="text/javascript";try{O.appendChild(AE.createTextNode("window."+K+"=1;"))}catch(J){}P.insertBefore(O,P.firstChild);if(Au[K]){AM.support.scriptEval=true;delete Au[K]}try{delete O.test}catch(A){AM.support.deleteExpando=false}P.removeChild(O);if(N.attachEvent&&N.fireEvent){N.attachEvent("onclick",function F(){AM.support.noCloneEvent=false;N.detachEvent("onclick",F)});N.cloneNode(true).fireEvent("onclick")}N=AE.createElement("div");N.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";P=AE.createDocumentFragment();P.appendChild(N.firstChild);AM.support.checkClone=P.cloneNode(true).cloneNode(true).lastChild.checked;AM(function(){var Q=AE.createElement("div");Q.style.width=Q.style.paddingLeft="1px";AE.body.appendChild(Q);AM.boxModel=AM.support.boxModel=Q.offsetWidth===2;AE.body.removeChild(Q).style.display="none"});P=function(Q){var T=AE.createElement("div");Q="on"+Q;var R=Q in T;if(!R){T.setAttribute(Q,"return;");R=typeof T[Q]==="function"}return R};AM.support.submitBubbles=P("submit");AM.support.changeBubbles=P("change");P=O=N=L=G=null}})();AM.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var An="jQuery"+Al(),E=0,Ay={};AM.extend({cache:{},expando:An,noData:{embed:true,object:true,applet:true},data:function(F,A,K){if(!(F.nodeName&&AM.noData[F.nodeName.toLowerCase()])){F=F==Au?Ay:F;var G=F[An],J=AM.cache;if(!G&&typeof A==="string"&&K===AD){return null}G||(G=++E);if(typeof A==="object"){F[An]=G;J[G]=AM.extend(true,{},A)}else{if(!J[G]){F[An]=G;J[G]={}}}F=J[G];if(K!==AD){F[A]=K}return typeof A==="string"?F[A]:F}},removeData:function(F,A){if(!(F.nodeName&&AM.noData[F.nodeName.toLowerCase()])){F=F==Au?Ay:F;var K=F[An],G=AM.cache,J=G[K];if(A){if(J){delete J[A];AM.isEmptyObject(J)&&AM.removeData(F)}}else{if(AM.support.deleteExpando){delete F[AM.expando]}else{F.removeAttribute&&F.removeAttribute(AM.expando)}delete G[K]}}}});AM.fn.extend({data:function(F,A){if(typeof F==="undefined"&&this.length){return AM.data(this[0])}else{if(typeof F==="object"){return this.each(function(){AM.data(this,F)})}}var J=F.split(".");J[1]=J[1]?"."+J[1]:"";if(A===AD){var G=this.triggerHandler("getData"+J[1]+"!",[J[0]]);if(G===AD&&this.length){G=AM.data(this[0],F)}return G===AD&&J[1]?this.data(J[0]):G}else{return this.trigger("setData"+J[1]+"!",[J[0],A]).each(function(){AM.data(this,F,A)})}},removeData:function(A){return this.each(function(){AM.removeData(this,A)})}});AM.extend({queue:function(F,A,J){if(F){A=(A||"fx")+"queue";var G=AM.data(F,A);if(!J){return G||[]}if(!G||AM.isArray(J)){G=AM.data(F,A,AM.makeArray(J))}else{G.push(J)}return G}},dequeue:function(F,A){A=A||"fx";var J=AM.queue(F,A),G=J.shift();if(G==="inprogress"){G=J.shift()}if(G){A==="fx"&&J.unshift("inprogress");G.call(F,function(){AM.dequeue(F,A)})}}});AM.fn.extend({queue:function(F,A){if(typeof F!=="string"){A=F;F="fx"}if(A===AD){return AM.queue(this[0],F)}return this.each(function(){var G=AM.queue(this,F,A);F==="fx"&&G[0]!=="inprogress"&&AM.dequeue(this,F)})},dequeue:function(A){return this.each(function(){AM.dequeue(this,A)})},delay:function(F,A){F=AM.fx?AM.fx.speeds[F]||F:F;A=A||"fx";return this.queue(A,function(){var G=this;setTimeout(function(){AM.dequeue(G,A)},F)})},clearQueue:function(A){return this.queue(A||"fx",[])}});var BI=/[\n\t]/g,AG=/\s+/,BE=/\r/g,As=/href|src|style/,A0=/(button|input)/i,Ac=/(button|input|object|select|textarea)/i,AF=/^(a|area)$/i,A4=/radio|checkbox/;AM.fn.extend({attr:function(F,A){return AU(this,F,A,true,AM.attr)},removeAttr:function(A){return this.each(function(){AM.attr(this,A,"");this.nodeType===1&&this.removeAttribute(A)})},addClass:function(P){if(AM.isFunction(P)){return this.each(function(R){var Q=AM(this);Q.addClass(P.call(this,R,Q.attr("class")))})}if(P&&typeof P==="string"){for(var O=(P||"").split(AG),N=0,K=this.length;N<K;N++){var L=this[N];if(L.nodeType===1){if(L.className){for(var G=" "+L.className+" ",J=L.className,A=0,F=O.length;A<F;A++){if(G.indexOf(" "+O[A]+" ")<0){J+=" "+O[A]}}L.className=AM.trim(J)}else{L.className=P}}}}return this},removeClass:function(F){if(AM.isFunction(F)){return this.each(function(P){var Q=AM(this);Q.removeClass(F.call(this,P,Q.attr("class")))})}if(F&&typeof F==="string"||F===AD){for(var A=(F||"").split(AG),O=0,K=this.length;O<K;O++){var L=this[O];if(L.nodeType===1&&L.className){if(F){for(var G=(" "+L.className+" ").replace(BI," "),J=0,N=A.length;J<N;J++){G=G.replace(" "+A[J]+" "," ")}L.className=AM.trim(G)}else{L.className=""}}}}return this},toggleClass:function(F,A){var J=typeof F,G=typeof A==="boolean";if(AM.isFunction(F)){return this.each(function(L){var K=AM(this);K.toggleClass(F.call(this,L,K.attr("class"),A),A)})}return this.each(function(){if(J==="string"){for(var O,L=0,N=AM(this),P=A,K=F.split(AG);O=K[L++];){P=G?P:!N.hasClass(O);N[P?"addClass":"removeClass"](O)}}else{if(J==="undefined"||J==="boolean"){this.className&&AM.data(this,"__className__",this.className);this.className=this.className||F===false?"":AM.data(this,"__className__")||""}}})},hasClass:function(F){F=" "+F+" ";for(var A=0,G=this.length;A<G;A++){if((" "+this[A].className+" ").replace(BI," ").indexOf(F)>-1){return true}}return false},val:function(F){if(F===AD){var A=this[0];if(A){if(AM.nodeName(A,"option")){return(A.attributes.value||{}).specified?A.value:A.text}if(AM.nodeName(A,"select")){var O=A.selectedIndex,K=[],L=A.options;A=A.type==="select-one";if(O<0){return null}var G=A?O:0;for(O=A?O+1:L.length;G<O;G++){var J=L[G];if(J.selected){F=AM(J).val();if(A){return F}K.push(F)}}return K}if(A4.test(A.type)&&!AM.support.checkOn){return A.getAttribute("value")===null?"on":A.value}return(A.value||"").replace(BE,"")}return AD}var N=AM.isFunction(F);return this.each(function(P){var T=AM(this),R=F;if(this.nodeType===1){if(N){R=F.call(this,P,T.val())}if(typeof R==="number"){R+=""}if(AM.isArray(R)&&A4.test(this.type)){this.checked=AM.inArray(T.val(),R)>=0}else{if(AM.nodeName(this,"select")){var Q=AM.makeArray(R);AM("option",this).each(function(){this.selected=AM.inArray(AM(this).val(),Q)>=0});if(!Q.length){this.selectedIndex=-1}}else{this.value=R}}}})}});AM.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(F,A,L,J){if(!F||F.nodeType===3||F.nodeType===8){return AD}if(J&&A in AM.attrFn){return AM(F)[A](L)}J=F.nodeType!==1||!AM.isXMLDoc(F);var K=L!==AD;A=J&&AM.props[A]||A;if(F.nodeType===1){var G=As.test(A);if(A in F&&J&&!G){if(K){A==="type"&&A0.test(F.nodeName)&&F.parentNode&&AM.error("type property can't be changed");F[A]=L}if(AM.nodeName(F,"form")&&F.getAttributeNode(A)){return F.getAttributeNode(A).nodeValue}if(A==="tabIndex"){return(A=F.getAttributeNode("tabIndex"))&&A.specified?A.value:Ac.test(F.nodeName)||AF.test(F.nodeName)&&F.href?0:AD}return F[A]}if(!AM.support.style&&J&&A==="style"){if(K){F.style.cssText=""+L}return F.style.cssText}K&&F.setAttribute(A,""+L);F=!AM.support.hrefNormalized&&J&&G?F.getAttribute(A,2):F.getAttribute(A);return F===null?AD:F}return AM.style(F,A,L)}});var Af=/\.(.*)$/,m=function(A){return A.replace(/[^\w\s\.\|`]/g,function(F){return"\\"+F})};AM.event={add:function(T,R,P,N){if(!(T.nodeType===3||T.nodeType===8)){if(T.setInterval&&T!==Au&&!T.frameElement){T=Au}var O,K;if(P.handler){O=P;P=O.handler}if(!P.guid){P.guid=AM.guid++}if(K=AM.data(T)){var L=K.events=K.events||{},F=K.handle;if(!F){K.handle=F=function(){return typeof AM!=="undefined"&&!AM.event.triggered?AM.event.handle.apply(F.elem,arguments):AD}}F.elem=T;R=R.split(" ");for(var J,G=0,A;J=R[G++];){K=O?AM.extend({},O):{handler:P,data:N};if(J.indexOf(".")>-1){A=J.split(".");J=A.shift();K.namespace=A.slice(0).sort().join(".")}else{A=[];K.namespace=""}K.type=J;K.guid=P.guid;var V=L[J],Q=AM.event.special[J]||{};if(!V){V=L[J]=[];if(!Q.setup||Q.setup.call(T,N,A,F)===false){if(T.addEventListener){T.addEventListener(J,F,false)}else{T.attachEvent&&T.attachEvent("on"+J,F)}}}if(Q.add){Q.add.call(T,K);if(!K.handler.guid){K.handler.guid=P.guid}}V.push(K);AM.event.global[J]=true}T=null}}},global:{},remove:function(W,V,R,P){if(!(W.nodeType===3||W.nodeType===8)){var Q,N=0,O,J,L,K,A,X,T=AM.data(W),F=T&&T.events;if(T&&F){if(V&&V.type){R=V.handler;V=V.type}if(!V||typeof V==="string"&&V.charAt(0)==="."){V=V||"";for(Q in F){AM.event.remove(W,Q+V)}}else{for(V=V.split(" ");Q=V[N++];){K=Q;O=Q.indexOf(".")<0;J=[];if(!O){J=Q.split(".");Q=J.shift();L=new RegExp("(^|\\.)"+AM.map(J.slice(0).sort(),m).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=F[Q]){if(R){K=AM.event.special[Q]||{};for(G=P||0;G<A.length;G++){X=A[G];if(R.guid===X.guid){if(O||L.test(X.namespace)){P==null&&A.splice(G--,1);K.remove&&K.remove.call(W,X)}if(P!=null){break}}}if(A.length===0||P!=null&&A.length===1){if(!K.teardown||K.teardown.call(W,J)===false){Am(W,Q,T.handle)}delete F[Q]}}else{for(var G=0;G<A.length;G++){X=A[G];if(O||L.test(X.namespace)){AM.event.remove(W,K,X.handler,G);A.splice(G--,1)}}}}}if(AM.isEmptyObject(F)){if(V=T.handle){V.elem=null}delete T.events;delete T.handle;AM.isEmptyObject(T)&&AM.removeData(W)}}}}},trigger:function(Q,P,O,L){var N=Q.type||Q;if(!L){Q=typeof Q==="object"?Q[An]?Q:AM.extend(AM.Event(N),Q):AM.Event(N);if(N.indexOf("!")>=0){Q.type=N=N.slice(0,-1);Q.exclusive=true}if(!O){Q.stopPropagation();AM.event.global[N]&&AM.each(AM.cache,function(){this.events&&this.events[N]&&AM.event.trigger(Q,P,this.handle.elem)})}if(!O||O.nodeType===3||O.nodeType===8){return AD}Q.result=AD;Q.target=O;P=AM.makeArray(P);P.unshift(Q)}Q.currentTarget=O;(L=AM.data(O,"handle"))&&L.apply(O,P);L=O.parentNode||O.ownerDocument;try{if(!(O&&O.nodeName&&AM.noData[O.nodeName.toLowerCase()])){if(O["on"+N]&&O["on"+N].apply(O,P)===false){Q.result=false}}}catch(J){}if(!Q.isPropagationStopped()&&L){AM.event.trigger(Q,P,L,true)}else{if(!Q.isDefaultPrevented()){L=Q.target;var K,A=AM.nodeName(L,"a")&&N==="click",G=AM.event.special[N]||{};if((!G._default||G._default.call(O,Q)===false)&&!A&&!(L&&L.nodeName&&AM.noData[L.nodeName.toLowerCase()])){try{if(L[N]){if(K=L["on"+N]){L["on"+N]=null}AM.event.triggered=true;L[N]()}}catch(F){}if(K){L["on"+N]=K}AM.event.triggered=false}}}},handle:function(F){var A,N,K,L;F=arguments[0]=AM.event.fix(F||Au.event);F.currentTarget=this;A=F.type.indexOf(".")<0&&!F.exclusive;if(!A){N=F.type.split(".");F.type=N.shift();K=new RegExp("(^|\\.)"+N.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}L=AM.data(this,"events");N=L[F.type];if(L&&N){N=N.slice(0);L=0;for(var G=N.length;L<G;L++){var J=N[L];if(A||K.test(J.namespace)){F.handler=J.handler;F.data=J.data;F.handleObj=J;J=J.handler.apply(this,arguments);if(J!==AD){F.result=J;if(J===false){F.preventDefault();F.stopPropagation()}}if(F.isImmediatePropagationStopped()){break}}}}return F.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(F){if(F[An]){return F}var A=F;F=AM.Event(A);for(var J=this.props.length,G;J;){G=this.props[--J];F[G]=A[G]}if(!F.target){F.target=F.srcElement||AE}if(F.target.nodeType===3){F.target=F.target.parentNode}if(!F.relatedTarget&&F.fromElement){F.relatedTarget=F.fromElement===F.target?F.toElement:F.fromElement}if(F.pageX==null&&F.clientX!=null){A=AE.documentElement;J=AE.body;F.pageX=F.clientX+(A&&A.scrollLeft||J&&J.scrollLeft||0)-(A&&A.clientLeft||J&&J.clientLeft||0);F.pageY=F.clientY+(A&&A.scrollTop||J&&J.scrollTop||0)-(A&&A.clientTop||J&&J.clientTop||0)}if(!F.which&&(F.charCode||F.charCode===0?F.charCode:F.keyCode)){F.which=F.charCode||F.keyCode}if(!F.metaKey&&F.ctrlKey){F.metaKey=F.ctrlKey}if(!F.which&&F.button!==AD){F.which=F.button&1?1:F.button&2?3:F.button&4?2:0}return F},guid:100000000,proxy:AM.proxy,special:{ready:{setup:AM.bindReady,teardown:AM.noop},live:{add:function(A){AM.event.add(this,A.origType,AM.extend({},A,{handler:AL}))},remove:function(F){var A=true,G=F.origType.replace(Af,"");AM.each(AM.data(this,"events").live||[],function(){if(G===this.origType.replace(Af,"")){return A=false}});A&&AM.event.remove(this,F.origType,AL)}},beforeunload:{setup:function(F,A,G){if(this.setInterval){this.onbeforeunload=G}return false},teardown:function(F,A){if(this.onbeforeunload===A){this.onbeforeunload=null}}}}};var Am=AE.removeEventListener?function(F,A,G){F.removeEventListener(A,G,false)}:function(F,A,G){F.detachEvent("on"+A,G)};AM.Event=function(A){if(!this.preventDefault){return new AM.Event(A)}if(A&&A.type){this.originalEvent=A;this.type=A.type}else{this.type=A}this.timeStamp=Al();this[An]=true};AM.Event.prototype={preventDefault:function(){this.isDefaultPrevented=AR;var A=this.originalEvent;if(A){A.preventDefault&&A.preventDefault();A.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=AR;var A=this.originalEvent;if(A){A.stopPropagation&&A.stopPropagation();A.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=AR;this.stopPropagation()},isDefaultPrevented:AT,isPropagationStopped:AT,isImmediatePropagationStopped:AT};var AJ=function(F){var A=F.relatedTarget;try{for(;A&&A!==this;){A=A.parentNode}if(A!==this){F.type=F.data;AM.event.handle.apply(this,arguments)}}catch(G){}},t=function(A){A.type=A.data;AM.event.handle.apply(this,arguments)};AM.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(F,A){AM.event.special[F]={setup:function(G){AM.event.add(this,A,G&&G.selector?t:AJ,F)},teardown:function(G){AM.event.remove(this,A,G&&G.selector?t:AJ)}}});if(!AM.support.submitBubbles){AM.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!=="form"){AM.event.add(this,"click.specialSubmit",function(F){var A=F.target,G=A.type;if((G==="submit"||G==="image")&&AM(A).closest("form").length){return Aq("submit",this,arguments)}});AM.event.add(this,"keypress.specialSubmit",function(F){var A=F.target,G=A.type;if((G==="text"||G==="password")&&AM(A).closest("form").length&&F.keyCode===13){return Aq("submit",this,arguments)}})}else{return false}},teardown:function(){AM.event.remove(this,".specialSubmit")}}}if(!AM.support.changeBubbles){var n=/textarea|input|select/i,I,U=function(F){var A=F.type,G=F.value;if(A==="radio"||A==="checkbox"){G=F.checked}else{if(A==="select-multiple"){G=F.selectedIndex>-1?AM.map(F.options,function(J){return J.selected}).join("-"):""}else{if(F.nodeName.toLowerCase()==="select"){G=F.selectedIndex}}}return G},BH=function(F,A){var K=F.target,G,J;if(!(!n.test(K.nodeName)||K.readOnly)){G=AM.data(K,"_change_data");J=U(K);if(F.type!=="focusout"||K.type!=="radio"){AM.data(K,"_change_data",J)}if(!(G===AD||J===G)){if(G!=null||J){F.type="change";return AM.event.trigger(F,A,K)}}}};AM.event.special.change={filters:{focusout:BH,click:function(F){var A=F.target,G=A.type;if(G==="radio"||G==="checkbox"||A.nodeName.toLowerCase()==="select"){return BH.call(this,F)}},keydown:function(F){var A=F.target,G=A.type;if(F.keyCode===13&&A.nodeName.toLowerCase()!=="textarea"||F.keyCode===32&&(G==="checkbox"||G==="radio")||G==="select-multiple"){return BH.call(this,F)}},beforeactivate:function(A){A=A.target;AM.data(A,"_change_data",U(A))}},setup:function(){if(this.type==="file"){return false}for(var A in I){AM.event.add(this,A+".specialChange",I[A])}return n.test(this.nodeName)},teardown:function(){AM.event.remove(this,".specialChange");return n.test(this.nodeName)}};I=AM.event.special.change.filters}AE.addEventListener&&AM.each({focus:"focusin",blur:"focusout"},function(F,A){function G(J){J=AM.event.fix(J);J.type=A;return AM.event.handle.call(this,J)}AM.event.special[A]={setup:function(){this.addEventListener(F,G,true)},teardown:function(){this.removeEventListener(F,G,true)}}});AM.each(["bind","one"],function(F,A){AM.fn[A]=function(O,K,L){if(typeof O==="object"){for(var G in O){this[A](G,K,O[G],L)}return this}if(AM.isFunction(K)){L=K;K=AD}var J=A==="one"?AM.proxy(L,function(P){AM(this).unbind(P,J);return L.apply(this,arguments)}):L;if(O==="unload"&&A!=="one"){this.one(O,K,L)}else{G=0;for(var N=this.length;G<N;G++){AM.event.add(this[G],O,J,K)}}return this}});AM.fn.extend({unbind:function(F,A){if(typeof F==="object"&&!F.preventDefault){for(var J in F){this.unbind(J,F[J])}}else{J=0;for(var G=this.length;J<G;J++){AM.event.remove(this[J],F,A)}}return this},delegate:function(F,A,J,G){return this.live(A,J,G,F)},undelegate:function(F,A,G){return arguments.length===0?this.unbind("live"):this.die(A,null,G,F)},trigger:function(F,A){return this.each(function(){AM.event.trigger(F,A,this)})},triggerHandler:function(F,A){if(this[0]){F=AM.Event(F);F.preventDefault();F.stopPropagation();AM.event.trigger(F,A,this[0]);return F.result}},toggle:function(F){for(var A=arguments,G=1;G<A.length;){AM.proxy(F,A[G++])}return this.click(AM.proxy(F,function(J){var K=(AM.data(this,"lastToggle"+F.guid)||0)%G;AM.data(this,"lastToggle"+F.guid,K+1);J.preventDefault();return A[K].apply(this,arguments)||false}))},hover:function(F,A){return this.mouseenter(F).mouseleave(A||F)}});var BL={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};AM.each(["live","die"],function(F,A){AM.fn[A]=function(R,P,Q,N){var O,J=0,L,K,G=N||this.selector,T=N?this:AM(this.context);if(AM.isFunction(P)){Q=P;P=AD}for(R=(R||"").split(" ");(O=R[J++])!=null;){N=Af.exec(O);L="";if(N){L=N[0];O=O.replace(Af,"")}if(O==="hover"){R.push("mouseenter"+L,"mouseleave"+L)}else{K=O;if(O==="focus"||O==="blur"){R.push(BL[O]+L);O+=L}else{O=(BL[O]||O)+L}A==="live"?T.each(function(){AM.event.add(this,x(O,G),{data:P,selector:G,handler:Q,origType:O,origHandler:Q,preType:K})}):T.unbind(x(O,G),Q)}}return this}});AM.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(F,A){AM.fn[A]=function(G){return G?this.bind(A,G):this.trigger(A)};if(AM.attrFn){AM.attrFn[A]=true}});Au.attachEvent&&!Au.addEventListener&&Au.attachEvent("onunload",function(){for(var F in AM.cache){if(AM.cache[F].handle){try{AM.event.remove(AM.cache[F].handle.elem)}catch(A){}}}});(function(){function Z(BQ){for(var BP="",Ab,Aa=0;BQ[Aa];Aa++){Ab=BQ[Aa];if(Ab.nodeType===3||Ab.nodeType===4){BP+=Ab.nodeValue}else{if(Ab.nodeType!==8){BP+=Z(Ab.childNodes)}}}return BP}function Y(BS,BR,BQ,BP,Aa,Ab){Aa=0;for(var BU=BP.length;Aa<BU;Aa++){var BV=BP[Aa];if(BV){BV=BV[BS];for(var BT=false;BV;){if(BV.sizcache===BQ){BT=BP[BV.sizset];break}if(BV.nodeType===1&&!Ab){BV.sizcache=BQ;BV.sizset=Aa}if(BV.nodeName.toLowerCase()===BR){BT=BV;break}BV=BV[BS]}BP[Aa]=BT}}}function X(BS,BR,BQ,BP,Aa,Ab){Aa=0;for(var BU=BP.length;Aa<BU;Aa++){var BV=BP[Aa];if(BV){BV=BV[BS];for(var BT=false;BV;){if(BV.sizcache===BQ){BT=BP[BV.sizset];break}if(BV.nodeType===1){if(!Ab){BV.sizcache=BQ;BV.sizset=Aa}if(typeof BR!=="string"){if(BV===BR){BT=true;break}}else{if(Q.filter(BR,[BV]).length>0){BT=BV;break}}}BV=BV[BS]}BP[Aa]=BT}}}var V=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,W=0,R=Object.prototype.toString,T=false,O=true;[0,0].sort(function(){O=false;return 0});var Q=function(BU,BT,BR,BQ){BR=BR||[];var Ab=BT=BT||AE;if(BT.nodeType!==1&&BT.nodeType!==9){return[]}if(!BU||typeof BU!=="string"){return BR}for(var BP=[],BZ,Ba,BW,BS,BY=true,BV=F(BT),BX=BU;(V.exec(""),BZ=V.exec(BX))!==null;){BX=BZ[3];BP.push(BZ[1]);if(BZ[2]){BS=BZ[3];break}}if(BP.length>1&&L.exec(BU)){if(BP.length===2&&P.relative[BP[0]]){Ba=w(BP[0]+BP[1],BT)}else{for(Ba=P.relative[BP[0]]?[BT]:Q(BP.shift(),BT);BP.length;){BU=BP.shift();if(P.relative[BU]){BU+=BP.shift()}Ba=w(BU,Ba)}}}else{if(!BQ&&BP.length>1&&BT.nodeType===9&&!BV&&P.match.ID.test(BP[0])&&!P.match.ID.test(BP[BP.length-1])){BZ=Q.find(BP.shift(),BT,BV);BT=BZ.expr?Q.filter(BZ.expr,BZ.set)[0]:BZ.set[0]}if(BT){BZ=BQ?{expr:BP.pop(),set:A(BQ)}:Q.find(BP.pop(),BP.length===1&&(BP[0]==="~"||BP[0]==="+")&&BT.parentNode?BT.parentNode:BT,BV);Ba=BZ.expr?Q.filter(BZ.expr,BZ.set):BZ.set;if(BP.length>0){BW=A(Ba)}else{BY=false}for(;BP.length;){var Aa=BP.pop();BZ=Aa;if(P.relative[Aa]){BZ=BP.pop()}else{Aa=""}if(BZ==null){BZ=BT}P.relative[Aa](BW,BZ,BV)}}else{BW=[]}}BW||(BW=Ba);BW||Q.error(Aa||BU);if(R.call(BW)==="[object Array]"){if(BY){if(BT&&BT.nodeType===1){for(BU=0;BW[BU]!=null;BU++){if(BW[BU]&&(BW[BU]===true||BW[BU].nodeType===1&&J(BT,BW[BU]))){BR.push(Ba[BU])}}}else{for(BU=0;BW[BU]!=null;BU++){BW[BU]&&BW[BU].nodeType===1&&BR.push(Ba[BU])}}}else{BR.push.apply(BR,BW)}}else{A(BW,BR)}if(BS){Q(BS,Ab,BR,BQ);Q.uniqueSort(BR)}return BR};Q.uniqueSort=function(Ab){if(N){T=O;Ab.sort(N);if(T){for(var Aa=1;Aa<Ab.length;Aa++){Ab[Aa]===Ab[Aa-1]&&Ab.splice(Aa--,1)}}}return Ab};Q.matches=function(Ab,Aa){return Q(Ab,null,null,Aa)};Q.find=function(BS,BR,BQ){var BP,Aa;if(!BS){return[]}for(var Ab=0,BU=P.order.length;Ab<BU;Ab++){var BV=P.order[Ab];if(Aa=P.leftMatch[BV].exec(BS)){var BT=Aa[1];Aa.splice(1,1);if(BT.substr(BT.length-1)!=="\\"){Aa[1]=(Aa[1]||"").replace(/\\/g,"");BP=P.find[BV](Aa,BR,BQ);if(BP!=null){BS=BS.replace(P.match[BV],"");break}}}}BP||(BP=BR.getElementsByTagName("*"));return{set:BP,expr:BS}};Q.filter=function(BV,BU,BS,BQ){for(var Ab=BV,BP=[],Bb=BU,Bc,BY,BT=BU&&BU[0]&&F(BU[0]);BV&&BU.length;){for(var Ba in P.filter){if((Bc=P.leftMatch[Ba].exec(BV))!=null&&Bc[2]){var BW=P.filter[Ba],BZ,Aa;Aa=Bc[1];BY=false;Bc.splice(1,1);if(Aa.substr(Aa.length-1)!=="\\"){if(Bb===BP){BP=[]}if(P.preFilter[Ba]){if(Bc=P.preFilter[Ba](Bc,Bb,BS,BP,BQ,BT)){if(Bc===true){continue}}else{BY=BZ=true}}if(Bc){for(var BR=0;(Aa=Bb[BR])!=null;BR++){if(Aa){BZ=BW(Aa,Bc,BR,Bb);var BX=BQ^!!BZ;if(BS&&BZ!=null){if(BX){BY=true}else{Bb[BR]=false}}else{if(BX){BP.push(Aa);BY=true}}}}}if(BZ!==AD){BS||(Bb=BP);BV=BV.replace(P.match[Ba],"");if(!BY){return[]}break}}}}if(BV===Ab){if(BY==null){Q.error(BV)}else{break}}Ab=BV}return Bb};Q.error=function(Aa){throw"Syntax error, unrecognized expression: "+Aa};var P=Q.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(Aa){return Aa.getAttribute("href")}},relative:{"+":function(BQ,BP){var Ab=typeof BP==="string",Aa=Ab&&!/\W/.test(BP);Ab=Ab&&!Aa;if(Aa){BP=BP.toLowerCase()}Aa=0;for(var BR=BQ.length,BS;Aa<BR;Aa++){if(BS=BQ[Aa]){for(;(BS=BS.previousSibling)&&BS.nodeType!==1;){}BQ[Aa]=Ab||BS&&BS.nodeName.toLowerCase()===BP?BS||false:BS===BP}}Ab&&Q.filter(BP,BQ,true)},">":function(BQ,BP){var Ab=typeof BP==="string";if(Ab&&!/\W/.test(BP)){BP=BP.toLowerCase();for(var Aa=0,BR=BQ.length;Aa<BR;Aa++){var BS=BQ[Aa];if(BS){Ab=BS.parentNode;BQ[Aa]=Ab.nodeName.toLowerCase()===BP?Ab:false}}}else{Aa=0;for(BR=BQ.length;Aa<BR;Aa++){if(BS=BQ[Aa]){BQ[Aa]=Ab?BS.parentNode:BS.parentNode===BP}}Ab&&Q.filter(BP,BQ,true)}},"":function(BQ,BP,Ab){var Aa=W++,BR=X;if(typeof BP==="string"&&!/\W/.test(BP)){var BS=BP=BP.toLowerCase();BR=Y}BR("parentNode",BP,Aa,BQ,BS,Ab)},"~":function(BQ,BP,Ab){var Aa=W++,BR=X;if(typeof BP==="string"&&!/\W/.test(BP)){var BS=BP=BP.toLowerCase();BR=Y}BR("previousSibling",BP,Aa,BQ,BS,Ab)}},find:{ID:function(BP,Ab,Aa){if(typeof Ab.getElementById!=="undefined"&&!Aa){return(BP=Ab.getElementById(BP[1]))?[BP]:[]}},NAME:function(BQ,BP){if(typeof BP.getElementsByName!=="undefined"){var Ab=[];BP=BP.getElementsByName(BQ[1]);for(var Aa=0,BR=BP.length;Aa<BR;Aa++){BP[Aa].getAttribute("name")===BQ[1]&&Ab.push(BP[Aa])}return Ab.length===0?null:Ab}},TAG:function(Ab,Aa){return Aa.getElementsByTagName(Ab[1])}},preFilter:{CLASS:function(BR,BQ,Ab,Aa,BS,BT){BR=" "+BR[1].replace(/\\/g,"")+" ";if(BT){return BR}BT=0;for(var BP;(BP=BQ[BT])!=null;BT++){if(BP){if(BS^(BP.className&&(" "+BP.className+" ").replace(/[\t\n]/g," ").indexOf(BR)>=0)){Ab||Aa.push(BP)}else{if(Ab){BQ[BT]=false}}}}return false},ID:function(Aa){return Aa[1].replace(/\\/g,"")},TAG:function(Aa){return Aa[1].toLowerCase()},CHILD:function(Ab){if(Ab[1]==="nth"){var Aa=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(Ab[2]==="even"&&"2n"||Ab[2]==="odd"&&"2n+1"||!/\D/.test(Ab[2])&&"0n+"+Ab[2]||Ab[2]);Ab[2]=Aa[1]+(Aa[2]||1)-0;Ab[3]=Aa[3]-0}Ab[0]=W++;return Ab},ATTR:function(BQ,BP,Ab,Aa,BR,BS){BP=BQ[1].replace(/\\/g,"");if(!BS&&P.attrMap[BP]){BQ[1]=P.attrMap[BP]}if(BQ[2]==="~="){BQ[4]=" "+BQ[4]+" "}return BQ},PSEUDO:function(BQ,BP,Ab,Aa,BR){if(BQ[1]==="not"){if((V.exec(BQ[3])||"").length>1||/^\w/.test(BQ[3])){BQ[3]=Q(BQ[3],null,null,BP)}else{BQ=Q.filter(BQ[3],BP,Ab,true^BR);Ab||Aa.push.apply(Aa,BQ);return false}}else{if(P.match.POS.test(BQ[0])||P.match.CHILD.test(BQ[0])){return true}}return BQ},POS:function(Aa){Aa.unshift(true);return Aa}},filters:{enabled:function(Aa){return Aa.disabled===false&&Aa.type!=="hidden"},disabled:function(Aa){return Aa.disabled===true},checked:function(Aa){return Aa.checked===true},selected:function(Aa){return Aa.selected===true},parent:function(Aa){return !!Aa.firstChild},empty:function(Aa){return !Aa.firstChild},has:function(BP,Ab,Aa){return !!Q(Aa[3],BP).length},header:function(Aa){return/h\d/i.test(Aa.nodeName)},text:function(Aa){return"text"===Aa.type},radio:function(Aa){return"radio"===Aa.type},checkbox:function(Aa){return"checkbox"===Aa.type},file:function(Aa){return"file"===Aa.type},password:function(Aa){return"password"===Aa.type},submit:function(Aa){return"submit"===Aa.type},image:function(Aa){return"image"===Aa.type},reset:function(Aa){return"reset"===Aa.type},button:function(Aa){return"button"===Aa.type||Aa.nodeName.toLowerCase()==="button"},input:function(Aa){return/input|select|textarea|button/i.test(Aa.nodeName)}},setFilters:{first:function(Ab,Aa){return Aa===0},last:function(BQ,BP,Ab,Aa){return BP===Aa.length-1},even:function(Ab,Aa){return Aa%2===0},odd:function(Ab,Aa){return Aa%2===1},lt:function(BP,Ab,Aa){return Ab<Aa[3]-0},gt:function(BP,Ab,Aa){return Ab>Aa[3]-0},nth:function(BP,Ab,Aa){return Aa[3]-0===Ab},eq:function(BP,Ab,Aa){return Aa[3]-0===Ab}},filter:{PSEUDO:function(BQ,BP,Ab,Aa){var BR=BP[1],BS=P.filters[BR];if(BS){return BS(BQ,Ab,BP,Aa)}else{if(BR==="contains"){return(BQ.textContent||BQ.innerText||Z([BQ])||"").indexOf(BP[3])>=0}else{if(BR==="not"){BP=BP[3];Ab=0;for(Aa=BP.length;Ab<Aa;Ab++){if(BP[Ab]===BQ){return false}}return true}else{Q.error("Syntax error, unrecognized expression: "+BR)}}}},CHILD:function(BR,BQ){var Ab=BQ[1],Aa=BR;switch(Ab){case"only":case"first":for(;Aa=Aa.previousSibling;){if(Aa.nodeType===1){return false}}if(Ab==="first"){return true}Aa=BR;case"last":for(;Aa=Aa.nextSibling;){if(Aa.nodeType===1){return false}}return true;case"nth":Ab=BQ[2];var BS=BQ[3];if(Ab===1&&BS===0){return true}BQ=BQ[0];var BT=BR.parentNode;if(BT&&(BT.sizcache!==BQ||!BR.nodeIndex)){var BP=0;for(Aa=BT.firstChild;Aa;Aa=Aa.nextSibling){if(Aa.nodeType===1){Aa.nodeIndex=++BP}}BT.sizcache=BQ}BR=BR.nodeIndex-BS;return Ab===0?BR===0:BR%Ab===0&&BR/Ab>=0}},ID:function(Ab,Aa){return Ab.nodeType===1&&Ab.getAttribute("id")===Aa},TAG:function(Ab,Aa){return Aa==="*"&&Ab.nodeType===1||Ab.nodeName.toLowerCase()===Aa},CLASS:function(Ab,Aa){return(" "+(Ab.className||Ab.getAttribute("class"))+" ").indexOf(Aa)>-1},ATTR:function(BQ,BP){var Ab=BP[1];BQ=P.attrHandle[Ab]?P.attrHandle[Ab](BQ):BQ[Ab]!=null?BQ[Ab]:BQ.getAttribute(Ab);Ab=BQ+"";var Aa=BP[2];BP=BP[4];return BQ==null?Aa==="!=":Aa==="="?Ab===BP:Aa==="*="?Ab.indexOf(BP)>=0:Aa==="~="?(" "+Ab+" ").indexOf(BP)>=0:!BP?Ab&&BQ!==false:Aa==="!="?Ab!==BP:Aa==="^="?Ab.indexOf(BP)===0:Aa==="$="?Ab.substr(Ab.length-BP.length)===BP:Aa==="|="?Ab===BP||Ab.substr(0,BP.length+1)===BP+"-":false},POS:function(BQ,BP,Ab,Aa){var BR=P.setFilters[BP[2]];if(BR){return BR(BQ,Ab,BP,Aa)}}}},L=P.match.POS;for(var G in P.match){P.match[G]=new RegExp(P.match[G].source+/(?![^\[]*\])(?![^\(]*\))/.source);P.leftMatch[G]=new RegExp(/(^(?:.|\r|\n)*?)/.source+P.match[G].source.replace(/\\(\d+)/g,function(Ab,Aa){return"\\"+(Aa-0+1)}))}var A=function(Ab,Aa){Ab=Array.prototype.slice.call(Ab,0);if(Aa){Aa.push.apply(Aa,Ab);return Aa}return Ab};try{Array.prototype.slice.call(AE.documentElement.childNodes,0)}catch(K){A=function(BQ,BP){BP=BP||[];if(R.call(BQ)==="[object Array]"){Array.prototype.push.apply(BP,BQ)}else{if(typeof BQ.length==="number"){for(var Ab=0,Aa=BQ.length;Ab<Aa;Ab++){BP.push(BQ[Ab])}}else{for(Ab=0;BQ[Ab];Ab++){BP.push(BQ[Ab])}}}return BP}}var N;if(AE.documentElement.compareDocumentPosition){N=function(Ab,Aa){if(!Ab.compareDocumentPosition||!Aa.compareDocumentPosition){if(Ab==Aa){T=true}return Ab.compareDocumentPosition?-1:1}Ab=Ab.compareDocumentPosition(Aa)&4?-1:Ab===Aa?0:1;if(Ab===0){T=true}return Ab}}else{if("sourceIndex" in AE.documentElement){N=function(Ab,Aa){if(!Ab.sourceIndex||!Aa.sourceIndex){if(Ab==Aa){T=true}return Ab.sourceIndex?-1:1}Ab=Ab.sourceIndex-Aa.sourceIndex;if(Ab===0){T=true}return Ab}}else{if(AE.createRange){N=function(BQ,BP){if(!BQ.ownerDocument||!BP.ownerDocument){if(BQ==BP){T=true}return BQ.ownerDocument?-1:1}var Ab=BQ.ownerDocument.createRange(),Aa=BP.ownerDocument.createRange();Ab.setStart(BQ,0);Ab.setEnd(BQ,0);Aa.setStart(BP,0);Aa.setEnd(BP,0);BQ=Ab.compareBoundaryPoints(Range.START_TO_END,Aa);if(BQ===0){T=true}return BQ}}}}(function(){var BP=AE.createElement("div"),Ab="script"+(new Date).getTime();BP.innerHTML="<a name='"+Ab+"'/>";var Aa=AE.documentElement;Aa.insertBefore(BP,Aa.firstChild);if(AE.getElementById(Ab)){P.find.ID=function(BQ,BR,BS){if(typeof BR.getElementById!=="undefined"&&!BS){return(BR=BR.getElementById(BQ[1]))?BR.id===BQ[1]||typeof BR.getAttributeNode!=="undefined"&&BR.getAttributeNode("id").nodeValue===BQ[1]?[BR]:AD:[]}};P.filter.ID=function(BQ,BR){var BS=typeof BQ.getAttributeNode!=="undefined"&&BQ.getAttributeNode("id");return BQ.nodeType===1&&BS&&BS.nodeValue===BR}}Aa.removeChild(BP);Aa=BP=null})();(function(){var Aa=AE.createElement("div");Aa.appendChild(AE.createComment(""));if(Aa.getElementsByTagName("*").length>0){P.find.TAG=function(BQ,BP){BP=BP.getElementsByTagName(BQ[1]);if(BQ[1]==="*"){BQ=[];for(var Ab=0;BP[Ab];Ab++){BP[Ab].nodeType===1&&BQ.push(BP[Ab])}BP=BQ}return BP}}Aa.innerHTML="<a href='#'></a>";if(Aa.firstChild&&typeof Aa.firstChild.getAttribute!=="undefined"&&Aa.firstChild.getAttribute("href")!=="#"){P.attrHandle.href=function(Ab){return Ab.getAttribute("href",2)}}Aa=null})();AE.querySelectorAll&&function(){var BP=Q,Ab=AE.createElement("div");Ab.innerHTML="<p class='TEST'></p>";if(!(Ab.querySelectorAll&&Ab.querySelectorAll(".TEST").length===0)){Q=function(BQ,BT,BU,BR){BT=BT||AE;if(!BR&&BT.nodeType===9&&!F(BT)){try{return A(BT.querySelectorAll(BQ),BU)}catch(BS){}}return BP(BQ,BT,BU,BR)};for(var Aa in BP){Q[Aa]=BP[Aa]}Ab=null}}();(function(){var Aa=AE.createElement("div");Aa.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!Aa.getElementsByClassName||Aa.getElementsByClassName("e").length===0)){Aa.lastChild.className="e";if(Aa.getElementsByClassName("e").length!==1){P.order.splice(1,0,"CLASS");P.find.CLASS=function(BQ,BP,Ab){if(typeof BP.getElementsByClassName!=="undefined"&&!Ab){return BP.getElementsByClassName(BQ[1])}};Aa=null}}})();var J=AE.compareDocumentPosition?function(Ab,Aa){return !!(Ab.compareDocumentPosition(Aa)&16)}:function(Ab,Aa){return Ab!==Aa&&(Ab.contains?Ab.contains(Aa):true)},F=function(Aa){return(Aa=(Aa?Aa.ownerDocument||Aa:0).documentElement)?Aa.nodeName!=="HTML":false},w=function(BQ,BP){var Ab=[],Aa="",BR;for(BP=BP.nodeType?[BP]:BP;BR=P.match.PSEUDO.exec(BQ);){Aa+=BR[0];BQ=BQ.replace(P.match.PSEUDO,"")}BQ=P.relative[BQ]?BQ+"*":BQ;BR=0;for(var BS=BP.length;BR<BS;BR++){Q(BQ,BP[BR],Ab)}return Q.filter(Aa,Ab)};AM.find=Q;AM.expr=Q.selectors;AM.expr[":"]=AM.expr.filters;AM.unique=Q.uniqueSort;AM.text=Z;AM.isXMLDoc=F;AM.contains=J})();var H=/Until$/,BF=/^(?:parents|prevUntil|prevAll)/,A2=/,/;AY=Array.prototype.slice;var Ar=function(F,A,J){if(AM.isFunction(A)){return AM.grep(F,function(L,K){return !!A.call(L,K,L)===J})}else{if(A.nodeType){return AM.grep(F,function(K){return K===A===J})}else{if(typeof A==="string"){var G=AM.grep(F,function(K){return K.nodeType===1});if(Az.test(A)){return AM.filter(A,G,!J)}else{A=AM.filter(A,G)}}}}return AM.grep(F,function(K){return AM.inArray(K,A)>=0===J})};AM.fn.extend({find:function(F){for(var A=this.pushStack("","find",F),N=0,K=0,L=this.length;K<L;K++){N=A.length;AM.find(F,this[K],A);if(K>0){for(var G=N;G<A.length;G++){for(var J=0;J<N;J++){if(A[J]===A[G]){A.splice(G--,1);break}}}}}return A},has:function(F){var A=AM(F);return this.filter(function(){for(var J=0,G=A.length;J<G;J++){if(AM.contains(this,A[J])){return true}}})},not:function(A){return this.pushStack(Ar(this,A,false),"not",A)},filter:function(A){return this.pushStack(Ar(this,A,true),"filter",A)},is:function(A){return !!A&&AM.filter(A,this).length>0},closest:function(P,O){if(AM.isArray(P)){var N=[],K=this[0],L,G={},J;if(K&&P.length){L=0;for(var A=P.length;L<A;L++){J=P[L];G[J]||(G[J]=AM.expr.match.POS.test(J)?AM(J,O||this.context):J)}for(;K&&K.ownerDocument&&K!==O;){for(J in G){L=G[J];if(L.jquery?L.index(K)>-1:AM(K).is(L)){N.push({selector:J,elem:K});delete G[J]}}K=K.parentNode}}return N}var F=AM.expr.match.POS.test(P)?AM(P,O||this.context):null;return this.map(function(R,Q){for(;Q&&Q.ownerDocument&&Q!==O;){if(F?F.index(Q)>-1:AM(Q).is(P)){return Q}Q=Q.parentNode}return null})},index:function(A){if(!A||typeof A==="string"){return AM.inArray(this[0],A?AM(A):this.parent().children())}return AM.inArray(A.jquery?A[0]:A,this)},add:function(F,A){F=typeof F==="string"?AM(F,A||this.context):AM.makeArray(F);A=AM.merge(this.get(),F);return this.pushStack(e(F[0])||e(A[0])?A:AM.unique(A))},andSelf:function(){return this.add(this.prevObject)}});AM.each({parent:function(A){return(A=A.parentNode)&&A.nodeType!==11?A:null},parents:function(A){return AM.dir(A,"parentNode")},parentsUntil:function(F,A,G){return AM.dir(F,"parentNode",G)},next:function(A){return AM.nth(A,2,"nextSibling")},prev:function(A){return AM.nth(A,2,"previousSibling")},nextAll:function(A){return AM.dir(A,"nextSibling")},prevAll:function(A){return AM.dir(A,"previousSibling")},nextUntil:function(F,A,G){return AM.dir(F,"nextSibling",G)},prevUntil:function(F,A,G){return AM.dir(F,"previousSibling",G)},siblings:function(A){return AM.sibling(A.parentNode.firstChild,A)},children:function(A){return AM.sibling(A.firstChild)},contents:function(A){return AM.nodeName(A,"iframe")?A.contentDocument||A.contentWindow.document:AM.makeArray(A.childNodes)}},function(F,A){AM.fn[F]=function(K,G){var J=AM.map(this,A,K);H.test(F)||(G=K);if(G&&typeof G==="string"){J=AM.filter(G,J)}J=this.length>1?AM.unique(J):J;if((this.length>1||A2.test(G))&&BF.test(F)){J=J.reverse()}return this.pushStack(J,F,AY.call(arguments).join(","))}});AM.extend({filter:function(F,A,G){if(G){F=":not("+F+")"}return AM.find.matches(F,A)},dir:function(F,A,J){var G=[];for(F=F[A];F&&F.nodeType!==9&&(J===AD||F.nodeType!==1||!AM(F).is(J));){F.nodeType===1&&G.push(F);F=F[A]}return G},nth:function(F,A,J){A=A||1;for(var G=0;F;F=F[J]){if(F.nodeType===1&&++G===A){break}}return F},sibling:function(F,A){for(var G=[];F;F=F.nextSibling){F.nodeType===1&&F!==A&&G.push(F)}return G}});var AN=/ jQuery\d+="(?:\d+|null)"/g,AW=/^\s+/,y=/(<([\w:]+)[^>]*?)\/>/g,Aj=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,f=/<([\w:]+)/,AH=/<tbody/i,o=/<|&#?\w+;/,Av=/<script|<object|<embed|<option|<style/i,AP=/checked\s*(?:[^=]|=\s*.checked.)/i,BO=function(F,A,G){return Aj.test(G)?F:A+"></"+G+">"},Ap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};Ap.optgroup=Ap.option;Ap.tbody=Ap.tfoot=Ap.colgroup=Ap.caption=Ap.thead;Ap.th=Ap.td;if(!AM.support.htmlSerialize){Ap._default=[1,"div<div>","</div>"]}AM.fn.extend({text:function(A){if(AM.isFunction(A)){return this.each(function(F){var G=AM(this);G.text(A.call(this,F,G.text()))})}if(typeof A!=="object"&&A!==AD){return this.empty().append((this[0]&&this[0].ownerDocument||AE).createTextNode(A))}return AM.text(this)},wrapAll:function(F){if(AM.isFunction(F)){return this.each(function(G){AM(this).wrapAll(F.call(this,G))})}if(this[0]){var A=AM(F,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&A.insertBefore(this[0]);A.map(function(){for(var G=this;G.firstChild&&G.firstChild.nodeType===1;){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(A){if(AM.isFunction(A)){return this.each(function(F){AM(this).wrapInner(A.call(this,F))})}return this.each(function(){var F=AM(this),G=F.contents();G.length?G.wrapAll(A):F.append(A)})},wrap:function(A){return this.each(function(){AM(this).wrapAll(A)})},unwrap:function(){return this.parent().each(function(){AM.nodeName(this,"body")||AM(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(A){this.nodeType===1&&this.appendChild(A)})},prepend:function(){return this.domManip(arguments,true,function(A){this.nodeType===1&&this.insertBefore(A,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this)})}else{if(arguments.length){var A=AM(arguments[0]);A.push.apply(A,this.toArray());return this.pushStack(A,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this.nextSibling)})}else{if(arguments.length){var A=this.pushStack(this,"after",arguments);A.push.apply(A,AM(arguments[0]).toArray());return A}}},remove:function(F,A){for(var J=0,G;(G=this[J])!=null;J++){if(!F||AM.filter(F,[G]).length){if(!A&&G.nodeType===1){AM.cleanData(G.getElementsByTagName("*"));AM.cleanData([G])}G.parentNode&&G.parentNode.removeChild(G)}}return this},empty:function(){for(var F=0,A;(A=this[F])!=null;F++){for(A.nodeType===1&&AM.cleanData(A.getElementsByTagName("*"));A.firstChild;){A.removeChild(A.firstChild)}}return this},clone:function(F){var A=this.map(function(){if(!AM.support.noCloneEvent&&!AM.isXMLDoc(this)){var J=this.outerHTML,G=this.ownerDocument;if(!J){J=G.createElement("div");J.appendChild(this.cloneNode(true));J=J.innerHTML}return AM.clean([J.replace(AN,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(AW,"")],G)[0]}else{return this.cloneNode(true)}});if(F===true){BN(this,A);BN(this.find("*"),A.find("*"))}return A},html:function(F){if(F===AD){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(AN,""):null}else{if(typeof F==="string"&&!Av.test(F)&&(AM.support.leadingWhitespace||!AW.test(F))&&!Ap[(f.exec(F)||["",""])[1].toLowerCase()]){F=F.replace(y,BO);try{for(var A=0,J=this.length;A<J;A++){if(this[A].nodeType===1){AM.cleanData(this[A].getElementsByTagName("*"));this[A].innerHTML=F}}}catch(G){this.empty().append(F)}}else{AM.isFunction(F)?this.each(function(N){var K=AM(this),L=K.html();K.empty().append(function(){return F.call(this,N,L)})}):this.empty().append(F)}}return this},replaceWith:function(A){if(this[0]&&this[0].parentNode){if(AM.isFunction(A)){return this.each(function(F){var J=AM(this),G=J.html();J.replaceWith(A.call(this,F,G))})}if(typeof A!=="string"){A=AM(A).detach()}return this.each(function(){var F=this.nextSibling,G=this.parentNode;AM(this).remove();F?AM(F).before(A):AM(G).append(A)})}else{return this.pushStack(AM(AM.isFunction(A)?A():A),"replaceWith",A)}},detach:function(A){return this.remove(A,true)},domManip:function(R,Q,P){function N(T){return AM.nodeName(T,"table")?T.getElementsByTagName("tbody")[0]||T.appendChild(T.ownerDocument.createElement("tbody")):T}var O,K,L=R[0],F=[],J;if(!AM.support.checkClone&&arguments.length===3&&typeof L==="string"&&AP.test(L)){return this.each(function(){AM(this).domManip(R,Q,P,true)})}if(AM.isFunction(L)){return this.each(function(T){var V=AM(this);R[0]=L.call(this,T,Q?V.html():AD);V.domManip(R,Q,P)})}if(this[0]){O=L&&L.parentNode;O=AM.support.parentNode&&O&&O.nodeType===11&&O.childNodes.length===this.length?{fragment:O}:A9(R,this,F);J=O.fragment;if(K=J.childNodes.length===1?(J=J.firstChild):J.firstChild){Q=Q&&AM.nodeName(K,"tr");for(var G=0,A=this.length;G<A;G++){P.call(Q?N(this[G],K):this[G],G>0||O.cacheable||this.length>1?J.cloneNode(true):J)}}F.length&&AM.each(F,AB)}return this}});AM.fragments={};AM.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(F,A){AM.fn[F]=function(N){var K=[];N=AM(N);var L=this.length===1&&this[0].parentNode;if(L&&L.nodeType===11&&L.childNodes.length===1&&N.length===1){N[A](this[0]);return this}else{L=0;for(var G=N.length;L<G;L++){var J=(L>0?this.clone(true):this).get();AM.fn[A].apply(AM(N[L]),J);K=K.concat(J)}return this.pushStack(K,F,N.selector)}}});AM.extend({clean:function(R,Q,P,N){Q=Q||AE;if(typeof Q.createElement==="undefined"){Q=Q.ownerDocument||Q[0]&&Q[0].ownerDocument||AE}for(var O=[],K=0,L;(L=R[K])!=null;K++){if(typeof L==="number"){L+=""}if(L){if(typeof L==="string"&&!o.test(L)){L=Q.createTextNode(L)}else{if(typeof L==="string"){L=L.replace(y,BO);var F=(f.exec(L)||["",""])[1].toLowerCase(),J=Ap[F]||Ap._default,G=J[0],A=Q.createElement("div");for(A.innerHTML=J[1]+L+J[2];G--;){A=A.lastChild}if(!AM.support.tbody){G=AH.test(L);F=F==="table"&&!G?A.firstChild&&A.firstChild.childNodes:J[1]==="<table>"&&!G?A.childNodes:[];for(J=F.length-1;J>=0;--J){AM.nodeName(F[J],"tbody")&&!F[J].childNodes.length&&F[J].parentNode.removeChild(F[J])}}!AM.support.leadingWhitespace&&AW.test(L)&&A.insertBefore(Q.createTextNode(AW.exec(L)[0]),A.firstChild);L=A.childNodes}}if(L.nodeType){O.push(L)}else{O=AM.merge(O,L)}}}if(P){for(K=0;O[K];K++){if(N&&AM.nodeName(O[K],"script")&&(!O[K].type||O[K].type.toLowerCase()==="text/javascript")){N.push(O[K].parentNode?O[K].parentNode.removeChild(O[K]):O[K])}else{O[K].nodeType===1&&O.splice.apply(O,[K+1,0].concat(AM.makeArray(O[K].getElementsByTagName("script"))));P.appendChild(O[K])}}}return O},cleanData:function(P){for(var O,N,K=AM.cache,L=AM.event.special,G=AM.support.deleteExpando,J=0,A;(A=P[J])!=null;J++){if(N=A[AM.expando]){O=K[N];if(O.events){for(var F in O.events){L[F]?AM.event.remove(A,F):Am(A,F,O.handle)}}if(G){delete A[AM.expando]}else{A.removeAttribute&&A.removeAttribute(AM.expando)}delete K[N]}}}});var M=/z-?index|font-?weight|opacity|zoom|line-?height/i,BA=/alpha\([^)]*\)/,Aw=/opacity=([^)]*)/,Ak=/float/i,AI=/-([a-z])/ig,BJ=/([A-Z])/g,A5=/^-?\d+(?:px)?$/i,Ao=/^-?\d/,AK={position:"absolute",visibility:"hidden",display:"block"},u=["Left","Right"],b=["Top","Bottom"],BM=AE.defaultView&&AE.defaultView.getComputedStyle,AQ=AM.support.cssFloat?"cssFloat":"styleFloat",p=function(F,A){return A.toUpperCase()};AM.fn.css=function(F,A){return AU(this,F,A,true,function(K,G,J){if(J===AD){return AM.curCSS(K,G)}if(typeof J==="number"&&!M.test(G)){J+="px"}AM.style(K,G,J)})};AM.extend({style:function(F,A,K){if(!F||F.nodeType===3||F.nodeType===8){return AD}if((A==="width"||A==="height")&&parseFloat(K)<0){K=AD}var G=F.style||F,J=K!==AD;if(!AM.support.opacity&&A==="opacity"){if(J){G.zoom=1;A=parseInt(K,10)+""==="NaN"?"":"alpha(opacity="+K*100+")";F=G.filter||AM.curCSS(F,"filter")||"";G.filter=BA.test(F)?F.replace(BA,A):A}return G.filter&&G.filter.indexOf("opacity=")>=0?parseFloat(Aw.exec(G.filter)[1])/100+"":""}if(Ak.test(A)){A=AQ}A=A.replace(AI,p);if(J){G[A]=K}return G[A]},css:function(F,A,N,K){if(A==="width"||A==="height"){var L,G=A==="width"?u:b;function J(){L=A==="width"?F.offsetWidth:F.offsetHeight;K!=="border"&&AM.each(G,function(){K||(L-=parseFloat(AM.curCSS(F,"padding"+this,true))||0);if(K==="margin"){L+=parseFloat(AM.curCSS(F,"margin"+this,true))||0}else{L-=parseFloat(AM.curCSS(F,"border"+this+"Width",true))||0}})}F.offsetWidth!==0?J():AM.swap(F,AK,J);return Math.max(0,Math.round(L))}return AM.curCSS(F,A,N)},curCSS:function(F,A,L){var J,K=F.style;if(!AM.support.opacity&&A==="opacity"&&F.currentStyle){J=Aw.test(F.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return J===""?"1":J}if(Ak.test(A)){A=AQ}if(!L&&K&&K[A]){J=K[A]}else{if(BM){if(Ak.test(A)){A="float"}A=A.replace(BJ,"-$1").toLowerCase();K=F.ownerDocument.defaultView;if(!K){return null}if(F=K.getComputedStyle(F,null)){J=F.getPropertyValue(A)}if(A==="opacity"&&J===""){J="1"}}else{if(F.currentStyle){L=A.replace(AI,p);J=F.currentStyle[A]||F.currentStyle[L];if(!A5.test(J)&&Ao.test(J)){A=K.left;var G=F.runtimeStyle.left;F.runtimeStyle.left=F.currentStyle.left;K.left=L==="fontSize"?"1em":J||0;J=K.pixelLeft+"px";K.left=A;F.runtimeStyle.left=G}}}}return J},swap:function(F,A,K){var G={};for(var J in A){G[J]=F.style[J];F.style[J]=A[J]}K.call(F);for(J in A){F.style[J]=G[J]}}});if(AM.expr&&AM.expr.filters){AM.expr.filters.hidden=function(F){var A=F.offsetWidth,J=F.offsetHeight,G=F.nodeName.toLowerCase()==="tr";return A===0&&J===0&&!G?true:A>0&&J>0&&!G?false:AM.curCSS(F,"display")==="none"};AM.expr.filters.visible=function(A){return !AM.expr.filters.hidden(A)}}var A8=Al(),At=/<script(.|\s)*?\/script>/gi,AO=/select|textarea/i,z=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,Ag=/=\?(&|$)/,S=/\?/,g=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,BB=/%20/g,Ax=AM.fn.load;AM.fn.extend({load:function(F,A,L){if(typeof F!=="string"){return Ax.call(this,F)}else{if(!this.length){return this}}var J=F.indexOf(" ");if(J>=0){var K=F.slice(J,F.length);F=F.slice(0,J)}J="GET";if(A){if(AM.isFunction(A)){L=A;A=null}else{if(typeof A==="object"){A=AM.param(A,AM.ajaxSettings.traditional);J="POST"}}}var G=this;AM.ajax({url:F,type:J,dataType:"html",data:A,complete:function(N,O){if(O==="success"||O==="notmodified"){G.html(K?AM("<div />").append(N.responseText.replace(At,"")).find(K):N.responseText)}L&&G.each(L,[N.responseText,O,N])}});return this},serialize:function(){return AM.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?AM.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||AO.test(this.nodeName)||z.test(this.type))}).map(function(F,A){F=AM(this).val();return F==null?null:AM.isArray(F)?AM.map(F,function(G){return{name:A.name,value:G}}):{name:A.name,value:F}}).get()}});AM.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(F,A){AM.fn[A]=function(G){return this.bind(A,G)}});AM.extend({get:function(F,A,J,G){if(AM.isFunction(A)){G=G||J;J=A;A=null}return AM.ajax({type:"GET",url:F,data:A,success:J,dataType:G})},getScript:function(F,A){return AM.get(F,null,A,"script")},getJSON:function(F,A,G){return AM.get(F,A,G,"json")},post:function(F,A,J,G){if(AM.isFunction(A)){G=G||J;J=A;A={}}return AM.ajax({type:"POST",url:F,data:A,success:J,dataType:G})},ajaxSetup:function(A){AM.extend(AM.ajaxSettings,A)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:Au.XMLHttpRequest&&(Au.location.protocol!=="file:"||!Au.ActiveXObject)?function(){return new Au.XMLHttpRequest}:function(){try{return new Au.ActiveXObject("Microsoft.XMLHTTP")}catch(A){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(BP){function Ab(){w.success&&w.success.call(T,O,W,F);w.global&&Z("ajaxSuccess",[F,w])}function Aa(){w.complete&&w.complete.call(T,F,W);w.global&&Z("ajaxComplete",[F,w]);w.global&&!--AM.active&&AM.event.trigger("ajaxStop")}function Z(BR,BS){(w.context?AM(w.context):AM.event).trigger(BR,BS)}var w=AM.extend(true,{},AM.ajaxSettings,BP),V,W,O,T=BP&&BP.context||w,P=w.type.toUpperCase();if(w.data&&w.processData&&typeof w.data!=="string"){w.data=AM.param(w.data,w.traditional)}if(w.dataType==="jsonp"){if(P==="GET"){Ag.test(w.url)||(w.url+=(S.test(w.url)?"&":"?")+(w.jsonp||"callback")+"=?")}else{if(!w.data||!Ag.test(w.data)){w.data=(w.data?w.data+"&":"")+(w.jsonp||"callback")+"=?"}}w.dataType="json"}if(w.dataType==="json"&&(w.data&&Ag.test(w.data)||Ag.test(w.url))){V=w.jsonpCallback||"jsonp"+A8++;if(w.data){w.data=(w.data+"").replace(Ag,"="+V+"$1")}w.url=w.url.replace(Ag,"="+V+"$1");w.dataType="script";Au[V]=Au[V]||function(BR){O=BR;Ab();Aa();Au[V]=AD;try{delete Au[V]}catch(BS){}A&&A.removeChild(K)}}if(w.dataType==="script"&&w.cache===null){w.cache=false}if(w.cache===false&&P==="GET"){var L=Al(),G=w.url.replace(g,"$1_="+L+"$2");w.url=G+(G===w.url?(S.test(w.url)?"&":"?")+"_="+L:"")}if(w.data&&P==="GET"){w.url+=(S.test(w.url)?"&":"?")+w.data}w.global&&!AM.active++&&AM.event.trigger("ajaxStart");L=(L=B.exec(w.url))&&(L[1]&&L[1]!==location.protocol||L[2]!==location.host);if(w.dataType==="script"&&P==="GET"&&L){var A=AE.getElementsByTagName("head")[0]||AE.documentElement,K=AE.createElement("script");K.src=w.url;if(w.scriptCharset){K.charset=w.scriptCharset}if(!V){var N=false;K.onload=K.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){N=true;Ab();Aa();K.onload=K.onreadystatechange=null;A&&K.parentNode&&A.removeChild(K)}}}A.insertBefore(K,A.firstChild);return AD}var J=false,F=w.xhr();if(F){w.username?F.open(P,w.url,w.async,w.username,w.password):F.open(P,w.url,w.async);try{if(w.data||BP&&BP.contentType){F.setRequestHeader("Content-Type",w.contentType)}if(w.ifModified){AM.lastModified[w.url]&&F.setRequestHeader("If-Modified-Since",AM.lastModified[w.url]);AM.etag[w.url]&&F.setRequestHeader("If-None-Match",AM.etag[w.url])}L||F.setRequestHeader("X-Requested-With","XMLHttpRequest");F.setRequestHeader("Accept",w.dataType&&w.accepts[w.dataType]?w.accepts[w.dataType]+", */*":w.accepts._default)}catch(BQ){}if(w.beforeSend&&w.beforeSend.call(T,F,w)===false){w.global&&!--AM.active&&AM.event.trigger("ajaxStop");F.abort();return false}w.global&&Z("ajaxSend",[F,w]);var Y=F.onreadystatechange=function(BS){if(!F||F.readyState===0||BS==="abort"){J||Aa();J=true;if(F){F.onreadystatechange=AM.noop}}else{if(!J&&F&&(F.readyState===4||BS==="timeout")){J=true;F.onreadystatechange=AM.noop;W=BS==="timeout"?"timeout":!AM.httpSuccess(F)?"error":w.ifModified&&AM.httpNotModified(F,w.url)?"notmodified":"success";var BT;if(W==="success"){try{O=AM.httpData(F,w.dataType,w)}catch(BR){W="parsererror";BT=BR}}if(W==="success"||W==="notmodified"){V||Ab()}else{AM.handleError(w,F,W,BT)}Aa();BS==="timeout"&&F.abort();if(w.async){F=null}}}};try{var X=F.abort;F.abort=function(){F&&X.call(F);Y("abort")}}catch(R){}w.async&&w.timeout>0&&setTimeout(function(){F&&!J&&Y("timeout")},w.timeout);try{F.send(P==="POST"||P==="PUT"||P==="DELETE"?w.data:null)}catch(Q){AM.handleError(w,F,null,Q);Aa()}w.async||Y();return F}},handleError:function(F,A,J,G){if(F.error){F.error.call(F.context||F,A,J,G)}if(F.global){(F.context?AM(F.context):AM.event).trigger("ajaxError",[A,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol==="file:"||F.status>=200&&F.status<300||F.status===304||F.status===1223||F.status===0}catch(A){}return false},httpNotModified:function(F,A){var J=F.getResponseHeader("Last-Modified"),G=F.getResponseHeader("Etag");if(J){AM.lastModified[A]=J}if(G){AM.etag[A]=G}return F.status===304||F.status===0},httpData:function(F,A,K){var G=F.getResponseHeader("content-type")||"",J=A==="xml"||!A&&G.indexOf("xml")>=0;F=J?F.responseXML:F.responseText;J&&F.documentElement.nodeName==="parsererror"&&AM.error("parsererror");if(K&&K.dataFilter){F=K.dataFilter(F,A)}if(typeof F==="string"){if(A==="json"||!A&&G.indexOf("json")>=0){F=AM.parseJSON(F)}else{if(A==="script"||!A&&G.indexOf("javascript")>=0){AM.globalEval(F)}}}return F},param:function(F,A){function L(N,O){if(AM.isArray(O)){AM.each(O,function(P,Q){A||/\[\]$/.test(N)?J(N,Q):L(N+"["+(typeof Q==="object"||AM.isArray(Q)?P:"")+"]",Q)})}else{!A&&O!=null&&typeof O==="object"?AM.each(O,function(P,Q){L(N+"["+P+"]",Q)}):J(N,O)}}function J(N,O){O=AM.isFunction(O)?O():O;K[K.length]=encodeURIComponent(N)+"="+encodeURIComponent(O)}var K=[];if(A===AD){A=AM.ajaxSettings.traditional}if(AM.isArray(F)||F.jquery){AM.each(F,function(){J(this.name,this.value)})}else{for(var G in F){L(G,F[G])}}return K.join("&").replace(BB,"+")}});var BK={},BG=/toggle|show|hide/,A3=/^([+-]=)?([\d+-.]+)(.*)$/,AV,AA=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];AM.fn.extend({show:function(F,A){if(F||F===0){return this.animate(Ai("show",3),F,A)}else{F=0;for(A=this.length;F<A;F++){var K=AM.data(this[F],"olddisplay");this[F].style.display=K||"";if(AM.css(this[F],"display")==="none"){K=this[F].nodeName;var G;if(BK[K]){G=BK[K]}else{var J=AM("<"+K+" />").appendTo("body");G=J.css("display");if(G==="none"){G="block"}J.remove();BK[K]=G}AM.data(this[F],"olddisplay",G)}}F=0;for(A=this.length;F<A;F++){this[F].style.display=AM.data(this[F],"olddisplay")||""}return this}},hide:function(F,A){if(F||F===0){return this.animate(Ai("hide",3),F,A)}else{F=0;for(A=this.length;F<A;F++){var G=AM.data(this[F],"olddisplay");!G&&G!=="none"&&AM.data(this[F],"olddisplay",AM.css(this[F],"display"))}F=0;for(A=this.length;F<A;F++){this[F].style.display="none"}return this}},_toggle:AM.fn.toggle,toggle:function(F,A){var G=typeof F==="boolean";if(AM.isFunction(F)&&AM.isFunction(A)){this._toggle.apply(this,arguments)}else{F==null||G?this.each(function(){var J=G?F:AM(this).is(":hidden");AM(this)[J?"show":"hide"]()}):this.animate(Ai("toggle",3),F,A)}return this},fadeTo:function(F,A,G){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:A},F,G)},animate:function(F,A,K,G){var J=AM.speed(A,K,G);if(AM.isEmptyObject(F)){return this.each(J.complete)}return this[J.queue===false?"each":"queue"](function(){var N=AM.extend({},J),O,P=this.nodeType===1&&AM(this).is(":hidden"),L=this;for(O in F){var Q=O.replace(AI,p);if(O!==Q){F[Q]=F[O];delete F[O];O=Q}if(F[O]==="hide"&&P||F[O]==="show"&&!P){return N.complete.call(this)}if((O==="height"||O==="width")&&this.style){N.display=AM.css(this,"display");N.overflow=this.style.overflow}if(AM.isArray(F[O])){(N.specialEasing=N.specialEasing||{})[O]=F[O][1];F[O]=F[O][0]}}if(N.overflow!=null){this.style.overflow="hidden"}N.curAnim=AM.extend({},F);AM.each(F,function(T,R){var X=new AM.fx(L,N,T);if(BG.test(R)){X[R==="toggle"?P?"show":"hide":R](F)}else{var W=A3.exec(R),Y=X.cur(true)||0;if(W){R=parseFloat(W[2]);var V=W[3]||"px";if(V!=="px"){L.style[T]=(R||1)+V;Y=(R||1)/X.cur(true)*Y;L.style[T]=Y+V}if(W[1]){R=(W[1]==="-="?-1:1)*R+Y}X.custom(Y,R,V)}else{X.custom(Y,R,"")}}});return true})},stop:function(F,A){var G=AM.timers;F&&this.queue([]);this.each(function(){for(var J=G.length-1;J>=0;J--){if(G[J].elem===this){A&&G[J](true);G.splice(J,1)}}});A||this.dequeue();return this}});AM.each({slideDown:Ai("show",1),slideUp:Ai("hide",1),slideToggle:Ai("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(F,A){AM.fn[F]=function(J,G){return this.animate(A,J,G)}});AM.extend({speed:function(F,A,J){var G=F&&typeof F==="object"?F:{complete:J||!J&&A||AM.isFunction(F)&&F,duration:F,easing:J&&A||A&&!AM.isFunction(A)&&A};G.duration=AM.fx.off?0:typeof G.duration==="number"?G.duration:AM.fx.speeds[G.duration]||AM.fx.speeds._default;G.old=G.complete;G.complete=function(){G.queue!==false&&AM(this).dequeue();AM.isFunction(G.old)&&G.old.call(this)};return G},easing:{linear:function(F,A,J,G){return J+G*F},swing:function(F,A,J,G){return(-Math.cos(F*Math.PI)/2+0.5)*G+J}},timers:[],fx:function(F,A,G){this.options=A;this.elem=F;this.prop=G;if(!A.orig){A.orig={}}}});AM.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(AM.fx.step[this.prop]||AM.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(A){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}return(A=parseFloat(AM.css(this.elem,this.prop,A)))&&A>-10000?A:parseFloat(AM.curCSS(this.elem,this.prop))||0},custom:function(F,A,K){function G(L){return J.step(L)}this.startTime=Al();this.start=F;this.end=A;this.unit=K||this.unit||"px";this.now=this.start;this.pos=this.state=0;var J=this;G.elem=this.elem;if(G()&&AM.timers.push(G)&&!AV){AV=setInterval(AM.fx.tick,13)}},show:function(){this.options.orig[this.prop]=AM.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());AM(this.elem).show()},hide:function(){this.options.orig[this.prop]=AM.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(F){var A=Al(),K=true;if(F||A>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var G in this.options.curAnim){if(this.options.curAnim[G]!==true){K=false}}if(K){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;F=AM.data(this.elem,"olddisplay");this.elem.style.display=F?F:this.options.display;if(AM.css(this.elem,"display")==="none"){this.elem.style.display="block"}}this.options.hide&&AM(this.elem).hide();if(this.options.hide||this.options.show){for(var J in this.options.curAnim){AM.style(this.elem,J,this.options.orig[J])}}this.options.complete.call(this.elem)}return false}else{J=A-this.startTime;this.state=J/this.options.duration;F=this.options.easing||(AM.easing.swing?"swing":"linear");this.pos=AM.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||F](this.state,J,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};AM.extend(AM.fx,{tick:function(){for(var F=AM.timers,A=0;A<F.length;A++){F[A]()||F.splice(A--,1)}F.length||AM.fx.stop()},stop:function(){clearInterval(AV);AV=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(A){AM.style(A.elem,"opacity",A.now)},_default:function(A){if(A.elem.style&&A.elem.style[A.prop]!=null){A.elem.style[A.prop]=(A.prop==="width"||A.prop==="height"?Math.max(0,A.now):A.now)+A.unit}else{A.elem[A.prop]=A.now}}}});if(AM.expr&&AM.expr.filters){AM.expr.filters.animated=function(A){return AM.grep(AM.timers,function(F){return A===F.elem}).length}}AM.fn.offset="getBoundingClientRect" in AE.documentElement?function(F){var A=this[0];if(F){return this.each(function(K){AM.offset.setOffset(this,F,K)})}if(!A||!A.ownerDocument){return null}if(A===A.ownerDocument.body){return AM.offset.bodyOffset(A)}var J=A.getBoundingClientRect(),G=A.ownerDocument;A=G.body;G=G.documentElement;return{top:J.top+(self.pageYOffset||AM.support.boxModel&&G.scrollTop||A.scrollTop)-(G.clientTop||A.clientTop||0),left:J.left+(self.pageXOffset||AM.support.boxModel&&G.scrollLeft||A.scrollLeft)-(G.clientLeft||A.clientLeft||0)}}:function(Q){var P=this[0];if(Q){return this.each(function(R){AM.offset.setOffset(this,Q,R)})}if(!P||!P.ownerDocument){return null}if(P===P.ownerDocument.body){return AM.offset.bodyOffset(P)}AM.offset.initialize();var O=P.offsetParent,L=P,N=P.ownerDocument,J,K=N.documentElement,A=N.body;L=(N=N.defaultView)?N.getComputedStyle(P,null):P.currentStyle;for(var G=P.offsetTop,F=P.offsetLeft;(P=P.parentNode)&&P!==A&&P!==K;){if(AM.offset.supportsFixedPosition&&L.position==="fixed"){break}J=N?N.getComputedStyle(P,null):P.currentStyle;G-=P.scrollTop;F-=P.scrollLeft;if(P===O){G+=P.offsetTop;F+=P.offsetLeft;if(AM.offset.doesNotAddBorder&&!(AM.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(P.nodeName))){G+=parseFloat(J.borderTopWidth)||0;F+=parseFloat(J.borderLeftWidth)||0}L=O;O=P.offsetParent}if(AM.offset.subtractsBorderForOverflowNotVisible&&J.overflow!=="visible"){G+=parseFloat(J.borderTopWidth)||0;F+=parseFloat(J.borderLeftWidth)||0}L=J}if(L.position==="relative"||L.position==="static"){G+=A.offsetTop;F+=A.offsetLeft}if(AM.offset.supportsFixedPosition&&L.position==="fixed"){G+=Math.max(K.scrollTop,A.scrollTop);F+=Math.max(K.scrollLeft,A.scrollLeft)}return{top:G,left:F}};AM.offset={initialize:function(){var F=AE.body,A=AE.createElement("div"),L,J,K,G=parseFloat(AM.curCSS(F,"marginTop",true))||0;AM.extend(A.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});A.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";F.insertBefore(A,F.firstChild);L=A.firstChild;J=L.firstChild;K=L.nextSibling.firstChild.firstChild;this.doesNotAddBorder=J.offsetTop!==5;this.doesAddBorderForTableAndCells=K.offsetTop===5;J.style.position="fixed";J.style.top="20px";this.supportsFixedPosition=J.offsetTop===20||J.offsetTop===15;J.style.position=J.style.top="";L.style.overflow="hidden";L.style.position="relative";this.subtractsBorderForOverflowNotVisible=J.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=F.offsetTop!==G;F.removeChild(A);AM.offset.initialize=AM.noop},bodyOffset:function(F){var A=F.offsetTop,G=F.offsetLeft;AM.offset.initialize();if(AM.offset.doesNotIncludeMarginInBodyOffset){A+=parseFloat(AM.curCSS(F,"marginTop",true))||0;G+=parseFloat(AM.curCSS(F,"marginLeft",true))||0}return{top:A,left:G}},setOffset:function(F,A,N){if(/static/.test(AM.curCSS(F,"position"))){F.style.position="relative"}var K=AM(F),L=K.offset(),G=parseInt(AM.curCSS(F,"top",true),10)||0,J=parseInt(AM.curCSS(F,"left",true),10)||0;if(AM.isFunction(A)){A=A.call(F,N,L)}N={top:A.top-L.top+G,left:A.left-L.left+J};"using" in A?A.using.call(F,N):K.css(N)}};AM.fn.extend({position:function(){if(!this[0]){return null}var F=this[0],A=this.offsetParent(),J=this.offset(),G=/^body|html$/i.test(A[0].nodeName)?{top:0,left:0}:A.offset();J.top-=parseFloat(AM.curCSS(F,"marginTop",true))||0;J.left-=parseFloat(AM.curCSS(F,"marginLeft",true))||0;G.top+=parseFloat(AM.curCSS(A[0],"borderTopWidth",true))||0;G.left+=parseFloat(AM.curCSS(A[0],"borderLeftWidth",true))||0;return{top:J.top-G.top,left:J.left-G.left}},offsetParent:function(){return this.map(function(){for(var A=this.offsetParent||AE.body;A&&!/^body|html$/i.test(A.nodeName)&&AM.css(A,"position")==="static";){A=A.offsetParent}return A})}});AM.each(["Left","Top"],function(F,A){var G="scroll"+A;AM.fn[G]=function(K){var L=this[0],J;if(!L){return null}if(K!==AD){return this.each(function(){if(J=h(this)){J.scrollTo(!F?K:AM(J).scrollLeft(),F?K:AM(J).scrollTop())}else{this[G]=K}})}else{return(J=h(L))?"pageXOffset" in J?J[F?"pageYOffset":"pageXOffset"]:AM.support.boxModel&&J.document.documentElement[G]||J.document.body[G]:L[G]}}});AM.each(["Height","Width"],function(F,A){var G=A.toLowerCase();AM.fn["inner"+A]=function(){return this[0]?AM.css(this[0],G,false,"padding"):null};AM.fn["outer"+A]=function(J){return this[0]?AM.css(this[0],G,false,J?"margin":"border"):null};AM.fn[G]=function(J){var K=this[0];if(!K){return J==null?null:this}if(AM.isFunction(J)){return this.each(function(L){var N=AM(this);N[G](J.call(this,L,N[G]()))})}return"scrollTo" in K&&K.document?K.document.compatMode==="CSS1Compat"&&K.document.documentElement["client"+A]||K.document.body["client"+A]:K.nodeType===9?Math.max(K.documentElement["client"+A],K.body["scroll"+A],K.documentElement["scroll"+A],K.body["offset"+A],K.documentElement["offset"+A]):J===AD?AM.css(K,G):this.css(G,typeof J==="string"?J:J+"px")}});Au.jQuery=Au.$=AM})(window);(function(){if(!Date.now){Date.now=function(){return +new Date}}try{document.createElement("div").style.setProperty("opacity",0,"")}catch(DF){var Bv=CSSStyleDeclaration.prototype,D4=Bv.setProperty;Bv.setProperty=function(e,Ew,Ev){D4.call(this,e,Ew+"",Ev)}}d3={version:"2.8.1"};function Ep(Ex,Ew){try{for(var Ev in Ew){Object.defineProperty(Ex.prototype,Ev,{value:Ew[Ev],enumerable:false})}}catch(Ey){Ex.prototype=Ew}}var B2=At;function En(Ev){var e=-1,Ex=Ev.length,Ew=[];while(++e<Ex){Ew.push(Ev[e])}return Ew}function At(e){return Array.prototype.slice.call(e)}try{B2(document.documentElement.childNodes)[0].nodeType}catch(EM){B2=En}var Ci=[].__proto__?function(Ev,e){Ev.__proto__=e}:function(Ew,e){for(var Ev in e){Ew[Ev]=e[Ev]}};d3.map=function(e){var Ew=new AK;for(var Ev in e){Ew.set(Ev,e[Ev])}return Ew};function AK(){}Ep(AK,{has:function(e){return Er+e in this},get:function(e){return this[Er+e]},set:function(e,Ev){return this[Er+e]=Ev},remove:function(e){e=Er+e;return e in this&&delete this[e]},keys:function(){var e=[];this.forEach(function(Ev){e.push(Ev)});return e},values:function(){var e=[];this.forEach(function(Ev,Ew){e.push(Ew)});return e},entries:function(){var e=[];this.forEach(function(Ev,Ew){e.push({key:Ev,value:Ew})});return e},forEach:function(Ev){for(var e in this){if(e.charCodeAt(0)===Bx){Ev.call(this,e.substring(1),this[e])}}}});var Er="\0",Bx=Er.charCodeAt(0);function t(){return this}d3.functor=function(e){return typeof e==="function"?e:function(){return e}};d3.rebind=function(Ew,Ev){var e=1,Ey=arguments.length,Ex;while(++e<Ey){Ew[Ex=arguments[e]]=CT(Ew,Ev,Ev[Ex])}return Ew};function CT(Ev,e,Ew){return function(){var Ex=Ew.apply(e,arguments);return arguments.length?Ev:Ex}}d3.ascending=function(Ev,e){return Ev<e?-1:Ev>e?1:Ev>=e?0:NaN};d3.descending=function(Ev,e){return e<Ev?-1:e>Ev?1:e>=Ev?0:NaN};d3.mean=function(E0,Ey){var Ez=E0.length,Ev,e=0,Ex=-1,Ew=0;if(arguments.length===1){while(++Ex<Ez){if(ET(Ev=E0[Ex])){e+=(Ev-e)/++Ew}}}else{while(++Ex<Ez){if(ET(Ev=Ey.call(E0,E0[Ex],Ex))){e+=(Ev-e)/++Ew}}}return Ew?e:undefined};d3.median=function(Ev,e){if(arguments.length>1){Ev=Ev.map(e)}Ev=Ev.filter(ET);return Ev.length?d3.quantile(Ev.sort(d3.ascending),0.5):undefined};d3.min=function(Ez,Ex){var Ew=-1,Ey=Ez.length,Ev,e;if(arguments.length===1){while(++Ew<Ey&&((Ev=Ez[Ew])==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ey){if((e=Ez[Ew])!=null&&Ev>e){Ev=e}}}else{while(++Ew<Ey&&((Ev=Ex.call(Ez,Ez[Ew],Ew))==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ey){if((e=Ex.call(Ez,Ez[Ew],Ew))!=null&&Ev>e){Ev=e}}}return Ev};d3.max=function(Ez,Ex){var Ew=-1,Ey=Ez.length,Ev,e;if(arguments.length===1){while(++Ew<Ey&&((Ev=Ez[Ew])==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ey){if((e=Ez[Ew])!=null&&e>Ev){Ev=e}}}else{while(++Ew<Ey&&((Ev=Ex.call(Ez,Ez[Ew],Ew))==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ey){if((e=Ex.call(Ez,Ez[Ew],Ew))!=null&&e>Ev){Ev=e}}}return Ev};d3.extent=function(E0,Ex){var Ew=-1,Ez=E0.length,Ev,e,Ey;if(arguments.length===1){while(++Ew<Ez&&((Ev=Ey=E0[Ew])==null||Ev!=Ev)){Ev=Ey=undefined}while(++Ew<Ez){if((e=E0[Ew])!=null){if(Ev>e){Ev=e}if(Ey<e){Ey=e}}}}else{while(++Ew<Ez&&((Ev=Ey=Ex.call(E0,E0[Ew],Ew))==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ez){if((e=Ex.call(E0,E0[Ew],Ew))!=null){if(Ev>e){Ev=e}if(Ey<e){Ey=e}}}}return[Ev,Ey]};d3.random={normal:function(e,Ev){if(arguments.length<2){Ev=1}if(arguments.length<1){e=0}return function(){var Ew,Ey,Ex;do{Ew=Math.random()*2-1;Ey=Math.random()*2-1;Ex=Ew*Ew+Ey*Ey}while(!Ex||Ex>1);return e+Ev*Ew*Math.sqrt(-2*Math.log(Ex)/Ex)}}};function ET(e){return e!=null&&!isNaN(e)}d3.sum=function(Ez,Ex){var Ew=0,Ey=Ez.length,e,Ev=-1;if(arguments.length===1){while(++Ev<Ey){if(!isNaN(e=+Ez[Ev])){Ew+=e}}}else{while(++Ev<Ey){if(!isNaN(e=+Ex.call(Ez,Ez[Ev],Ev))){Ew+=e}}}return Ew};d3.quantile=function(Ew,E0){var Ex=(Ew.length-1)*E0+1,Ey=Math.floor(Ex),Ev=Ew[Ey-1],Ez=Ex-Ey;return Ez?Ev+Ez*(Ew[Ey]-Ev):Ev};d3.transpose=function(e){return d3.zip.apply(d3,e)};d3.zip=function(){if(!(Ez=arguments.length)){return[]}for(var Ex=-1,e=d3.min(arguments,Cz),Ew=new Array(e);++Ex<e;){for(var Ev=-1,Ez,Ey=Ew[Ex]=new Array(Ez);++Ev<Ez;){Ey[Ev]=arguments[Ev][Ex]}}return Ew};function Cz(e){return e.length}d3.bisector=function(e){return{left:function(Ew,Ev,Ez,Ey){if(arguments.length<3){Ez=0}if(arguments.length<4){Ey=Ew.length}while(Ez<Ey){var Ex=Ez+Ey>>1;if(e.call(Ew,Ew[Ex],Ex)<Ev){Ez=Ex+1}else{Ey=Ex}}return Ez},right:function(Ew,Ev,Ez,Ey){if(arguments.length<3){Ez=0}if(arguments.length<4){Ey=Ew.length}while(Ez<Ey){var Ex=Ez+Ey>>1;if(Ev<e.call(Ew,Ew[Ex],Ex)){Ey=Ex}else{Ez=Ex+1}}return Ez}}};var Do=d3.bisector(function(e){return e});d3.bisectLeft=Do.left;d3.bisect=d3.bisectRight=Do.right;d3.first=function(Ez,Ex){var Ew=0,Ey=Ez.length,Ev=Ez[0],e;if(arguments.length===1){Ex=d3.ascending}while(++Ew<Ey){if(Ex.call(Ez,Ev,e=Ez[Ew])>0){Ev=e}}return Ev};d3.last=function(Ez,Ex){var Ew=0,Ey=Ez.length,Ev=Ez[0],e;if(arguments.length===1){Ex=d3.ascending}while(++Ew<Ey){if(Ex.call(Ez,Ev,e=Ez[Ew])<=0){Ev=e}}return Ev};d3.nest=function(){var Ex={},Ew=[],E0=[],Ev,Ey;function Ez(E8,E6){if(E6>=Ew.length){return Ey?Ey.call(Ex,E8):(Ev?E8.sort(Ev):E8)}var E7=-1,E2=E8.length,FA=Ew[E6++],E5,E4,E3=new AK,E9,E1={};while(++E7<E2){if(E9=E3.get(E5=FA(E4=E8[E7]))){E9.push(E4)}else{E3.set(E5,[E4])}}E3.forEach(function(FB){E1[FB]=Ez(E3.get(FB),E6)});return E1}function e(E4,E5){if(E5>=Ew.length){return E4}var E1=[],E2=E0[E5++],E3;for(E3 in E4){E1.push({key:E3,values:e(E4[E3],E5)})}if(E2){E1.sort(function(E7,E6){return E2(E7.key,E6.key)})}return E1}Ex.map=function(E1){return Ez(E1,0)};Ex.entries=function(E1){return e(Ez(E1,0),0)};Ex.key=function(E1){Ew.push(E1);return Ex};Ex.sortKeys=function(E1){E0[Ew.length-1]=E1;return Ex};Ex.sortValues=function(E1){Ev=E1;return Ex};Ex.rollup=function(E1){Ey=E1;return Ex};return Ex};d3.keys=function(Ew){var Ev=[];for(var e in Ew){Ev.push(e)}return Ev};d3.values=function(Ew){var e=[];for(var Ev in Ew){e.push(Ew[Ev])}return e};d3.entries=function(Ew){var e=[];for(var Ev in Ew){e.push({key:Ev,value:Ew[Ev]})}return e};d3.permute=function(Ey,Ev){var e=[],Ew=-1,Ex=Ev.length;while(++Ew<Ex){e[Ew]=Ey[Ev[Ew]]}return e};d3.merge=function(e){return Array.prototype.concat.apply([],e)};d3.split=function(E0,Ey){var Ex=[],e=[],Ew,Ev=-1,Ez=E0.length;if(arguments.length<2){Ey=Cg}while(++Ev<Ez){if(Ey.call(e,Ew=E0[Ev],Ev)){e=[]}else{if(!e.length){Ex.push(e)}e.push(Ew)}}return Ex};function Cg(e){return e==null}function BR(e){return e.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}d3.range=function(E0,Ey,Ez){if(arguments.length<3){Ez=1;if(arguments.length<2){Ey=E0;E0=0}}if((Ey-E0)/Ez===Infinity){throw new Error("infinite range")}var Ev=[],e=Dl(Math.abs(Ez)),Ex=-1,Ew;E0*=e,Ey*=e,Ez*=e;if(Ez<0){while((Ew=E0+Ez*++Ex)>Ey){Ev.push(Ew/e)}}else{while((Ew=E0+Ez*++Ex)<Ey){Ev.push(Ew/e)}}return Ev};function Dl(e){var Ev=1;while(e*Ev%1){Ev*=10}return Ev}d3.requote=function(e){return e.replace(Bg,"\\$&")};var Bg=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(e,Ev){return Ev?Math.round(e*(Ev=Math.pow(10,Ev)))/Ev:Math.round(e)};d3.xhr=function(e,Ew,Ex){var Ev=new XMLHttpRequest;if(arguments.length<3){Ex=Ew,Ew=null}else{if(Ew&&Ev.overrideMimeType){Ev.overrideMimeType(Ew)}}Ev.open("GET",e,true);if(Ew){Ev.setRequestHeader("Accept",Ew)}Ev.onreadystatechange=function(){if(Ev.readyState===4){Ex(Ev.status<300?Ev:null)}};Ev.send(null)};d3.text=function(e,Ew,Ex){function Ev(Ey){Ex(Ey&&Ey.responseText)}if(arguments.length<3){Ex=Ew;Ew=null}d3.xhr(e,Ew,Ev)};d3.json=function(e,Ev){d3.text(e,"application/json",function(Ew){Ev(Ew?JSON.parse(Ew):null)})};d3.html=function(e,Ev){d3.text(e,"text/html",function(Ex){if(Ex!=null){var Ew=document.createRange();Ew.selectNode(document.body);Ex=Ew.createContextualFragment(Ex)}Ev(Ex)})};d3.xml=function(e,Ew,Ex){function Ev(Ey){Ex(Ey&&Ey.responseXML)}if(arguments.length<3){Ex=Ew;Ew=null}d3.xhr(e,Ew,Ev)};var CJ={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:CJ,qualify:function(e){var Ev=e.indexOf(":"),Ew=e;if(Ev>=0){Ew=e.substring(0,Ev);e=e.substring(Ev+1)}return CJ.hasOwnProperty(Ew)?{space:CJ[Ew],local:e}:e}};d3.dispatch=function(){var e=new Ce,Ev=-1,Ew=arguments.length;while(++Ev<Ew){e[arguments[Ev]]=C2(e)}return e};function Ce(){}Ce.prototype.on=function(Ew,Ex){var Ev=Ew.indexOf("."),e="";if(Ev>0){e=Ew.substring(Ev+1);Ew=Ew.substring(0,Ev)}return arguments.length<2?this[Ew].on(e):this[Ew].on(e,Ex)};function C2(e){var Ew=[],Ev=new AK;function Ex(){var E0=Ew,Ez=-1,E1=E0.length,Ey;while(++Ez<E1){if(Ey=E0[Ez].on){Ey.apply(this,arguments)}}return e}Ex.on=function(Ez,E1){var Ey=Ev.get(Ez),E0;if(arguments.length<2){return Ey&&Ey.on}if(Ey){Ey.on=null;Ew=Ew.slice(0,E0=Ew.indexOf(Ey)).concat(Ew.slice(E0+1));Ev.remove(Ez)}if(E1){Ew.push(Ev.set(Ez,{on:E1}))}return e};return Ex}d3.format=function(E2){var Ez=BK.exec(E2),E4=Ez[1]||" ",Ev=Ez[3]||"",Ex=Ez[5],e=+Ez[6],E5=Ez[7],E0=Ez[8],E1=Ez[9],Ew=1,E3="",Ey=false;if(E0){E0=+E0.substring(1)}if(Ex){E4="0";if(E5){e-=Math.floor((e-1)/4)}}switch(E1){case"n":E5=true;E1="g";break;case"%":Ew=100;E3="%";E1="f";break;case"p":Ew=100;E3="%";E1="r";break;case"d":Ey=true;E0=0;break;case"s":Ew=-1;E1="r";break}if(E1=="r"&&!E0){E1="g"}E1=R.get(E1)||Ag;return function(E9){if(Ey&&(E9%1)){return""}var E6=(E9<0)&&(E9=-E9)?"\u2212":Ev;if(Ew<0){var E8=d3.formatPrefix(E9,E0);E9*=E8.scale;E3=E8.symbol}else{E9*=Ew}E9=E1(E9,E0);if(Ex){var E7=E9.length+E6.length;if(E7<e){E9=new Array(e-E7+1).join(E4)+E9}if(E5){E9=Bj(E9)}E9=E6+E9}else{if(E5){E9=Bj(E9)}E9=E6+E9;var E7=E9.length;if(E7<e){E9=new Array(e-E7+1).join(E4)+E9}}return E9+E3}};var BK=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;var R=d3.map({g:function(e,Ev){return e.toPrecision(Ev)},e:function(e,Ev){return e.toExponential(Ev)},f:function(e,Ev){return e.toFixed(Ev)},r:function(e,Ev){return d3.round(e,Ev=CL(e,Ev)).toFixed(Math.max(0,Math.min(20,Ev)))}});function CL(e,Ev){return Ev-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-Ev))/Math.LN10):1)}function Ag(e){return e+""}function Bj(Ex){var Ev=Ex.lastIndexOf("."),Ew=Ev>=0?Ex.substring(Ev):(Ev=Ex.length,""),e=[];while(Ev>0){e.push(Ex.substring(Ev-=3,Ev+3))}return e.reverse().join(",")+Ew}var BH=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(B1);d3.formatPrefix=function(Ew,e){var Ev=0;if(Ew){if(Ew<0){Ew*=-1}if(e){Ew=d3.round(Ew,CL(Ew,e))}Ev=1+Math.floor(1e-12+Math.log(Ew)/Math.LN10);Ev=Math.max(-24,Math.min(24,Math.floor((Ev<=0?Ev+1:Ev-1)/3)*3))}return BH[8+Ev/3]};function B1(Ev,e){return{scale:Math.pow(10,(8-e)*3),symbol:Ev}}var A2=AP(2),Y=AP(3),EO=function(){return Bi};var p=d3.map({linear:EO,poly:AP,quad:function(){return A2},cubic:function(){return Y},sin:function(){return Df},exp:function(){return DC},circle:function(){return CH},elastic:o,back:ED,bounce:function(){return BB}});var I=d3.map({"in":Bi,out:U,"in-out":AW,"out-in":function(e){return AW(U(e))}});d3.ease=function(Ev){var Ex=Ev.indexOf("-"),Ew=Ex>=0?Ev.substring(0,Ex):Ev,e=Ex>=0?Ev.substring(Ex+1):"in";Ew=p.get(Ew)||EO;e=I.get(e)||Bi;return DJ(e(Ew.apply(null,Array.prototype.slice.call(arguments,1))))};function DJ(e){return function(Ev){return Ev<=0?0:Ev>=1?1:e(Ev)}}function U(e){return function(Ev){return 1-e(1-Ev)}}function AW(e){return function(Ev){return 0.5*(Ev<0.5?e(2*Ev):(2-e(2-2*Ev)))}}function Bi(e){return e}function AP(Ev){return function(e){return Math.pow(e,Ev)}}function Df(e){return 1-Math.cos(e*Math.PI/2)}function DC(e){return Math.pow(2,10*(e-1))}function CH(e){return 1-Math.sqrt(1-e*e)}function o(e,Ew){var Ev;if(arguments.length<2){Ew=0.45}if(arguments.length<1){e=1;Ev=Ew/4}else{Ev=Ew/(2*Math.PI)*Math.asin(1/e)}return function(Ex){return 1+e*Math.pow(2,10*-Ex)*Math.sin((Ex-Ev)*2*Math.PI/Ew)}}function ED(e){if(!e){e=1.70158}return function(Ev){return Ev*Ev*((e+1)*Ev-e)}}function BB(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+0.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+0.9375:7.5625*(e-=2.625/2.75)*e+0.984375}d3.event=null;function Ee(){d3.event.stopPropagation();d3.event.preventDefault()}function u(){var Ew=d3.event,Ev;while(Ev=Ew.sourceEvent){Ew=Ev}return Ew}function EN(Ew){var e=new Ce,Ev=0,Ex=arguments.length;while(++Ev<Ex){e[arguments[Ev]]=C2(e)}e.of=function(Ez,Ey){return function(E0){try{var E1=E0.sourceEvent=d3.event;E0.target=Ew;d3.event=E0;e[E0.type].apply(Ez,Ey)}finally{d3.event=E1}}};return e}d3.interpolate=function(Ev,e){var Ew=d3.interpolators.length,Ex;while(--Ew>=0&&!(Ex=d3.interpolators[Ew](Ev,e))){}return Ex};d3.interpolateNumber=function(Ev,e){e-=Ev;return function(Ew){return Ev+e*Ew}};d3.interpolateRound=function(Ev,e){e-=Ev;return function(Ew){return Math.round(Ev+e*Ew)}};d3.interpolateString=function(E1,E0){var Ex,Ez,Ey,E3=0,E2=0,E4=[],e=[],Ew,Ev;DS.lastIndex=0;for(Ez=0;Ex=DS.exec(E0);++Ez){if(Ex.index){E4.push(E0.substring(E3,E2=Ex.index))}e.push({i:E4.length,x:Ex[0]});E4.push(null);E3=DS.lastIndex}if(E3<E0.length){E4.push(E0.substring(E3))}for(Ez=0,Ew=e.length;(Ex=DS.exec(E1))&&Ez<Ew;++Ez){Ev=e[Ez];if(Ev.x==Ex[0]){if(Ev.i){if(E4[Ev.i+1]==null){E4[Ev.i-1]+=Ev.x;E4.splice(Ev.i,1);for(Ey=Ez+1;Ey<Ew;++Ey){e[Ey].i--}}else{E4[Ev.i-1]+=Ev.x+E4[Ev.i+1];E4.splice(Ev.i,2);for(Ey=Ez+1;Ey<Ew;++Ey){e[Ey].i-=2}}}else{if(E4[Ev.i+1]==null){E4[Ev.i]=Ev.x}else{E4[Ev.i]=Ev.x+E4[Ev.i+1];E4.splice(Ev.i+1,1);for(Ey=Ez+1;Ey<Ew;++Ey){e[Ey].i--}}}e.splice(Ez,1);Ew--;Ez--}else{Ev.x=d3.interpolateNumber(parseFloat(Ex[0]),parseFloat(Ev.x))}}while(Ez<Ew){Ev=e.pop();if(E4[Ev.i+1]==null){E4[Ev.i]=Ev.x}else{E4[Ev.i]=Ev.x+E4[Ev.i+1];E4.splice(Ev.i+1,1)}Ew--}if(E4.length===1){return E4[0]==null?e[0].x:function(){return E0}}return function(E5){for(Ez=0;Ez<Ew;++Ez){E4[(Ev=e[Ez]).i]=Ev.x(E5)}return E4.join("")}};d3.interpolateTransform=function(E7,E6){var E8=[],Ev=[],Ez,Ey=d3.transform(E7),Ex=d3.transform(E6),E3=Ey.translate,E2=Ex.translate,Ew=Ey.rotate,e=Ex.rotate,E1=Ey.skew,E0=Ex.skew,E5=Ey.scale,E4=Ex.scale;if(E3[0]!=E2[0]||E3[1]!=E2[1]){E8.push("translate(",null,",",null,")");Ev.push({i:1,x:d3.interpolateNumber(E3[0],E2[0])},{i:3,x:d3.interpolateNumber(E3[1],E2[1])})}else{if(E2[0]||E2[1]){E8.push("translate("+E2+")")}else{E8.push("")}}if(Ew!=e){Ev.push({i:E8.push(E8.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(Ew,e)})}else{if(e){E8.push(E8.pop()+"rotate("+e+")")}}if(E1!=E0){Ev.push({i:E8.push(E8.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(E1,E0)})}else{if(E0){E8.push(E8.pop()+"skewX("+E0+")")}}if(E5[0]!=E4[0]||E5[1]!=E4[1]){Ez=E8.push(E8.pop()+"scale(",null,",",null,")");Ev.push({i:Ez-4,x:d3.interpolateNumber(E5[0],E4[0])},{i:Ez-2,x:d3.interpolateNumber(E5[1],E4[1])})}else{if(E4[0]!=1||E4[1]!=1){E8.push(E8.pop()+"scale("+E4+")")}}Ez=Ev.length;return function(FA){var E9=-1,FB;while(++E9<Ez){E8[(FB=Ev[E9]).i]=FB.x(FA)}return E8.join("")}};d3.interpolateRgb=function(Ev,e){Ev=d3.rgb(Ev);e=d3.rgb(e);var Ex=Ev.r,Ew=Ev.g,E0=Ev.b,Ez=e.r-Ex,Ey=e.g-Ew,E1=e.b-E0;return function(E2){return"#"+BI(Math.round(Ex+Ez*E2))+BI(Math.round(Ew+Ey*E2))+BI(Math.round(E0+E1*E2))}};d3.interpolateHsl=function(Ew,e){Ew=d3.hsl(Ew);e=d3.hsl(e);var E1=Ew.h,E0=Ew.s,Ex=Ew.l,Ez=e.h-E1,Ey=e.s-E0,Ev=e.l-Ex;return function(E2){return Ac(E1+Ez*E2,E0+Ey*E2,Ex+Ev*E2).toString()}};d3.interpolateArray=function(Ey,Ew){var Ev=[],E1=[],Ex=Ey.length,e=Ew.length,E0=Math.min(Ey.length,Ew.length),Ez;for(Ez=0;Ez<E0;++Ez){Ev.push(d3.interpolate(Ey[Ez],Ew[Ez]))}for(;Ez<Ex;++Ez){E1[Ez]=Ey[Ez]}for(;Ez<e;++Ez){E1[Ez]=Ew[Ez]}return function(E2){for(Ez=0;Ez<E0;++Ez){E1[Ez]=Ev[Ez](E2)}return E1}};d3.interpolateObject=function(Ev,e){var Ex={},Ey={},Ew;for(Ew in Ev){if(Ew in e){Ex[Ew]=DD(Ew)(Ev[Ew],e[Ew])}else{Ey[Ew]=Ev[Ew]}}for(Ew in e){if(!(Ew in Ev)){Ey[Ew]=e[Ew]}}return function(Ez){for(Ew in Ex){Ey[Ew]=Ex[Ew](Ez)}return Ey}};var DS=/[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;function DD(e){return e=="transform"?d3.interpolateTransform:d3.interpolate}d3.interpolators=[d3.interpolateObject,function(Ev,e){return(e instanceof Array)&&d3.interpolateArray(Ev,e)},function(Ev,e){return(typeof Ev==="string"||typeof e==="string")&&d3.interpolateString(Ev+"",e+"")},function(Ev,e){return(typeof e==="string"?x.has(e)||/^(#|rgb\(|hsl\()/.test(e):e instanceof Ct||e instanceof DB)&&d3.interpolateRgb(Ev,e)},function(Ev,e){return !isNaN(Ev=+Ev)&&!isNaN(e=+e)&&d3.interpolateNumber(Ev,e)}];function EW(Ev,e){e=e-(Ev=+Ev)?1/(e-Ev):0;return function(Ew){return(Ew-Ev)*e}}function AF(Ev,e){e=e-(Ev=+Ev)?1/(e-Ev):0;return function(Ew){return Math.max(0,Math.min(1,(Ew-Ev)*e))}}d3.rgb=function(Ew,Ev,e){return arguments.length===1?(Ew instanceof Ct?CO(Ew.r,Ew.g,Ew.b):AR(""+Ew,CO,Ac)):CO(~~Ew,~~Ev,~~e)};function CO(Ew,Ev,e){return new Ct(Ew,Ev,e)}function Ct(Ew,Ev,e){this.r=Ew;this.g=Ev;this.b=e}Ct.prototype.brighter=function(Ev){Ev=Math.pow(0.7,arguments.length?Ev:1);var Ey=this.r,Ex=this.g,e=this.b,Ew=30;if(!Ey&&!Ex&&!e){return CO(Ew,Ew,Ew)}if(Ey&&Ey<Ew){Ey=Ew}if(Ex&&Ex<Ew){Ex=Ew}if(e&&e<Ew){e=Ew}return CO(Math.min(255,Math.floor(Ey/Ev)),Math.min(255,Math.floor(Ex/Ev)),Math.min(255,Math.floor(e/Ev)))};Ct.prototype.darker=function(e){e=Math.pow(0.7,arguments.length?e:1);return CO(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))};Ct.prototype.hsl=function(){return Ds(this.r,this.g,this.b)};Ct.prototype.toString=function(){return"#"+BI(this.r)+BI(this.g)+BI(this.b)};function BI(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function AR(Ez,Ex,E0){var e=0,Ew=0,Ey=0,E2,E1,Ev;E2=/([a-z]+)\((.*)\)/i.exec(Ez);if(E2){E1=E2[2].split(",");switch(E2[1]){case"hsl":return E0(parseFloat(E1[0]),parseFloat(E1[1])/100,parseFloat(E1[2])/100);case"rgb":return Ex(Ch(E1[0]),Ch(E1[1]),Ch(E1[2]))}}if(Ev=x.get(Ez)){return Ex(Ev.r,Ev.g,Ev.b)}if(Ez!=null&&Ez.charAt(0)==="#"){if(Ez.length===4){e=Ez.charAt(1);e+=e;Ew=Ez.charAt(2);Ew+=Ew;Ey=Ez.charAt(3);Ey+=Ey}else{if(Ez.length===7){e=Ez.substring(1,3);Ew=Ez.substring(3,5);Ey=Ez.substring(5,7)}}e=parseInt(e,16);Ew=parseInt(Ew,16);Ey=parseInt(Ey,16)}return Ex(e,Ew,Ey)}function Ds(e,Ey,E0){var Ew=Math.min(e/=255,Ey/=255,E0/=255),E1=Math.max(e,Ey,E0),Ez=E1-Ew,Ex,E2,Ev=(E1+Ew)/2;if(Ez){E2=Ev<0.5?Ez/(E1+Ew):Ez/(2-E1-Ew);if(e==E1){Ex=(Ey-E0)/Ez+(Ey<E0?6:0)}else{if(Ey==E1){Ex=(E0-e)/Ez+2}else{Ex=(e-Ey)/Ez+4}}Ex*=60}else{E2=Ex=0}return CX(Ex,E2,Ev)}function Ch(Ev){var e=parseFloat(Ev);return Ev.charAt(Ev.length-1)==="%"?Math.round(e*2.55):e}var x=d3.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});x.forEach(function(e,Ev){x.set(e,AR(Ev,CO,Ac))});d3.hsl=function(Ew,Ev,e){return arguments.length===1?(Ew instanceof DB?CX(Ew.h,Ew.s,Ew.l):AR(""+Ew,Ds,CX)):CX(+Ew,+Ev,+e)};function CX(Ew,Ev,e){return new DB(Ew,Ev,e)}function DB(Ew,Ev,e){this.h=Ew;this.s=Ev;this.l=e}DB.prototype.brighter=function(e){e=Math.pow(0.7,arguments.length?e:1);return CX(this.h,this.s,this.l/e)};DB.prototype.darker=function(e){e=Math.pow(0.7,arguments.length?e:1);return CX(this.h,this.s,e*this.l)};DB.prototype.rgb=function(){return Ac(this.h,this.s,this.l)};DB.prototype.toString=function(){return this.rgb().toString()};function Ac(Ez,Ey,e){var Ex,Ew;Ez=Ez%360;if(Ez<0){Ez+=360}Ey=Ey<0?0:Ey>1?1:Ey;e=e<0?0:e>1?1:e;Ew=e<=0.5?e*(1+Ey):e+Ey-e*Ey;Ex=2*e-Ew;function Ev(E1){if(E1>360){E1-=360}else{if(E1<0){E1+=360}}if(E1<60){return Ex+(Ew-Ex)*E1/60}if(E1<180){return Ew}if(E1<240){return Ex+(Ew-Ex)*(240-E1)/60}return Ex}function E0(E1){return Math.round(Ev(E1)*255)}return CO(E0(Ez+120),E0(Ez),E0(Ez-120))}function CA(e){Ci(e,B9);return e}var Bn=function(e,Ev){return Ev.querySelector(e)},Db=function(e,Ev){return Ev.querySelectorAll(e)},CW=document.documentElement,B=CW.matchesSelector||CW.webkitMatchesSelector||CW.mozMatchesSelector||CW.msMatchesSelector||CW.oMatchesSelector,A=function(Ev,e){return B.call(Ev,e)};if(typeof Sizzle==="function"){Bn=function(e,Ev){return Sizzle(e,Ev)[0]};Db=function(e,Ev){return Sizzle.uniqueSort(Sizzle(e,Ev))};A=Sizzle.matchesSelector}var B9=[];d3.selection=function(){return D7};d3.selection.prototype=B9;B9.select=function(Ez){var Ew=[],E3,e,E2,Ex;if(typeof Ez!=="function"){Ez=S(Ez)}for(var E0=-1,Ey=this.length;++E0<Ey;){Ew.push(E3=[]);E3.parentNode=(E2=this[E0]).parentNode;for(var E1=-1,Ev=E2.length;++E1<Ev;){if(Ex=E2[E1]){E3.push(e=Ez.call(Ex,Ex.__data__,E1));if(e&&"__data__" in Ex){e.__data__=Ex.__data__}}else{E3.push(null)}}}return CA(Ew)};function S(e){return function(){return Bn(e,this)}}B9.selectAll=function(Ey){var Ev=[],E2,Ew;if(typeof Ey!=="function"){Ey=Bc(Ey)}for(var Ez=-1,Ex=this.length;++Ez<Ex;){for(var E1=this[Ez],E0=-1,e=E1.length;++E0<e;){if(Ew=E1[E0]){Ev.push(E2=B2(Ey.call(Ew,Ew.__data__,E0)));E2.parentNode=Ew}}}return CA(Ev)};function Bc(e){return function(){return Db(e,this)}}B9.attr=function(Ev,E1){Ev=d3.ns.qualify(Ev);if(arguments.length<2){var Ez=this.node();return Ev.local?Ez.getAttributeNS(Ev.space,Ev.local):Ez.getAttribute(Ev)}function Ew(){this.removeAttribute(Ev)}function Ey(){this.removeAttributeNS(Ev.space,Ev.local)}function E2(){this.setAttribute(Ev,E1)}function Ex(){this.setAttributeNS(Ev.space,Ev.local,E1)}function E0(){var E3=E1.apply(this,arguments);if(E3==null){this.removeAttribute(Ev)}else{this.setAttribute(Ev,E3)}}function e(){var E3=E1.apply(this,arguments);if(E3==null){this.removeAttributeNS(Ev.space,Ev.local)}else{this.setAttributeNS(Ev.space,Ev.local,E3)}}return this.each(E1==null?(Ev.local?Ey:Ew):(typeof E1==="function"?(Ev.local?e:E0):(Ev.local?Ex:E2)))};B9.classed=function(e,Ew){var Ex=e.split(G),Ey=Ex.length,Ev=-1;if(arguments.length>1){while(++Ev<Ey){Dy.call(this,Ex[Ev],Ew)}return this}else{while(++Ev<Ey){if(!Dy.call(this,Ex[Ev])){return false}}return true}};var G=/\s+/g;function Dy(e,Ey){var Ev=new RegExp("(^|\\s+)"+d3.requote(e)+"(\\s+|$)","g");if(arguments.length<2){var Ex=this.node();if(E1=Ex.classList){return E1.contains(e)}var E1=Ex.className;Ev.lastIndex=0;return Ev.test(E1.baseVal!=null?E1.baseVal:E1)}function E0(){if(E4=this.classList){return E4.add(e)}var E4=this.className,E2=E4.baseVal!=null,E3=E2?E4.baseVal:E4;Ev.lastIndex=0;if(!Ev.test(E3)){E3=BR(E3+" "+e);if(E2){E4.baseVal=E3}else{this.className=E3}}}function Ez(){if(E4=this.classList){return E4.remove(e)}var E4=this.className,E2=E4.baseVal!=null,E3=E2?E4.baseVal:E4;E3=BR(E3.replace(Ev," "));if(E2){E4.baseVal=E3}else{this.className=E3}}function Ew(){(Ey.apply(this,arguments)?E0:Ez).call(this)}return this.each(typeof Ey==="function"?Ew:Ey?E0:Ez)}B9.style=function(Ew,Ez,Ex){if(arguments.length<3){Ex=""}if(arguments.length<2){return window.getComputedStyle(this.node(),null).getPropertyValue(Ew)}function Ev(){this.style.removeProperty(Ew)}function Ey(){this.style.setProperty(Ew,Ez,Ex)}function e(){var E0=Ez.apply(this,arguments);if(E0==null){this.style.removeProperty(Ew)}else{this.style.setProperty(Ew,E0,Ex)}}return this.each(Ez==null?Ev:(typeof Ez==="function"?e:Ey))};B9.property=function(Ev,Ex){if(arguments.length<2){return this.node()[Ev]}function e(){delete this[Ev]}function Ew(){this[Ev]=Ex}function Ey(){var Ez=Ex.apply(this,arguments);if(Ez==null){delete this[Ev]}else{this[Ev]=Ez}}return this.each(Ex==null?e:(typeof Ex==="function"?Ey:Ew))};B9.text=function(e){return arguments.length<1?this.node().textContent:this.each(typeof e==="function"?function(){var Ev=e.apply(this,arguments);this.textContent=Ev==null?"":Ev}:e==null?function(){this.textContent=""}:function(){this.textContent=e})};B9.html=function(e){return arguments.length<1?this.node().innerHTML:this.each(typeof e==="function"?function(){var Ev=e.apply(this,arguments);this.innerHTML=Ev==null?"":Ev}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e})};B9.append=function(Ev){Ev=d3.ns.qualify(Ev);function e(){return this.appendChild(document.createElementNS(this.namespaceURI,Ev))}function Ew(){return this.appendChild(document.createElementNS(Ev.space,Ev.local))}return this.select(Ev.local?Ew:e)};B9.insert=function(e,Ew){e=d3.ns.qualify(e);function Ev(){return this.insertBefore(document.createElementNS(this.namespaceURI,e),Bn(Ew,this))}function Ex(){return this.insertBefore(document.createElementNS(e.space,e.local),Bn(Ew,this))}return this.select(e.local?Ex:Ev)};B9.remove=function(){return this.each(function(){var e=this.parentNode;if(e){e.removeChild(this)}})};B9.data=function(E1,E3){var Ey=-1,Ev=this.length,E2,Ew;if(!arguments.length){E1=new Array(Ev=(E2=this[0]).length);while(++Ey<Ev){if(Ew=E2[Ey]){E1[Ey]=Ew.__data__}}return E1}function Ez(FG,E8){var FB,E5=FG.length,E7=E8.length,FE=Math.min(E5,E7),FD=Math.max(E5,E7),FI=[],FF=[],FC=[],E6,E4;if(E3){var FJ=new AK,FH=[],FA,E9=E8.length;for(FB=-1;++FB<E5;){FA=E3.call(E6=FG[FB],E6.__data__,FB);if(FJ.has(FA)){FC[E9++]=E6}else{FJ.set(FA,E6)}FH.push(FA)}for(FB=-1;++FB<E7;){FA=E3.call(E8,E4=E8[FB],FB);if(FJ.has(FA)){FI[FB]=E6=FJ.get(FA);E6.__data__=E4;FF[FB]=FC[FB]=null}else{FF[FB]=b(E4);FI[FB]=FC[FB]=null}FJ.remove(FA)}for(FB=-1;++FB<E5;){if(FJ.has(FH[FB])){FC[FB]=FG[FB]}}}else{for(FB=-1;++FB<FE;){E6=FG[FB];E4=E8[FB];if(E6){E6.__data__=E4;FI[FB]=E6;FF[FB]=FC[FB]=null}else{FF[FB]=b(E4);FI[FB]=FC[FB]=null}}for(;FB<E7;++FB){FF[FB]=b(E8[FB]);FI[FB]=FC[FB]=null}for(;FB<FD;++FB){FC[FB]=FG[FB];FF[FB]=FI[FB]=null}}FF.update=FI;FF.parentNode=FI.parentNode=FC.parentNode=FG.parentNode;E0.push(FF);Ex.push(FI);e.push(FC)}var E0=Az([]),Ex=CA([]),e=CA([]);if(typeof E1==="function"){while(++Ey<Ev){Ez(E2=this[Ey],E1.call(E2,E2.parentNode.__data__,Ey))}}else{while(++Ey<Ev){Ez(E2=this[Ey],E1)}}Ex.enter=function(){return E0};Ex.exit=function(){return e};return Ex};function b(e){return{__data__:e}}B9.datum=B9.map=function(e){return arguments.length<1?this.property("__data__"):this.property("__data__",e)};B9.filter=function(e){var Ew=[],E2,E1,Ex;if(typeof e!=="function"){e=AY(e)}for(var Ez=0,Ey=this.length;Ez<Ey;Ez++){Ew.push(E2=[]);E2.parentNode=(E1=this[Ez]).parentNode;for(var E0=0,Ev=E1.length;E0<Ev;E0++){if((Ex=E1[E0])&&e.call(Ex,Ex.__data__,E0)){E2.push(Ex)}}}return CA(Ew)};function AY(e){return function(){return A(this,e)}}B9.order=function(){for(var Ev=-1,e=this.length;++Ev<e;){for(var Ez=this[Ev],Ew=Ez.length-1,Ex=Ez[Ew],Ey;--Ew>=0;){if(Ey=Ez[Ew]){if(Ex&&Ex!==Ey.nextSibling){Ex.parentNode.insertBefore(Ey,Ex)}Ex=Ey}}}return this};B9.sort=function(Ev){Ev=D3.apply(this,arguments);for(var Ew=-1,e=this.length;++Ew<e;){this[Ew].sort(Ev)}return this.order()};function D3(e){if(!arguments.length){e=d3.ascending}return function(Ew,Ev){return e(Ew&&Ew.__data__,Ev&&Ev.__data__)}}B9.on=function(Ex,Ey,e){if(arguments.length<3){e=false}var Ev="__on"+Ex,Ew=Ex.indexOf(".");if(Ew>0){Ex=Ex.substring(0,Ew)}if(arguments.length<2){return(Ew=this.node()[Ev])&&Ew._}return this.each(function(E3,E0){var E1=this,E2=E1[Ev];if(E2){E1.removeEventListener(Ex,E2,E2.$);delete E1[Ev]}if(Ey){E1.addEventListener(Ex,E1[Ev]=Ez,Ez.$=e);Ez._=Ey}function Ez(E4){var E5=d3.event;d3.event=E4;try{Ey.call(E1,E1.__data__,E0)}finally{d3.event=E5}}})};B9.each=function(E0){for(var Ev=-1,e=this.length;++Ev<e;){for(var Ey=this[Ev],Ew=-1,Ez=Ey.length;++Ew<Ez;){var Ex=Ey[Ew];if(Ex){E0.call(Ex,Ex.__data__,Ew,Ev)}}}return this};B9.call=function(e){e.apply(this,(arguments[0]=this,arguments));return this};B9.empty=function(){return !this.node()};B9.node=function(E0){for(var Ev=0,e=this.length;Ev<e;Ev++){for(var Ey=this[Ev],Ew=0,Ez=Ey.length;Ew<Ez;Ew++){var Ex=Ey[Ew];if(Ex){return Ex}}}return null};B9.transition=function(){var Ev=[],Ew,Ez;for(var Ex=-1,e=this.length;++Ex<e;){Ev.push(Ew=[]);for(var E0=this[Ex],Ey=-1,E1=E0.length;++Ey<E1;){Ew.push((Ez=E0[Ey])?{node:Ez,delay:Cn,duration:EE}:null)}}return D5(Ev,EL||++EZ,Date.now())};var D7=CA([[document]]);D7[0].parentNode=CW;d3.select=function(e){return typeof e==="string"?D7.select(e):CA([[e]])};d3.selectAll=function(e){return typeof e==="string"?D7.selectAll(e):CA([B2(e)])};function Az(e){Ci(e,Cq);return e}var Cq=[];d3.selection.enter=Az;d3.selection.enter.prototype=Cq;Cq.append=B9.append;Cq.insert=B9.insert;Cq.empty=B9.empty;Cq.node=B9.node;Cq.select=function(Ez){var Ew=[],E4,e,E2,E3,Ey;for(var E0=-1,Ex=this.length;++E0<Ex;){E2=(E3=this[E0]).update;Ew.push(E4=[]);E4.parentNode=E3.parentNode;for(var E1=-1,Ev=E3.length;++E1<Ev;){if(Ey=E3[E1]){E4.push(E2[E1]=e=Ez.call(E3.parentNode,Ey.__data__,E1));e.__data__=Ey.__data__}else{E4.push(null)}}}return CA(Ew)};function D5(e,Ez,Ex){Ci(e,CR);var Ew=new AK,Ev=d3.dispatch("start","end"),Ey=Ad;e.id=Ez;e.time=Ex;e.tween=function(E0,E1){if(arguments.length<2){return Ew.get(E0)}if(E1==null){Ew.remove(E0)}else{Ew.set(E0,E1)}return e};e.ease=function(E0){if(!arguments.length){return Ey}Ey=typeof E0==="function"?E0:d3.ease.apply(d3,arguments);return e};e.each=function(E0,E1){if(arguments.length<2){return B3.call(e,E0)}Ev.on(E0,E1);return e};d3.timer(function(E0){e.each(function(E8,E5,E4){var FA=[],E2=this,E6=e[E4][E5].delay,E3=e[E4][E5].duration,FB=E2.__transition__||(E2.__transition__={active:0,count:0});++FB.count;E6<=E0?E1(E0):d3.timer(E1,E6,Ex);function E1(FC){if(FB.active>Ez){return E9()}FB.active=Ez;Ew.forEach(function(FD,FE){if(tween=FE.call(E2,E8,E5)){FA.push(tween)}});Ev.start.call(E2,E8,E5);if(!E7(FC)){d3.timer(E7,0,Ex)}return 1}function E7(FC){if(FB.active!==Ez){return E9()}var FD=(FC-E6)/E3,FE=Ey(FD),FF=FA.length;while(FF>0){FA[--FF].call(E2,FE)}if(FD>=1){E9();EL=Ez;Ev.end.call(E2,E8,E5);EL=0;return 1}}function E9(){if(!--FB.count){delete E2.__transition__}return 1}});return 1},0,Ex);return e}var Q={};function EC(Ew,Ev,e){return e!=""&&Q}function E(Ex,e){var Ew=DD(Ex);function Ev(E2,E1,Ez){var E0=e.call(this,E2,E1);return E0==null?Ez!=""&&Q:Ez!=E0&&Ew(Ez,E0)}function Ey(E1,E0,Ez){return Ez!=e&&Ew(Ez,e)}return typeof e==="function"?Ev:e==null?EC:(e+="",Ey)}var CR=[],EZ=0,EL=0,D=0,EA=250,C3=d3.ease("cubic-in-out"),Cn=D,EE=EA,Ad=C3;CR.call=B9.call;d3.transition=function(e){return arguments.length?(EL?e.transition():e):D7.transition()};d3.transition.prototype=CR;CR.select=function(Ez){var Ew=[],E3,e,Ex;if(typeof Ez!=="function"){Ez=S(Ez)}for(var E0=-1,Ey=this.length;++E0<Ey;){Ew.push(E3=[]);for(var E2=this[E0],E1=-1,Ev=E2.length;++E1<Ev;){if((Ex=E2[E1])&&(e=Ez.call(Ex.node,Ex.node.__data__,E1))){if("__data__" in Ex.node){e.__data__=Ex.node.__data__}E3.push({node:e,delay:Ex.delay,duration:Ex.duration})}else{E3.push(null)}}}return D5(Ew,this.id,this.time).ease(this.ease())};CR.selectAll=function(E0){var Ex=[],E5,e,Ey;if(typeof E0!=="function"){E0=Bc(E0)}for(var E2=-1,Ez=this.length;++E2<Ez;){for(var E4=this[E2],E3=-1,Ew=E4.length;++E3<Ew;){if(Ey=E4[E3]){e=E0.call(Ey.node,Ey.node.__data__,E3);Ex.push(E5=[]);for(var E1=-1,Ev=e.length;++E1<Ev;){E5.push({node:e[E1],delay:Ey.delay,duration:Ey.duration})}}}}return D5(Ex,this.id,this.time).ease(this.ease())};CR.attr=function(e,Ev){return this.attrTween(e,E(e,Ev))};CR.attrTween=function(e,Ew){var Ev=d3.ns.qualify(e);function Ex(E1,Ez){var E0=Ew.call(this,E1,Ez,this.getAttribute(Ev));return E0===Q?(this.removeAttribute(Ev),null):E0&&function(E2){this.setAttribute(Ev,E0(E2))}}function Ey(E1,Ez){var E0=Ew.call(this,E1,Ez,this.getAttributeNS(Ev.space,Ev.local));return E0===Q?(this.removeAttributeNS(Ev.space,Ev.local),null):E0&&function(E2){this.setAttributeNS(Ev.space,Ev.local,E0(E2))}}return this.tween("attr."+e,Ev.local?Ey:Ex)};CR.style=function(e,Ew,Ev){if(arguments.length<3){Ev=""}return this.styleTween(e,E(e,Ew),Ev)};CR.styleTween=function(e,Ew,Ev){if(arguments.length<3){Ev=""}return this.tween("style."+e,function(Ez,Ex){var Ey=Ew.call(this,Ez,Ex,window.getComputedStyle(this,null).getPropertyValue(e));return Ey===Q?(this.style.removeProperty(e),null):Ey&&function(E0){this.style.setProperty(e,Ey(E0),Ev)}})};CR.text=function(e){return this.tween("text",function(Ew,Ev){this.textContent=typeof e==="function"?e.call(this,Ew,Ev):e})};CR.remove=function(){return this.each("end.transition",function(){var e;if(!this.__transition__&&(e=this.parentNode)){e.removeChild(this)}})};CR.delay=function(Ev){var e=this;return e.each(typeof Ev==="function"?function(Ey,Ex,Ew){e[Ew][Ex].delay=Ev.apply(this,arguments)|0}:(Ev=Ev|0,function(Ey,Ex,Ew){e[Ew][Ex].delay=Ev}))};CR.duration=function(Ev){var e=this;return e.each(typeof Ev==="function"?function(Ey,Ex,Ew){e[Ew][Ex].duration=Math.max(1,Ev.apply(this,arguments)|0)}:(Ev=Math.max(1,Ev|0),function(Ey,Ex,Ew){e[Ew][Ex].duration=Ev}))};function B3(E4){var e=EL,Ey=Ad,E2=Cn,Ez=EE;EL=this.id;Ad=this.ease();for(var E0=0,Ex=this.length;E0<Ex;E0++){for(var E3=this[E0],E1=0,Ev=E3.length;E1<Ev;E1++){var Ew=E3[E1];if(Ew){Cn=this[E0][E1].delay;EE=this[E0][E1].duration;E4.call(Ew=Ew.node,Ew.__data__,E1,E0)}}}EL=e;Ad=Ey;Cn=E2;EE=Ez;return this}CR.transition=function(){return this.select(t)};var A6=null,BE,C1;d3.timer=function(Ez,e,Ey){var Ex=false,Ew,Ev=A6;if(arguments.length<3){if(arguments.length<2){e=0}else{if(!isFinite(e)){return}}Ey=Date.now()}while(Ev){if(Ev.callback===Ez){Ev.then=Ey;Ev.delay=e;Ex=true;break}Ew=Ev;Ev=Ev.next}if(!Ex){A6={callback:Ez,then:Ey,delay:e,next:A6}}if(!BE){C1=clearTimeout(C1);BE=1;EU(EV)}};function EV(){var e,Ew=Date.now(),Ex=A6;while(Ex){e=Ew-Ex.then;if(e>=Ex.delay){Ex.flush=Ex.callback(e)}Ex=Ex.next}var Ev=Cs()-Ew;if(Ev>24){if(isFinite(Ev)){clearTimeout(C1);C1=setTimeout(EV,Ev)}BE=0}else{BE=1;EU(EV)}}d3.timer.flush=function(){var e,Ev=Date.now(),Ew=A6;while(Ew){e=Ev-Ew.then;if(!Ew.delay){Ew.flush=Ew.callback(e)}Ew=Ew.next}Cs()};function Cs(){var Ev=null,e=A6,Ew=Infinity;while(e){if(e.flush){e=Ev?Ev.next=e.next:A6=e.next}else{Ew=Math.min(Ew,e.then+e.delay);e=(Ev=e).next}}return Ew}var EU=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.transform=function(Ev){var Ew=document.createElementNS(d3.ns.prefix.svg,"g"),e={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(Ex){Ew.setAttribute("transform",Ex);var Ey=Ew.transform.baseVal.consolidate();return new N(Ey?Ey.matrix:e)})(Ev)};function N(e){var Ex=[e.a,e.b],Ev=[e.c,e.d],Ez=DA(Ex),Ew=Cj(Ex,Ev),Ey=DA(Ax(Ev,Ex,-Ew))||0;if(Ex[0]*Ev[1]<Ev[0]*Ex[1]){Ex[0]*=-1;Ex[1]*=-1;Ez*=-1;Ew*=-1}this.rotate=(Ez?Math.atan2(Ex[1],Ex[0]):Math.atan2(-Ev[0],Ev[1]))*CY;this.translate=[e.e,e.f];this.scale=[Ez,Ey];this.skew=Ey?Math.atan2(Ew,Ey)*CY:0}N.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};function Cj(Ev,e){return Ev[0]*e[0]+Ev[1]*e[1]}function DA(e){var Ev=Math.sqrt(Cj(e,e));if(Ev){e[0]/=Ev;e[1]/=Ev}return Ev}function Ax(Ev,e,Ew){Ev[0]+=Ew*e[0];Ev[1]+=Ew*e[1];return Ev}var CY=180/Math.PI;d3.mouse=function(e){return AS(e,u())};var BP=/WebKit/.test(navigator.userAgent)?-1:0;function AS(Ex,E0){var Ey=Ex.ownerSVGElement||Ex;if(Ey.createSVGPoint){var Ev=Ey.createSVGPoint();if((BP<0)&&(window.scrollX||window.scrollY)){Ey=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var Ew=Ey[0][0].getScreenCTM();BP=!(Ew.f||Ew.e);Ey.remove()}if(BP){Ev.x=E0.pageX;Ev.y=E0.pageY}else{Ev.x=E0.clientX;Ev.y=E0.clientY}Ev=Ev.matrixTransform(Ex.getScreenCTM().inverse());return[Ev.x,Ev.y]}var Ez=Ex.getBoundingClientRect();return[E0.clientX-Ez.left-Ex.clientLeft,E0.clientY-Ez.top-Ex.clientTop]}d3.touches=function(e,Ev){if(arguments.length<2){Ev=u().touches}return Ev?B2(Ev).map(function(Ex){var Ew=AS(e,Ex);Ew.identifier=Ex.identifier;return Ew}):[]};function AJ(){}d3.scale={};function CP(Ev){var Ew=Ev[0],e=Ev[Ev.length-1];return Ew<e?[Ew,e]:[e,Ew]}function AT(e){return e.rangeExtent?e.rangeExtent():CP(e.range())}function Dk(E0,Ey){var Ez=0,Ex=E0.length-1,Ew=E0[Ez],Ev=E0[Ex],e;if(Ev<Ew){e=Ez;Ez=Ex;Ex=e;e=Ew;Ew=Ev;Ev=e}if(e=Ev-Ew){Ey=Ey(e);E0[Ez]=Ey.floor(Ew);E0[Ex]=Ey.ceil(Ev)}return E0}function Cc(){return Math}d3.scale.linear=function(){return CM([0,1],[0,1],d3.interpolate,false)};function CM(Ez,Ex,Ey,E1){var Ew,Ev;function e(){var E2=Math.min(Ez.length,Ex.length)>2?f:AI,E3=E1?AF:EW;Ew=E2(Ez,Ex,E3,Ey);Ev=E2(Ex,Ez,E3,d3.interpolate);return E0}function E0(E2){return Ew(E2)}E0.invert=function(E2){return Ev(E2)};E0.domain=function(E2){if(!arguments.length){return Ez}Ez=E2.map(Number);return e()};E0.range=function(E2){if(!arguments.length){return Ex}Ex=E2;return e()};E0.rangeRound=function(E2){return E0.range(E2).interpolate(d3.interpolateRound)};E0.clamp=function(E2){if(!arguments.length){return E1}E1=E2;return e()};E0.interpolate=function(E2){if(!arguments.length){return Ey}Ey=E2;return e()};E0.ticks=function(E2){return Cm(Ez,E2)};E0.tickFormat=function(E2){return Cw(Ez,E2)};E0.nice=function(){Dk(Ez,AM);return e()};E0.copy=function(){return CM(Ez,Ex,Ey,E1)};return e()}function Dc(Ev,e){return d3.rebind(Ev,e,"range","rangeRound","interpolate","clamp")}function AM(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return{floor:function(Ev){return Math.floor(Ev/e)*e},ceil:function(Ev){return Math.ceil(Ev/e)*e}}}function O(Ez,e){var Ew=CP(Ez),Ev=Ew[1]-Ew[0],Ey=Math.pow(10,Math.floor(Math.log(Ev/e)/Math.LN10)),Ex=e/Ev*Ey;if(Ex<=0.15){Ey*=10}else{if(Ex<=0.35){Ey*=5}else{if(Ex<=0.75){Ey*=2}}}Ew[0]=Math.ceil(Ew[0]/Ey)*Ey;Ew[1]=Math.floor(Ew[1]/Ey)*Ey+Ey*0.5;Ew[2]=Ey;return Ew}function Cm(Ev,e){return d3.range.apply(d3,O(Ev,e))}function Cw(Ev,e){return d3.format(",."+Math.max(0,-Math.floor(Math.log(O(Ev,e)[2])/Math.LN10+0.01))+"f")}function AI(Ey,e,Ez,Ew){var Ev=Ez(Ey[0],Ey[1]),Ex=Ew(e[0],e[1]);return function(E0){return Ex(Ev(E0))}}function f(E0,Ev,E1,Ey){var Ex=[],Ez=[],Ew=0,e=Math.min(E0.length,Ev.length)-1;if(E0[e]<E0[0]){E0=E0.slice().reverse();Ev=Ev.slice().reverse()}while(++Ew<=e){Ex.push(E1(E0[Ew-1],E0[Ew]));Ez.push(Ey(Ev[Ew-1],Ev[Ew]))}return function(E2){var E3=d3.bisect(E0,E2,1,e)-1;return Ez[E3](Ex[E3](E2))}}d3.scale.log=function(){return D1(d3.scale.linear(),Dd)};function D1(e,Ev){var Ew=Ev.pow;function Ex(Ey){return e(Ev(Ey))}Ex.invert=function(Ey){return Ew(e.invert(Ey))};Ex.domain=function(Ey){if(!arguments.length){return e.domain().map(Ew)}Ev=Ey[0]<0?Dg:Dd;Ew=Ev.pow;e.domain(Ey.map(Ev));return Ex};Ex.nice=function(){e.domain(Dk(e.domain(),Cc));return Ex};Ex.ticks=function(){var E3=CP(e.domain()),E4=[];if(E3.every(isFinite)){var E2=Math.floor(E3[0]),E1=Math.ceil(E3[1]),E0=Ew(E3[0]),Ez=Ew(E3[1]);if(Ev===Dg){E4.push(Ew(E2));for(;E2++<E1;){for(var Ey=9;Ey>0;Ey--){E4.push(Ew(E2)*Ey)}}}else{for(;E2<E1;E2++){for(var Ey=1;Ey<10;Ey++){E4.push(Ew(E2)*Ey)}}E4.push(Ew(E2))}for(E2=0;E4[E2]<E0;E2++){}for(E1=E4.length;E4[E1-1]>Ez;E1--){}E4=E4.slice(E2,E1)}return E4};Ex.tickFormat=function(E2,E1){if(arguments.length<2){E1=Bo}if(arguments.length<1){return E1}var Ey=E2/Ex.ticks().length,Ez=Ev===Dg?(E0=-1e-12,Math.floor):(E0=1e-12,Math.ceil),E0;return function(E3){return E3/Ew(Ez(Ev(E3)+E0))<Ey?E1(E3):""}};Ex.copy=function(){return D1(e.copy(),Ev)};return Dc(Ex,e)}var Bo=d3.format(".0e");function Dd(e){return Math.log(e<0?0:e)/Math.LN10}function Dg(e){return -Math.log(e>0?0:-e)/Math.LN10}Dd.pow=function(e){return Math.pow(10,e)};Dg.pow=function(e){return -Math.pow(10,-e)};d3.scale.pow=function(){return Dp(d3.scale.linear(),1)};function Dp(e,Ew){var Ev=DU(Ew),Ex=DU(1/Ew);function Ey(Ez){return e(Ev(Ez))}Ey.invert=function(Ez){return Ex(e.invert(Ez))};Ey.domain=function(Ez){if(!arguments.length){return e.domain().map(Ex)}e.domain(Ez.map(Ev));return Ey};Ey.ticks=function(Ez){return Cm(Ey.domain(),Ez)};Ey.tickFormat=function(Ez){return Cw(Ey.domain(),Ez)};Ey.nice=function(){return Ey.domain(Dk(Ey.domain(),AM))};Ey.exponent=function(Ez){if(!arguments.length){return Ew}var E0=Ey.domain();Ev=DU(Ew=Ez);Ex=DU(1/Ew);return Ey.domain(E0)};Ey.copy=function(){return Dp(e.copy(),Ew)};return Dc(Ey,e)}function DU(Ev){return function(e){return e<0?-Math.pow(-e,Ev):Math.pow(e,Ev)}}d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){return BF([],{t:"range",x:[]})};function BF(Ez,Ew){var Ey,Ev,Ex;function E0(E1){return Ev[((Ey.get(E1)||Ey.set(E1,Ez.push(E1)))-1)%Ev.length]}function e(E2,E1){return d3.range(Ez.length).map(function(E3){return E2+E1*E3})}E0.domain=function(E1){if(!arguments.length){return Ez}Ez=[];Ey=new AK;var E3=-1,E4=E1.length,E2;while(++E3<E4){if(!Ey.has(E2=E1[E3])){Ey.set(E2,Ez.push(E2))}}return E0[Ew.t](Ew.x,Ew.p)};E0.range=function(E1){if(!arguments.length){return Ev}Ev=E1;Ex=0;Ew={t:"range",x:E1};return E0};E0.rangePoints=function(E1,E4){if(arguments.length<2){E4=0}var E5=E1[0],E2=E1[1],E3=(E2-E5)/(Ez.length-1+E4);Ev=e(Ez.length<2?(E5+E2)/2:E5+E3*E4/2,E3);Ex=0;Ew={t:"rangePoints",x:E1,p:E4};return E0};E0.rangeBands=function(E1,E5){if(arguments.length<2){E5=0}var E2=E1[1]<E1[0],E6=E1[E2-0],E3=E1[1-E2],E4=(E3-E6)/(Ez.length+E5);Ev=e(E6+E4*E5,E4);if(E2){Ev.reverse()}Ex=E4*(1-E5);Ew={t:"rangeBands",x:E1,p:E5};return E0};E0.rangeRoundBands=function(E1,E6){if(arguments.length<2){E6=0}var E3=E1[1]<E1[0],E7=E1[E3-0],E4=E1[1-E3],E5=Math.floor((E4-E7)/(Ez.length+E6)),E2=E4-E7-(Ez.length-E6)*E5;Ev=e(E7+Math.round(E2/2),E5);if(E3){Ev.reverse()}Ex=Math.round(E5*(1-E6));Ew={t:"rangeRoundBands",x:E1,p:E6};return E0};E0.rangeBand=function(){return Ex};E0.rangeExtent=function(){return CP(Ew.x)};E0.copy=function(){return BF(Ez,Ew)};return E0.domain(Ez)}d3.scale.category10=function(){return d3.scale.ordinal().range(BM)};d3.scale.category20=function(){return d3.scale.ordinal().range(BA)};d3.scale.category20b=function(){return d3.scale.ordinal().range(EK)};d3.scale.category20c=function(){return d3.scale.ordinal().range(EJ)};var BM=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var BA=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];var EK=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"];var EJ=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return V([],[])};function V(Ew,Ev){var Ex;function e(){var Ez=0,E1=Ew.length,E0=Ev.length;Ex=[];while(++Ez<E0){Ex[Ez-1]=d3.quantile(Ew,Ez/E0)}return Ey}function Ey(Ez){if(isNaN(Ez=+Ez)){return NaN}return Ev[d3.bisect(Ex,Ez)]}Ey.domain=function(Ez){if(!arguments.length){return Ew}Ew=Ez.filter(function(E0){return !isNaN(E0)}).sort(d3.ascending);return e()};Ey.range=function(Ez){if(!arguments.length){return Ev}Ev=Ez;return e()};Ey.quantiles=function(){return Ex};Ey.copy=function(){return V(Ew,Ev)};return e()}d3.scale.quantize=function(){return By(0,1,[0,1])};function By(Ey,Ew,Ev){var Ez,Ex;function E0(E1){return Ev[Math.max(0,Math.min(Ex,Math.floor(Ez*(E1-Ey))))]}function e(){Ez=Ev.length/(Ew-Ey);Ex=Ev.length-1;return E0}E0.domain=function(E1){if(!arguments.length){return[Ey,Ew]}Ey=+E1[0];Ew=+E1[E1.length-1];return e()};E0.range=function(E1){if(!arguments.length){return Ev}Ev=E1;return e()};E0.copy=function(){return By(Ey,Ew,Ev)};return e()}d3.scale.identity=function(){return Cd([0,1])};function Cd(Ev){function e(Ew){return +Ew}e.invert=e;e.domain=e.range=function(Ew){if(!arguments.length){return Ev}Ev=Ew.map(e);return e};e.ticks=function(Ew){return Cm(Ev,Ew)};e.tickFormat=function(Ew){return Cw(Ev,Ew)};e.copy=function(){return Cd(Ev)};return e}d3.svg={};d3.svg.arc=function(){var Ey=An,Ex=BV,Ew=Dh,e=AA;function Ev(){var E2=Ey.apply(this,arguments),E1=Ex.apply(this,arguments),E0=Ew.apply(this,arguments)+Ec,Ez=e.apply(this,arguments)+Ec,E8=(Ez<E0&&(E8=E0,E0=Ez,Ez=E8),Ez-E0),E5=E8<Math.PI?"0":"1",E4=Math.cos(E0),E7=Math.sin(E0),E3=Math.cos(Ez),E6=Math.sin(Ez);return E8>=Eh?(E2?"M0,"+E1+"A"+E1+","+E1+" 0 1,1 0,"+(-E1)+"A"+E1+","+E1+" 0 1,1 0,"+E1+"M0,"+E2+"A"+E2+","+E2+" 0 1,0 0,"+(-E2)+"A"+E2+","+E2+" 0 1,0 0,"+E2+"Z":"M0,"+E1+"A"+E1+","+E1+" 0 1,1 0,"+(-E1)+"A"+E1+","+E1+" 0 1,1 0,"+E1+"Z"):(E2?"M"+E1*E4+","+E1*E7+"A"+E1+","+E1+" 0 "+E5+",1 "+E1*E3+","+E1*E6+"L"+E2*E3+","+E2*E6+"A"+E2+","+E2+" 0 "+E5+",0 "+E2*E4+","+E2*E7+"Z":"M"+E1*E4+","+E1*E7+"A"+E1+","+E1+" 0 "+E5+",1 "+E1*E3+","+E1*E6+"L0,0Z")}Ev.innerRadius=function(Ez){if(!arguments.length){return Ey}Ey=d3.functor(Ez);return Ev};Ev.outerRadius=function(Ez){if(!arguments.length){return Ex}Ex=d3.functor(Ez);return Ev};Ev.startAngle=function(Ez){if(!arguments.length){return Ew}Ew=d3.functor(Ez);return Ev};Ev.endAngle=function(Ez){if(!arguments.length){return e}e=d3.functor(Ez);return Ev};Ev.centroid=function(){var E0=(Ey.apply(this,arguments)+Ex.apply(this,arguments))/2,Ez=(Ew.apply(this,arguments)+e.apply(this,arguments))/2+Ec;return[Math.cos(Ez)*E0,Math.sin(Ez)*E0]};return Ev};var Ec=-Math.PI/2,Eh=2*Math.PI-0.000001;function An(e){return e.innerRadius}function BV(e){return e.outerRadius}function Dh(e){return e.startAngle}function AA(e){return e.endAngle}function Cv(Ev){var e=D9,E0=D8,Ex=CE,Ez=A7.get(Ex),Ey=0.7;function Ew(E1){return E1.length<1?null:"M"+Ez(Ev(AH(this,E1,e,E0)),Ey)}Ew.x=function(E1){if(!arguments.length){return e}e=E1;return Ew};Ew.y=function(E1){if(!arguments.length){return E0}E0=E1;return Ew};Ew.interpolate=function(E1){if(!arguments.length){return Ex}if(!A7.has(E1+="")){E1=CE}Ez=A7.get(Ex=E1);return Ew};Ew.tension=function(E1){if(!arguments.length){return Ey}Ey=E1;return Ew};return Ew}d3.svg.line=function(){return Cv(Object)};function AH(E3,Ey,E0,Ez){var E2=[],Ex=-1,e=Ey.length,Ew=typeof E0==="function",Ev=typeof Ez==="function",E1;if(Ew&&Ev){while(++Ex<e){E2.push([E0.call(E3,E1=Ey[Ex],Ex),Ez.call(E3,E1,Ex)])}}else{if(Ew){while(++Ex<e){E2.push([E0.call(E3,Ey[Ex],Ex),Ez])}}else{if(Ev){while(++Ex<e){E2.push([E0,Ez.call(E3,Ey[Ex],Ex)])}}else{while(++Ex<e){E2.push([E0,Ez])}}}}return E2}function D9(e){return e[0]}function D8(e){return e[1]}var CE="linear";var A7=d3.map({linear:Ek,"step-before":Ah,"step-after":EY,basis:C0,"basis-open":Ae,"basis-closed":BT,bundle:BU,cardinal:B7,"cardinal-open":A4,"cardinal-closed":P,monotone:Bl});function Ek(Ev){var e=0,Ey=Ev.length,Ex=Ev[0],Ew=[Ex[0],",",Ex[1]];while(++e<Ey){Ew.push("L",(Ex=Ev[e])[0],",",Ex[1])}return Ew.join("")}function Ah(Ev){var e=0,Ey=Ev.length,Ex=Ev[0],Ew=[Ex[0],",",Ex[1]];while(++e<Ey){Ew.push("V",(Ex=Ev[e])[1],"H",Ex[0])}return Ew.join("")}function EY(Ev){var e=0,Ey=Ev.length,Ex=Ev[0],Ew=[Ex[0],",",Ex[1]];while(++e<Ey){Ew.push("H",(Ex=Ev[e])[0],"V",Ex[1])}return Ew.join("")}function A4(Ev,e){return Ev.length<4?Ek(Ev):Ev[1]+BZ(Ev.slice(1,Ev.length-1),A0(Ev,e))}function P(Ev,e){return Ev.length<3?Ek(Ev):Ev[0]+BZ((Ev.push(Ev[0]),Ev),A0([Ev[Ev.length-2]].concat(Ev,[Ev[1]]),e))}function B7(Ew,Ev,e){return Ew.length<3?Ek(Ew):Ew[0]+BZ(Ew,A0(Ew,Ev))}function BZ(E0,Ez){if(Ez.length<1||(E0.length!=Ez.length&&E0.length!=Ez.length+2)){return Ek(E0)}var E1=E0.length!=Ez.length,E4="",E2=E0[0],e=E0[1],Ey=Ez[0],E3=Ey,Ew=1;if(E1){E4+="Q"+(e[0]-Ey[0]*2/3)+","+(e[1]-Ey[1]*2/3)+","+e[0]+","+e[1];E2=E0[1];Ew=2}if(Ez.length>1){E3=Ez[1];e=E0[Ew];Ew++;E4+="C"+(E2[0]+Ey[0])+","+(E2[1]+Ey[1])+","+(e[0]-E3[0])+","+(e[1]-E3[1])+","+e[0]+","+e[1];for(var Ev=2;Ev<Ez.length;Ev++,Ew++){e=E0[Ew];E3=Ez[Ev];E4+="S"+(e[0]-E3[0])+","+(e[1]-E3[1])+","+e[0]+","+e[1]}}if(E1){var Ex=E0[Ew];E4+="Q"+(e[0]+E3[0]*2/3)+","+(e[1]+E3[1]*2/3)+","+Ex[0]+","+Ex[1]}return E4}function A0(E0,Ey){var Ew=[],Ex=(1-Ey)/2,E2,E1=E0[0],Ez=E0[1],Ev=1,e=E0.length;while(++Ev<e){E2=E1;E1=Ez;Ez=E0[Ev];Ew.push([Ex*(Ez[0]-E2[0]),Ex*(Ez[1]-E2[1])])}return Ew}function C0(E1){if(E1.length<3){return Ek(E1)}var Ew=1,Ev=E1.length,Ex=E1[0],e=Ex[0],Ez=Ex[1],E0=[e,e,e,(Ex=E1[1])[0]],Ey=[Ez,Ez,Ez,Ex[1]],E2=[e,",",Ez];Au(E2,E0,Ey);while(++Ew<Ev){Ex=E1[Ew];E0.shift();E0.push(Ex[0]);Ey.shift();Ey.push(Ex[1]);Au(E2,E0,Ey)}Ew=-1;while(++Ew<2){E0.shift();E0.push(Ex[0]);Ey.shift();Ey.push(Ex[1]);Au(E2,E0,Ey)}return E2.join("")}function Ae(Ex){if(Ex.length<4){return Ek(Ex)}var Ez=[],Ew=-1,E0=Ex.length,Ey,Ev=[0],e=[0];while(++Ew<3){Ey=Ex[Ew];Ev.push(Ey[0]);e.push(Ey[1])}Ez.push(Dn(EP,Ev)+","+Dn(EP,e));--Ew;while(++Ew<E0){Ey=Ex[Ew];Ev.shift();Ev.push(Ey[0]);e.shift();e.push(Ey[1]);Au(Ez,Ev,e)}return Ez.join("")}function BT(Ey){var E0,Ex=-1,E1=Ey.length,e=E1+4,Ez,Ew=[],Ev=[];while(++Ex<4){Ez=Ey[Ex%E1];Ew.push(Ez[0]);Ev.push(Ez[1])}E0=[Dn(EP,Ew),",",Dn(EP,Ev)];--Ex;while(++Ex<e){Ez=Ey[Ex%E1];Ew.shift();Ew.push(Ez[0]);Ev.shift();Ev.push(Ez[1]);Au(E0,Ew,Ev)}return E0.join("")}function BU(E0,Ez){var Ew=E0.length-1,Ev=E0[0][0],Ey=E0[0][1],E3=E0[Ew][0]-Ev,E2=E0[Ew][1]-Ey,Ex=-1,e,E1;while(++Ex<=Ew){e=E0[Ex];E1=Ex/Ew;e[0]=Ez*e[0]+(1-Ez)*(Ev+E1*E3);e[1]=Ez*e[1]+(1-Ez)*(Ey+E1*E2)}return C0(E0)}function Dn(Ev,e){return Ev[0]*e[0]+Ev[1]*e[1]+Ev[2]*e[2]+Ev[3]*e[3]}var ES=[0,2/3,1/3,0],EQ=[0,1/3,2/3,0],EP=[0,1/6,2/3,1/6];function Au(Ev,e,Ew){Ev.push("C",Dn(ES,e),",",Dn(ES,Ew),",",Dn(EQ,e),",",Dn(EQ,Ew),",",Dn(EP,e),",",Dn(EP,Ew))}function Eq(Ev,e){return(e[1]-Ev[1])/(e[0]-Ev[0])}function CI(Ex){var Ew=0,Ev=Ex.length-1,e=[],E0=Ex[0],Ez=Ex[1],Ey=e[0]=Eq(E0,Ez);while(++Ew<Ev){e[Ew]=Ey+(Ey=Eq(E0=Ez,Ez=Ex[Ew+1]))}e[Ew]=Ey;return e}function AC(E1){var Ey=[],Ex,E0,Ez,E2,e=CI(E1),Ew=-1,Ev=E1.length-1;while(++Ew<Ev){Ex=Eq(E1[Ew],E1[Ew+1]);if(Math.abs(Ex)<0.000001){e[Ew]=e[Ew+1]=0}else{E0=e[Ew]/Ex;Ez=e[Ew+1]/Ex;E2=E0*E0+Ez*Ez;if(E2>9){E2=Ex*3/Math.sqrt(E2);e[Ew]=E2*E0;e[Ew+1]=E2*Ez}}}Ew=-1;while(++Ew<=Ev){E2=(E1[Math.min(Ev,Ew+1)][0]-E1[Math.max(0,Ew-1)][0])/(6*(1+e[Ew]*e[Ew]));Ey.push([E2||0,e[Ew]*E2||0])}return Ey}function Bl(e){return e.length<3?Ek(e):e[0]+BZ(e,AC(e))}d3.svg.line.radial=function(){var e=Cv(h);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};function h(Ex){var e,Ew=-1,Ez=Ex.length,Ey,Ev;while(++Ew<Ez){e=Ex[Ew];Ey=e[0];Ev=e[1]+Ec;e[0]=Ey*Math.cos(Ev);e[1]=Ey*Math.sin(Ev)}return Ex}function Es(Ez){var Ew=D9,Ev=D9,E3=0,E1=D8,E0,Ey,Ex,E2=0.7;function e(E6){if(E6.length<1){return null}var E5=AH(this,E6,Ew,E3),E4=AH(this,E6,Ew===Ev?Bq(E5):Ev,E3===E1?Bp(E5):E1);return"M"+Ey(Ez(E4),E2)+"L"+Ex(Ez(E5.reverse()),E2)+"Z"}e.x=function(E4){if(!arguments.length){return Ev}Ew=Ev=E4;return e};e.x0=function(E4){if(!arguments.length){return Ew}Ew=E4;return e};e.x1=function(E4){if(!arguments.length){return Ev}Ev=E4;return e};e.y=function(E4){if(!arguments.length){return E1}E3=E1=E4;return e};e.y0=function(E4){if(!arguments.length){return E3}E3=E4;return e};e.y1=function(E4){if(!arguments.length){return E1}E1=E4;return e};e.interpolate=function(E4){if(!arguments.length){return E0}if(!A7.has(E4+="")){E4=CE}Ey=A7.get(E0=E4);Ex=Ey.reverse||Ey;return e};e.tension=function(E4){if(!arguments.length){return E2}E2=E4;return e};return e.interpolate("linear")}Ah.reverse=EY;EY.reverse=Ah;d3.svg.area=function(){return Es(Object)};function Bq(e){return function(Ew,Ev){return e[Ev][0]}}function Bp(e){return function(Ew,Ev){return e[Ev][1]}}d3.svg.area.radial=function(){var e=Es(h);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};d3.svg.chord=function(){var e=AB,E1=AL,E0=X,E2=Dh,Ey=AA;function Ez(E7,E5){var E6=E3(this,e,E7,E5),E4=E3(this,E1,E7,E5);return"M"+E6.p0+Ev(E6.r,E6.p1,E6.a1-E6.a0)+(Ew(E6,E4)?Ex(E6.r,E6.p1,E6.r,E6.p0):Ex(E6.r,E6.p1,E4.r,E4.p0)+Ev(E4.r,E4.p1,E4.a1-E4.a0)+Ex(E4.r,E4.p1,E6.r,E6.p0))+"Z"}function E3(E7,FA,FB,E8){var E6=FA.call(E7,FB,E8),E9=E0.call(E7,E6,E8),E5=E2.call(E7,E6,E8)+Ec,E4=Ey.call(E7,E6,E8)+Ec;return{r:E9,a0:E5,a1:E4,p0:[E9*Math.cos(E5),E9*Math.sin(E5)],p1:[E9*Math.cos(E4),E9*Math.sin(E4)]}}function Ew(E5,E4){return E5.a0==E4.a0&&E5.a1==E4.a1}function Ev(E5,E6,E4){return"A"+E5+","+E5+" 0 "+ +(E4>Math.PI)+",1 "+E6}function Ex(E5,E7,E4,E6){return"Q 0,0 "+E6}Ez.radius=function(E4){if(!arguments.length){return E0}E0=d3.functor(E4);return Ez};Ez.source=function(E4){if(!arguments.length){return e}e=d3.functor(E4);return Ez};Ez.target=function(E4){if(!arguments.length){return E1}E1=d3.functor(E4);return Ez};Ez.startAngle=function(E4){if(!arguments.length){return E2}E2=d3.functor(E4);return Ez};Ez.endAngle=function(E4){if(!arguments.length){return Ey}Ey=d3.functor(E4);return Ez};return Ez};function AB(e){return e.source}function AL(e){return e.target}function X(e){return e.radius}function Dx(e){return e.startAngle}function CQ(e){return e.endAngle}d3.svg.diagonal=function(){var Ew=AB,Ex=AL,e=L;function Ev(E2,Ez){var E3=Ew.call(this,E2,Ez),E0=Ex.call(this,E2,Ez),Ey=(E3.y+E0.y)/2,E1=[E3,{x:E3.x,y:Ey},{x:E0.x,y:Ey},E0];E1=E1.map(e);return"M"+E1[0]+"C"+E1[1]+" "+E1[2]+" "+E1[3]}Ev.source=function(Ey){if(!arguments.length){return Ew}Ew=d3.functor(Ey);return Ev};Ev.target=function(Ey){if(!arguments.length){return Ex}Ex=d3.functor(Ey);return Ev};Ev.projection=function(Ey){if(!arguments.length){return e}e=Ey;return Ev};return Ev};function L(e){return[e.x,e.y]}d3.svg.diagonal.radial=function(){var Ew=d3.svg.diagonal(),e=L,Ev=Ew.projection;Ew.projection=function(Ex){return arguments.length?Ev(M(e=Ex)):e};return Ew};function M(e){return function(){var Ex=e.apply(this,arguments),Ew=Ex[0],Ev=Ex[1]+Ec;return[Ew*Math.cos(Ev),Ew*Math.sin(Ev)]}}d3.svg.mouse=d3.mouse;d3.svg.touches=d3.touches;d3.svg.symbol=function(){var Ev=AQ,e=Cr;function Ew(Ey,Ex){return(Ei.get(Ev.call(this,Ey,Ex))||A8)(e.call(this,Ey,Ex))}Ew.type=function(Ex){if(!arguments.length){return Ev}Ev=d3.functor(Ex);return Ew};Ew.size=function(Ex){if(!arguments.length){return e}e=d3.functor(Ex);return Ew};return Ew};function Cr(){return 64}function AQ(){return"circle"}function A8(e){var Ev=Math.sqrt(e/Math.PI);return"M0,"+Ev+"A"+Ev+","+Ev+" 0 1,1 0,"+(-Ev)+"A"+Ev+","+Ev+" 0 1,1 0,"+Ev+"Z"}var Ei=d3.map({circle:A8,cross:function(e){var Ev=Math.sqrt(e/5)/2;return"M"+-3*Ev+","+-Ev+"H"+-Ev+"V"+-3*Ev+"H"+Ev+"V"+-Ev+"H"+3*Ev+"V"+Ev+"H"+Ev+"V"+3*Ev+"H"+-Ev+"V"+Ev+"H"+-3*Ev+"Z"},diamond:function(e){var Ev=Math.sqrt(e/(2*BC)),Ew=Ev*BC;return"M0,"+-Ev+"L"+Ew+",0 0,"+Ev+" "+-Ew+",0Z"},square:function(e){var Ev=Math.sqrt(e)/2;return"M"+-Ev+","+-Ev+"L"+Ev+","+-Ev+" "+Ev+","+Ev+" "+-Ev+","+Ev+"Z"},"triangle-down":function(e){var Ew=Math.sqrt(e/A5),Ev=Ew*A5/2;return"M0,"+Ev+"L"+Ew+","+-Ev+" "+-Ew+","+-Ev+"Z"},"triangle-up":function(e){var Ew=Math.sqrt(e/A5),Ev=Ew*A5/2;return"M0,"+-Ev+"L"+Ew+","+Ev+" "+-Ew+","+Ev+"Z"}});d3.svg.symbolTypes=Ei.keys();var A5=Math.sqrt(3),BC=Math.tan(30*Math.PI/180);d3.svg.axis=function(){var Ex=d3.scale.linear(),E0="bottom",Ey=6,e=6,Ev=6,E4=3,E3=[10],Ez=null,E2,E1=0;function Ew(E5){E5.each(function(){var FO=d3.select(this);var FP=Ez==null?(Ex.ticks?Ex.ticks.apply(Ex,E3):Ex.domain()):Ez,FI=E2==null?(Ex.tickFormat?Ex.tickFormat.apply(Ex,E3):String):E2;var FA=BW(Ex,FP,E1),E9=FO.selectAll(".minor").data(FA,String),FL=E9.enter().insert("line","g").attr("class","tick minor").style("opacity",0.000001),FJ=d3.transition(E9.exit()).style("opacity",0.000001).remove(),E7=d3.transition(E9).style("opacity",1);var FN=FO.selectAll("g").data(FP,String),FF=FN.enter().insert("g","path").style("opacity",0.000001),FH=d3.transition(FN.exit()).style("opacity",0.000001).remove(),FB=d3.transition(FN).style("opacity",1),E6;var FE=AT(Ex),FG=FO.selectAll(".domain").data([0]),E8=FG.enter().append("path").attr("class","domain"),FQ=d3.transition(FG);var FK=Ex.copy(),FM=this.__chart__||FK;this.__chart__=FK;FF.append("line").attr("class","tick");FF.append("text");FB.select("text").text(FI);switch(E0){case"bottom":E6=C7;FL.attr("y2",e);E7.attr("x2",0).attr("y2",e);FF.select("line").attr("y2",Ey);FF.select("text").attr("y",Math.max(Ey,0)+E4);FB.select("line").attr("x2",0).attr("y2",Ey);FB.select("text").attr("x",0).attr("y",Math.max(Ey,0)+E4).attr("dy",".71em").attr("text-anchor","middle");FQ.attr("d","M"+FE[0]+","+Ev+"V0H"+FE[1]+"V"+Ev);break;case"top":E6=C7;FL.attr("y2",-e);E7.attr("x2",0).attr("y2",-e);FF.select("line").attr("y2",-Ey);FF.select("text").attr("y",-(Math.max(Ey,0)+E4));FB.select("line").attr("x2",0).attr("y2",-Ey);FB.select("text").attr("x",0).attr("y",-(Math.max(Ey,0)+E4)).attr("dy","0em").attr("text-anchor","middle");FQ.attr("d","M"+FE[0]+","+-Ev+"V0H"+FE[1]+"V"+-Ev);break;case"left":E6=C5;FL.attr("x2",-e);E7.attr("x2",-e).attr("y2",0);FF.select("line").attr("x2",-Ey);FF.select("text").attr("x",-(Math.max(Ey,0)+E4));FB.select("line").attr("x2",-Ey).attr("y2",0);FB.select("text").attr("x",-(Math.max(Ey,0)+E4)).attr("y",0).attr("dy",".32em").attr("text-anchor","end");FQ.attr("d","M"+-Ev+","+FE[0]+"H0V"+FE[1]+"H"+-Ev);break;case"right":E6=C5;FL.attr("x2",e);E7.attr("x2",e).attr("y2",0);FF.select("line").attr("x2",Ey);FF.select("text").attr("x",Math.max(Ey,0)+E4);FB.select("line").attr("x2",Ey).attr("y2",0);FB.select("text").attr("x",Math.max(Ey,0)+E4).attr("y",0).attr("dy",".32em").attr("text-anchor","start");FQ.attr("d","M"+Ev+","+FE[0]+"H0V"+FE[1]+"H"+Ev);break}if(Ex.ticks){FF.call(E6,FM);FB.call(E6,FK);FH.call(E6,FK);FL.call(E6,FM);E7.call(E6,FK);FJ.call(E6,FK)}else{var FD=FK.rangeBand()/2,FC=function(FR){return FK(FR)+FD};FF.call(E6,FC);FB.call(E6,FC)}})}Ew.scale=function(E5){if(!arguments.length){return Ex}Ex=E5;return Ew};Ew.orient=function(E5){if(!arguments.length){return E0}E0=E5;return Ew};Ew.ticks=function(){if(!arguments.length){return E3}E3=arguments;return Ew};Ew.tickValues=function(E5){if(!arguments.length){return Ez}Ez=E5;return Ew};Ew.tickFormat=function(E5){if(!arguments.length){return E2}E2=E5;return Ew};Ew.tickSize=function(E5,E8,E6){if(!arguments.length){return Ey}var E7=arguments.length-1;Ey=+E5;e=E7>1?+E8:Ey;Ev=E7>0?+arguments[E7]:Ey;return Ew};Ew.tickPadding=function(E5){if(!arguments.length){return E4}E4=+E5;return Ew};Ew.tickSubdivide=function(E5){if(!arguments.length){return E1}E1=+E5;return Ew};return Ew};function C7(Ev,e){Ev.attr("transform",function(Ew){return"translate("+e(Ew)+",0)"})}function C5(e,Ev){e.attr("transform",function(Ew){return"translate(0,"+Ev(Ew)+")"})}function BW(Ew,E0,Ev){E1=[];if(Ev&&E0.length>1){var E3=CP(Ew.domain()),E1,Ey=-1,e=E0.length,Ez=(E0[1]-E0[0])/++Ev,Ex,E2;while(++Ey<e){for(Ex=Ev;--Ex>0;){if((E2=+E0[Ey]-Ex*Ez)>=E3[0]){E1.push(E2)}}}for(--Ey,Ex=0;++Ex<Ev&&(E2=+E0[Ey]+Ex*Ez)<E3[1];){E1.push(E2)}}return E1}d3.svg.brush=function(){var e=EN(Ey,"brushstart","brush","brushend"),E0=null,Ez=null,E1=AD[0],E4=[[0,0],[0,0]],Ev;function Ey(E5){E5.each(function(){var E8=d3.select(this),E7=E8.selectAll(".background").data([0]),E6=E8.selectAll(".extent").data([0]),FA=E8.selectAll(".resize").data(E1,String),E9;E8.style("pointer-events","all").on("mousedown.brush",E2).on("touchstart.brush",E2);E7.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");E6.enter().append("rect").attr("class","extent").style("cursor","move");FA.enter().append("g").attr("class",function(FB){return"resize "+FB}).style("cursor",function(FB){return Cf[FB]}).append("rect").attr("x",function(FB){return/[ew]$/.test(FB)?-3:null}).attr("y",function(FB){return/^[ns]/.test(FB)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");FA.style("display",Ey.empty()?"none":null);FA.exit().remove();if(E0){E9=AT(E0);E7.attr("x",E9[0]).attr("width",E9[1]-E9[0]);Ex(E8)}if(Ez){E9=AT(Ez);E7.attr("y",E9[0]).attr("height",E9[1]-E9[0]);Ew(E8)}E3(E8)})}function E3(E5){E5.selectAll(".resize").attr("transform",function(E6){return"translate("+E4[+/e$/.test(E6)][0]+","+E4[+/^s/.test(E6)][1]+")"})}function Ex(E5){E5.select(".extent").attr("x",E4[0][0]);E5.selectAll(".extent,.n>rect,.s>rect").attr("width",E4[1][0]-E4[0][0])}function Ew(E5){E5.select(".extent").attr("y",E4[0][1]);E5.selectAll(".extent,.e>rect,.w>rect").attr("height",E4[1][1]-E4[0][1])}function E2(){var FO=this,E6=d3.select(d3.event.target),FC=e.of(FO,arguments),FJ=d3.select(FO),FL=E6.datum(),FH=!/^(n|s)$/.test(FL)&&E0,FF=!/^(e|w)$/.test(FL)&&Ez,FG=E6.classed("extent"),FM,FN=FD(),E7;var FA=d3.select(window).on("mousemove.brush",FB).on("mouseup.brush",E5).on("touchmove.brush",FB).on("touchend.brush",E5).on("keydown.brush",FE).on("keyup.brush",E9);if(FG){FN[0]=E4[0][0]-FN[0];FN[1]=E4[0][1]-FN[1]}else{if(FL){var FK=+/w$/.test(FL),FI=+/^n/.test(FL);E7=[E4[1-FK][0]-FN[0],E4[1-FI][1]-FN[1]];FN[0]=E4[FK][0];FN[1]=E4[FI][1]}else{if(d3.event.altKey){FM=FN.slice()}}}FJ.style("pointer-events","none").selectAll(".resize").style("display",null);d3.select("body").style("cursor",E6.style("cursor"));FC({type:"brushstart"});FB();Ee();function FD(){var FP=d3.event.changedTouches;return FP?d3.touches(FO,FP)[0]:d3.mouse(FO)}function FE(){if(d3.event.keyCode==32){if(!FG){FM=null;FN[0]-=E4[1][0];FN[1]-=E4[1][1];FG=2}Ee()}}function E9(){if(d3.event.keyCode==32&&FG==2){FN[0]+=E4[1][0];FN[1]+=E4[1][1];FG=0;Ee()}}function FB(){var FP=FD(),FQ=false;if(E7){FP[0]+=E7[0];FP[1]+=E7[1]}if(!FG){if(d3.event.altKey){if(!FM){FM=[(E4[0][0]+E4[1][0])/2,(E4[0][1]+E4[1][1])/2]}FN[0]=E4[+(FP[0]<FM[0])][0];FN[1]=E4[+(FP[1]<FM[1])][1]}else{FM=null}}if(FH&&E8(FP,E0,0)){Ex(FJ);FQ=true}if(FF&&E8(FP,Ez,1)){Ew(FJ);FQ=true}if(FQ){E3(FJ);FC({type:"brush",mode:FG?"move":"resize"})}}function E8(FX,FR,FT){var FU=AT(FR),FQ=FU[0],FP=FU[1],FV=FN[FT],FY=E4[1][FT]-E4[0][FT],FS,FW;if(FG){FQ-=FV;FP-=FY+FV}FS=Math.max(FQ,Math.min(FP,FX[FT]));if(FG){FW=(FS+=FV)+FY}else{if(FM){FV=Math.max(FQ,Math.min(FP,2*FM[FT]-FS))}if(FV<FS){FW=FS;FS=FV}else{FW=FV}}if(E4[0][FT]!==FS||E4[1][FT]!==FW){Ev=null;E4[0][FT]=FS;E4[1][FT]=FW;return true}}function E5(){FB();FJ.style("pointer-events","all").selectAll(".resize").style("display",Ey.empty()?"none":null);d3.select("body").style("cursor",null);FA.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);FC({type:"brushend"});Ee()}}Ey.x=function(E5){if(!arguments.length){return E0}E0=E5;E1=AD[!E0<<1|!Ez];return Ey};Ey.y=function(E5){if(!arguments.length){return Ez}Ez=E5;E1=AD[!E0<<1|!Ez];return Ey};Ey.extent=function(FA){var E7,E5,E9,E8,E6;if(!arguments.length){FA=Ev||E4;if(E0){E7=FA[0][0],E5=FA[1][0];if(!Ev){E7=E4[0][0],E5=E4[1][0];if(E0.invert){E7=E0.invert(E7),E5=E0.invert(E5)}if(E5<E7){E6=E7,E7=E5,E5=E6}}}if(Ez){E9=FA[0][1],E8=FA[1][1];if(!Ev){E9=E4[0][1],E8=E4[1][1];if(Ez.invert){E9=Ez.invert(E9),E8=Ez.invert(E8)}if(E8<E9){E6=E9,E9=E8,E8=E6}}}return E0&&Ez?[[E7,E9],[E5,E8]]:E0?[E7,E5]:Ez&&[E9,E8]}Ev=[[0,0],[0,0]];if(E0){E7=FA[0],E5=FA[1];if(Ez){E7=E7[0],E5=E5[0]}Ev[0][0]=E7,Ev[1][0]=E5;if(E0.invert){E7=E0(E7),E5=E0(E5)}if(E5<E7){E6=E7,E7=E5,E5=E6}E4[0][0]=E7|0,E4[1][0]=E5|0}if(Ez){E9=FA[0],E8=FA[1];if(E0){E9=E9[1],E8=E8[1]}Ev[0][1]=E9,Ev[1][1]=E8;if(Ez.invert){E9=Ez(E9),E8=Ez(E8)}if(E8<E9){E6=E9,E9=E8,E8=E6}E4[0][1]=E9|0,E4[1][1]=E8|0}return Ey};Ey.clear=function(){Ev=null;E4[0][0]=E4[0][1]=E4[1][0]=E4[1][1]=0;return Ey};Ey.empty=function(){return(E0&&E4[0][0]===E4[1][0])||(Ez&&E4[0][1]===E4[1][1])};return d3.rebind(Ey,e,"on")};var Cf={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};var AD=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={};d3.behavior.drag=function(){var Ex=EN(Ew,"drag","dragstart","dragend"),e=null;function Ew(){this.on("mousedown.drag",Ev).on("touchstart.drag",Ev)}function Ev(){var E0=this,E4=Ex.of(E0,arguments),E3=d3.event.target,Ez,E1=E6(),E2=0;var E5=d3.select(window).on("mousemove.drag",E7).on("touchmove.drag",E7).on("mouseup.drag",Ey,true).on("touchend.drag",Ey,true);if(e){Ez=e.apply(E0,arguments);Ez=[Ez.x-E1[0],Ez.y-E1[1]]}else{Ez=[0,0]}E4({type:"dragstart"});function E6(){var FA=E0.parentNode,E9=d3.event.changedTouches;return E9?d3.touches(FA,E9)[0]:d3.mouse(FA)}function E7(){if(!E0.parentNode){return Ey()}var FB=E6(),FA=FB[0]-E1[0],E9=FB[1]-E1[1];E2|=FA|E9;E1=FB;Ee();E4({type:"drag",x:FB[0]+Ez[0],y:FB[1]+Ez[1],dx:FA,dy:E9})}function Ey(){E4({type:"dragend"});if(E2){Ee();if(d3.event.target===E3){E5.on("click.drag",E8,true)}}E5.on("mousemove.drag",null).on("touchmove.drag",null).on("mouseup.drag",null).on("touchend.drag",null)}function E8(){Ee();E5.on("click.drag",null)}}Ew.origin=function(Ey){if(!arguments.length){return e}e=Ey;return Ew};return d3.rebind(Ew,Ex,"on")};d3.behavior.zoom=function(){var E1=[0,0],FC,FG=1,E8,Ew=DV,E7=EN(e,"zoom"),FB,E9,Ey,Ex,E0;function e(){this.on("mousedown.zoom",E5).on("mousewheel.zoom",E4).on("mousemove.zoom",FD).on("DOMMouseScroll.zoom",E4).on("dblclick.zoom",E2).on("touchstart.zoom",FA).on("touchmove.zoom",E3).on("touchend.zoom",FA)}e.translate=function(FH){if(!arguments.length){return E1}E1=FH.map(Number);return e};e.scale=function(FH){if(!arguments.length){return FG}FG=+FH;return e};e.scaleExtent=function(FH){if(!arguments.length){return Ew}Ew=FH==null?DV:FH.map(Number);return e};e.x=function(FH){if(!arguments.length){return E9}E9=FH;FB=FH.copy();return e};e.y=function(FH){if(!arguments.length){return Ex}Ex=FH;Ey=FH.copy();return e};function Ev(FH){return[(FH[0]-E1[0])/FG,(FH[1]-E1[1])/FG]}function E6(FH){return[FH[0]*FG+E1[0],FH[1]*FG+E1[1]]}function Ez(FH){FG=Math.max(Ew[0],Math.min(Ew[1],FH))}function FE(FI,FH){FH=E6(FH);E1[0]+=FI[0]-FH[0];E1[1]+=FI[1]-FH[1]}function FF(FH){if(E9){E9.domain(FB.range().map(function(FI){return(FI-E1[0])/FG}).map(FB.invert))}if(Ex){Ex.domain(Ey.range().map(function(FI){return(FI-E1[1])/FG}).map(Ey.invert))}d3.event.preventDefault();FH({type:"zoom",scale:FG,translate:E1})}function E5(){var FK=this,FN=E7.of(FK,arguments),FM=d3.event.target,FL=0,FO=d3.select(window).on("mousemove.zoom",FJ).on("mouseup.zoom",FI),FH=Ev(d3.mouse(FK));window.focus();Ee();function FJ(){FL=1;FE(d3.mouse(FK),FH);FF(FN)}function FI(){if(FL){Ee()}FO.on("mousemove.zoom",null).on("mouseup.zoom",null);if(FL&&d3.event.target===FM){FO.on("click.zoom",FP)}}function FP(){Ee();FO.on("click.zoom",null)}}function E4(){if(!FC){FC=Ev(d3.mouse(this))}Ez(Math.pow(2,BJ()*0.002)*FG);FE(d3.mouse(this),FC);FF(E7.of(this,arguments))}function FD(){FC=null}function E2(){var FI=d3.mouse(this),FH=Ev(FI);Ez(d3.event.shiftKey?FG/2:FG*2);FE(FI,FH);FF(E7.of(this,arguments))}function FA(){var FK=d3.touches(this),FI=Date.now();E8=FG;FC={};FK.forEach(function(FL){FC[FL.identifier]=Ev(FL)});Ee();if((FK.length===1)&&(FI-E0<500)){var FJ=FK[0],FH=Ev(FK[0]);Ez(FG*2);FE(FJ,FH);FF(E7.of(this,arguments))}E0=FI}function E3(){var FJ=d3.touches(this),FL=FJ[0],FI=FC[FL.identifier];if(FK=FJ[1]){var FK,FH=FC[FK.identifier];FL=[(FL[0]+FK[0])/2,(FL[1]+FK[1])/2];FI=[(FI[0]+FH[0])/2,(FI[1]+FH[1])/2];Ez(d3.event.scale*E8)}FE(FL,FI);FF(E7.of(this,arguments))}return d3.rebind(e,E7,"on")};var CD,DV=[0,Infinity];function BJ(){if(!CD){CD=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode}var Ew=d3.event,Ex;try{CD.scrollTop=1000;CD.dispatchEvent(Ew);Ex=1000-CD.scrollTop}catch(Ev){Ex=Ew.wheelDelta||(-Ew.detail*5)}return Ex}d3.layout={};d3.layout.bundle=function(){return function(e){var Ew=[],Ev=-1,Ex=e.length;while(++Ev<Ex){Ew.push(CZ(e[Ev]))}return Ew}};function CZ(Ex){var Ez=Ex.source,e=Ex.target,Ey=DQ(Ez,e),Ew=[Ez];while(Ez!==Ey){Ez=Ez.parent;Ew.push(Ez)}var Ev=Ew.length;while(e!==Ey){Ew.splice(Ev,0,e);e=e.parent}return Ew}function C9(Ew){var Ev=[],e=Ew.parent;while(e!=null){Ev.push(Ew);Ew=e;e=e.parent}Ev.push(Ew);return Ev}function DQ(Ex,Ev){if(Ex===Ev){return Ex}var Ew=C9(Ex),e=C9(Ev),Ey=Ew.pop(),Ez=e.pop(),E0=null;while(Ey===Ez){E0=Ey;Ey=Ew.pop();Ez=e.pop()}return E0}d3.layout.chord=function(){var Ez={},E0,Ex,E4,Ew,E3=0,e,Ev,Ey;function E2(){var E9={},FC=[],FK=d3.range(Ew),FG=[],FA,FI,E8,FD,FB;E0=[];Ex=[];FA=0,FD=-1;while(++FD<Ew){FI=0,FB=-1;while(++FB<Ew){FI+=E4[FD][FB]}FC.push(FI);FG.push(d3.range(Ew));FA+=FI}if(e){FK.sort(function(FM,FL){return e(FC[FM],FC[FL])})}if(Ev){FG.forEach(function(FM,FL){FM.sort(function(FO,FN){return Ev(E4[FL][FO],E4[FL][FN])})})}FA=(2*Math.PI-E3*Ew)/FA;FI=0,FD=-1;while(++FD<Ew){E8=FI,FB=-1;while(++FB<Ew){var FH=FK[FD],FF=FG[FH][FB],FJ=E4[FH][FF],E7=FI,E6=FI+=FJ*FA;E9[FH+"-"+FF]={index:FH,subindex:FF,startAngle:E7,endAngle:E6,value:FJ}}Ex.push({index:FH,startAngle:E8,endAngle:FI,value:(FI-E8)/FA});FI+=E3}FD=-1;while(++FD<Ew){FB=FD-1;while(++FB<Ew){var E5=E9[FD+"-"+FB],FE=E9[FB+"-"+FD];if(E5.value||FE.value){E0.push(E5.value<FE.value?{source:FE,target:E5}:{source:E5,target:FE})}}}if(Ey){E1()}}function E1(){E0.sort(function(E6,E5){return Ey((E6.source.value+E6.target.value)/2,(E5.source.value+E5.target.value)/2)})}Ez.matrix=function(E5){if(!arguments.length){return E4}Ew=(E4=E5)&&E4.length;E0=Ex=null;return Ez};Ez.padding=function(E5){if(!arguments.length){return E3}E3=E5;E0=Ex=null;return Ez};Ez.sortGroups=function(E5){if(!arguments.length){return e}e=E5;E0=Ex=null;return Ez};Ez.sortSubgroups=function(E5){if(!arguments.length){return Ev}Ev=E5;E0=null;return Ez};Ez.sortChords=function(E5){if(!arguments.length){return Ey}Ey=E5;if(E0){E1()}return Ez};Ez.chords=function(){if(!E0){E2()}return E0};Ez.groups=function(){if(!Ex){E2()}return Ex};return Ez};d3.layout.force=function(){var Ev={},E8=d3.dispatch("start","tick","end"),E4=[1,1],FA,Ey,E1=0.9,FC=DR,Ex=BG,E7=-30,Ez=0.1,E2=0.8,FB,E6=[],Ew=[],E0,e,E3;function E9(FD){return function(FK,FF,FJ,FE,FI){if(FK.point!==FD){var FM=FK.cx-FD.x,FL=FK.cy-FD.y,FH=1/Math.sqrt(FM*FM+FL*FL);if((FE-FF)*FH<E2){var FG=FK.charge*FH*FH;FD.px-=FM*FG;FD.py-=FL*FG;return true}if(FK.point&&isFinite(FH)){var FG=FK.pointCharge*FH*FH;FD.px-=FM*FG;FD.py-=FL*FG}}return !FK.charge}}Ev.tick=function(){if((Ey*=0.99)<0.005){E8.end({type:"end",alpha:Ey=0});return true}var FF=E6.length,FG=Ew.length,FD,FJ,FE,FN,FM,FH,FI,FL,FK;for(FJ=0;FJ<FG;++FJ){FE=Ew[FJ];FN=FE.source;FM=FE.target;FL=FM.x-FN.x;FK=FM.y-FN.y;if(FH=(FL*FL+FK*FK)){FH=Ey*e[FJ]*((FH=Math.sqrt(FH))-E0[FJ])/FH;FL*=FH;FK*=FH;FM.x-=FL*(FI=FN.weight/(FM.weight+FN.weight));FM.y-=FK*FI;FN.x+=FL*(FI=1-FI);FN.y+=FK*FI}}if(FI=Ey*Ez){FL=E4[0]/2;FK=E4[1]/2;FJ=-1;if(FI){while(++FJ<FF){FE=E6[FJ];FE.x+=(FL-FE.x)*FI;FE.y+=(FK-FE.y)*FI}}}if(E7){Dv(FD=d3.geom.quadtree(E6),Ey,E3);FJ=-1;while(++FJ<FF){if(!(FE=E6[FJ]).fixed){FD.visit(E9(FE))}}}FJ=-1;while(++FJ<FF){FE=E6[FJ];if(FE.fixed){FE.x=FE.px;FE.y=FE.py}else{FE.x-=(FE.px-(FE.px=FE.x))*E1;FE.y-=(FE.py-(FE.py=FE.y))*E1}}E8.tick({type:"tick",alpha:Ey})};Ev.nodes=function(FD){if(!arguments.length){return E6}E6=FD;return Ev};Ev.links=function(FD){if(!arguments.length){return Ew}Ew=FD;return Ev};Ev.size=function(FD){if(!arguments.length){return E4}E4=FD;return Ev};Ev.linkDistance=function(FD){if(!arguments.length){return FC}FC=d3.functor(FD);return Ev};Ev.distance=Ev.linkDistance;Ev.linkStrength=function(FD){if(!arguments.length){return Ex}Ex=d3.functor(FD);return Ev};Ev.friction=function(FD){if(!arguments.length){return E1}E1=FD;return Ev};Ev.charge=function(FD){if(!arguments.length){return E7}E7=typeof FD==="function"?FD:+FD;return Ev};Ev.gravity=function(FD){if(!arguments.length){return Ez}Ez=FD;return Ev};Ev.theta=function(FD){if(!arguments.length){return E2}E2=FD;return Ev};Ev.alpha=function(FD){if(!arguments.length){return Ey}if(Ey){if(FD>0){Ey=FD}else{Ey=0}}else{if(FD>0){E8.start({type:"start",alpha:Ey=FD});d3.timer(Ev.tick)}}return Ev};Ev.start=function(){var FH,FG,FE=E6.length,FF=Ew.length,FK=E4[0],FJ=E4[1],FM,FD;for(FH=0;FH<FE;++FH){(FD=E6[FH]).index=FH;FD.weight=0}E0=[];e=[];for(FH=0;FH<FF;++FH){FD=Ew[FH];if(typeof FD.source=="number"){FD.source=E6[FD.source]}if(typeof FD.target=="number"){FD.target=E6[FD.target]}E0[FH]=FC.call(this,FD,FH);e[FH]=Ex.call(this,FD,FH);++FD.source.weight;++FD.target.weight}for(FH=0;FH<FE;++FH){FD=E6[FH];if(isNaN(FD.x)){FD.x=FI("x",FK)}if(isNaN(FD.y)){FD.y=FI("y",FJ)}if(isNaN(FD.px)){FD.px=FD.x}if(isNaN(FD.py)){FD.py=FD.y}}E3=[];if(typeof E7==="function"){for(FH=0;FH<FE;++FH){E3[FH]=+E7.call(this,E6[FH],FH)}}else{for(FH=0;FH<FE;++FH){E3[FH]=E7}}function FI(FS,FR){var FQ=FL(FH),FP=-1,FO=FQ.length,FN;while(++FP<FO){if(!isNaN(FN=FQ[FP][FS])){return FN}}return Math.random()*FR}function FL(){if(!FM){FM=[];for(FG=0;FG<FE;++FG){FM[FG]=[]}for(FG=0;FG<FF;++FG){var FN=Ew[FG];FM[FN.source.index].push(FN.target);FM[FN.target.index].push(FN.source)}}return FM[FH]}return Ev.resume()};Ev.resume=function(){return Ev.alpha(0.1)};Ev.stop=function(){return Ev.alpha(0)};Ev.drag=function(){if(!FA){FA=d3.behavior.drag().origin(Object).on("dragstart",E5).on("drag",DE).on("dragend",Ck)}this.on("mouseover.force",J).on("mouseout.force",Du).call(FA)};function E5(FD){J(DK=FD);C6=Ev}return d3.rebind(Ev,E8,"on")};var C6,DK;function J(e){e.fixed|=2}function Du(e){if(e!==DK){e.fixed&=1}}function Ck(){DK.fixed&=1;C6=DK=null}function DE(){DK.px=d3.event.x;DK.py=d3.event.y;C6.resume()}function Dv(E3,Ey,E2){var Ez=0,Ew=0;E3.charge=0;if(!E3.leaf){var e=E3.nodes,Ev=e.length,E0=-1,E1;while(++E0<Ev){E1=e[E0];if(E1==null){continue}Dv(E1,Ey,E2);E3.charge+=E1.charge;Ez+=E1.charge*E1.cx;Ew+=E1.charge*E1.cy}}if(E3.point){if(!E3.leaf){E3.point.x+=Math.random()-0.5;E3.point.y+=Math.random()-0.5}var Ex=Ey*E2[E3.point.index];E3.charge+=E3.pointCharge=Ex;Ez+=Ex*E3.point.x;Ew+=Ex*E3.point.y}E3.cx=Ez/E3.charge;E3.cy=Ew/E3.charge}function DR(e){return 20}function BG(e){return 1}d3.layout.partition=function(){var Ew=d3.layout.hierarchy(),Ex=[1,1];function e(E1,E5,E7,E6){var Ez=E1.children;E1.x=E5;E1.y=E1.depth*E6;E1.dx=E7;E1.dy=E6;if(Ez&&(E0=Ez.length)){var E2=-1,E0,E4,E3;E7=E1.value?E7/E1.value:0;while(++E2<E0){e(E4=Ez[E2],E5,E3=E4.value*E7,E6);E5+=E3}}}function Ey(E1){var E0=E1.children,E2=0;if(E0&&(E3=E0.length)){var Ez=-1,E3;while(++Ez<E3){E2=Math.max(E2,Ey(E0[Ez]))}}return 1+E2}function Ev(E1,E0){var Ez=Ew.call(this,E1,E0);e(Ez[0],0,Ex[0],Ex[1]/Ey(Ez[0]));return Ez}Ev.size=function(Ez){if(!arguments.length){return Ex}Ex=Ez;return Ev};return Dq(Ev,Ew)};d3.layout.pie=function(){var Ey=Number,Ex=n,Ew=0,Ev=2*Math.PI;function e(E5,E3){var E1=E5.map(function(E7,E6){return +Ey.call(e,E7,E6)});var Ez=+(typeof Ew==="function"?Ew.apply(this,arguments):Ew);var E0=((typeof Ev==="function"?Ev.apply(this,arguments):Ev)-Ew)/d3.sum(E1);var E2=d3.range(E5.length);if(Ex!=null){E2.sort(Ex===n?function(E7,E6){return E1[E6]-E1[E7]}:function(E7,E6){return Ex(E5[E7],E5[E6])})}var E4=[];E2.forEach(function(E6){E4[E6]={data:E5[E6],value:d=E1[E6],startAngle:Ez,endAngle:Ez+=d*E0}});return E4}e.value=function(Ez){if(!arguments.length){return Ey}Ey=Ez;return e};e.sort=function(Ez){if(!arguments.length){return Ex}Ex=Ez;return e};e.startAngle=function(Ez){if(!arguments.length){return Ew}Ew=Ez;return e};e.endAngle=function(Ez){if(!arguments.length){return Ev}Ev=Ez;return e};return e};var n={};d3.layout.stack=function(){var Ex=Object,Ew=Av,Ez=DM,Ey=DN,Ev=z,E0=y;function e(E8,FA){var E9=E8.map(function(FD,FC){return Ex.call(e,FD,FC)});var FB=E9.map(function(FD,FC){return FD.map(function(FE,FF){return[Ev.call(e,FE,FF),E0.call(e,FE,FF)]})});var E5=Ew.call(e,FB,FA);E9=d3.permute(E9,E5);FB=d3.permute(FB,E5);var E4=Ez.call(e,FB,FA);var E2=E9.length,E3=E9[0].length,E7,E6,E1;for(E6=0;E6<E3;++E6){Ey.call(e,E9[0][E6],E1=E4[E6],FB[0][E6][1]);for(E7=1;E7<E2;++E7){Ey.call(e,E9[E7][E6],E1+=FB[E7-1][E6][1],FB[E7][E6][1])}}return E8}e.values=function(E1){if(!arguments.length){return Ex}Ex=E1;return e};e.order=function(E1){if(!arguments.length){return Ew}Ew=typeof E1==="function"?E1:AX.get(E1)||Av;return e};e.offset=function(E1){if(!arguments.length){return Ez}Ez=typeof E1==="function"?E1:w.get(E1)||DM;return e};e.x=function(E1){if(!arguments.length){return Ev}Ev=E1;return e};e.y=function(E1){if(!arguments.length){return E0}E0=E1;return e};e.out=function(E1){if(!arguments.length){return Ey}Ey=E1;return e};return e};function z(e){return e.x}function y(e){return e.y}function DN(Ev,e,Ew){Ev.y0=e;Ev.y=Ew}var AX=d3.map({"inside-out":function(Ey){var Ew=Ey.length,Ez,Ex,E3=Ey.map(A1),E0=Ey.map(Br),E1=d3.range(Ew).sort(function(E6,E5){return E3[E6]-E3[E5]}),E2=0,e=0,E4=[],Ev=[];for(Ez=0;Ez<Ew;++Ez){Ex=E1[Ez];if(E2<e){E2+=E0[Ex];E4.push(Ex)}else{e+=E0[Ex];Ev.push(Ex)}}return Ev.reverse().concat(E4)},reverse:function(e){return d3.range(e.length).reverse()},"default":Av});var w=d3.map({silhouette:function(Ey){var Ev=Ey.length,Ew=Ey[0].length,E0=[],E1=0,Ez,Ex,e,E2=[];for(Ex=0;Ex<Ew;++Ex){for(Ez=0,e=0;Ez<Ev;Ez++){e+=Ey[Ez][Ex][1]}if(e>E1){E1=e}E0.push(e)}for(Ex=0;Ex<Ew;++Ex){E2[Ex]=(E1-E0[Ex])/2}return E2},wiggle:function(E0){var Ev=E0.length,E4=E0[0],Ew=E4.length,E2=0,E1,Ez,Ey,E7,E6,E3,E8,e,Ex,E5=[];E5[0]=e=Ex=0;for(Ez=1;Ez<Ew;++Ez){for(E1=0,E7=0;E1<Ev;++E1){E7+=E0[E1][Ez][1]}for(E1=0,E6=0,E8=E4[Ez][0]-E4[Ez-1][0];E1<Ev;++E1){for(Ey=0,E3=(E0[E1][Ez][1]-E0[E1][Ez-1][1])/(2*E8);Ey<E1;++Ey){E3+=(E0[Ey][Ez][1]-E0[Ey][Ez-1][1])/E8}E6+=E3*E0[E1][Ez][1]}E5[Ez]=e-=E7?E6/E7*E8:0;if(e<Ex){Ex=e}}for(Ez=0;Ez<Ew;++Ez){E5[Ez]-=Ex}return E5},expand:function(Ez){var E1=Ez.length,e=Ez[0].length,Ev=1/E1,Ex,Ew,E0,Ey=[];for(Ew=0;Ew<e;++Ew){for(Ex=0,E0=0;Ex<E1;Ex++){E0+=Ez[Ex][Ew][1]}if(E0){for(Ex=0;Ex<E1;Ex++){Ez[Ex][Ew][1]/=E0}}else{for(Ex=0;Ex<E1;Ex++){Ez[Ex][Ew][1]=Ev}}}for(Ew=0;Ew<e;++Ew){Ey[Ew]=0}return Ey},zero:DM});function Av(e){return d3.range(e.length)}function DM(Ex){var Ev=-1,e=Ex[0].length,Ew=[];while(++Ev<e){Ew[Ev]=0}return Ew}function A1(Ez){var Ex=1,Ew=0,Ev=Ez[0][1],e,Ey=Ez.length;for(;Ex<Ey;++Ex){if((e=Ez[Ex][1])>Ev){Ew=Ex;Ev=e}}return Ew}function Br(e){return e.reduce(DL,0)}function DL(e,Ev){return e+Ev[1]}d3.layout.histogram=function(){var Ey=true,Ev=Number,e=Af,Ew=EX;function Ex(E2,E3){var E8=[],E6=E2.map(Ev,this),E4=e.call(this,E6,E3),E7=Ew.call(this,E4,E6,E3),E9,E3=-1,Ez=E6.length,E0=E7.length-1,E1=Ey?1:1/Ez,E5;while(++E3<E0){E9=E8[E3]=[];E9.dx=E7[E3+1]-(E9.x=E7[E3]);E9.y=0}E3=-1;while(++E3<Ez){E5=E6[E3];if((E5>=E4[0])&&(E5<=E4[1])){E9=E8[d3.bisect(E7,E5,1,E0)-1];E9.y+=E1;E9.push(E2[E3])}}return E8}Ex.value=function(Ez){if(!arguments.length){return Ev}Ev=Ez;return Ex};Ex.range=function(Ez){if(!arguments.length){return e}e=d3.functor(Ez);return Ex};Ex.bins=function(Ez){if(!arguments.length){return Ew}Ew=typeof Ez==="number"?function(E0){return F(E0,Ez)}:d3.functor(Ez);return Ex};Ex.frequency=function(Ez){if(!arguments.length){return Ey}Ey=!!Ez;return Ex};return Ex};function EX(Ev,e){return F(Ev,Math.ceil(Math.log(e.length)/Math.LN2+1))}function F(Ex,Ez){var Ew=-1,Ev=+Ex[0],e=(Ex[1]-Ev)/Ez,Ey=[];while(++Ew<=Ez){Ey[Ew]=e*Ew+Ev}return Ey}function Af(e){return[d3.min(e),d3.max(e)]}d3.layout.hierarchy=function(){var Ew=B5,Ev=AZ,Ey=Eg;function Ex(E5,E4,E0){var E7=Ev.call(e,E5,E4),E2=H?E5:{data:E5};E2.depth=E4;E0.push(E2);if(E7&&(E1=E7.length)){var E6=-1,E1,E8=E2.children=[],E9=0,E3=E4+1;while(++E6<E1){d=Ex(E7[E6],E3,E0);d.parent=E2;E8.push(d);E9+=d.value}if(Ew){E8.sort(Ew)}if(Ey){E2.value=E9}}else{if(Ey){E2.value=+Ey.call(e,E5,E4)||0}}return E2}function Ez(E4,E5){var E3=E4.children,E0=0;if(E3&&(E6=E3.length)){var E2=-1,E6,E1=E5+1;while(++E2<E6){E0+=Ez(E3[E2],E1)}}else{if(Ey){E0=+Ey.call(e,H?E4:E4.data,E5)||0}}if(Ey){E4.value=E0}return E0}function e(E1){var E0=[];Ex(E1,0,E0);return E0}e.sort=function(E0){if(!arguments.length){return Ew}Ew=E0;return e};e.children=function(E0){if(!arguments.length){return Ev}Ev=E0;return e};e.value=function(E0){if(!arguments.length){return Ey}Ey=E0;return e};e.revalue=function(E0){Ez(E0,0);return E0};return e};function Dq(Ev,e){d3.rebind(Ev,e,"sort","children","value");Ev.links=Dr;Ev.nodes=function(Ew){H=true;return(Ev.nodes=Ev)(Ew)};return Ev}function AZ(e){return e.children}function Eg(e){return e.value}function B5(Ev,e){return e.value-Ev.value}function Dr(e){return d3.merge(e.map(function(Ev){return(Ev.children||[]).map(function(Ew){return{source:Ev,target:Ew}})}))}var H=false;d3.layout.pack=function(){var e=d3.layout.hierarchy().sort(CU),Ew=[1,1];function Ev(E3,E1){var E0=e.call(this,E3,E1),Ey=E0[0];Ey.x=0;Ey.y=0;CF(Ey);var Ex=Ew[0],E2=Ew[1],Ez=1/Math.max(2*Ey.r/Ex,2*Ey.r/E2);C8(Ey,Ex/2,E2/2,Ez);return E0}Ev.size=function(Ex){if(!arguments.length){return Ew}Ew=Ex;return Ev};return Dq(Ev,e)};function CU(Ev,e){return Ev.value-e.value}function Aw(Ev,e){var Ew=Ev._pack_next;Ev._pack_next=e;e._pack_prev=Ev;e._pack_next=Ew;Ew._pack_prev=e}function Ab(Ev,e){Ev._pack_next=e;e._pack_prev=Ev}function CN(Ew,e){var Ex=e.x-Ew.x,Ev=e.y-Ew.y,Ey=Ew.r+e.r;return Ey*Ey-Ex*Ex-Ev*Ev>0.001}function k(E4){var E9=Infinity,FD=-Infinity,e=Infinity,Ey=-Infinity,E3=E4.length,FC,FB,FA,E7,E6;function Ew(FE){E9=Math.min(FE.x-FE.r,E9);FD=Math.max(FE.x+FE.r,FD);e=Math.min(FE.y-FE.r,e);Ey=Math.max(FE.y+FE.r,Ey)}E4.forEach(AO);FC=E4[0];FC.x=-FC.r;FC.y=0;Ew(FC);if(E3>1){FB=E4[1];FB.x=FB.r;FB.y=0;Ew(FB);if(E3>2){FA=E4[2];Aa(FC,FB,FA);Ew(FA);Aw(FC,FA);FC._pack_prev=FA;Aw(FA,FB);FB=FC._pack_next;for(var E8=3;E8<E3;E8++){Aa(FC,FB,FA=E4[E8]);var Ev=0,Ez=1,Ex=1;for(E7=FB._pack_next;E7!==FB;E7=E7._pack_next,Ez++){if(CN(E7,FA)){Ev=1;break}}if(Ev==1){for(E6=FC._pack_prev;E6!==E7._pack_prev;E6=E6._pack_prev,Ex++){if(CN(E6,FA)){break}}}if(Ev){if(Ez<Ex||(Ez==Ex&&FB.r<FC.r)){Ab(FC,FB=E7)}else{Ab(FC=E6,FB)}E8--}else{Aw(FC,FA);FB=FA;Ew(FA)}}}}var E1=(E9+FD)/2,E0=(e+Ey)/2,E2=0;for(var E8=0;E8<E3;E8++){var E5=E4[E8];E5.x-=E1;E5.y-=E0;E2=Math.max(E2,E5.r+Math.sqrt(E5.x*E5.x+E5.y*E5.y))}E4.forEach(Ca);return E2}function AO(e){e._pack_next=e._pack_prev=e}function Ca(e){delete e._pack_next;delete e._pack_prev}function CF(Ev){var e=Ev.children;if(e&&e.length){e.forEach(CF);Ev.r=k(e)}else{Ev.r=Math.sqrt(Ev.value)}}function C8(Ey,e,E0,Ev){var Ex=Ey.children;Ey.x=(e+=Ev*Ey.x);Ey.y=(E0+=Ev*Ey.y);Ey.r*=Ev;if(Ex){var Ew=-1,Ez=Ex.length;while(++Ew<Ez){C8(Ex[Ew],e,E0,Ev)}}}function Aa(Ez,Ex,Ev){var E2=Ez.r+Ev.r,E5=Ex.x-Ez.x,E3=Ex.y-Ez.y;if(E2&&(E5||E3)){var E4=Ex.r+Ev.r,E1=Math.sqrt(E5*E5+E3*E3),E0=Math.max(-1,Math.min(1,(E2*E2+E1*E1-E4*E4)/(2*E2*E1))),e=Math.acos(E0),Ey=E0*(E2/=E1),Ew=Math.sin(e)*E2;Ev.x=Ez.x+Ey*E5+Ew*E3;Ev.y=Ez.y+Ey*E3-Ew*E5}else{Ev.x=Ez.x+E2;Ev.y=Ez.y}}d3.layout.cluster=function(){var Ev=d3.layout.hierarchy().sort(null).value(null),Ex=Bu,Ew=[1,1];function e(E5,E2){var Ey=Ev.call(this,E5,E2),E6=Ey[0],E7,E8=0,E4,E3;Eb(E6,function(FB){var FA=FB.children;if(FA&&FA.length){FB.x=Al(FA);FB.y=Ak(FA)}else{FB.x=E7?E8+=Ex(FB,E7):0;FB.y=0;E7=FB}});var E1=CV(E6),E9=Bz(E6),E0=E1.x-Ex(E1,E9)/2,Ez=E9.x+Ex(E9,E1)/2;Eb(E6,function(FA){FA.x=(FA.x-E0)/(Ez-E0)*Ew[0];FA.y=(1-(E6.y?FA.y/E6.y:1))*Ew[1]});return Ey}e.separation=function(Ey){if(!arguments.length){return Ex}Ex=Ey;return e};e.size=function(Ey){if(!arguments.length){return Ew}Ew=Ey;return e};return Dq(e,Ev)};function Ak(e){return 1+d3.max(e,function(Ev){return Ev.y})}function Al(e){return e.reduce(function(Ev,Ew){return Ev+Ew.x},0)/e.length}function CV(Ev){var e=Ev.children;return e&&e.length?CV(e[0]):Ev}function Bz(Ev){var e=Ev.children,Ew;return e&&(Ew=e.length)?Bz(e[Ew-1]):Ev}d3.layout.tree=function(){var Ev=d3.layout.hierarchy().sort(null).value(null),Ex=Bu,Ew=[1,1];function e(E5,E3){var Ez=Ev.call(this,E5,E3),E7=Ez[0];function E4(FF,FB){var FD=FF.children,FI=FF._tree;if(FD&&(FE=FD.length)){var FE,FK=FD[0],FJ,FH=FK,FC,FG=-1;while(++FG<FE){FC=FD[FG];E4(FC,FJ);FH=Ey(FC,FJ,FH);FJ=FC}Bw(FF);var FL=0.5*(FK._tree.prelim+FC._tree.prelim);if(FB){FI.prelim=FB._tree.prelim+Ex(FF,FB);FI.mod=FI.prelim-FL}else{FI.prelim=FL}}else{if(FB){FI.prelim=FB._tree.prelim+Ex(FF,FB)}}}function E6(FE,FB){FE.x=FE._tree.prelim+FB;var FD=FE.children;if(FD&&(FF=FD.length)){var FC=-1,FF;FB+=FE._tree.mod;while(++FC<FF){E6(FD[FC],FB)}}}function Ey(FF,FB,FI){if(FB){var FE=FF,FD=FF,FH=FB,FG=FF.parent.children[0],FK=FE._tree.mod,FJ=FD._tree.mod,FM=FH._tree.mod,FL=FG._tree.mod,FC;while(FH=AG(FH),FE=Em(FE),FH&&FE){FG=Em(FG);FD=AG(FD);FD._tree.ancestor=FF;FC=FH._tree.prelim+FM-FE._tree.prelim-FK+Ex(FH,FE);if(FC>0){Eo(DX(FH,FF,FI),FF,FC);FK+=FC;FJ+=FC}FM+=FH._tree.mod;FK+=FE._tree.mod;FL+=FG._tree.mod;FJ+=FD._tree.mod}if(FH&&!AG(FD)){FD._tree.thread=FH;FD._tree.mod+=FM-FJ}if(FE&&!Em(FG)){FG._tree.thread=FE;FG._tree.mod+=FK-FL;FI=FF}}return FI}Eb(E7,function(FC,FB){FC._tree={ancestor:FC,prelim:0,mod:0,change:0,shift:0,number:FB?FB._tree.number+1:0}});E4(E7);E6(E7,-E7._tree.prelim);var E2=CC(E7,Ap),FA=CC(E7,Bb),E9=CC(E7,W),E1=E2.x-Ex(E2,FA)/2,E0=FA.x+Ex(FA,E2)/2,E8=E9.depth||1;Eb(E7,function(FB){FB.x=(FB.x-E1)/(E0-E1)*Ew[0];FB.y=FB.depth/E8*Ew[1];delete FB._tree});return Ez}e.separation=function(Ey){if(!arguments.length){return Ex}Ex=Ey;return e};e.size=function(Ey){if(!arguments.length){return Ew}Ew=Ey;return e};return Dq(e,Ev)};function Bu(Ev,e){return Ev.parent==e.parent?1:2}function Em(Ev){var e=Ev.children;return e&&e.length?e[0]:Ev._tree.thread}function AG(Ev){var e=Ev.children,Ew;return e&&(Ew=e.length)?e[Ew-1]:Ev._tree.thread}function CC(Ew,Ex){var Ev=Ew.children;if(Ev&&(Ey=Ev.length)){var Ez,Ey,e=-1;while(++e<Ey){if(Ex(Ez=CC(Ev[e],Ex),Ew)>0){Ew=Ez}}}return Ew}function Bb(Ev,e){return Ev.x-e.x}function Ap(Ev,e){return e.x-Ev.x}function W(Ev,e){return Ev.depth-e.depth}function Eb(Ev,Ew){function e(E1,E0){var Ez=E1.children;if(Ez&&(E2=Ez.length)){var E3,Ey=null,Ex=-1,E2;while(++Ex<E2){E3=Ez[Ex];e(E3,Ey);Ey=E3}}Ew(E1,E0)}e(Ev,null)}function Bw(Ex){var e=0,Ez=0,Ew=Ex.children,Ev=Ew.length,Ey;while(--Ev>=0){Ey=Ew[Ev]._tree;Ey.prelim+=e;Ey.mod+=e;e+=Ey.shift+(Ez+=Ey.change)}}function Eo(Ev,Ew,e){Ev=Ev._tree;Ew=Ew._tree;var Ex=e/(Ew.number-Ev.number);Ev.change+=Ex;Ew.change-=Ex;Ew.shift+=e;Ew.prelim+=e;Ew.mod+=e}function DX(e,Ew,Ev){return e._tree.ancestor.parent==Ew.parent?e._tree.ancestor:Ev}d3.layout.treemap=function(){var E1=d3.layout.hierarchy(),E5=Math.round,E7=[1,1],E2=null,e=Cu,E3=false,Ez,E0=0.5*(1+Math.sqrt(5));function Ev(FA,E8){var E9=-1,FD=FA.length,FC,FB;while(++E9<FD){FB=(FC=FA[E9]).value*(E8<0?0:E8);FC.area=isNaN(FB)||FB<=0?0:FB}}function Ex(FC){var E9=FC.children;if(E9&&E9.length){var FF=e(FC),FH=[],FE=E9.slice(),E8,FD=Infinity,FB,FG=Math.min(FF.dx,FF.dy),FA;Ev(FE,FF.dx*FF.dy/FC.value);FH.area=0;while((FA=FE.length)>0){FH.push(E8=FE[FA-1]);FH.area+=E8.area;if((FB=Ew(FH,FG))<=FD){FE.pop();FD=FB}else{FH.area-=FH.pop().area;Ey(FH,FG,FF,false);FG=Math.min(FF.dx,FF.dy);FH.length=FH.area=0;FD=Infinity}}if(FH.length){Ey(FH,FG,FF,true);FH.length=FH.area=0}E9.forEach(Ex)}}function E6(FB){var E8=FB.children;if(E8&&E8.length){var FA=e(FB),E9=E8.slice(),FD,FC=[];Ev(E9,FA.dx*FA.dy/FB.value);FC.area=0;while(FD=E9.pop()){FC.push(FD);FC.area+=FD.area;if(FD.z!=null){Ey(FC,FD.z?FA.dx:FA.dy,FA,!E9.length);FC.length=FC.area=0}}E8.forEach(E6)}}function Ew(FD,E9){var FB=FD.area,FC,FF=0,E8=Infinity,FA=-1,FE=FD.length;while(++FA<FE){if(!(FC=FD[FA].area)){continue}if(FC<E8){E8=FC}if(FC>FF){FF=FC}}FB*=FB;E9*=E9;return FB?Math.max((E9*FF*E0)/FB,FB/(E9*E8*E0)):Infinity}function Ey(FH,FG,FC,FF){var FA=-1,E9=FH.length,FD=FC.x,FB=FC.y,FE=FG?E5(FH.area/FG):0,E8;if(FG==FC.dx){if(FF||FE>FC.dy){FE=FC.dy}while(++FA<E9){E8=FH[FA];E8.x=FD;E8.y=FB;E8.dy=FE;FD+=E8.dx=Math.min(FC.x+FC.dx-FD,FE?E5(E8.area/FE):0)}E8.z=true;E8.dx+=FC.x+FC.dx-FD;FC.y+=FE;FC.dy-=FE}else{if(FF||FE>FC.dx){FE=FC.dx}while(++FA<E9){E8=FH[FA];E8.x=FD;E8.y=FB;E8.dx=FE;FB+=E8.dy=Math.min(FC.y+FC.dy-FB,FE?E5(E8.area/FE):0)}E8.z=false;E8.dy+=FC.y+FC.dy-FB;FC.x+=FE;FC.dx-=FE}}function E4(FA){var E9=Ez||E1(FA),E8=E9[0];E8.x=0;E8.y=0;E8.dx=E7[0];E8.dy=E7[1];if(Ez){E1.revalue(E8)}Ev([E8],E8.dx*E8.dy/E8.value);(Ez?E6:Ex)(E8);if(E3){Ez=E9}return E9}E4.size=function(E8){if(!arguments.length){return E7}E7=E8;return E4};E4.padding=function(E8){if(!arguments.length){return E2}function FB(FC){var FD=E8.call(E4,FC,FC.depth);return FD==null?Cu(FC):AU(FC,typeof FD==="number"?[FD,FD,FD,FD]:FD)}function FA(FC){return AU(FC,E8)}var E9;e=(E2=E8)==null?Cu:(E9=typeof E8)==="function"?FB:E9==="number"?(E8=[E8,E8,E8,E8],FA):FA;return E4};E4.round=function(E8){if(!arguments.length){return E5!=Number}E5=E8?Math.round:Number;return E4};E4.sticky=function(E8){if(!arguments.length){return E3}E3=E8;Ez=null;return E4};E4.ratio=function(E8){if(!arguments.length){return E0}E0=E8;return E4};return Dq(E4,E1)};function Cu(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function AU(Ex,Ey){var e=Ex.x+Ey[3],Ez=Ex.y+Ey[0],Ew=Ex.dx-Ey[1]-Ey[3],Ev=Ex.dy-Ey[0]-Ey[2];if(Ew<0){e+=Ew/2;Ew=0}if(Ev<0){Ez+=Ev/2;Ev=0}return{x:e,y:Ez,dx:Ew,dy:Ev}}d3.csv=function(e,Ev){d3.text(e,"text/csv",function(Ew){Ev(Ew&&d3.csv.parse(Ew))})};d3.csv.parse=function(e){var Ev;return d3.csv.parseRows(e,function(E0,Ey){if(Ey){var Ez={},Ex=-1,Ew=Ev.length;while(++Ex<Ew){Ez[Ev[Ex]]=E0[Ex]}return Ez}else{Ev=E0;return null}})};d3.csv.parseRows=function(E1,Ey){var Ev={},Ex={},E4=[],E2=/\r\n|[,\r\n]/g,e=0,E3,Ez;E2.lastIndex=0;function Ew(){if(E2.lastIndex>=E1.length){return Ex}if(Ez){Ez=false;return Ev}var E6=E2.lastIndex;if(E1.charCodeAt(E6)===34){var E7=E6;while(E7++<E1.length){if(E1.charCodeAt(E7)===34){if(E1.charCodeAt(E7+1)!==34){break}E7++}}E2.lastIndex=E7+2;var E8=E1.charCodeAt(E7+1);if(E8===13){Ez=true;if(E1.charCodeAt(E7+2)===10){E2.lastIndex++}}else{if(E8===10){Ez=true}}return E1.substring(E6+1,E7).replace(/""/g,'"')}var E5=E2.exec(E1);if(E5){Ez=E5[0].charCodeAt(0)!==44;return E1.substring(E6,E5.index)}E2.lastIndex=E1.length;return E1.substring(E6)}while((E3=Ew())!==Ex){var E0=[];while((E3!==Ev)&&(E3!==Ex)){E0.push(E3);E3=Ew()}if(Ey&&!(E0=Ey(E0,e++))){continue}E4.push(E0)}return E4};d3.csv.format=function(e){return e.map(CK).join("\n")};function CK(e){return e.map(AE).join(",")}function AE(e){return/[",\n]/.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}d3.geo={};var Cb=Math.PI/180;d3.geo.azimuthal=function(){var Ez="orthographic",E2,Ex=200,Ew=[480,250],e,E1,Ey,E0;function Ev(FE){var E4=FE[0]*Cb-e,FD=FE[1]*Cb,E8=Math.cos(E4),E3=Math.sin(E4),E6=Math.cos(FD),FC=Math.sin(FD),E5=Ez!=="orthographic"?E0*FC+Ey*E6*E8:null,E9,E7=Ez==="stereographic"?1/(1+E5):Ez==="gnomonic"?1/E5:Ez==="equidistant"?(E9=Math.acos(E5),E9?E9/Math.sin(E9):0):Ez==="equalarea"?Math.sqrt(2/(1+E5)):1,FB=E7*E6*E3,FA=E7*(E0*E6*E8-Ey*FC);return[Ex*FB+Ew[0],Ex*FA+Ew[1]]}Ev.invert=function(E6){var E3=(E6[0]-Ew[0])/Ex,E9=(E6[1]-Ew[1])/Ex,E4=Math.sqrt(E3*E3+E9*E9),E8=Ez==="stereographic"?2*Math.atan(E4):Ez==="gnomonic"?Math.atan(E4):Ez==="equidistant"?E4:Ez==="equalarea"?2*Math.asin(0.5*E4):Math.asin(E4),E5=Math.sin(E8),E7=Math.cos(E8);return[(e+Math.atan2(E3*E5,E4*Ey*E7+E9*E0*E5))/Cb,Math.asin(E7*E0-(E4?(E9*E5*Ey)/E4:0))/Cb]};Ev.mode=function(E3){if(!arguments.length){return Ez}Ez=E3+"";return Ev};Ev.origin=function(E3){if(!arguments.length){return E2}E2=E3;e=E2[0]*Cb;E1=E2[1]*Cb;Ey=Math.cos(E1);E0=Math.sin(E1);return Ev};Ev.scale=function(E3){if(!arguments.length){return Ex}Ex=+E3;return Ev};Ev.translate=function(E3){if(!arguments.length){return Ew}Ew=[+E3[0],+E3[1]];return Ev};return Ev.origin([0,0])};d3.geo.albers=function(){var E2=[-98,38],E0=[29.5,45.5],Ez=1000,Ey=[480,250],E1,Ex,Ev,E3;function Ew(E6){var E4=Ex*(Cb*E6[0]-E1),E5=Math.sqrt(Ev-2*Ex*Math.sin(Cb*E6[1]))/Ex;return[Ez*E5*Math.sin(E4)+Ey[0],Ez*(E5*Math.cos(E4)-E3)+Ey[1]]}Ew.invert=function(E7){var E4=(E7[0]-Ey[0])/Ez,E9=(E7[1]-Ey[1])/Ez,E8=E3+E9,E5=Math.atan2(E4,E8),E6=Math.sqrt(E4*E4+E8*E8);return[(E1+E5/Ex)/Cb,Math.asin((Ev-E6*E6*Ex*Ex)/(2*Ex))/Cb]};function e(){var E5=Cb*E0[0],E4=Cb*E0[1],E8=Cb*E2[1],E6=Math.sin(E5),E7=Math.cos(E5);E1=Cb*E2[0];Ex=0.5*(E6+Math.sin(E4));Ev=E7*E7+2*Ex*E6;E3=Math.sqrt(Ev-2*Ex*Math.sin(E8))/Ex;return Ew}Ew.origin=function(E4){if(!arguments.length){return E2}E2=[+E4[0],+E4[1]];return e()};Ew.parallels=function(E4){if(!arguments.length){return E0}E0=[+E4[0],+E4[1]];return e()};Ew.scale=function(E4){if(!arguments.length){return Ez}Ez=+E4;return Ew};Ew.translate=function(E4){if(!arguments.length){return Ey}Ey=[+E4[0],+E4[1]];return Ew};return e()};d3.geo.albersUsa=function(){var e=d3.geo.albers();var Ey=d3.geo.albers().origin([-160,60]).parallels([55,65]);var Ex=d3.geo.albers().origin([-160,20]).parallels([8,18]);var Ew=d3.geo.albers().origin([-60,10]).parallels([8,18]);function Ev(E1){var E0=E1[0],Ez=E1[1];return(Ez>50?Ey:E0<-140?Ex:Ez<21?Ew:e)(E1)}Ev.scale=function(Ez){if(!arguments.length){return e.scale()}e.scale(Ez);Ey.scale(Ez*0.6);Ex.scale(Ez);Ew.scale(Ez*1.5);return Ev.translate(e.translate())};Ev.translate=function(E0){if(!arguments.length){return e.translate()}var Ez=e.scale()/1000,E2=E0[0],E1=E0[1];e.translate(E0);Ey.translate([E2-400*Ez,E1+170*Ez]);Ex.translate([E2-190*Ez,E1+200*Ez]);Ew.translate([E2+580*Ez,E1+430*Ez]);return Ev};return Ev.scale(e.scale())};d3.geo.bonne=function(){var Ez=200,Ey=[480,250],e,Ex,Ew,Ev;function E0(E4){var E1=E4[0]*Cb-e,E5=E4[1]*Cb-Ex;if(Ew){var E3=Ev+Ew-E5,E2=E1*Math.cos(E5)/E3;E1=E3*Math.sin(E2);E5=E3*Math.cos(E2)-Ev}else{E1*=Math.cos(E5);E5*=-1}return[Ez*E1+Ey[0],Ez*E5+Ey[1]]}E0.invert=function(E3){var E1=(E3[0]-Ey[0])/Ez,E5=(E3[1]-Ey[1])/Ez;if(Ew){var E4=Ev+E5,E2=Math.sqrt(E1*E1+E4*E4);E5=Ev+Ew-E2;E1=e+E2*Math.atan2(E1,E4)/Math.cos(E5)}else{E5*=-1;E1/=Math.cos(E5)}return[E1/Cb,E5/Cb]};E0.parallel=function(E1){if(!arguments.length){return Ew/Cb}Ev=1/Math.tan(Ew=E1*Cb);return E0};E0.origin=function(E1){if(!arguments.length){return[e/Cb,Ex/Cb]}e=E1[0]*Cb;Ex=E1[1]*Cb;return E0};E0.scale=function(E1){if(!arguments.length){return Ez}Ez=+E1;return E0};E0.translate=function(E1){if(!arguments.length){return Ey}Ey=[+E1[0],+E1[1]];return E0};return E0.origin([0,0]).parallel(45)};d3.geo.equirectangular=function(){var Ew=500,Ev=[480,250];function e(Ey){var Ex=Ey[0]/360,Ez=-Ey[1]/360;return[Ew*Ex+Ev[0],Ew*Ez+Ev[1]]}e.invert=function(Ey){var Ex=(Ey[0]-Ev[0])/Ew,Ez=(Ey[1]-Ev[1])/Ew;return[360*Ex,-360*Ez]};e.scale=function(Ex){if(!arguments.length){return Ew}Ew=+Ex;return e};e.translate=function(Ex){if(!arguments.length){return Ev}Ev=[+Ex[0],+Ex[1]];return e};return e};d3.geo.mercator=function(){var Ew=500,Ev=[480,250];function e(Ey){var Ex=Ey[0]/360,Ez=-(Math.log(Math.tan(Math.PI/4+Ey[1]*Cb/2))/Cb)/360;return[Ew*Ex+Ev[0],Ew*Math.max(-0.5,Math.min(0.5,Ez))+Ev[1]]}e.invert=function(Ey){var Ex=(Ey[0]-Ev[0])/Ew,Ez=(Ey[1]-Ev[1])/Ew;return[360*Ex,2*Math.atan(Math.exp(-360*Ez*Cb))/Cb-90]};e.scale=function(Ex){if(!arguments.length){return Ew}Ew=+Ex;return e};e.translate=function(Ex){if(!arguments.length){return Ev}Ev=[+Ex[0],+Ex[1]];return e};return e};function DI(Ev,e){return function(Ew){return Ew&&Ev.hasOwnProperty(Ew.type)?Ev[Ew.type](Ew):e}}d3.geo.path=function(){var E0=4.5,E4=Z(E0),Ez=d3.geo.albersUsa();function E3(E6,E5){if(typeof E0==="function"){E4=Z(E0.apply(this,arguments))}return Ev(E6)||null}function E1(E5){return Ez(E5).join(",")}var Ev=DI({FeatureCollection:function(E8){var E7=[],E6=E8.features,E5=-1,E9=E6.length;while(++E5<E9){E7.push(Ev(E6[E5].geometry))}return E7.join("")},Feature:function(E5){return Ev(E5.geometry)},Point:function(E5){return"M"+E1(E5.coordinates)+E4},MultiPoint:function(E8){var E6=[],E7=E8.coordinates,E5=-1,E9=E7.length;while(++E5<E9){E6.push("M",E1(E7[E5]),E4)}return E6.join("")},LineString:function(E8){var E6=["M"],E7=E8.coordinates,E5=-1,E9=E7.length;while(++E5<E9){E6.push(E1(E7[E5]),"L")}E6.pop();return E6.join("")},MultiLineString:function(FB){var E9=[],FA=FB.coordinates,E8=-1,FC=FA.length,E6,E7,E5;while(++E8<FC){E6=FA[E8];E7=-1;E5=E6.length;E9.push("M");while(++E7<E5){E9.push(E1(E6[E7]),"L")}E9.pop()}return E9.join("")},Polygon:function(FB){var E9=[],FA=FB.coordinates,E8=-1,FC=FA.length,E6,E7,E5;while(++E8<FC){E6=FA[E8];E7=-1;if((E5=E6.length-1)>0){E9.push("M");while(++E7<E5){E9.push(E1(E6[E7]),"L")}E9[E9.length-1]="Z"}}return E9.join("")},MultiPolygon:function(E6){var FF=[],FE=E6.coordinates,FD=-1,E7=FE.length,FA,FC,E8,FB,E9,E5;while(++FD<E7){FA=FE[FD];FC=-1;E8=FA.length;while(++FC<E8){FB=FA[FC];E9=-1;if((E5=FB.length-1)>0){FF.push("M");while(++E9<E5){FF.push(E1(FB[E9]),"L")}FF[FF.length-1]="Z"}}}return FF.join("")},GeometryCollection:function(E8){var E7=[],E6=E8.geometries,E5=-1,E9=E6.length;while(++E5<E9){E7.push(Ev(E6[E5]))}return E7.join("")}});var Ew=E3.area=DI({FeatureCollection:function(E8){var E7=0,E6=E8.features,E5=-1,E9=E6.length;while(++E5<E9){E7+=Ew(E6[E5])}return E7},Feature:function(E5){return Ew(E5.geometry)},Polygon:function(E5){return Ey(E5.coordinates)},MultiPolygon:function(E8){var E6=0,E7=E8.coordinates,E5=-1,E9=E7.length;while(++E5<E9){E6+=Ey(E7[E5])}return E6},GeometryCollection:function(E8){var E7=0,E6=E8.geometries,E5=-1,E9=E6.length;while(++E5<E9){E7+=Ew(E6[E5])}return E7}},0);function Ey(E7){var E6=Ex(E7[0]),E5=0,E8=E7.length;while(++E5<E8){E6-=Ex(E7[E5])}return E6}function e(FD){var FB=d3.geom.polygon(FD[0].map(Ez)),E5=FB.area(),E6=FB.centroid(E5<0?(E5*=-1,1):-1),FC=E6[0],FA=E6[1],E9=E5,E8=0,E7=FD.length;while(++E8<E7){FB=d3.geom.polygon(FD[E8].map(Ez));E5=FB.area();E6=FB.centroid(E5<0?(E5*=-1,1):-1);FC-=E6[0];FA-=E6[1];E9-=E5}return[FC,FA,6*E9]}var E2=E3.centroid=DI({Feature:function(E5){return E2(E5.geometry)},Polygon:function(E6){var E5=e(E6.coordinates);return[E5[0]/E5[2],E5[1]/E5[2]]},MultiPolygon:function(E6){var E5=0,FD=E6.coordinates,E7,FC=0,FB=0,FA=0,E9=-1,E8=FD.length;while(++E9<E8){E7=e(FD[E9]);FC+=E7[0];FB+=E7[1];FA+=E7[2]}return[FC/FA,FB/FA]}});function Ex(E5){return Math.abs(d3.geom.polygon(E5.map(Ez)).area())}E3.projection=function(E5){Ez=E5;return E3};E3.pointRadius=function(E5){if(typeof E5==="function"){E0=E5}else{E0=+E5;E4=Z(E0)}return E3};return E3};function Z(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+(-2*e)+"a"+e+","+e+" 0 1,1 0,"+(+2*e)+"z"}d3.geo.bounds=function(Ew){var Ey=Infinity,e=Infinity,Ev=-Infinity,Ex=-Infinity;Bk(Ew,function(Ez,E0){if(Ez<Ey){Ey=Ez}if(Ez>Ev){Ev=Ez}if(E0<e){e=E0}if(E0>Ex){Ex=E0}});return[[Ey,e],[Ev,Ex]]};function Bk(Ev,e){if(D0.hasOwnProperty(Ev.type)){D0[Ev.type](Ev,e)}}var D0={Feature:Ef,FeatureCollection:De,GeometryCollection:Cy,LineString:Dj,MultiLineString:Dw,MultiPoint:Dj,MultiPolygon:Ed,Point:ER,Polygon:BQ};function Ef(Ev,e){Bk(Ev.geometry,e)}function De(Ex,Ew){for(var e=Ex.features,Ev=0,Ey=e.length;Ev<Ey;Ev++){Bk(e[Ev].geometry,Ew)}}function Cy(Ex,Ew){for(var e=Ex.geometries,Ev=0,Ey=e.length;Ev<Ey;Ev++){Bk(e[Ev],Ew)}}function Dj(Ex,Ew){for(var e=Ex.coordinates,Ev=0,Ey=e.length;Ev<Ey;Ev++){Ew.apply(null,e[Ev])}}function Dw(E0,Ez){for(var Ew=E0.coordinates,Ey=0,E1=Ew.length;Ey<E1;Ey++){for(var Ev=Ew[Ey],Ex=0,e=Ev.length;Ex<e;Ex++){Ez.apply(null,Ev[Ex])}}}function Ed(E0,Ez){for(var Ew=E0.coordinates,Ey=0,E1=Ew.length;Ey<E1;Ey++){for(var Ev=Ew[Ey][0],Ex=0,e=Ev.length;Ex<e;Ex++){Ez.apply(null,Ev[Ex])}}}function ER(Ev,e){e.apply(null,Ev.coordinates)}function BQ(Ex,Ew){for(var e=Ex.coordinates[0],Ev=0,Ey=e.length;Ev<Ey;Ev++){Ew.apply(null,e[Ev])}}d3.geo.circle=function(){var E2=[0,0],Ez=90-0.01,E0=Ez*Cb,Ew=d3.geo.greatArc().target(Object);function Ev(){}function Ex(E3){return Ew.distance(E3)<E0}Ev.clip=function(E3){Ew.source(typeof E2==="function"?E2.apply(this,arguments):E2);return E1(E3)};var E1=DI({FeatureCollection:function(E4){var E3=E4.features.map(E1).filter(Object);return E3&&(E4=Object.create(E4),E4.features=E3,E4)},Feature:function(E4){var E3=E1(E4.geometry);return E3&&(E4=Object.create(E4),E4.geometry=E3,E4)},Point:function(E3){return Ex(E3.coordinates)&&E3},MultiPoint:function(E4){var E3=E4.coordinates.filter(Ex);return E3.length&&{type:E4.type,coordinates:E3}},LineString:function(E4){var E3=Ey(E4.coordinates);return E3.length&&(E4=Object.create(E4),E4.coordinates=E3,E4)},MultiLineString:function(E4){var E3=E4.coordinates.map(Ey).filter(function(E5){return E5.length});return E3.length&&(E4=Object.create(E4),E4.coordinates=E3,E4)},Polygon:function(E4){var E3=E4.coordinates.map(Ey);return E3[0].length&&(E4=Object.create(E4),E4.coordinates=E3,E4)},MultiPolygon:function(E4){var E3=E4.coordinates.map(function(E5){return E5.map(Ey)}).filter(function(E5){return E5[0].length});return E3.length&&(E4=Object.create(E4),E4.coordinates=E3,E4)},GeometryCollection:function(E4){var E3=E4.geometries.map(E1).filter(Object);return E3.length&&(E4=Object.create(E4),E4.geometries=E3,E4)}});function Ey(E8){var E7=-1,E5=E8.length,E6=[],FB,FA,E9,E4,E3;while(++E7<E5){E3=Ew.distance(E9=E8[E7]);if(E3<E0){if(FA){E6.push(Eu(FA,E9)((E4-E0)/(E4-E3)))}E6.push(E9);FB=FA=null}else{FA=E9;if(!FB&&E6.length){E6.push(Eu(E6[E6.length-1],FA)((E0-E4)/(E3-E4)));FB=FA}}E4=E3}if(FA&&E6.length){E3=Ew.distance(E9=E6[0]);E6.push(Eu(FA,E9)((E4-E0)/(E4-E3)))}return e(E6)}function e(E9){var E7=0,FA=E9.length,E6,E3,E4=FA?[E9[0]]:E9,E8,E5=Ew.source();while(++E7<FA){E8=Ew.source(E9[E7-1])(E9[E7]).coordinates;for(E6=0,E3=E8.length;++E6<E3;){E4.push(E8[E6])}}Ew.source(E5);return E4}Ev.origin=function(E3){if(!arguments.length){return E2}E2=E3;return Ev};Ev.angle=function(E3){if(!arguments.length){return Ez}E0=(Ez=+E3)*Cb;return Ev};Ev.precision=function(E3){if(!arguments.length){return Ew.precision()}Ew.precision(E3);return Ev};return Ev};d3.geo.greatArc=function(){var Ew=Bh,Ex=Bm,Ev=6*Cb;function e(){var Ez=typeof Ew==="function"?Ew.apply(this,arguments):Ew,Ey=typeof Ex==="function"?Ex.apply(this,arguments):Ex,E1=Eu(Ez,Ey),E2=Ev/E1.d,E0=0,E3=[Ez];while((E0+=E2)<1){E3.push(E1(E0))}E3.push(Ey);return{type:"LineString",coordinates:E3}}e.distance=function(){var Ez=typeof Ew==="function"?Ew.apply(this,arguments):Ew,Ey=typeof Ex==="function"?Ex.apply(this,arguments):Ex;return Eu(Ez,Ey).d};e.source=function(Ey){if(!arguments.length){return Ew}Ew=Ey;return e};e.target=function(Ey){if(!arguments.length){return Ex}Ex=Ey;return e};e.precision=function(Ey){if(!arguments.length){return Ev/Cb}Ev=Ey*Cb;return e};return e};function Bh(e){return e.source}function Bm(e){return e.target}function Eu(E8,E5){var Ex=E8[0]*Cb,E4=Math.cos(Ex),Ew=Math.sin(Ex),FA=E8[1]*Cb,Ez=Math.cos(FA),E9=Math.sin(FA),Ev=E5[0]*Cb,E3=Math.cos(Ev),e=Math.sin(Ev),E7=E5[1]*Cb,Ey=Math.cos(E7),E6=Math.sin(E7),E2=E0.d=Math.acos(Math.max(-1,Math.min(1,E9*E6+Ez*Ey*Math.cos(Ev-Ex)))),E1=Math.sin(E2);function E0(FD){var FC=Math.sin(E2-(FD*=E2))/E1,FG=Math.sin(FD)/E1,FB=FC*Ez*E4+FG*Ey*E3,FF=FC*Ez*Ew+FG*Ey*e,FE=FC*E9+FG*E6;return[Math.atan2(FF,FB)/Cb,Math.atan2(FE,Math.sqrt(FB*FB+FF*FF))/Cb]}return E0}d3.geo.greatCircle=d3.geo.circle;d3.geom={};d3.geom.contour=function(e,Ev){var E3=Ev||K(e),Ez=[],E1=E3[0],E0=E3[1],E4=0,E2=0,Ex=NaN,Ew=NaN,Ey=0;do{Ey=0;if(e(E1-1,E0-1)){Ey+=1}if(e(E1,E0-1)){Ey+=2}if(e(E1-1,E0)){Ey+=4}if(e(E1,E0)){Ey+=8}if(Ey===6){E4=Ew===-1?-1:1;E2=0}else{if(Ey===9){E4=0;E2=Ex===1?-1:1}else{E4=Bf[Ey];E2=Bd[Ey]}}if(E4!=Ex&&E2!=Ew){Ez.push([E1,E0]);Ex=E4;Ew=E2}E1+=E4;E0+=E2}while(E3[0]!=E1||E3[1]!=E0);return Ez};var Bf=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],Bd=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];function K(Ev){var e=0,Ew=0;while(true){if(Ev(e,Ew)){return[e,Ew]}if(e===0){e=Ew+1;Ew=0}else{e=e-1;Ew=Ew+1}}}d3.geom.hull=function(E3){if(E3.length<3){return[]}var E2=E3.length,Ey=E2-1,E9=[],E5=[],E0,Ez,E1=0,Ex,E7,Ev,E4,FA,E8,E6,Ew;for(E0=1;E0<E2;++E0){if(E3[E0][1]<E3[E1][1]){E1=E0}else{if(E3[E0][1]==E3[E1][1]){E1=(E3[E0][0]<E3[E1][0]?E0:E1)}}}for(E0=0;E0<E2;++E0){if(E0===E1){continue}E7=E3[E0][1]-E3[E1][1];Ex=E3[E0][0]-E3[E1][0];E9.push({angle:Math.atan2(E7,Ex),index:E0})}E9.sort(function(FC,FB){return FC.angle-FB.angle});E6=E9[0].angle;E8=E9[0].index;FA=0;for(E0=1;E0<Ey;++E0){Ez=E9[E0].index;if(E6==E9[E0].angle){Ex=E3[E8][0]-E3[E1][0];E7=E3[E8][1]-E3[E1][1];Ev=E3[Ez][0]-E3[E1][0];E4=E3[Ez][1]-E3[E1][1];if((Ex*Ex+E7*E7)>=(Ev*Ev+E4*E4)){E9[E0].index=-1}else{E9[FA].index=-1;E6=E9[E0].angle;FA=E0;E8=Ez}}else{E6=E9[E0].angle;FA=E0;E8=Ez}}E5.push(E1);for(E0=0,Ez=0;E0<2;++Ez){if(E9[Ez].index!==-1){E5.push(E9[Ez].index);E0++}}Ew=E5.length;for(;Ez<Ey;++Ez){if(E9[Ez].index===-1){continue}while(!B0(E5[Ew-2],E5[Ew-1],E9[Ez].index,E3)){--Ew}E5[Ew++]=E9[Ez].index}var e=[];for(E0=0;E0<Ew;++E0){e.push(E3[E5[E0]])}return e};function B0(Ex,Ew,Ev,E4){var E5,E3,E2,E1,E0,Ez,Ey;E5=E4[Ex];E3=E5[0];E2=E5[1];E5=E4[Ew];E1=E5[0];E0=E5[1];E5=E4[Ev];Ez=E5[0];Ey=E5[1];return((Ey-E2)*(E1-E3)-(E0-E2)*(Ez-E3))>0}d3.geom.polygon=function(e){e.area=function(){var Ex=0,Ey=e.length,Ew=e[Ey-1][0]*e[0][1],Ev=e[Ey-1][1]*e[0][0];while(++Ex<Ey){Ew+=e[Ex-1][0]*e[Ex][1];Ev+=e[Ex-1][1]*e[Ex][0]}return(Ev-Ew)*0.5};e.centroid=function(Ey){var Ez=-1,E2=e.length,Ew=0,E1=0,Ex,Ev=e[E2-1],E0;if(!arguments.length){Ey=-1/(6*e.area())}while(++Ez<E2){Ex=Ev;Ev=e[Ez];E0=Ex[0]*Ev[1]-Ev[0]*Ex[1];Ew+=(Ex[0]+Ev[0])*E0;E1+=(Ex[1]+Ev[1])*E0}return[Ew*Ey,E1*Ey]};e.clip=function(E1){var E3,Ey=-1,Ev=e.length,Ex,Ew,E4=e[Ev-1],E2,E0,Ez;while(++Ey<Ev){E3=E1.slice();E1.length=0;E2=e[Ey];E0=E3[(Ew=E3.length)-1];Ex=-1;while(++Ex<Ew){Ez=E3[Ex];if(T(Ez,E4,E2)){if(!T(E0,E4,E2)){E1.push(Dm(E0,Ez,E4,E2))}E1.push(Ez)}else{if(T(E0,E4,E2)){E1.push(Dm(E0,Ez,E4,E2))}}E0=Ez}E4=E2}return E1};return e};function T(Ew,Ev,e){return(e[0]-Ev[0])*(Ew[1]-Ev[1])<(e[1]-Ev[1])*(Ew[0]-Ev[0])}function Dm(E7,E6,FA,E9){var E5=E7[0],E4=E6[0],E3=FA[0],E1=E9[0],Ex=E7[1],Ew=E6[1],Ev=FA[1],e=E9[1],FB=E5-E3,Ey=E4-E5,FC=E1-E3,Ez=Ex-Ev,E8=Ew-Ex,E0=e-Ev,E2=(FC*Ez-E0*FB)/(E0*Ey-FC*E8);return[E5+E2*Ey,Ex+E2*E8]}d3.geom.voronoi=function(Ev){var e=Ev.map(function(){return[]});D6(Ev,function(Ey){var E4,E3,Ex,Ew,E1,Ez;if(Ey.a===1&&Ey.b>=0){E4=Ey.ep.r;E3=Ey.ep.l}else{E4=Ey.ep.l;E3=Ey.ep.r}if(Ey.a===1){E1=E4?E4.y:-1000000;Ex=Ey.c-Ey.b*E1;Ez=E3?E3.y:1000000;Ew=Ey.c-Ey.b*Ez}else{Ex=E4?E4.x:-1000000;E1=Ey.c-Ey.a*Ex;Ew=E3?E3.x:1000000;Ez=Ey.c-Ey.a*Ew}var E2=[Ex,E1],E0=[Ew,Ez];e[Ey.region.l.index].push(E2,E0);e[Ey.region.r.index].push(E2,E0)});return e.map(function(Ey,Ex){var Ew=Ev[Ex][0],Ez=Ev[Ex][1];Ey.forEach(function(E0){E0.angle=Math.atan2(E0[0]-Ew,E0[1]-Ez)});return Ey.sort(function(E1,E0){return E1.angle-E0.angle}).filter(function(E1,E0){return !E0||(E1.angle-Ey[E0-1].angle>1e-10)})})};var Bs={l:"r",r:"l"};function D6(Ez,Ex){var FD={list:Ez.map(function(e,FF){return{index:FF,x:e[0],y:e[1]}}).sort(function(FF,e){return FF.y<e.y?-1:FF.y>e.y?1:FF.x<e.x?-1:FF.x>e.x?1:0}),bottomSite:null};var Ew={list:[],leftEnd:null,rightEnd:null,init:function(){Ew.leftEnd=Ew.createHalfEdge(null,"l");Ew.rightEnd=Ew.createHalfEdge(null,"l");Ew.leftEnd.r=Ew.rightEnd;Ew.rightEnd.l=Ew.leftEnd;Ew.list.unshift(Ew.leftEnd,Ew.rightEnd)},createHalfEdge:function(FF,e){return{edge:FF,side:e,vertex:null,l:null,r:null}},insert:function(FF,e){e.l=FF;e.r=FF.r;FF.r.l=e;FF.r=e},leftBound:function(FF){var e=Ew.leftEnd;do{e=e.r}while(e!=Ew.rightEnd&&FC.rightOf(e,FF));e=e.l;return e},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?FD.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?FD.bottomSite:e.edge.region[Bs[e.side]]}};var FC={bisect:function(FI,FG){var FH={region:{l:FI,r:FG},ep:{l:null,r:null}};var FF=FG.x-FI.x,e=FG.y-FI.y,FK=FF>0?FF:-FF,FJ=e>0?e:-e;FH.c=FI.x*FF+FI.y*e+(FF*FF+e*e)*0.5;if(FK>FJ){FH.a=1;FH.b=e/FF;FH.c/=FF}else{FH.b=1;FH.a=FF/e;FH.c/=e}return FH},intersect:function(FI,FH){var FN=FI.edge,FM=FH.edge;if(!FN||!FM||(FN.region.r==FM.region.r)){return null}var FL=(FN.a*FM.b)-(FN.b*FM.a);if(Math.abs(FL)<1e-10){return null}var FG=(FN.c*FM.b-FM.c*FN.b)/FL,FQ=(FM.c*FN.a-FN.c*FM.a)/FL,FP=FN.region.r,FK=FM.region.r,FF,FJ;if((FP.y<FK.y)||(FP.y==FK.y&&FP.x<FK.x)){FF=FI;FJ=FN}else{FF=FH;FJ=FM}var FO=(FG>=FJ.region.r.x);if((FO&&(FF.side==="l"))||(!FO&&(FF.side==="r"))){return null}return{x:FG,y:FQ}},rightOf:function(FK,FF){var FO=FK.edge,FI=FO.region.r,FR=(FF.x>FI.x);if(FR&&(FK.side==="l")){return 1}if(!FR&&(FK.side==="r")){return 0}if(FO.a===1){var FQ=FF.y-FI.y,FG=FF.x-FI.x,FL=0,FP=0;if((!FR&&(FO.b<0))||(FR&&(FO.b>=0))){FP=FL=(FQ>=FO.b*FG)}else{FP=((FF.x+FF.y*FO.b)>FO.c);if(FO.b<0){FP=!FP}if(!FP){FL=1}}if(!FL){var FS=FI.x-FO.region.l.x;FP=(FO.b*(FG*FG-FQ*FQ))<(FS*FQ*(1+2*FG/FS+FO.b*FO.b));if(FO.b<0){FP=!FP}}}else{var FH=FO.c-FO.a*FF.x,FN=FF.y-FH,FM=FF.x-FI.x,FJ=FH-FI.y;FP=(FN*FN)>(FM*FM+FJ*FJ)}return FK.side==="l"?FP:!FP},endPoint:function(FG,FF,e){FG.ep[FF]=e;if(!FG.ep[Bs[FF]]){return}Ex(FG)},distance:function(FH,FG){var FF=FH.x-FG.x,e=FH.y-FG.y;return Math.sqrt(FF*FF+e*e)}};var Ev={list:[],insert:function(FJ,FF,FK){FJ.vertex=FF;FJ.ystar=FF.y+FK;for(var FG=0,FI=Ev.list,e=FI.length;FG<e;FG++){var FH=FI[FG];if(FJ.ystar>FH.ystar||(FJ.ystar==FH.ystar&&FF.x>FH.vertex.x)){continue}else{break}}FI.splice(FG,0,FJ)},del:function(FH){for(var FG=0,FF=Ev.list,e=FF.length;FG<e&&(FF[FG]!=FH);++FG){}FF.splice(FG,1)},empty:function(){return Ev.list.length===0},nextEvent:function(FH){for(var FG=0,FF=Ev.list,e=FF.length;FG<e;++FG){if(FF[FG]==FH){return FF[FG+1]}}return null},min:function(){var e=Ev.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return Ev.list.shift()}};Ew.init();FD.bottomSite=FD.list.shift();var FE=FD.list.shift(),E1;var E6,E3,Ey,FA,E0;var E4,E5,FB,E7,E2;var E9,E8;while(true){if(!Ev.empty()){E1=Ev.min()}if(FE&&(Ev.empty()||FE.y<E1.y||(FE.y==E1.y&&FE.x<E1.x))){E6=Ew.leftBound(FE);E3=Ew.right(E6);E4=Ew.rightRegion(E6);E9=FC.bisect(E4,FE);E0=Ew.createHalfEdge(E9,"l");Ew.insert(E6,E0);E7=FC.intersect(E6,E0);if(E7){Ev.del(E6);Ev.insert(E6,E7,FC.distance(E7,FE))}E6=E0;E0=Ew.createHalfEdge(E9,"r");Ew.insert(E6,E0);E7=FC.intersect(E0,E3);if(E7){Ev.insert(E0,E7,FC.distance(E7,FE))}FE=FD.list.shift()}else{if(!Ev.empty()){E6=Ev.extractMin();Ey=Ew.left(E6);E3=Ew.right(E6);FA=Ew.right(E3);E4=Ew.leftRegion(E6);E5=Ew.rightRegion(E3);E2=E6.vertex;FC.endPoint(E6.edge,E6.side,E2);FC.endPoint(E3.edge,E3.side,E2);Ew.del(E6);Ev.del(E3);Ew.del(E3);E8="l";if(E4.y>E5.y){FB=E4;E4=E5;E5=FB;E8="r"}E9=FC.bisect(E4,E5);E0=Ew.createHalfEdge(E9,E8);Ew.insert(Ey,E0);FC.endPoint(E9,Bs[E8],E2);E7=FC.intersect(Ey,E0);if(E7){Ev.del(Ey);Ev.insert(Ey,E7,FC.distance(E7,E4))}E7=FC.intersect(E0,FA);if(E7){Ev.insert(E0,E7,FC.distance(E7,E4))}}else{break}}}for(E6=Ew.right(Ew.leftEnd);E6!=Ew.rightEnd;E6=Ew.right(E6)){Ex(E6.edge)}}d3.geom.delaunay=function(Ev){var e=Ev.map(function(){return[]}),Ew=[];D6(Ev,function(Ex){e[Ex.region.l.index].push(Ev[Ex.region.r.index])});e.forEach(function(E2,E1){var Ez=Ev[E1],Ey=Ez[0],E3=Ez[1];E2.forEach(function(E4){E4.angle=Math.atan2(E4[0]-Ey,E4[1]-E3)});E2.sort(function(E5,E4){return E5.angle-E4.angle});for(var E0=0,Ex=E2.length-1;E0<Ex;E0++){Ew.push([Ez,E2[E0],E2[E0+1]])}});return Ew};d3.geom.quadtree=function(E3,Ew,E2,e,E1){var Ev,Ey=-1,Ex=E3.length;if(Ex&&isNaN(E3[0].x)){E3=E3.map(l)}if(arguments.length<5){if(arguments.length===3){E1=e=E2;E2=Ew}else{Ew=E2=Infinity;e=E1=-Infinity;while(++Ey<Ex){Ev=E3[Ey];if(Ev.x<Ew){Ew=Ev.x}if(Ev.y<E2){E2=Ev.y}if(Ev.x>e){e=Ev.x}if(Ev.y>E1){E1=Ev.y}}var E6=e-Ew,E5=E1-E2;if(E6>E5){E1=E2+E6}else{e=Ew+E5}}}function E4(FD,FC,E9,FB,E8,FA){if(isNaN(FC.x)||isNaN(FC.y)){return}if(FD.leaf){var E7=FD.point;if(E7){if((Math.abs(E7.x-FC.x)+Math.abs(E7.y-FC.y))<0.01){Ez(FD,FC,E9,FB,E8,FA)}else{FD.point=null;Ez(FD,E7,E9,FB,E8,FA);Ez(FD,FC,E9,FB,E8,FA)}}else{FD.point=FC}}else{Ez(FD,FC,E9,FB,E8,FA)}}function Ez(FB,E9,FA,FG,E8,FE){var FF=(FA+E8)*0.5,FD=(FG+FE)*0.5,FH=E9.x>=FF,E7=E9.y>=FD,FC=(E7<<1)+FH;FB.leaf=false;FB=FB.nodes[FC]||(FB.nodes[FC]=DP());if(FH){FA=FF}else{E8=FF}if(E7){FG=FD}else{FE=FD}E4(FB,E9,FA,FG,E8,FE)}var E0=DP();E0.add=function(E7){E4(E0,E7,Ew,E2,e,E1)};E0.visit=function(E7){BS(E7,E0,Ew,E2,e,E1)};E3.forEach(E0.add);return E0};function DP(){return{leaf:true,nodes:[],point:null}}function BS(Ey,Ex,Ev,E2,e,E0){if(!Ey(Ex,Ev,E2,e,E0)){var E1=(Ev+e)*0.5,Ez=(E2+E0)*0.5,Ew=Ex.nodes;if(Ew[0]){BS(Ey,Ew[0],Ev,E2,E1,Ez)}if(Ew[1]){BS(Ey,Ew[1],E1,E2,e,Ez)}if(Ew[2]){BS(Ey,Ew[2],Ev,Ez,E1,E0)}if(Ew[3]){BS(Ey,Ew[3],E1,Ez,e,E0)}}}function l(e){return{x:e[0],y:e[1]}}d3.time={};var DO=Date;function EG(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}EG.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){DZ.setUTCDate.apply(this._,arguments)},setDay:function(){DZ.setUTCDay.apply(this._,arguments)},setFullYear:function(){DZ.setUTCFullYear.apply(this._,arguments)},setHours:function(){DZ.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){DZ.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){DZ.setUTCMinutes.apply(this._,arguments)},setMonth:function(){DZ.setUTCMonth.apply(this._,arguments)},setSeconds:function(){DZ.setUTCSeconds.apply(this._,arguments)},setTime:function(){DZ.setTime.apply(this._,arguments)}};var DZ=Date.prototype;d3.time.format=function(e){var Ew=e.length;function Ev(Ez){var Ey=[],E0=-1,Ex=0,E2,E1;while(++E0<Ew){if(e.charCodeAt(E0)==37){Ey.push(e.substring(Ex,E0),(E1=Dt[E2=e.charAt(++E0)])?E1(Ez):E2);Ex=E0+1}}Ey.push(e.substring(Ex,E0));return Ey.join("")}Ev.parse=function(Ey){var E0={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},Ez=CG(E0,e,Ey,0);if(Ez!=Ey.length){return null}if("p" in E0){E0.H=E0.H%12+E0.p*12}var Ex=new DO();Ex.setFullYear(E0.y,E0.m,E0.d);Ex.setHours(E0.H,E0.M,E0.S,E0.L);return Ex};Ev.toString=function(){return e};return Ev};function CG(Ex,E2,E0,Ey){var E1,e,Ez=0,Ev=E2.length,Ew=E0.length;while(Ez<Ev){if(Ey>=Ew){return -1}E1=E2.charCodeAt(Ez++);if(E1==37){e=Ej[E2.charAt(Ez++)];if(!e||((Ey=e(Ex,E0,Ey))<0)){return -1}}else{if(E1!=E0.charCodeAt(Ey++)){return -1}}}return Ey}var As=d3.format("02d"),Ar=d3.format("03d"),Aq=d3.format("04d"),Ao=d3.format("2d");var Dt={a:function(e){return d3_time_weekdays[e.getDay()].substring(0,3)},A:function(e){return d3_time_weekdays[e.getDay()]},b:function(e){return BD[e.getMonth()].substring(0,3)},B:function(e){return BD[e.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(e){return As(e.getDate())},e:function(e){return Ao(e.getDate())},H:function(e){return As(e.getHours())},I:function(e){return As(e.getHours()%12||12)},j:function(e){return Ar(1+d3.time.dayOfYear(e))},L:function(e){return Ar(e.getMilliseconds())},m:function(e){return As(e.getMonth()+1)},M:function(e){return As(e.getMinutes())},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e){return As(e.getSeconds())},U:function(e){return As(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return As(d3.time.mondayOfYear(e))},x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(e){return As(e.getFullYear()%100)},Y:function(e){return Aq(e.getFullYear()%10000)},Z:DW,"%":function(e){return"%"}};var Ej={a:EF,A:BO,b:AV,B:Cl,c:CS,d:A3,e:A3,H:AN,I:AN,L:EB,m:D2,M:BY,p:Ea,S:B8,x:Et,X:Dz,y:g,Y:Am};function EF(Ev,e,Ew){return C4.test(e.substring(Ew,Ew+=3))?Ew:-1}function BO(Ev,e,Ew){Ay.lastIndex=0;var Ex=Ay.exec(e.substring(Ew,Ew+10));return Ex?Ew+=Ex[0].length:-1}var C4=/^(?:sun|mon|tue|wed|thu|fri|sat)/i,Ay=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i;d3_time_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function AV(Ev,e,Ew){var Ex=Cp.get(e.substring(Ew,Ew+=3).toLowerCase());return Ex==null?-1:(Ev.m=Ex,Ew)}var Cp=d3.map({jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11});function Cl(Ev,e,Ew){EI.lastIndex=0;var Ex=EI.exec(e.substring(Ew,Ew+12));return Ex?(Ev.m=DG.get(Ex[0].toLowerCase()),Ew+=Ex[0].length):-1}var EI=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;var DG=d3.map({january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11});var BD=["January","February","March","April","May","June","July","August","September","October","November","December"];function CS(Ev,e,Ew){return CG(Ev,Dt.c.toString(),e,Ew)}function Et(Ev,e,Ew){return CG(Ev,Dt.x.toString(),e,Ew)}function Dz(Ev,e,Ew){return CG(Ev,Dt.X.toString(),e,Ew)}function Am(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+4));return Ex?(Ev.y=+Ex[0],Ew+=Ex[0].length):-1}function g(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.y=Aj()+ +Ex[0],Ew+=Ex[0].length):-1}function Aj(){return ~~(new Date().getFullYear()/1000)*1000}function D2(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.m=Ex[0]-1,Ew+=Ex[0].length):-1}function A3(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.d=+Ex[0],Ew+=Ex[0].length):-1}function AN(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.H=+Ex[0],Ew+=Ex[0].length):-1}function BY(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.M=+Ex[0],Ew+=Ex[0].length):-1}function B8(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.S=+Ex[0],Ew+=Ex[0].length):-1}function EB(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+3));return Ex?(Ev.L=+Ex[0],Ew+=Ex[0].length):-1}var Da=/\s*\d+/;function Ea(Ev,e,Ew){var Ex=C.get(e.substring(Ew,Ew+=2).toLowerCase());return Ex==null?-1:(Ev.p=Ex,Ew)}var C=d3.map({am:0,pm:1});function DW(Ey){var Ex=Ey.getTimezoneOffset(),Ew=Ex>0?"-":"+",Ev=~~(Math.abs(Ex)/60),e=Math.abs(Ex)%60;return Ew+As(Ev)+As(e)}d3.time.format.utc=function(Ev){var e=d3.time.format(Ev);function Ew(Ex){try{DO=EG;var Ey=new DO();Ey._=Ex;return e(Ey)}finally{DO=Date}}Ew.parse=function(Ey){try{DO=EG;var Ex=e.parse(Ey);return Ex&&Ex._}finally{DO=Date}};Ew.toString=e.toString;return Ew};var B4=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Bt:B4;function Bt(e){return e.toISOString()}Bt.parse=function(e){return new Date(e)};Bt.toString=B4.toString;function Ba(Ez,e,Ev){function E2(E3){var E5=Ez(E3),E4=Ex(E5,1);return E3-E5<E4-E3?E5:E4}function E1(E3){e(E3=Ez(new DO(E3-1)),1);return E3}function Ex(E4,E3){e(E4=new DO(+E4),E3);return E4}function Ey(E5,E4,E3){var E6=E1(E5),E7=[];if(E3>1){while(E6<E4){if(!(Ev(E6)%E3)){E7.push(new Date(+E6))}e(E6,1)}}else{while(E6<E4){E7.push(new Date(+E6)),e(E6,1)}}return E7}function Ew(E6,E5,E4){try{DO=EG;var E3=new EG();E3._=E6;return Ey(E3,E5,E4)}finally{DO=Date}}Ez.floor=Ez;Ez.round=E2;Ez.ceil=E1;Ez.offset=Ex;Ez.range=Ey;var E0=Ez.utc=B6(Ez);E0.floor=E0;E0.round=B6(E2);E0.ceil=B6(E1);E0.offset=B6(Ex);E0.range=Ew;return Ez}function B6(e){return function(Ew,Ev){try{DO=EG;var Ex=new EG();Ex._=Ew;return e(Ex,Ev)._}finally{DO=Date}}}d3.time.second=Ba(function(e){return new DO(Math.floor(e/1000)*1000)},function(e,Ev){e.setTime(e.getTime()+Math.floor(Ev)*1000)},function(e){return e.getSeconds()});d3.time.seconds=d3.time.second.range;d3.time.seconds.utc=d3.time.second.utc.range;d3.time.minute=Ba(function(e){return new DO(Math.floor(e/60000)*60000)},function(e,Ev){e.setTime(e.getTime()+Math.floor(Ev)*60000)},function(e){return e.getMinutes()});d3.time.minutes=d3.time.minute.range;d3.time.minutes.utc=d3.time.minute.utc.range;d3.time.hour=Ba(function(e){var Ev=e.getTimezoneOffset()/60;return new DO((Math.floor(e/3600000-Ev)+Ev)*3600000)},function(e,Ev){e.setTime(e.getTime()+Math.floor(Ev)*3600000)},function(e){return e.getHours()});d3.time.hours=d3.time.hour.range;d3.time.hours.utc=d3.time.hour.utc.range;d3.time.day=Ba(function(e){return new DO(e.getFullYear(),e.getMonth(),e.getDate())},function(e,Ev){e.setDate(e.getDate()+Ev)},function(e){return e.getDate()-1});d3.time.days=d3.time.day.range;d3.time.days.utc=d3.time.day.utc.range;d3.time.dayOfYear=function(e){var Ev=d3.time.year(e);return Math.floor((e-Ev)/86400000-(e.getTimezoneOffset()-Ev.getTimezoneOffset())/1440)};d3_time_weekdays.forEach(function(Ev,Ew){Ev=Ev.toLowerCase();Ew=7-Ew;var e=d3.time[Ev]=Ba(function(Ex){(Ex=d3.time.day(Ex)).setDate(Ex.getDate()-(Ex.getDay()+Ew)%7);return Ex},function(Ex,Ey){Ex.setDate(Ex.getDate()+Math.floor(Ey)*7)},function(Ey){var Ex=d3.time.year(Ey).getDay();return Math.floor((d3.time.dayOfYear(Ey)+(Ex+Ew)%7)/7)-(Ex!==Ew)});d3.time[Ev+"s"]=e.range;d3.time[Ev+"s"].utc=e.utc.range;d3.time[Ev+"OfYear"]=function(Ey){var Ex=d3.time.year(Ey).getDay();return Math.floor((d3.time.dayOfYear(Ey)+(Ex+Ew)%7)/7)}});d3.time.week=d3.time.sunday;d3.time.weeks=d3.time.sunday.range;d3.time.weeks.utc=d3.time.sunday.utc.range;d3.time.weekOfYear=d3.time.sundayOfYear;d3.time.month=Ba(function(e){return new DO(e.getFullYear(),e.getMonth(),1)},function(e,Ev){e.setMonth(e.getMonth()+Ev)},function(e){return e.getMonth()});d3.time.months=d3.time.month.range;d3.time.months.utc=d3.time.month.utc.range;d3.time.year=Ba(function(e){return new DO(e.getFullYear(),0,1)},function(e,Ev){e.setFullYear(e.getFullYear()+Ev)},function(e){return e.getFullYear()});d3.time.years=d3.time.year.range;d3.time.years.utc=d3.time.year.utc.range;function Ai(e,Ev,Ew){function Ex(Ey){return e(Ey)}Ex.invert=function(Ey){return DY(e.invert(Ey))};Ex.domain=function(Ey){if(!arguments.length){return e.domain().map(DY)}e.domain(Ey);return Ex};Ex.nice=function(Ey){var Ez=DT(Ex.domain());return Ex.domain([Ey.floor(Ez[0]),Ey.ceil(Ez[1])])};Ex.ticks=function(Ey,Ez){var E2=DT(Ex.domain());if(typeof Ey!=="function"){var E1=E2[1]-E2[0],E3=E1/Ey,E0=d3.bisect(Cx,E3);if(E0==Cx.length){return Ev.year(E2,Ey)}if(!E0){return e.ticks(Ey).map(DY)}if(Math.log(E3/Cx[E0-1])<Math.log(Cx[E0]/E3)){--E0}Ey=Ev[E0];Ez=Ey[1];Ey=Ey[0].range}return Ey(E2[0],new Date(+E2[1]+1),Ez)};Ex.tickFormat=function(){return Ew};Ex.copy=function(){return Ai(e.copy(),Ev,Ew)};return d3.rebind(Ex,e,"range","rangeRound","interpolate","clamp")}function DT(Ev){var Ew=Ev[0],e=Ev[Ev.length-1];return Ew<e?[Ew,e]:[e,Ew]}function DY(e){return new Date(e)}function BX(e){return function(Ev){var Ew=e.length-1,Ex=e[Ew];while(!Ex[1](Ev)){Ex=e[--Ew]}return Ex[0](Ev)}}function CB(Ev){var e=new Date(Ev,0,1);e.setFullYear(Ev);return e}function EH(Ew){var Ex=Ew.getFullYear(),Ev=CB(Ex),e=CB(Ex+1);return Ex+(Ew-Ev)/(e-Ev)}var Cx=[1000,5000,15000,30000,60000,300000,900000,1800000,3600000,10800000,21600000,43200000,86400000,172800000,604800000,2592000000,7776000000,31536000000];var BN=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]];var DH=[[d3.time.format("%Y"),function(e){return true}],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]];var BL=d3.scale.linear(),m=BX(DH);BN.year=function(Ev,e){return BL.domain(Ev.map(EH)).ticks(e).map(CB)};d3.time.scale=function(){return Ai(d3.scale.linear(),BN,m)};var El=BN.map(function(e){return[e[0].utc,e[1]]});var A9=[[d3.time.format.utc("%Y"),function(e){return true}],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Co=BX(A9);function Be(Ev){var e=new Date(Date.UTC(Ev,0,1));e.setUTCFullYear(Ev);return e}function Di(Ew){var Ex=Ew.getUTCFullYear(),Ev=Be(Ex),e=Be(Ex+1);return Ex+(Ew-Ev)/(e-Ev)}El.year=function(Ev,e){return BL.domain(Ev.map(Di)).ticks(e).map(Be)};d3.time.scale.utc=function(){return Ai(d3.scale.linear(),El,Co)}})();var Box2D={};(function(C,B){function A(){}if(!(Object.prototype.defineProperty instanceof Function)&&Object.prototype.__defineGetter__ instanceof Function&&Object.prototype.__defineSetter__ instanceof Function){Object.defineProperty=function(F,E,D){D.get instanceof Function&&F.__defineGetter__(E,D.get);D.set instanceof Function&&F.__defineSetter__(E,D.set)}}C.inherit=function(E,D){A.prototype=D.prototype;E.prototype=new A;E.prototype.constructor=E};C.generateCallback=function(E,D){return function(){D.apply(E,arguments)}};C.NVector=function(F){if(F===B){F=0}for(var E=Array(F||0),D=0;D<F;++D){E[D]=0}return E};C.is=function(E,D){if(E===null){return false}if(D instanceof Function&&E instanceof D){return true}if(E.constructor.__implements!=B&&E.constructor.__implements[D]){return true}return false};C.parseUInt=function(D){return Math.abs(parseInt(D))}})(Box2D);var Vector=Array,Vector_a2j_Number=Box2D.NVector;if(typeof Box2D==="undefined"){Box2D={}}if(typeof Box2D.Collision==="undefined"){Box2D.Collision={}}if(typeof Box2D.Collision.Shapes==="undefined"){Box2D.Collision.Shapes={}}if(typeof Box2D.Common==="undefined"){Box2D.Common={}}if(typeof Box2D.Common.Math==="undefined"){Box2D.Common.Math={}}if(typeof Box2D.Dynamics==="undefined"){Box2D.Dynamics={}}if(typeof Box2D.Dynamics.Contacts==="undefined"){Box2D.Dynamics.Contacts={}}if(typeof Box2D.Dynamics.Controllers==="undefined"){Box2D.Dynamics.Controllers={}}if(typeof Box2D.Dynamics.Joints==="undefined"){Box2D.Dynamics.Joints={}}(function(){function BN(){BN.b2AABB.apply(this,arguments)}function BM(){BM.b2Bound.apply(this,arguments)}function BG(){BG.b2BoundValues.apply(this,arguments);this.constructor===BG&&this.b2BoundValues.apply(this,arguments)}function AS(){AS.b2Collision.apply(this,arguments)}function AV(){AV.b2ContactID.apply(this,arguments);this.constructor===AV&&this.b2ContactID.apply(this,arguments)}function BU(){BU.b2ContactPoint.apply(this,arguments)}function A5(){A5.b2Distance.apply(this,arguments)}function Ad(){Ad.b2DistanceInput.apply(this,arguments)}function BT(){BT.b2DistanceOutput.apply(this,arguments)}function A9(){A9.b2DistanceProxy.apply(this,arguments)}function A4(){A4.b2DynamicTree.apply(this,arguments);this.constructor===A4&&this.b2DynamicTree.apply(this,arguments)}function BE(){BE.b2DynamicTreeBroadPhase.apply(this,arguments)}function BF(){BF.b2DynamicTreeNode.apply(this,arguments)}function BK(){BK.b2DynamicTreePair.apply(this,arguments)}function A3(){A3.b2Manifold.apply(this,arguments);this.constructor===A3&&this.b2Manifold.apply(this,arguments)}function A1(){A1.b2ManifoldPoint.apply(this,arguments);this.constructor===A1&&this.b2ManifoldPoint.apply(this,arguments)}function Aj(){Aj.b2Point.apply(this,arguments)}function AR(){AR.b2RayCastInput.apply(this,arguments);this.constructor===AR&&this.b2RayCastInput.apply(this,arguments)}function AX(){AX.b2RayCastOutput.apply(this,arguments)}function BQ(){BQ.b2Segment.apply(this,arguments)}function BL(){BL.b2SeparationFunction.apply(this,arguments)}function BC(){BC.b2Simplex.apply(this,arguments);this.constructor===BC&&this.b2Simplex.apply(this,arguments)}function BP(){BP.b2SimplexCache.apply(this,arguments)}function A8(){A8.b2SimplexVertex.apply(this,arguments)}function BD(){BD.b2TimeOfImpact.apply(this,arguments)}function A7(){A7.b2TOIInput.apply(this,arguments)}function BZ(){BZ.b2WorldManifold.apply(this,arguments);this.constructor===BZ&&this.b2WorldManifold.apply(this,arguments)}function Az(){Az.ClipVertex.apply(this,arguments)}function As(){As.Features.apply(this,arguments)}function An(){An.b2CircleShape.apply(this,arguments);this.constructor===An&&this.b2CircleShape.apply(this,arguments)}function Ai(){Ai.b2EdgeChainDef.apply(this,arguments);this.constructor===Ai&&this.b2EdgeChainDef.apply(this,arguments)}function Ak(){Ak.b2EdgeShape.apply(this,arguments);this.constructor===Ak&&this.b2EdgeShape.apply(this,arguments)}function Ae(){Ae.b2MassData.apply(this,arguments)}function Ac(){Ac.b2PolygonShape.apply(this,arguments);this.constructor===Ac&&this.b2PolygonShape.apply(this,arguments)}function Af(){Af.b2Shape.apply(this,arguments);this.constructor===Af&&this.b2Shape.apply(this,arguments)}function Aw(){Aw.b2Color.apply(this,arguments);this.constructor===Aw&&this.b2Color.apply(this,arguments)}function At(){At.b2Settings.apply(this,arguments)}function Ao(){Ao.b2Mat22.apply(this,arguments);this.constructor===Ao&&this.b2Mat22.apply(this,arguments)}function Av(){Av.b2Mat33.apply(this,arguments);this.constructor===Av&&this.b2Mat33.apply(this,arguments)}function Aq(){Aq.b2Math.apply(this,arguments)}function Ap(){Ap.b2Sweep.apply(this,arguments)}function Ah(){Ah.b2Transform.apply(this,arguments);this.constructor===Ah&&this.b2Transform.apply(this,arguments)}function Ab(){Ab.b2Vec2.apply(this,arguments);this.constructor===Ab&&this.b2Vec2.apply(this,arguments)}function AZ(){AZ.b2Vec3.apply(this,arguments);this.constructor===AZ&&this.b2Vec3.apply(this,arguments)}function AW(){AW.b2Body.apply(this,arguments);this.constructor===AW&&this.b2Body.apply(this,arguments)}function AY(){AY.b2BodyDef.apply(this,arguments);this.constructor===AY&&this.b2BodyDef.apply(this,arguments)}function AU(){AU.b2ContactFilter.apply(this,arguments)}function BS(){BS.b2ContactImpulse.apply(this,arguments)}function BH(){BH.b2ContactListener.apply(this,arguments)}function A6(){A6.b2ContactManager.apply(this,arguments);this.constructor===A6&&this.b2ContactManager.apply(this,arguments)}function BA(){BA.b2DebugDraw.apply(this,arguments);this.constructor===BA&&this.b2DebugDraw.apply(this,arguments)}function A2(){A2.b2DestructionListener.apply(this,arguments)}function Bf(){Bf.b2FilterData.apply(this,arguments)}function BB(){BB.b2Fixture.apply(this,arguments);this.constructor===BB&&this.b2Fixture.apply(this,arguments)}function Ag(){Ag.b2FixtureDef.apply(this,arguments);this.constructor===Ag&&this.b2FixtureDef.apply(this,arguments)}function AK(){AK.b2Island.apply(this,arguments);this.constructor===AK&&this.b2Island.apply(this,arguments)}function AE(){AE.b2TimeStep.apply(this,arguments)}function AC(){AC.b2World.apply(this,arguments);this.constructor===AC&&this.b2World.apply(this,arguments)}function Bn(){Bn.b2CircleContact.apply(this,arguments)}function Bk(){Bk.b2Contact.apply(this,arguments);this.constructor===Bk&&this.b2Contact.apply(this,arguments)}function Bb(){Bb.b2ContactConstraint.apply(this,arguments);this.constructor===Bb&&this.b2ContactConstraint.apply(this,arguments)}function Be(){Be.b2ContactConstraintPoint.apply(this,arguments)}function BR(){BR.b2ContactEdge.apply(this,arguments)}function BI(){BI.b2ContactFactory.apply(this,arguments);this.constructor===BI&&this.b2ContactFactory.apply(this,arguments)}function Au(){Au.b2ContactRegister.apply(this,arguments)}function AO(){AO.b2ContactResult.apply(this,arguments)}function Al(){Al.b2ContactSolver.apply(this,arguments);this.constructor===Al&&this.b2ContactSolver.apply(this,arguments)}function AG(){AG.b2EdgeAndCircleContact.apply(this,arguments)}function AL(){AL.b2NullContact.apply(this,arguments);this.constructor===AL&&this.b2NullContact.apply(this,arguments)}function Bp(){Bp.b2PolyAndCircleContact.apply(this,arguments)}function Bh(){Bh.b2PolyAndEdgeContact.apply(this,arguments)}function BW(){BW.b2PolygonContact.apply(this,arguments)}function AD(){AD.b2PositionSolverManifold.apply(this,arguments);this.constructor===AD&&this.b2PositionSolverManifold.apply(this,arguments)}function Ay(){Ay.b2BuoyancyController.apply(this,arguments)}function AQ(){AQ.b2ConstantAccelController.apply(this,arguments)}function AI(){AI.b2ConstantForceController.apply(this,arguments)}function AB(){AB.b2Controller.apply(this,arguments)}function Bj(){Bj.b2ControllerEdge.apply(this,arguments)}function BY(){BY.b2GravityController.apply(this,arguments)}function A0(){A0.b2TensorDampingController.apply(this,arguments)}function Bm(){Bm.b2DistanceJoint.apply(this,arguments);this.constructor===Bm&&this.b2DistanceJoint.apply(this,arguments)}function Bd(){Bd.b2DistanceJointDef.apply(this,arguments);this.constructor===Bd&&this.b2DistanceJointDef.apply(this,arguments)}function BO(){BO.b2FrictionJoint.apply(this,arguments);this.constructor===BO&&this.b2FrictionJoint.apply(this,arguments)}function Ar(){Ar.b2FrictionJointDef.apply(this,arguments);this.constructor===Ar&&this.b2FrictionJointDef.apply(this,arguments)}function AN(){AN.b2GearJoint.apply(this,arguments);this.constructor===AN&&this.b2GearJoint.apply(this,arguments)}function AF(){AF.b2GearJointDef.apply(this,arguments);this.constructor===AF&&this.b2GearJointDef.apply(this,arguments)}function AT(){AT.b2Jacobian.apply(this,arguments)}function Bo(){Bo.b2Joint.apply(this,arguments);this.constructor===Bo&&this.b2Joint.apply(this,arguments)}function Bg(){Bg.b2JointDef.apply(this,arguments);this.constructor===Bg&&this.b2JointDef.apply(this,arguments)}function AJ(){AJ.b2JointEdge.apply(this,arguments)}function BV(){BV.b2LineJoint.apply(this,arguments);this.constructor===BV&&this.b2LineJoint.apply(this,arguments)}function Ax(){Ax.b2LineJointDef.apply(this,arguments);this.constructor===Ax&&this.b2LineJointDef.apply(this,arguments)}function AP(){AP.b2MouseJoint.apply(this,arguments);this.constructor===AP&&this.b2MouseJoint.apply(this,arguments)}function AH(){AH.b2MouseJointDef.apply(this,arguments);this.constructor===AH&&this.b2MouseJointDef.apply(this,arguments)}function AA(){AA.b2PrismaticJoint.apply(this,arguments);this.constructor===AA&&this.b2PrismaticJoint.apply(this,arguments)}function Bi(){Bi.b2PrismaticJointDef.apply(this,arguments);this.constructor===Bi&&this.b2PrismaticJointDef.apply(this,arguments)}function BX(){BX.b2PulleyJoint.apply(this,arguments);this.constructor===BX&&this.b2PulleyJoint.apply(this,arguments)}function Bl(){Bl.b2PulleyJointDef.apply(this,arguments);this.constructor===Bl&&this.b2PulleyJointDef.apply(this,arguments)}function Bc(){Bc.b2RevoluteJoint.apply(this,arguments);this.constructor===Bc&&this.b2RevoluteJoint.apply(this,arguments)}function BJ(){BJ.b2RevoluteJointDef.apply(this,arguments);this.constructor===BJ&&this.b2RevoluteJointDef.apply(this,arguments)}function Am(){Am.b2WeldJoint.apply(this,arguments);this.constructor===Am&&this.b2WeldJoint.apply(this,arguments)}function AM(){AM.b2WeldJointDef.apply(this,arguments);this.constructor===AM&&this.b2WeldJointDef.apply(this,arguments)}Box2D.Collision.IBroadPhase="Box2D.Collision.IBroadPhase";Box2D.Collision.b2AABB=BN;Box2D.Collision.b2Bound=BM;Box2D.Collision.b2BoundValues=BG;Box2D.Collision.b2Collision=AS;Box2D.Collision.b2ContactID=AV;Box2D.Collision.b2ContactPoint=BU;Box2D.Collision.b2Distance=A5;Box2D.Collision.b2DistanceInput=Ad;Box2D.Collision.b2DistanceOutput=BT;Box2D.Collision.b2DistanceProxy=A9;Box2D.Collision.b2DynamicTree=A4;Box2D.Collision.b2DynamicTreeBroadPhase=BE;Box2D.Collision.b2DynamicTreeNode=BF;Box2D.Collision.b2DynamicTreePair=BK;Box2D.Collision.b2Manifold=A3;Box2D.Collision.b2ManifoldPoint=A1;Box2D.Collision.b2Point=Aj;Box2D.Collision.b2RayCastInput=AR;Box2D.Collision.b2RayCastOutput=AX;Box2D.Collision.b2Segment=BQ;Box2D.Collision.b2SeparationFunction=BL;Box2D.Collision.b2Simplex=BC;Box2D.Collision.b2SimplexCache=BP;Box2D.Collision.b2SimplexVertex=A8;Box2D.Collision.b2TimeOfImpact=BD;Box2D.Collision.b2TOIInput=A7;Box2D.Collision.b2WorldManifold=BZ;Box2D.Collision.ClipVertex=Az;Box2D.Collision.Features=As;Box2D.Collision.Shapes.b2CircleShape=An;Box2D.Collision.Shapes.b2EdgeChainDef=Ai;Box2D.Collision.Shapes.b2EdgeShape=Ak;Box2D.Collision.Shapes.b2MassData=Ae;Box2D.Collision.Shapes.b2PolygonShape=Ac;Box2D.Collision.Shapes.b2Shape=Af;Box2D.Common.b2internal="Box2D.Common.b2internal";Box2D.Common.b2Color=Aw;Box2D.Common.b2Settings=At;Box2D.Common.Math.b2Mat22=Ao;Box2D.Common.Math.b2Mat33=Av;Box2D.Common.Math.b2Math=Aq;Box2D.Common.Math.b2Sweep=Ap;Box2D.Common.Math.b2Transform=Ah;Box2D.Common.Math.b2Vec2=Ab;Box2D.Common.Math.b2Vec3=AZ;Box2D.Dynamics.b2Body=AW;Box2D.Dynamics.b2BodyDef=AY;Box2D.Dynamics.b2ContactFilter=AU;Box2D.Dynamics.b2ContactImpulse=BS;Box2D.Dynamics.b2ContactListener=BH;Box2D.Dynamics.b2ContactManager=A6;Box2D.Dynamics.b2DebugDraw=BA;Box2D.Dynamics.b2DestructionListener=A2;Box2D.Dynamics.b2FilterData=Bf;Box2D.Dynamics.b2Fixture=BB;Box2D.Dynamics.b2FixtureDef=Ag;Box2D.Dynamics.b2Island=AK;Box2D.Dynamics.b2TimeStep=AE;Box2D.Dynamics.b2World=AC;Box2D.Dynamics.Contacts.b2CircleContact=Bn;Box2D.Dynamics.Contacts.b2Contact=Bk;Box2D.Dynamics.Contacts.b2ContactConstraint=Bb;Box2D.Dynamics.Contacts.b2ContactConstraintPoint=Be;Box2D.Dynamics.Contacts.b2ContactEdge=BR;Box2D.Dynamics.Contacts.b2ContactFactory=BI;Box2D.Dynamics.Contacts.b2ContactRegister=Au;Box2D.Dynamics.Contacts.b2ContactResult=AO;Box2D.Dynamics.Contacts.b2ContactSolver=Al;Box2D.Dynamics.Contacts.b2EdgeAndCircleContact=AG;Box2D.Dynamics.Contacts.b2NullContact=AL;Box2D.Dynamics.Contacts.b2PolyAndCircleContact=Bp;Box2D.Dynamics.Contacts.b2PolyAndEdgeContact=Bh;Box2D.Dynamics.Contacts.b2PolygonContact=BW;Box2D.Dynamics.Contacts.b2PositionSolverManifold=AD;Box2D.Dynamics.Controllers.b2BuoyancyController=Ay;Box2D.Dynamics.Controllers.b2ConstantAccelController=AQ;Box2D.Dynamics.Controllers.b2ConstantForceController=AI;Box2D.Dynamics.Controllers.b2Controller=AB;Box2D.Dynamics.Controllers.b2ControllerEdge=Bj;Box2D.Dynamics.Controllers.b2GravityController=BY;Box2D.Dynamics.Controllers.b2TensorDampingController=A0;Box2D.Dynamics.Joints.b2DistanceJoint=Bm;Box2D.Dynamics.Joints.b2DistanceJointDef=Bd;Box2D.Dynamics.Joints.b2FrictionJoint=BO;Box2D.Dynamics.Joints.b2FrictionJointDef=Ar;Box2D.Dynamics.Joints.b2GearJoint=AN;Box2D.Dynamics.Joints.b2GearJointDef=AF;Box2D.Dynamics.Joints.b2Jacobian=AT;Box2D.Dynamics.Joints.b2Joint=Bo;Box2D.Dynamics.Joints.b2JointDef=Bg;Box2D.Dynamics.Joints.b2JointEdge=AJ;Box2D.Dynamics.Joints.b2LineJoint=BV;Box2D.Dynamics.Joints.b2LineJointDef=Ax;Box2D.Dynamics.Joints.b2MouseJoint=AP;Box2D.Dynamics.Joints.b2MouseJointDef=AH;Box2D.Dynamics.Joints.b2PrismaticJoint=AA;Box2D.Dynamics.Joints.b2PrismaticJointDef=Bi;Box2D.Dynamics.Joints.b2PulleyJoint=BX;Box2D.Dynamics.Joints.b2PulleyJointDef=Bl;Box2D.Dynamics.Joints.b2RevoluteJoint=Bc;Box2D.Dynamics.Joints.b2RevoluteJointDef=BJ;Box2D.Dynamics.Joints.b2WeldJoint=Am;Box2D.Dynamics.Joints.b2WeldJointDef=AM})();Box2D.postDefs=[];(function(){var AF=Box2D.Collision.Shapes.b2CircleShape,AE=Box2D.Collision.Shapes.b2PolygonShape,AB=Box2D.Collision.Shapes.b2Shape,AM=Box2D.Common.b2Settings,AN=Box2D.Common.Math.b2Math,AJ=Box2D.Common.Math.b2Sweep,X=Box2D.Common.Math.b2Transform,AQ=Box2D.Common.Math.b2Vec2,AI=Box2D.Collision.b2AABB,f=Box2D.Collision.b2Bound,T=Box2D.Collision.b2BoundValues,x=Box2D.Collision.b2Collision,AA=Box2D.Collision.b2ContactID,AC=Box2D.Collision.b2ContactPoint,P=Box2D.Collision.b2Distance,J=Box2D.Collision.b2DistanceInput,AU=Box2D.Collision.b2DistanceOutput,AL=Box2D.Collision.b2DistanceProxy,AO=Box2D.Collision.b2DynamicTree,AH=Box2D.Collision.b2DynamicTreeBroadPhase,AD=Box2D.Collision.b2DynamicTreeNode,m=Box2D.Collision.b2DynamicTreePair,AG=Box2D.Collision.b2Manifold,e=Box2D.Collision.b2ManifoldPoint,t=Box2D.Collision.b2Point,b=Box2D.Collision.b2RayCastInput,AK=Box2D.Collision.b2RayCastOutput,C=Box2D.Collision.b2Segment,AY=Box2D.Collision.b2SeparationFunction,AW=Box2D.Collision.b2Simplex,AT=Box2D.Collision.b2SimplexCache,AV=Box2D.Collision.b2SimplexVertex,AR=Box2D.Collision.b2TimeOfImpact,AP=Box2D.Collision.b2TOIInput,AS=Box2D.Collision.b2WorldManifold,Aa=Box2D.Collision.ClipVertex,AZ=Box2D.Collision.Features,AX=Box2D.Collision.IBroadPhase;AI.b2AABB=function(){this.lowerBound=new AQ;this.upperBound=new AQ};AI.prototype.IsValid=function(){var A=this.upperBound.y-this.lowerBound.y;return A=(A=this.upperBound.x-this.lowerBound.x>=0&&A>=0)&&this.lowerBound.IsValid()&&this.upperBound.IsValid()};AI.prototype.GetCenter=function(){return new AQ((this.lowerBound.x+this.upperBound.x)/2,(this.lowerBound.y+this.upperBound.y)/2)};AI.prototype.GetExtents=function(){return new AQ((this.upperBound.x-this.lowerBound.x)/2,(this.upperBound.y-this.lowerBound.y)/2)};AI.prototype.Contains=function(A){var B=true;return B=(B=(B=(B=B&&this.lowerBound.x<=A.lowerBound.x)&&this.lowerBound.y<=A.lowerBound.y)&&A.upperBound.x<=this.upperBound.x)&&A.upperBound.y<=this.upperBound.y};AI.prototype.RayCast=function(I,H){var G=-Number.MAX_VALUE,D=Number.MAX_VALUE,A=H.p1.x,O=H.p1.y,M=H.p2.x-H.p1.x,N=H.p2.y-H.p1.y,L=Math.abs(N),B=I.normal,K=0,E=0,F=K=0;F=0;if(Math.abs(M)<Number.MIN_VALUE){if(A<this.lowerBound.x||this.upperBound.x<A){return false}}else{K=1/M;E=(this.lowerBound.x-A)*K;K=(this.upperBound.x-A)*K;F=-1;if(E>K){F=E;E=K;K=F;F=1}if(E>G){B.x=F;B.y=0;G=E}D=Math.min(D,K);if(G>D){return false}}if(L<Number.MIN_VALUE){if(O<this.lowerBound.y||this.upperBound.y<O){return false}}else{K=1/N;E=(this.lowerBound.y-O)*K;K=(this.upperBound.y-O)*K;F=-1;if(E>K){F=E;E=K;K=F;F=1}if(E>G){B.y=F;B.x=0;G=E}D=Math.min(D,K);if(G>D){return false}}I.fraction=G;return true};AI.prototype.TestOverlap=function(A){var D=A.lowerBound.y-this.upperBound.y,B=this.lowerBound.y-A.upperBound.y;if(A.lowerBound.x-this.upperBound.x>0||D>0){return false}if(this.lowerBound.x-A.upperBound.x>0||B>0){return false}return true};AI.Combine=function(A,D){var B=new AI;B.Combine(A,D);return B};AI.prototype.Combine=function(A,B){this.lowerBound.x=Math.min(A.lowerBound.x,B.lowerBound.x);this.lowerBound.y=Math.min(A.lowerBound.y,B.lowerBound.y);this.upperBound.x=Math.max(A.upperBound.x,B.upperBound.x);this.upperBound.y=Math.max(A.upperBound.y,B.upperBound.y)};f.b2Bound=function(){};f.prototype.IsLower=function(){return(this.value&1)==0};f.prototype.IsUpper=function(){return(this.value&1)==1};f.prototype.Swap=function(B){var E=this.value,D=this.proxy,A=this.stabbingCount;this.value=B.value;this.proxy=B.proxy;this.stabbingCount=B.stabbingCount;B.value=E;B.proxy=D;B.stabbingCount=A};T.b2BoundValues=function(){};T.prototype.b2BoundValues=function(){this.lowerValues=new Vector_a2j_Number;this.lowerValues[0]=0;this.lowerValues[1]=0;this.upperValues=new Vector_a2j_Number;this.upperValues[0]=0;this.upperValues[1]=0};x.b2Collision=function(){};x.ClipSegmentToLine=function(F,E,D,B){if(B===undefined){B=0}var A,K=0;A=E[0];var H=A.v;A=E[1];var I=A.v,G=D.x*H.x+D.y*H.y-B;A=D.x*I.x+D.y*I.y-B;G<=0&&F[K++].Set(E[0]);A<=0&&F[K++].Set(E[1]);if(G*A<0){D=G/(G-A);A=F[K];A=A.v;A.x=H.x+D*(I.x-H.x);A.y=H.y+D*(I.y-H.y);A=F[K];A.id=(G>0?E[0]:E[1]).id;++K}return K};x.EdgeSeparation=function(K,I,H,E,A){if(H===undefined){H=0}parseInt(K.m_vertexCount);var Q=K.m_vertices;K=K.m_normals;var N=parseInt(E.m_vertexCount),O=E.m_vertices,M,B;M=I.R;B=K[H];K=M.col1.x*B.x+M.col2.x*B.y;E=M.col1.y*B.x+M.col2.y*B.y;M=A.R;var L=M.col1.x*K+M.col1.y*E;M=M.col2.x*K+M.col2.y*E;for(var F=0,G=Number.MAX_VALUE,D=0;D<N;++D){B=O[D];B=B.x*L+B.y*M;if(B<G){G=B;F=D}}B=Q[H];M=I.R;H=I.position.x+(M.col1.x*B.x+M.col2.x*B.y);I=I.position.y+(M.col1.y*B.x+M.col2.y*B.y);B=O[F];M=A.R;Q=A.position.x+(M.col1.x*B.x+M.col2.x*B.y);A=A.position.y+(M.col1.y*B.x+M.col2.y*B.y);Q-=H;A-=I;return Q*K+A*E};x.FindMaxSeparation=function(L,K,I,E,A){var R=parseInt(K.m_vertexCount),O=K.m_normals,Q,N;N=A.R;Q=E.m_centroid;var B=A.position.x+(N.col1.x*Q.x+N.col2.x*Q.y),M=A.position.y+(N.col1.y*Q.x+N.col2.y*Q.y);N=I.R;Q=K.m_centroid;B-=I.position.x+(N.col1.x*Q.x+N.col2.x*Q.y);M-=I.position.y+(N.col1.y*Q.x+N.col2.y*Q.y);N=B*I.R.col1.x+M*I.R.col1.y;M=B*I.R.col2.x+M*I.R.col2.y;B=0;for(var F=-Number.MAX_VALUE,H=0;H<R;++H){Q=O[H];Q=Q.x*N+Q.y*M;if(Q>F){F=Q;B=H}}O=x.EdgeSeparation(K,I,B,E,A);Q=parseInt(B-1>=0?B-1:R-1);N=x.EdgeSeparation(K,I,Q,E,A);M=parseInt(B+1<R?B+1:0);F=x.EdgeSeparation(K,I,M,E,A);var D=H=0,G=0;if(N>O&&N>F){G=-1;H=Q;D=N}else{if(F>O){G=1;H=M;D=F}else{L[0]=B;return O}}for(;;){B=G==-1?H-1>=0?H-1:R-1:H+1<R?H+1:0;O=x.EdgeSeparation(K,I,B,E,A);if(O>D){H=B;D=O}else{break}}L[0]=H;return D};x.FindIncidentEdge=function(H,G,F,D,A,N){if(D===undefined){D=0}parseInt(G.m_vertexCount);var L=G.m_normals,M=parseInt(A.m_vertexCount);G=A.m_vertices;A=A.m_normals;var K;K=F.R;F=L[D];L=K.col1.x*F.x+K.col2.x*F.y;var B=K.col1.y*F.x+K.col2.y*F.y;K=N.R;F=K.col1.x*L+K.col1.y*B;B=K.col2.x*L+K.col2.y*B;L=F;K=0;for(var I=Number.MAX_VALUE,E=0;E<M;++E){F=A[E];F=L*F.x+B*F.y;if(F<I){I=F;K=E}}A=parseInt(K);L=parseInt(A+1<M?A+1:0);M=H[0];F=G[A];K=N.R;M.v.x=N.position.x+(K.col1.x*F.x+K.col2.x*F.y);M.v.y=N.position.y+(K.col1.y*F.x+K.col2.y*F.y);M.id.features.referenceEdge=D;M.id.features.incidentEdge=A;M.id.features.incidentVertex=0;M=H[1];F=G[L];K=N.R;M.v.x=N.position.x+(K.col1.x*F.x+K.col2.x*F.y);M.v.y=N.position.y+(K.col1.y*F.x+K.col2.y*F.y);M.id.features.referenceEdge=D;M.id.features.incidentEdge=L;M.id.features.incidentVertex=1};x.MakeClipPointVector=function(){var A=new Vector(2);A[0]=new Aa;A[1]=new Aa;return A};x.CollidePolygons=function(M,K,I,E,A){var S;M.m_pointCount=0;var Q=K.m_radius+E.m_radius;S=0;x.s_edgeAO[0]=S;var R=x.FindMaxSeparation(x.s_edgeAO,K,I,E,A);S=x.s_edgeAO[0];if(!(R>Q)){var O=0;x.s_edgeBO[0]=O;var B=x.FindMaxSeparation(x.s_edgeBO,E,A,K,I);O=x.s_edgeBO[0];if(!(B>Q)){var N=0,F=0;if(B>0.98*R+0.001){R=E;E=K;K=A;I=I;N=O;M.m_type=AG.e_faceB;F=1}else{R=K;E=E;K=I;I=A;N=S;M.m_type=AG.e_faceA;F=0}S=x.s_incidentEdge;x.FindIncidentEdge(S,R,K,N,E,I);O=parseInt(R.m_vertexCount);A=R.m_vertices;R=A[N];var H;H=N+1<O?A[parseInt(N+1)]:A[0];N=x.s_localTangent;N.Set(H.x-R.x,H.y-R.y);N.Normalize();A=x.s_localNormal;A.x=N.y;A.y=-N.x;E=x.s_planePoint;E.Set(0.5*(R.x+H.x),0.5*(R.y+H.y));B=x.s_tangent;O=K.R;B.x=O.col1.x*N.x+O.col2.x*N.y;B.y=O.col1.y*N.x+O.col2.y*N.y;var D=x.s_tangent2;D.x=-B.x;D.y=-B.y;N=x.s_normal;N.x=B.y;N.y=-B.x;var G=x.s_v11,L=x.s_v12;G.x=K.position.x+(O.col1.x*R.x+O.col2.x*R.y);G.y=K.position.y+(O.col1.y*R.x+O.col2.y*R.y);L.x=K.position.x+(O.col1.x*H.x+O.col2.x*H.y);L.y=K.position.y+(O.col1.y*H.x+O.col2.y*H.y);K=N.x*G.x+N.y*G.y;O=B.x*L.x+B.y*L.y+Q;H=x.s_clipPoints1;R=x.s_clipPoints2;L=0;L=x.ClipSegmentToLine(H,S,D,-B.x*G.x-B.y*G.y+Q);if(!(L<2)){L=x.ClipSegmentToLine(R,H,B,O);if(!(L<2)){M.m_localPlaneNormal.SetV(A);M.m_localPoint.SetV(E);for(E=A=0;E<AM.b2_maxManifoldPoints;++E){S=R[E];if(N.x*S.v.x+N.y*S.v.y-K<=Q){B=M.m_points[A];O=I.R;D=S.v.x-I.position.x;G=S.v.y-I.position.y;B.m_localPoint.x=D*O.col1.x+G*O.col1.y;B.m_localPoint.y=D*O.col2.x+G*O.col2.y;B.m_id.Set(S.id);B.m_id.features.flip=F;++A}}M.m_pointCount=A}}}}};x.CollideCircles=function(B,I,H,A,G){B.m_pointCount=0;var F,D;F=H.R;D=I.m_p;var E=H.position.x+(F.col1.x*D.x+F.col2.x*D.y);H=H.position.y+(F.col1.y*D.x+F.col2.y*D.y);F=G.R;D=A.m_p;E=G.position.x+(F.col1.x*D.x+F.col2.x*D.y)-E;G=G.position.y+(F.col1.y*D.x+F.col2.y*D.y)-H;F=I.m_radius+A.m_radius;if(!(E*E+G*G>F*F)){B.m_type=AG.e_circles;B.m_localPoint.SetV(I.m_p);B.m_localPlaneNormal.SetZero();B.m_pointCount=1;B.m_points[0].m_localPoint.SetV(A.m_p);B.m_points[0].m_id.key=0}};x.CollidePolygonAndCircle=function(K,I,H,E,A){var Q=K.m_pointCount=0,N=0,O,M;M=A.R;O=E.m_p;var B=A.position.y+(M.col1.y*O.x+M.col2.y*O.y);Q=A.position.x+(M.col1.x*O.x+M.col2.x*O.y)-H.position.x;N=B-H.position.y;M=H.R;H=Q*M.col1.x+N*M.col1.y;M=Q*M.col2.x+N*M.col2.y;var L=0;B=-Number.MAX_VALUE;A=I.m_radius+E.m_radius;var F=parseInt(I.m_vertexCount),G=I.m_vertices;I=I.m_normals;for(var D=0;D<F;++D){O=G[D];Q=H-O.x;N=M-O.y;O=I[D];Q=O.x*Q+O.y*N;if(Q>A){return}if(Q>B){B=Q;L=D}}Q=parseInt(L);N=parseInt(Q+1<F?Q+1:0);O=G[Q];G=G[N];if(B<Number.MIN_VALUE){K.m_pointCount=1;K.m_type=AG.e_faceA;K.m_localPlaneNormal.SetV(I[L]);K.m_localPoint.x=0.5*(O.x+G.x);K.m_localPoint.y=0.5*(O.y+G.y)}else{B=(H-G.x)*(O.x-G.x)+(M-G.y)*(O.y-G.y);if((H-O.x)*(G.x-O.x)+(M-O.y)*(G.y-O.y)<=0){if((H-O.x)*(H-O.x)+(M-O.y)*(M-O.y)>A*A){return}K.m_pointCount=1;K.m_type=AG.e_faceA;K.m_localPlaneNormal.x=H-O.x;K.m_localPlaneNormal.y=M-O.y;K.m_localPlaneNormal.Normalize();K.m_localPoint.SetV(O)}else{if(B<=0){if((H-G.x)*(H-G.x)+(M-G.y)*(M-G.y)>A*A){return}K.m_pointCount=1;K.m_type=AG.e_faceA;K.m_localPlaneNormal.x=H-G.x;K.m_localPlaneNormal.y=M-G.y;K.m_localPlaneNormal.Normalize();K.m_localPoint.SetV(G)}else{L=0.5*(O.x+G.x);O=0.5*(O.y+G.y);B=(H-L)*I[Q].x+(M-O)*I[Q].y;if(B>A){return}K.m_pointCount=1;K.m_type=AG.e_faceA;K.m_localPlaneNormal.x=I[Q].x;K.m_localPlaneNormal.y=I[Q].y;K.m_localPlaneNormal.Normalize();K.m_localPoint.Set(L,O)}}}K.m_points[0].m_localPoint.SetV(E.m_p);K.m_points[0].m_id.key=0};x.TestOverlap=function(B,H){var G=H.lowerBound,A=B.upperBound,F=G.x-A.x,E=G.y-A.y;G=B.lowerBound;A=H.upperBound;var D=G.y-A.y;if(F>0||E>0){return false}if(G.x-A.x>0||D>0){return false}return true};Box2D.postDefs.push(function(){Box2D.Collision.b2Collision.s_incidentEdge=x.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints1=x.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints2=x.MakeClipPointVector();Box2D.Collision.b2Collision.s_edgeAO=new Vector_a2j_Number(1);Box2D.Collision.b2Collision.s_edgeBO=new Vector_a2j_Number(1);Box2D.Collision.b2Collision.s_localTangent=new AQ;Box2D.Collision.b2Collision.s_localNormal=new AQ;Box2D.Collision.b2Collision.s_planePoint=new AQ;Box2D.Collision.b2Collision.s_normal=new AQ;Box2D.Collision.b2Collision.s_tangent=new AQ;Box2D.Collision.b2Collision.s_tangent2=new AQ;Box2D.Collision.b2Collision.s_v11=new AQ;Box2D.Collision.b2Collision.s_v12=new AQ;Box2D.Collision.b2Collision.b2CollidePolyTempVec=new AQ;Box2D.Collision.b2Collision.b2_nullFeature=255});AA.b2ContactID=function(){this.features=new AZ};AA.prototype.b2ContactID=function(){this.features._m_id=this};AA.prototype.Set=function(A){this.key=A._key};AA.prototype.Copy=function(){var A=new AA;A.key=this.key;return A};Object.defineProperty(AA.prototype,"key",{enumerable:false,configurable:true,get:function(){return this._key}});Object.defineProperty(AA.prototype,"key",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._key=A;this.features._referenceEdge=this._key&255;this.features._incidentEdge=(this._key&65280)>>8&255;this.features._incidentVertex=(this._key&16711680)>>16&255;this.features._flip=(this._key&4278190080)>>24&255}});AC.b2ContactPoint=function(){this.position=new AQ;this.velocity=new AQ;this.normal=new AQ;this.id=new AA};P.b2Distance=function(){};P.Distance=function(M,K,I){++P.b2_gjkCalls;var E=I.proxyA,A=I.proxyB,S=I.transformA,Q=I.transformB,R=P.s_simplex;R.ReadCache(K,E,S,A,Q);var O=R.m_vertices,B=P.s_saveA,N=P.s_saveB,F=0;R.GetClosestPoint().LengthSquared();for(var H=0,D,G=0;G<20;){F=R.m_count;for(H=0;H<F;H++){B[H]=O[H].indexA;N[H]=O[H].indexB}switch(R.m_count){case 1:break;case 2:R.Solve2();break;case 3:R.Solve3();break;default:AM.b2Assert(false)}if(R.m_count==3){break}D=R.GetClosestPoint();D.LengthSquared();H=R.GetSearchDirection();if(H.LengthSquared()<Number.MIN_VALUE*Number.MIN_VALUE){break}D=O[R.m_count];D.indexA=E.GetSupport(AN.MulTMV(S.R,H.GetNegative()));D.wA=AN.MulX(S,E.GetVertex(D.indexA));D.indexB=A.GetSupport(AN.MulTMV(Q.R,H));D.wB=AN.MulX(Q,A.GetVertex(D.indexB));D.w=AN.SubtractVV(D.wB,D.wA);++G;++P.b2_gjkIters;var L=false;for(H=0;H<F;H++){if(D.indexA==B[H]&&D.indexB==N[H]){L=true;break}}if(L){break}++R.m_count}P.b2_gjkMaxIters=AN.Max(P.b2_gjkMaxIters,G);R.GetWitnessPoints(M.pointA,M.pointB);M.distance=AN.SubtractVV(M.pointA,M.pointB).Length();M.iterations=G;R.WriteCache(K);if(I.useRadii){K=E.m_radius;A=A.m_radius;if(M.distance>K+A&&M.distance>Number.MIN_VALUE){M.distance-=K+A;I=AN.SubtractVV(M.pointB,M.pointA);I.Normalize();M.pointA.x+=K*I.x;M.pointA.y+=K*I.y;M.pointB.x-=A*I.x;M.pointB.y-=A*I.y}else{D=new AQ;D.x=0.5*(M.pointA.x+M.pointB.x);D.y=0.5*(M.pointA.y+M.pointB.y);M.pointA.x=M.pointB.x=D.x;M.pointA.y=M.pointB.y=D.y;M.distance=0}}};Box2D.postDefs.push(function(){Box2D.Collision.b2Distance.s_simplex=new AW;Box2D.Collision.b2Distance.s_saveA=new Vector_a2j_Number(3);Box2D.Collision.b2Distance.s_saveB=new Vector_a2j_Number(3)});J.b2DistanceInput=function(){};AU.b2DistanceOutput=function(){this.pointA=new AQ;this.pointB=new AQ};AL.b2DistanceProxy=function(){};AL.prototype.Set=function(A){switch(A.GetType()){case AB.e_circleShape:A=A instanceof AF?A:null;this.m_vertices=new Vector(1,true);this.m_vertices[0]=A.m_p;this.m_count=1;this.m_radius=A.m_radius;break;case AB.e_polygonShape:A=A instanceof AE?A:null;this.m_vertices=A.m_vertices;this.m_count=A.m_vertexCount;this.m_radius=A.m_radius;break;default:AM.b2Assert(false)}};AL.prototype.GetSupport=function(B){for(var F=0,E=this.m_vertices[0].x*B.x+this.m_vertices[0].y*B.y,A=1;A<this.m_count;++A){var D=this.m_vertices[A].x*B.x+this.m_vertices[A].y*B.y;if(D>E){F=A;E=D}}return F};AL.prototype.GetSupportVertex=function(B){for(var F=0,E=this.m_vertices[0].x*B.x+this.m_vertices[0].y*B.y,A=1;A<this.m_count;++A){var D=this.m_vertices[A].x*B.x+this.m_vertices[A].y*B.y;if(D>E){F=A;E=D}}return this.m_vertices[F]};AL.prototype.GetVertexCount=function(){return this.m_count};AL.prototype.GetVertex=function(A){if(A===undefined){A=0}AM.b2Assert(0<=A&&A<this.m_count);return this.m_vertices[A]};AO.b2DynamicTree=function(){};AO.prototype.b2DynamicTree=function(){this.m_freeList=this.m_root=null;this.m_insertionCount=this.m_path=0};AO.prototype.CreateProxy=function(B,F){var E=this.AllocateNode(),A=AM.b2_aabbExtension,D=AM.b2_aabbExtension;E.aabb.lowerBound.x=B.lowerBound.x-A;E.aabb.lowerBound.y=B.lowerBound.y-D;E.aabb.upperBound.x=B.upperBound.x+A;E.aabb.upperBound.y=B.upperBound.y+D;E.userData=F;this.InsertLeaf(E);return E};AO.prototype.DestroyProxy=function(A){this.RemoveLeaf(A);this.FreeNode(A)};AO.prototype.MoveProxy=function(B,E,D){AM.b2Assert(B.IsLeaf());if(B.aabb.Contains(E)){return false}this.RemoveLeaf(B);var A=AM.b2_aabbExtension+AM.b2_aabbMultiplier*(D.x>0?D.x:-D.x);D=AM.b2_aabbExtension+AM.b2_aabbMultiplier*(D.y>0?D.y:-D.y);B.aabb.lowerBound.x=E.lowerBound.x-A;B.aabb.lowerBound.y=E.lowerBound.y-D;B.aabb.upperBound.x=E.upperBound.x+A;B.aabb.upperBound.y=E.upperBound.y+D;this.InsertLeaf(B);return true};AO.prototype.Rebalance=function(B){if(B===undefined){B=0}if(this.m_root!=null){for(var E=0;E<B;E++){for(var D=this.m_root,A=0;D.IsLeaf()==false;){D=this.m_path>>A&1?D.child2:D.child1;A=A+1&31}++this.m_path;this.RemoveLeaf(D);this.InsertLeaf(D)}}};AO.prototype.GetFatAABB=function(A){return A.aabb};AO.prototype.GetUserData=function(A){return A.userData};AO.prototype.Query=function(B,F){if(this.m_root!=null){var E=new Vector,A=0;for(E[A++]=this.m_root;A>0;){var D=E[--A];if(D.aabb.TestOverlap(F)){if(D.IsLeaf()){if(!B(D)){break}}else{E[A++]=D.child1;E[A++]=D.child2}}}}};AO.prototype.RayCast=function(H,G){if(this.m_root!=null){var F=G.p1,D=G.p2,A=AN.SubtractVV(F,D);A.Normalize();A=AN.CrossFV(1,A);var N=AN.AbsV(A),L=G.maxFraction,M=new AI,K=0,B=0;K=F.x+L*(D.x-F.x);B=F.y+L*(D.y-F.y);M.lowerBound.x=Math.min(F.x,K);M.lowerBound.y=Math.min(F.y,B);M.upperBound.x=Math.max(F.x,K);M.upperBound.y=Math.max(F.y,B);var I=new Vector,E=0;for(I[E++]=this.m_root;E>0;){L=I[--E];if(L.aabb.TestOverlap(M)!=false){K=L.aabb.GetCenter();B=L.aabb.GetExtents();if(!(Math.abs(A.x*(F.x-K.x)+A.y*(F.y-K.y))-N.x*B.x-N.y*B.y>0)){if(L.IsLeaf()){K=new b;K.p1=G.p1;K.p2=G.p2;K.maxFraction=G.maxFraction;L=H(K,L);if(L==0){break}if(L>0){K=F.x+L*(D.x-F.x);B=F.y+L*(D.y-F.y);M.lowerBound.x=Math.min(F.x,K);M.lowerBound.y=Math.min(F.y,B);M.upperBound.x=Math.max(F.x,K);M.upperBound.y=Math.max(F.y,B)}}else{I[E++]=L.child1;I[E++]=L.child2}}}}}};AO.prototype.AllocateNode=function(){if(this.m_freeList){var A=this.m_freeList;this.m_freeList=A.parent;A.parent=null;A.child1=null;A.child2=null;return A}return new AD};AO.prototype.FreeNode=function(A){A.parent=this.m_freeList;this.m_freeList=A};AO.prototype.InsertLeaf=function(B){++this.m_insertionCount;if(this.m_root==null){this.m_root=B;this.m_root.parent=null}else{var E=B.aabb.GetCenter(),D=this.m_root;if(D.IsLeaf()==false){do{var A=D.child1;D=D.child2;D=Math.abs((A.aabb.lowerBound.x+A.aabb.upperBound.x)/2-E.x)+Math.abs((A.aabb.lowerBound.y+A.aabb.upperBound.y)/2-E.y)<Math.abs((D.aabb.lowerBound.x+D.aabb.upperBound.x)/2-E.x)+Math.abs((D.aabb.lowerBound.y+D.aabb.upperBound.y)/2-E.y)?A:D}while(D.IsLeaf()==false)}E=D.parent;A=this.AllocateNode();A.parent=E;A.userData=null;A.aabb.Combine(B.aabb,D.aabb);if(E){if(D.parent.child1==D){E.child1=A}else{E.child2=A}A.child1=D;A.child2=B;D.parent=A;B.parent=A;do{if(E.aabb.Contains(A.aabb)){break}E.aabb.Combine(E.child1.aabb,E.child2.aabb);A=E;E=E.parent}while(E)}else{A.child1=D;A.child2=B;D.parent=A;this.m_root=B.parent=A}}};AO.prototype.RemoveLeaf=function(A){if(A==this.m_root){this.m_root=null}else{var D=A.parent,B=D.parent;A=D.child1==A?D.child2:D.child1;if(B){if(B.child1==D){B.child1=A}else{B.child2=A}A.parent=B;for(this.FreeNode(D);B;){D=B.aabb;B.aabb=AI.Combine(B.child1.aabb,B.child2.aabb);if(D.Contains(B.aabb)){break}B=B.parent}}else{this.m_root=A;A.parent=null;this.FreeNode(D)}}};AH.b2DynamicTreeBroadPhase=function(){this.m_tree=new AO;this.m_moveBuffer=new Vector;this.m_pairBuffer=new Vector;this.m_pairCount=0};AH.prototype.CreateProxy=function(A,D){var B=this.m_tree.CreateProxy(A,D);++this.m_proxyCount;this.BufferMove(B);return B};AH.prototype.DestroyProxy=function(A){this.UnBufferMove(A);--this.m_proxyCount;this.m_tree.DestroyProxy(A)};AH.prototype.MoveProxy=function(A,D,B){this.m_tree.MoveProxy(A,D,B)&&this.BufferMove(A)};AH.prototype.TestOverlap=function(B,E){var D=this.m_tree.GetFatAABB(B),A=this.m_tree.GetFatAABB(E);return D.TestOverlap(A)};AH.prototype.GetUserData=function(A){return this.m_tree.GetUserData(A)};AH.prototype.GetFatAABB=function(A){return this.m_tree.GetFatAABB(A)};AH.prototype.GetProxyCount=function(){return this.m_proxyCount};AH.prototype.UpdatePairs=function(B){var H=this;var G=H.m_pairCount=0,A;for(G=0;G<H.m_moveBuffer.length;++G){A=H.m_moveBuffer[G];var F=H.m_tree.GetFatAABB(A);H.m_tree.Query(function(K){if(K==A){return true}if(H.m_pairCount==H.m_pairBuffer.length){H.m_pairBuffer[H.m_pairCount]=new m}var I=H.m_pairBuffer[H.m_pairCount];I.proxyA=K<A?K:A;I.proxyB=K>=A?K:A;++H.m_pairCount;return true},F)}for(G=H.m_moveBuffer.length=0;G<H.m_pairCount;){F=H.m_pairBuffer[G];var E=H.m_tree.GetUserData(F.proxyA),D=H.m_tree.GetUserData(F.proxyB);B(E,D);for(++G;G<H.m_pairCount;){E=H.m_pairBuffer[G];if(E.proxyA!=F.proxyA||E.proxyB!=F.proxyB){break}++G}}};AH.prototype.Query=function(A,B){this.m_tree.Query(A,B)};AH.prototype.RayCast=function(A,B){this.m_tree.RayCast(A,B)};AH.prototype.Validate=function(){};AH.prototype.Rebalance=function(A){if(A===undefined){A=0}this.m_tree.Rebalance(A)};AH.prototype.BufferMove=function(A){this.m_moveBuffer[this.m_moveBuffer.length]=A};AH.prototype.UnBufferMove=function(A){this.m_moveBuffer.splice(parseInt(this.m_moveBuffer.indexOf(A)),1)};AH.prototype.ComparePairs=function(){return 0};AH.__implements={};AH.__implements[AX]=true;AD.b2DynamicTreeNode=function(){this.aabb=new AI};AD.prototype.IsLeaf=function(){return this.child1==null};m.b2DynamicTreePair=function(){};AG.b2Manifold=function(){this.m_pointCount=0};AG.prototype.b2Manifold=function(){this.m_points=new Vector(AM.b2_maxManifoldPoints);for(var A=0;A<AM.b2_maxManifoldPoints;A++){this.m_points[A]=new e}this.m_localPlaneNormal=new AQ;this.m_localPoint=new AQ};AG.prototype.Reset=function(){for(var A=0;A<AM.b2_maxManifoldPoints;A++){(this.m_points[A] instanceof e?this.m_points[A]:null).Reset()}this.m_localPlaneNormal.SetZero();this.m_localPoint.SetZero();this.m_pointCount=this.m_type=0};AG.prototype.Set=function(A){this.m_pointCount=A.m_pointCount;for(var B=0;B<AM.b2_maxManifoldPoints;B++){(this.m_points[B] instanceof e?this.m_points[B]:null).Set(A.m_points[B])}this.m_localPlaneNormal.SetV(A.m_localPlaneNormal);this.m_localPoint.SetV(A.m_localPoint);this.m_type=A.m_type};AG.prototype.Copy=function(){var A=new AG;A.Set(this);return A};Box2D.postDefs.push(function(){Box2D.Collision.b2Manifold.e_circles=1;Box2D.Collision.b2Manifold.e_faceA=2;Box2D.Collision.b2Manifold.e_faceB=4});e.b2ManifoldPoint=function(){this.m_localPoint=new AQ;this.m_id=new AA};e.prototype.b2ManifoldPoint=function(){this.Reset()};e.prototype.Reset=function(){this.m_localPoint.SetZero();this.m_tangentImpulse=this.m_normalImpulse=0;this.m_id.key=0};e.prototype.Set=function(A){this.m_localPoint.SetV(A.m_localPoint);this.m_normalImpulse=A.m_normalImpulse;this.m_tangentImpulse=A.m_tangentImpulse;this.m_id.Set(A.m_id)};t.b2Point=function(){this.p=new AQ};t.prototype.Support=function(){return this.p};t.prototype.GetFirstVertex=function(){return this.p};b.b2RayCastInput=function(){this.p1=new AQ;this.p2=new AQ};b.prototype.b2RayCastInput=function(A,D,B){if(A===undefined){A=null}if(D===undefined){D=null}if(B===undefined){B=1}A&&this.p1.SetV(A);D&&this.p2.SetV(D);this.maxFraction=B};AK.b2RayCastOutput=function(){this.normal=new AQ};C.b2Segment=function(){this.p1=new AQ;this.p2=new AQ};C.prototype.TestSegment=function(H,G,F,D){if(D===undefined){D=0}var A=F.p1,N=F.p2.x-A.x,L=F.p2.y-A.y;F=this.p2.y-this.p1.y;var M=-(this.p2.x-this.p1.x),K=100*Number.MIN_VALUE,B=-(N*F+L*M);if(B>K){var I=A.x-this.p1.x,E=A.y-this.p1.y;A=I*F+E*M;if(0<=A&&A<=D*B){D=-N*E+L*I;if(-K*B<=D&&D<=B*(1+K)){A/=B;D=Math.sqrt(F*F+M*M);F/=D;M/=D;H[0]=A;G.Set(F,M);return true}}}return false};C.prototype.Extend=function(A){this.ExtendForward(A);this.ExtendBackward(A)};C.prototype.ExtendForward=function(A){var D=this.p2.x-this.p1.x,B=this.p2.y-this.p1.y;A=Math.min(D>0?(A.upperBound.x-this.p1.x)/D:D<0?(A.lowerBound.x-this.p1.x)/D:Number.POSITIVE_INFINITY,B>0?(A.upperBound.y-this.p1.y)/B:B<0?(A.lowerBound.y-this.p1.y)/B:Number.POSITIVE_INFINITY);this.p2.x=this.p1.x+D*A;this.p2.y=this.p1.y+B*A};C.prototype.ExtendBackward=function(A){var D=-this.p2.x+this.p1.x,B=-this.p2.y+this.p1.y;A=Math.min(D>0?(A.upperBound.x-this.p2.x)/D:D<0?(A.lowerBound.x-this.p2.x)/D:Number.POSITIVE_INFINITY,B>0?(A.upperBound.y-this.p2.y)/B:B<0?(A.lowerBound.y-this.p2.y)/B:Number.POSITIVE_INFINITY);this.p1.x=this.p2.x+D*A;this.p1.y=this.p2.y+B*A};AY.b2SeparationFunction=function(){this.m_localPoint=new AQ;this.m_axis=new AQ};AY.prototype.Initialize=function(H,G,F,D,A){this.m_proxyA=G;this.m_proxyB=D;var N=parseInt(H.count);AM.b2Assert(0<N&&N<3);var L,M,K,B,I=B=K=D=G=0,E=0;I=0;if(N==1){this.m_type=AY.e_points;L=this.m_proxyA.GetVertex(H.indexA[0]);M=this.m_proxyB.GetVertex(H.indexB[0]);N=L;H=F.R;G=F.position.x+(H.col1.x*N.x+H.col2.x*N.y);D=F.position.y+(H.col1.y*N.x+H.col2.y*N.y);N=M;H=A.R;K=A.position.x+(H.col1.x*N.x+H.col2.x*N.y);B=A.position.y+(H.col1.y*N.x+H.col2.y*N.y);this.m_axis.x=K-G;this.m_axis.y=B-D;this.m_axis.Normalize()}else{if(H.indexB[0]==H.indexB[1]){this.m_type=AY.e_faceA;G=this.m_proxyA.GetVertex(H.indexA[0]);D=this.m_proxyA.GetVertex(H.indexA[1]);M=this.m_proxyB.GetVertex(H.indexB[0]);this.m_localPoint.x=0.5*(G.x+D.x);this.m_localPoint.y=0.5*(G.y+D.y);this.m_axis=AN.CrossVF(AN.SubtractVV(D,G),1);this.m_axis.Normalize();N=this.m_axis;H=F.R;I=H.col1.x*N.x+H.col2.x*N.y;E=H.col1.y*N.x+H.col2.y*N.y;N=this.m_localPoint;H=F.R;G=F.position.x+(H.col1.x*N.x+H.col2.x*N.y);D=F.position.y+(H.col1.y*N.x+H.col2.y*N.y);N=M;H=A.R;K=A.position.x+(H.col1.x*N.x+H.col2.x*N.y);B=A.position.y+(H.col1.y*N.x+H.col2.y*N.y);I=(K-G)*I+(B-D)*E}else{if(H.indexA[0]==H.indexA[0]){this.m_type=AY.e_faceB;K=this.m_proxyB.GetVertex(H.indexB[0]);B=this.m_proxyB.GetVertex(H.indexB[1]);L=this.m_proxyA.GetVertex(H.indexA[0]);this.m_localPoint.x=0.5*(K.x+B.x);this.m_localPoint.y=0.5*(K.y+B.y);this.m_axis=AN.CrossVF(AN.SubtractVV(B,K),1);this.m_axis.Normalize();N=this.m_axis;H=A.R;I=H.col1.x*N.x+H.col2.x*N.y;E=H.col1.y*N.x+H.col2.y*N.y;N=this.m_localPoint;H=A.R;K=A.position.x+(H.col1.x*N.x+H.col2.x*N.y);B=A.position.y+(H.col1.y*N.x+H.col2.y*N.y);N=L;H=F.R;G=F.position.x+(H.col1.x*N.x+H.col2.x*N.y);D=F.position.y+(H.col1.y*N.x+H.col2.y*N.y);I=(G-K)*I+(D-B)*E}else{G=this.m_proxyA.GetVertex(H.indexA[0]);D=this.m_proxyA.GetVertex(H.indexA[1]);K=this.m_proxyB.GetVertex(H.indexB[0]);B=this.m_proxyB.GetVertex(H.indexB[1]);AN.MulX(F,L);L=AN.MulMV(F.R,AN.SubtractVV(D,G));AN.MulX(A,M);I=AN.MulMV(A.R,AN.SubtractVV(B,K));A=L.x*L.x+L.y*L.y;M=I.x*I.x+I.y*I.y;H=AN.SubtractVV(I,L);F=L.x*H.x+L.y*H.y;H=I.x*H.x+I.y*H.y;L=L.x*I.x+L.y*I.y;E=A*M-L*L;I=0;if(E!=0){I=AN.Clamp((L*H-F*M)/E,0,1)}if((L*I+H)/M<0){I=AN.Clamp((L-F)/A,0,1)}L=new AQ;L.x=G.x+I*(D.x-G.x);L.y=G.y+I*(D.y-G.y);M=new AQ;M.x=K.x+I*(B.x-K.x);M.y=K.y+I*(B.y-K.y);if(I==0||I==1){this.m_type=AY.e_faceB;this.m_axis=AN.CrossVF(AN.SubtractVV(B,K),1);this.m_axis.Normalize();this.m_localPoint=M}else{this.m_type=AY.e_faceA;this.m_axis=AN.CrossVF(AN.SubtractVV(D,G),1);this.m_localPoint=L}}}I<0&&this.m_axis.NegativeSelf()}};AY.prototype.Evaluate=function(B,F){var E,A,D=0;switch(this.m_type){case AY.e_points:E=AN.MulTMV(B.R,this.m_axis);A=AN.MulTMV(F.R,this.m_axis.GetNegative());E=this.m_proxyA.GetSupportVertex(E);A=this.m_proxyB.GetSupportVertex(A);E=AN.MulX(B,E);A=AN.MulX(F,A);return D=(A.x-E.x)*this.m_axis.x+(A.y-E.y)*this.m_axis.y;case AY.e_faceA:D=AN.MulMV(B.R,this.m_axis);E=AN.MulX(B,this.m_localPoint);A=AN.MulTMV(F.R,D.GetNegative());A=this.m_proxyB.GetSupportVertex(A);A=AN.MulX(F,A);return D=(A.x-E.x)*D.x+(A.y-E.y)*D.y;case AY.e_faceB:D=AN.MulMV(F.R,this.m_axis);A=AN.MulX(F,this.m_localPoint);E=AN.MulTMV(B.R,D.GetNegative());E=this.m_proxyA.GetSupportVertex(E);E=AN.MulX(B,E);return D=(E.x-A.x)*D.x+(E.y-A.y)*D.y;default:AM.b2Assert(false);return 0}};Box2D.postDefs.push(function(){Box2D.Collision.b2SeparationFunction.e_points=1;Box2D.Collision.b2SeparationFunction.e_faceA=2;Box2D.Collision.b2SeparationFunction.e_faceB=4});AW.b2Simplex=function(){this.m_v1=new AV;this.m_v2=new AV;this.m_v3=new AV;this.m_vertices=new Vector(3)};AW.prototype.b2Simplex=function(){this.m_vertices[0]=this.m_v1;this.m_vertices[1]=this.m_v2;this.m_vertices[2]=this.m_v3};AW.prototype.ReadCache=function(G,F,E,D,A){AM.b2Assert(0<=G.count&&G.count<=3);var L,I;this.m_count=G.count;for(var K=this.m_vertices,H=0;H<this.m_count;H++){var B=K[H];B.indexA=G.indexA[H];B.indexB=G.indexB[H];L=F.GetVertex(B.indexA);I=D.GetVertex(B.indexB);B.wA=AN.MulX(E,L);B.wB=AN.MulX(A,I);B.w=AN.SubtractVV(B.wB,B.wA);B.a=0}if(this.m_count>1){G=G.metric;L=this.GetMetric();if(L<0.5*G||2*G<L||L<Number.MIN_VALUE){this.m_count=0}}if(this.m_count==0){B=K[0];B.indexA=0;B.indexB=0;L=F.GetVertex(0);I=D.GetVertex(0);B.wA=AN.MulX(E,L);B.wB=AN.MulX(A,I);B.w=AN.SubtractVV(B.wB,B.wA);this.m_count=1}};AW.prototype.WriteCache=function(A){A.metric=this.GetMetric();A.count=Box2D.parseUInt(this.m_count);for(var D=this.m_vertices,B=0;B<this.m_count;B++){A.indexA[B]=Box2D.parseUInt(D[B].indexA);A.indexB[B]=Box2D.parseUInt(D[B].indexB)}};AW.prototype.GetSearchDirection=function(){switch(this.m_count){case 1:return this.m_v1.w.GetNegative();case 2:var A=AN.SubtractVV(this.m_v2.w,this.m_v1.w);return AN.CrossVV(A,this.m_v1.w.GetNegative())>0?AN.CrossFV(1,A):AN.CrossVF(A,1);default:AM.b2Assert(false);return new AQ}};AW.prototype.GetClosestPoint=function(){switch(this.m_count){case 0:AM.b2Assert(false);return new AQ;case 1:return this.m_v1.w;case 2:return new AQ(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);default:AM.b2Assert(false);return new AQ}};AW.prototype.GetWitnessPoints=function(A,B){switch(this.m_count){case 0:AM.b2Assert(false);break;case 1:A.SetV(this.m_v1.wA);B.SetV(this.m_v1.wB);break;case 2:A.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x;A.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y;B.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x;B.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:B.x=A.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x;B.y=A.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y;break;default:AM.b2Assert(false)}};AW.prototype.GetMetric=function(){switch(this.m_count){case 0:AM.b2Assert(false);return 0;case 1:return 0;case 2:return AN.SubtractVV(this.m_v1.w,this.m_v2.w).Length();case 3:return AN.CrossVV(AN.SubtractVV(this.m_v2.w,this.m_v1.w),AN.SubtractVV(this.m_v3.w,this.m_v1.w));default:AM.b2Assert(false);return 0}};AW.prototype.Solve2=function(){var A=this.m_v1.w,D=this.m_v2.w,B=AN.SubtractVV(D,A);A=-(A.x*B.x+A.y*B.y);if(A<=0){this.m_count=this.m_v1.a=1}else{D=D.x*B.x+D.y*B.y;if(D<=0){this.m_count=this.m_v2.a=1;this.m_v1.Set(this.m_v2)}else{B=1/(D+A);this.m_v1.a=D*B;this.m_v2.a=A*B;this.m_count=2}}};AW.prototype.Solve3=function(){var G=this.m_v1.w,F=this.m_v2.w,E=this.m_v3.w,D=AN.SubtractVV(F,G),A=AN.Dot(G,D),M=AN.Dot(F,D);A=-A;var K=AN.SubtractVV(E,G),L=AN.Dot(G,K),I=AN.Dot(E,K);L=-L;var B=AN.SubtractVV(E,F),H=AN.Dot(F,B);B=AN.Dot(E,B);H=-H;K=AN.CrossVV(D,K);D=K*AN.CrossVV(F,E);E=K*AN.CrossVV(E,G);G=K*AN.CrossVV(G,F);if(A<=0&&L<=0){this.m_count=this.m_v1.a=1}else{if(M>0&&A>0&&G<=0){I=1/(M+A);this.m_v1.a=M*I;this.m_v2.a=A*I;this.m_count=2}else{if(I>0&&L>0&&E<=0){M=1/(I+L);this.m_v1.a=I*M;this.m_v3.a=L*M;this.m_count=2;this.m_v2.Set(this.m_v3)}else{if(M<=0&&H<=0){this.m_count=this.m_v2.a=1;this.m_v1.Set(this.m_v2)}else{if(I<=0&&B<=0){this.m_count=this.m_v3.a=1;this.m_v1.Set(this.m_v3)}else{if(B>0&&H>0&&D<=0){M=1/(B+H);this.m_v2.a=B*M;this.m_v3.a=H*M;this.m_count=2;this.m_v1.Set(this.m_v3)}else{M=1/(D+E+G);this.m_v1.a=D*M;this.m_v2.a=E*M;this.m_v3.a=G*M;this.m_count=3}}}}}}};AT.b2SimplexCache=function(){this.indexA=new Vector_a2j_Number(3);this.indexB=new Vector_a2j_Number(3)};AV.b2SimplexVertex=function(){};AV.prototype.Set=function(A){this.wA.SetV(A.wA);this.wB.SetV(A.wB);this.w.SetV(A.w);this.a=A.a;this.indexA=A.indexA;this.indexB=A.indexB};AR.b2TimeOfImpact=function(){};AR.TimeOfImpact=function(N){++AR.b2_toiCalls;var L=N.proxyA,K=N.proxyB,E=N.sweepA,A=N.sweepB;AM.b2Assert(E.t0==A.t0);AM.b2Assert(1-E.t0>Number.MIN_VALUE);var U=L.m_radius+K.m_radius;N=N.tolerance;var R=0,S=0,Q=0;AR.s_cache.count=0;for(AR.s_distanceInput.useRadii=false;;){E.GetTransform(AR.s_xfA,R);A.GetTransform(AR.s_xfB,R);AR.s_distanceInput.proxyA=L;AR.s_distanceInput.proxyB=K;AR.s_distanceInput.transformA=AR.s_xfA;AR.s_distanceInput.transformB=AR.s_xfB;P.Distance(AR.s_distanceOutput,AR.s_cache,AR.s_distanceInput);if(AR.s_distanceOutput.distance<=0){R=1;break}AR.s_fcn.Initialize(AR.s_cache,L,AR.s_xfA,K,AR.s_xfB);var B=AR.s_fcn.Evaluate(AR.s_xfA,AR.s_xfB);if(B<=0){R=1;break}if(S==0){Q=B>U?AN.Max(U-N,0.75*U):AN.Max(B-N,0.02*U)}if(B-Q<0.5*N){if(S==0){R=1;break}break}var O=R,G=R,I=1;B=B;E.GetTransform(AR.s_xfA,I);A.GetTransform(AR.s_xfB,I);var D=AR.s_fcn.Evaluate(AR.s_xfA,AR.s_xfB);if(D>=Q){R=1;break}for(var H=0;;){var M=0;M=H&1?G+(Q-B)*(I-G)/(D-B):0.5*(G+I);E.GetTransform(AR.s_xfA,M);A.GetTransform(AR.s_xfB,M);var F=AR.s_fcn.Evaluate(AR.s_xfA,AR.s_xfB);if(AN.Abs(F-Q)<0.025*N){O=M;break}if(F>Q){G=M;B=F}else{I=M;D=F}++H;++AR.b2_toiRootIters;if(H==50){break}}AR.b2_toiMaxRootIters=AN.Max(AR.b2_toiMaxRootIters,H);if(O<(1+100*Number.MIN_VALUE)*R){break}R=O;S++;++AR.b2_toiIters;if(S==1000){break}}AR.b2_toiMaxIters=AN.Max(AR.b2_toiMaxIters,S);return R};Box2D.postDefs.push(function(){Box2D.Collision.b2TimeOfImpact.b2_toiCalls=0;Box2D.Collision.b2TimeOfImpact.b2_toiIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiMaxIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiRootIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiMaxRootIters=0;Box2D.Collision.b2TimeOfImpact.s_cache=new AT;Box2D.Collision.b2TimeOfImpact.s_distanceInput=new J;Box2D.Collision.b2TimeOfImpact.s_xfA=new X;Box2D.Collision.b2TimeOfImpact.s_xfB=new X;Box2D.Collision.b2TimeOfImpact.s_fcn=new AY;Box2D.Collision.b2TimeOfImpact.s_distanceOutput=new AU});AP.b2TOIInput=function(){this.proxyA=new AL;this.proxyB=new AL;this.sweepA=new AJ;this.sweepB=new AJ};AS.b2WorldManifold=function(){this.m_normal=new AQ};AS.prototype.b2WorldManifold=function(){this.m_points=new Vector(AM.b2_maxManifoldPoints);for(var A=0;A<AM.b2_maxManifoldPoints;A++){this.m_points[A]=new AQ}};AS.prototype.Initialize=function(I,H,G,D,A){if(G===undefined){G=0}if(A===undefined){A=0}if(I.m_pointCount!=0){var O=0,M,N,L=0,B=0,K=0,E=0,F=0;M=0;switch(I.m_type){case AG.e_circles:N=H.R;M=I.m_localPoint;O=H.position.x+N.col1.x*M.x+N.col2.x*M.y;H=H.position.y+N.col1.y*M.x+N.col2.y*M.y;N=D.R;M=I.m_points[0].m_localPoint;I=D.position.x+N.col1.x*M.x+N.col2.x*M.y;D=D.position.y+N.col1.y*M.x+N.col2.y*M.y;M=I-O;N=D-H;L=M*M+N*N;if(L>Number.MIN_VALUE*Number.MIN_VALUE){L=Math.sqrt(L);this.m_normal.x=M/L;this.m_normal.y=N/L}else{this.m_normal.x=1;this.m_normal.y=0}M=H+G*this.m_normal.y;D=D-A*this.m_normal.y;this.m_points[0].x=0.5*(O+G*this.m_normal.x+(I-A*this.m_normal.x));this.m_points[0].y=0.5*(M+D);break;case AG.e_faceA:N=H.R;M=I.m_localPlaneNormal;L=N.col1.x*M.x+N.col2.x*M.y;B=N.col1.y*M.x+N.col2.y*M.y;N=H.R;M=I.m_localPoint;K=H.position.x+N.col1.x*M.x+N.col2.x*M.y;E=H.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_normal.x=L;this.m_normal.y=B;for(O=0;O<I.m_pointCount;O++){N=D.R;M=I.m_points[O].m_localPoint;F=D.position.x+N.col1.x*M.x+N.col2.x*M.y;M=D.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_points[O].x=F+0.5*(G-(F-K)*L-(M-E)*B-A)*L;this.m_points[O].y=M+0.5*(G-(F-K)*L-(M-E)*B-A)*B}break;case AG.e_faceB:N=D.R;M=I.m_localPlaneNormal;L=N.col1.x*M.x+N.col2.x*M.y;B=N.col1.y*M.x+N.col2.y*M.y;N=D.R;M=I.m_localPoint;K=D.position.x+N.col1.x*M.x+N.col2.x*M.y;E=D.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_normal.x=-L;this.m_normal.y=-B;for(O=0;O<I.m_pointCount;O++){N=H.R;M=I.m_points[O].m_localPoint;F=H.position.x+N.col1.x*M.x+N.col2.x*M.y;M=H.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_points[O].x=F+0.5*(A-(F-K)*L-(M-E)*B-G)*L;this.m_points[O].y=M+0.5*(A-(F-K)*L-(M-E)*B-G)*B}}}};Aa.ClipVertex=function(){this.v=new AQ;this.id=new AA};Aa.prototype.Set=function(A){this.v.SetV(A.v);this.id.Set(A.id)};AZ.Features=function(){};Object.defineProperty(AZ.prototype,"referenceEdge",{enumerable:false,configurable:true,get:function(){return this._referenceEdge}});Object.defineProperty(AZ.prototype,"referenceEdge",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._referenceEdge=A;this._m_id._key=this._m_id._key&4294967040|this._referenceEdge&255}});Object.defineProperty(AZ.prototype,"incidentEdge",{enumerable:false,configurable:true,get:function(){return this._incidentEdge}});Object.defineProperty(AZ.prototype,"incidentEdge",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._incidentEdge=A;this._m_id._key=this._m_id._key&4294902015|this._incidentEdge<<8&65280}});Object.defineProperty(AZ.prototype,"incidentVertex",{enumerable:false,configurable:true,get:function(){return this._incidentVertex}});Object.defineProperty(AZ.prototype,"incidentVertex",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._incidentVertex=A;this._m_id._key=this._m_id._key&4278255615|this._incidentVertex<<16&16711680}});Object.defineProperty(AZ.prototype,"flip",{enumerable:false,configurable:true,get:function(){return this._flip}});Object.defineProperty(AZ.prototype,"flip",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._flip=A;this._m_id._key=this._m_id._key&16777215|this._flip<<24&4278190080}})})();(function(){var f=Box2D.Common.b2Settings,e=Box2D.Collision.Shapes.b2CircleShape,X=Box2D.Collision.Shapes.b2EdgeChainDef,T=Box2D.Collision.Shapes.b2EdgeShape,b=Box2D.Collision.Shapes.b2MassData,H=Box2D.Collision.Shapes.b2PolygonShape,O=Box2D.Collision.Shapes.b2Shape,E=Box2D.Common.Math.b2Mat22,D=Box2D.Common.Math.b2Math,P=Box2D.Common.Math.b2Transform,N=Box2D.Common.Math.b2Vec2,R=Box2D.Collision.b2Distance,S=Box2D.Collision.b2DistanceInput,Z=Box2D.Collision.b2DistanceOutput,J=Box2D.Collision.b2DistanceProxy,C=Box2D.Collision.b2SimplexCache;Box2D.inherit(e,Box2D.Collision.Shapes.b2Shape);e.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;e.b2CircleShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.m_p=new N};e.prototype.Copy=function(){var A=new e;A.Set(this);return A};e.prototype.Set=function(A){this.__super.Set.call(this,A);if(Box2D.is(A,e)){this.m_p.SetV((A instanceof e?A:null).m_p)}};e.prototype.TestPoint=function(A,G){var B=A.R,F=A.position.x+(B.col1.x*this.m_p.x+B.col2.x*this.m_p.y);B=A.position.y+(B.col1.y*this.m_p.x+B.col2.y*this.m_p.y);F=G.x-F;B=G.y-B;return F*F+B*B<=this.m_radius*this.m_radius};e.prototype.RayCast=function(B,K,M){var A=M.R,L=K.p1.x-(M.position.x+(A.col1.x*this.m_p.x+A.col2.x*this.m_p.y));M=K.p1.y-(M.position.y+(A.col1.y*this.m_p.x+A.col2.y*this.m_p.y));A=K.p2.x-K.p1.x;var G=K.p2.y-K.p1.y,Q=L*A+M*G,F=A*A+G*G,I=Q*Q-F*(L*L+M*M-this.m_radius*this.m_radius);if(I<0||F<Number.MIN_VALUE){return false}Q=-(Q+Math.sqrt(I));if(0<=Q&&Q<=K.maxFraction*F){Q/=F;B.fraction=Q;B.normal.x=L+Q*A;B.normal.y=M+Q*G;B.normal.Normalize();return true}return false};e.prototype.ComputeAABB=function(A,G){var B=G.R,F=G.position.x+(B.col1.x*this.m_p.x+B.col2.x*this.m_p.y);B=G.position.y+(B.col1.y*this.m_p.x+B.col2.y*this.m_p.y);A.lowerBound.Set(F-this.m_radius,B-this.m_radius);A.upperBound.Set(F+this.m_radius,B+this.m_radius)};e.prototype.ComputeMass=function(A,B){if(B===undefined){B=0}A.mass=B*f.b2_pi*this.m_radius*this.m_radius;A.center.SetV(this.m_p);A.I=A.mass*(0.5*this.m_radius*this.m_radius+(this.m_p.x*this.m_p.x+this.m_p.y*this.m_p.y))};e.prototype.ComputeSubmergedArea=function(A,K,B,I){if(K===undefined){K=0}B=D.MulX(B,this.m_p);var F=-(D.Dot(A,B)-K);if(F<-this.m_radius+Number.MIN_VALUE){return 0}if(F>this.m_radius){I.SetV(B);return Math.PI*this.m_radius*this.m_radius}K=this.m_radius*this.m_radius;var G=F*F;F=K*(Math.asin(F/this.m_radius)+Math.PI/2)+F*Math.sqrt(K-G);K=-2/3*Math.pow(K-G,1.5)/F;I.x=B.x+A.x*K;I.y=B.y+A.y*K;return F};e.prototype.GetLocalPosition=function(){return this.m_p};e.prototype.SetLocalPosition=function(A){this.m_p.SetV(A)};e.prototype.GetRadius=function(){return this.m_radius};e.prototype.SetRadius=function(A){if(A===undefined){A=0}this.m_radius=A};e.prototype.b2CircleShape=function(A){if(A===undefined){A=0}this.__super.b2Shape.call(this);this.m_type=O.e_circleShape;this.m_radius=A};X.b2EdgeChainDef=function(){};X.prototype.b2EdgeChainDef=function(){this.vertexCount=0;this.isALoop=true;this.vertices=[]};Box2D.inherit(T,Box2D.Collision.Shapes.b2Shape);T.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;T.b2EdgeShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.s_supportVec=new N;this.m_v1=new N;this.m_v2=new N;this.m_coreV1=new N;this.m_coreV2=new N;this.m_normal=new N;this.m_direction=new N;this.m_cornerDir1=new N;this.m_cornerDir2=new N};T.prototype.TestPoint=function(){return false};T.prototype.RayCast=function(F,M,U){var B,Q=M.p2.x-M.p1.x,K=M.p2.y-M.p1.y;B=U.R;var V=U.position.x+(B.col1.x*this.m_v1.x+B.col2.x*this.m_v1.y),I=U.position.y+(B.col1.y*this.m_v1.x+B.col2.y*this.m_v1.y),L=U.position.y+(B.col1.y*this.m_v2.x+B.col2.y*this.m_v2.y)-I;U=-(U.position.x+(B.col1.x*this.m_v2.x+B.col2.x*this.m_v2.y)-V);B=100*Number.MIN_VALUE;var G=-(Q*L+K*U);if(G>B){V=M.p1.x-V;var A=M.p1.y-I;I=V*L+A*U;if(0<=I&&I<=M.maxFraction*G){M=-Q*A+K*V;if(-B*G<=M&&M<=G*(1+B)){I/=G;F.fraction=I;M=Math.sqrt(L*L+U*U);F.normal.x=L/M;F.normal.y=U/M;return true}}}return false};T.prototype.ComputeAABB=function(A,K){var B=K.R,I=K.position.x+(B.col1.x*this.m_v1.x+B.col2.x*this.m_v1.y),F=K.position.y+(B.col1.y*this.m_v1.x+B.col2.y*this.m_v1.y),G=K.position.x+(B.col1.x*this.m_v2.x+B.col2.x*this.m_v2.y);B=K.position.y+(B.col1.y*this.m_v2.x+B.col2.y*this.m_v2.y);if(I<G){A.lowerBound.x=I;A.upperBound.x=G}else{A.lowerBound.x=G;A.upperBound.x=I}if(F<B){A.lowerBound.y=F;A.upperBound.y=B}else{A.lowerBound.y=B;A.upperBound.y=F}};T.prototype.ComputeMass=function(A){A.mass=0;A.center.SetV(this.m_v1);A.I=0};T.prototype.ComputeSubmergedArea=function(A,L,B,K){if(L===undefined){L=0}var F=new N(A.x*L,A.y*L),I=D.MulX(B,this.m_v1);B=D.MulX(B,this.m_v2);var G=D.Dot(A,I)-L;A=D.Dot(A,B)-L;if(G>0){if(A>0){return 0}else{I.x=-A/(G-A)*I.x+G/(G-A)*B.x;I.y=-A/(G-A)*I.y+G/(G-A)*B.y}}else{if(A>0){B.x=-A/(G-A)*I.x+G/(G-A)*B.x;B.y=-A/(G-A)*I.y+G/(G-A)*B.y}}K.x=(F.x+I.x+B.x)/3;K.y=(F.y+I.y+B.y)/3;return 0.5*((I.x-F.x)*(B.y-F.y)-(I.y-F.y)*(B.x-F.x))};T.prototype.GetLength=function(){return this.m_length};T.prototype.GetVertex1=function(){return this.m_v1};T.prototype.GetVertex2=function(){return this.m_v2};T.prototype.GetCoreVertex1=function(){return this.m_coreV1};T.prototype.GetCoreVertex2=function(){return this.m_coreV2};T.prototype.GetNormalVector=function(){return this.m_normal};T.prototype.GetDirectionVector=function(){return this.m_direction};T.prototype.GetCorner1Vector=function(){return this.m_cornerDir1};T.prototype.GetCorner2Vector=function(){return this.m_cornerDir2};T.prototype.Corner1IsConvex=function(){return this.m_cornerConvex1};T.prototype.Corner2IsConvex=function(){return this.m_cornerConvex2};T.prototype.GetFirstVertex=function(A){var B=A.R;return new N(A.position.x+(B.col1.x*this.m_coreV1.x+B.col2.x*this.m_coreV1.y),A.position.y+(B.col1.y*this.m_coreV1.x+B.col2.y*this.m_coreV1.y))};T.prototype.GetNextEdge=function(){return this.m_nextEdge};T.prototype.GetPrevEdge=function(){return this.m_prevEdge};T.prototype.Support=function(A,L,B){if(L===undefined){L=0}if(B===undefined){B=0}var K=A.R,F=A.position.x+(K.col1.x*this.m_coreV1.x+K.col2.x*this.m_coreV1.y),I=A.position.y+(K.col1.y*this.m_coreV1.x+K.col2.y*this.m_coreV1.y),G=A.position.x+(K.col1.x*this.m_coreV2.x+K.col2.x*this.m_coreV2.y);A=A.position.y+(K.col1.y*this.m_coreV2.x+K.col2.y*this.m_coreV2.y);if(F*L+I*B>G*L+A*B){this.s_supportVec.x=F;this.s_supportVec.y=I}else{this.s_supportVec.x=G;this.s_supportVec.y=A}return this.s_supportVec};T.prototype.b2EdgeShape=function(A,B){this.__super.b2Shape.call(this);this.m_type=O.e_edgeShape;this.m_nextEdge=this.m_prevEdge=null;this.m_v1=A;this.m_v2=B;this.m_direction.Set(this.m_v2.x-this.m_v1.x,this.m_v2.y-this.m_v1.y);this.m_length=this.m_direction.Normalize();this.m_normal.Set(this.m_direction.y,-this.m_direction.x);this.m_coreV1.Set(-f.b2_toiSlop*(this.m_normal.x-this.m_direction.x)+this.m_v1.x,-f.b2_toiSlop*(this.m_normal.y-this.m_direction.y)+this.m_v1.y);this.m_coreV2.Set(-f.b2_toiSlop*(this.m_normal.x+this.m_direction.x)+this.m_v2.x,-f.b2_toiSlop*(this.m_normal.y+this.m_direction.y)+this.m_v2.y);this.m_cornerDir1=this.m_normal;this.m_cornerDir2.Set(-this.m_normal.x,-this.m_normal.y)};T.prototype.SetPrevEdge=function(A,G,B,F){this.m_prevEdge=A;this.m_coreV1=G;this.m_cornerDir1=B;this.m_cornerConvex1=F};T.prototype.SetNextEdge=function(A,G,B,F){this.m_nextEdge=A;this.m_coreV2=G;this.m_cornerDir2=B;this.m_cornerConvex2=F};b.b2MassData=function(){this.mass=0;this.center=new N(0,0);this.I=0};Box2D.inherit(H,Box2D.Collision.Shapes.b2Shape);H.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;H.b2PolygonShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments)};H.prototype.Copy=function(){var A=new H;A.Set(this);return A};H.prototype.Set=function(A){this.__super.Set.call(this,A);if(Box2D.is(A,H)){A=A instanceof H?A:null;this.m_centroid.SetV(A.m_centroid);this.m_vertexCount=A.m_vertexCount;this.Reserve(this.m_vertexCount);for(var B=0;B<this.m_vertexCount;B++){this.m_vertices[B].SetV(A.m_vertices[B]);this.m_normals[B].SetV(A.m_normals[B])}}};H.prototype.SetAsArray=function(A,I){if(I===undefined){I=0}var B=new Vector,G=0,F;for(G=0;G<A.length;++G){F=A[G];B.push(F)}this.SetAsVector(B,I)};H.AsArray=function(A,F){if(F===undefined){F=0}var B=new H;B.SetAsArray(A,F);return B};H.prototype.SetAsVector=function(A,I){if(I===undefined){I=0}if(I==0){I=A.length}f.b2Assert(2<=I);this.m_vertexCount=I;this.Reserve(I);var B=0;for(B=0;B<this.m_vertexCount;B++){this.m_vertices[B].SetV(A[B])}for(B=0;B<this.m_vertexCount;++B){var G=parseInt(B),F=parseInt(B+1<this.m_vertexCount?B+1:0);G=D.SubtractVV(this.m_vertices[F],this.m_vertices[G]);f.b2Assert(G.LengthSquared()>Number.MIN_VALUE);this.m_normals[B].SetV(D.CrossVF(G,1));this.m_normals[B].Normalize()}this.m_centroid=H.ComputeCentroid(this.m_vertices,this.m_vertexCount)};H.AsVector=function(A,F){if(F===undefined){F=0}var B=new H;B.SetAsVector(A,F);return B};H.prototype.SetAsBox=function(A,B){if(A===undefined){A=0}if(B===undefined){B=0}this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-A,-B);this.m_vertices[1].Set(A,-B);this.m_vertices[2].Set(A,B);this.m_vertices[3].Set(-A,B);this.m_normals[0].Set(0,-1);this.m_normals[1].Set(1,0);this.m_normals[2].Set(0,1);this.m_normals[3].Set(-1,0);this.m_centroid.SetZero()};H.AsBox=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}var B=new H;B.SetAsBox(A,F);return B};H.prototype.SetAsOrientedBox=function(A,G,B,F){if(A===undefined){A=0}if(G===undefined){G=0}if(B===undefined){B=null}if(F===undefined){F=0}this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-A,-G);this.m_vertices[1].Set(A,-G);this.m_vertices[2].Set(A,G);this.m_vertices[3].Set(-A,G);this.m_normals[0].Set(0,-1);this.m_normals[1].Set(1,0);this.m_normals[2].Set(0,1);this.m_normals[3].Set(-1,0);this.m_centroid=B;A=new P;A.position=B;A.R.Set(F);for(B=0;B<this.m_vertexCount;++B){this.m_vertices[B]=D.MulX(A,this.m_vertices[B]);this.m_normals[B]=D.MulMV(A.R,this.m_normals[B])}};H.AsOrientedBox=function(A,I,B,G){if(A===undefined){A=0}if(I===undefined){I=0}if(B===undefined){B=null}if(G===undefined){G=0}var F=new H;F.SetAsOrientedBox(A,I,B,G);return F};H.prototype.SetAsEdge=function(A,B){this.m_vertexCount=2;this.Reserve(2);this.m_vertices[0].SetV(A);this.m_vertices[1].SetV(B);this.m_centroid.x=0.5*(A.x+B.x);this.m_centroid.y=0.5*(A.y+B.y);this.m_normals[0]=D.CrossVF(D.SubtractVV(B,A),1);this.m_normals[0].Normalize();this.m_normals[1].x=-this.m_normals[0].x;this.m_normals[1].y=-this.m_normals[0].y};H.AsEdge=function(A,F){var B=new H;B.SetAsEdge(A,F);return B};H.prototype.TestPoint=function(A,M){var B;B=A.R;for(var L=M.x-A.position.x,F=M.y-A.position.y,K=L*B.col1.x+F*B.col1.y,I=L*B.col2.x+F*B.col2.y,G=0;G<this.m_vertexCount;++G){B=this.m_vertices[G];L=K-B.x;F=I-B.y;B=this.m_normals[G];if(B.x*L+B.y*F>0){return false}}return true};H.prototype.RayCast=function(G,U,W){var B=0,V=U.maxFraction,L=0,Y=0,K,M;L=U.p1.x-W.position.x;Y=U.p1.y-W.position.y;K=W.R;var I=L*K.col1.x+Y*K.col1.y,A=L*K.col2.x+Y*K.col2.y;L=U.p2.x-W.position.x;Y=U.p2.y-W.position.y;K=W.R;U=L*K.col1.x+Y*K.col1.y-I;K=L*K.col2.x+Y*K.col2.y-A;for(var F=parseInt(-1),Q=0;Q<this.m_vertexCount;++Q){M=this.m_vertices[Q];L=M.x-I;Y=M.y-A;M=this.m_normals[Q];L=M.x*L+M.y*Y;Y=M.x*U+M.y*K;if(Y==0){if(L<0){return false}}else{if(Y<0&&L<B*Y){B=L/Y;F=Q}else{if(Y>0&&L<V*Y){V=L/Y}}}if(V<B-Number.MIN_VALUE){return false}}if(F>=0){G.fraction=B;K=W.R;M=this.m_normals[F];G.normal.x=K.col1.x*M.x+K.col2.x*M.y;G.normal.y=K.col1.y*M.x+K.col2.y*M.y;return true}return false};H.prototype.ComputeAABB=function(B,L){for(var Q=L.R,A=this.m_vertices[0],M=L.position.x+(Q.col1.x*A.x+Q.col2.x*A.y),I=L.position.y+(Q.col1.y*A.x+Q.col2.y*A.y),U=M,G=I,K=1;K<this.m_vertexCount;++K){A=this.m_vertices[K];var F=L.position.x+(Q.col1.x*A.x+Q.col2.x*A.y);A=L.position.y+(Q.col1.y*A.x+Q.col2.y*A.y);M=M<F?M:F;I=I<A?I:A;U=U>F?U:F;G=G>A?G:A}B.lowerBound.x=M-this.m_radius;B.lowerBound.y=I-this.m_radius;B.upperBound.x=U+this.m_radius;B.upperBound.y=G+this.m_radius};H.prototype.ComputeMass=function(I,Y){if(Y===undefined){Y=0}if(this.m_vertexCount==2){I.center.x=0.5*(this.m_vertices[0].x+this.m_vertices[1].x);I.center.y=0.5*(this.m_vertices[0].y+this.m_vertices[1].y);I.mass=0;I.I=0}else{for(var m=0,B=0,g=0,U=0,n=1/3,M=0;M<this.m_vertexCount;++M){var V=this.m_vertices[M],L=M+1<this.m_vertexCount?this.m_vertices[parseInt(M+1)]:this.m_vertices[0],A=V.x-0,F=V.y-0,W=L.x-0,Q=L.y-0,G=A*Q-F*W,K=0.5*G;g+=K;m+=K*n*(0+V.x+L.x);B+=K*n*(0+V.y+L.y);V=A;F=F;W=W;Q=Q;U+=G*(n*(0.25*(V*V+W*V+W*W)+(0*V+0*W))+0+(n*(0.25*(F*F+Q*F+Q*Q)+(0*F+0*Q))+0))}I.mass=Y*g;m*=1/g;B*=1/g;I.center.Set(m,B);I.I=Y*U}};H.prototype.ComputeSubmergedArea=function(F,M,U,B){if(M===undefined){M=0}var Q=D.MulTMV(U.R,F),K=M-D.Dot(F,U.position),V=new Vector_a2j_Number,I=0,L=parseInt(-1);M=parseInt(-1);var G=false;for(F=F=0;F<this.m_vertexCount;++F){V[F]=D.Dot(Q,this.m_vertices[F])-K;var A=V[F]<-Number.MIN_VALUE;if(F>0){if(A){if(!G){L=F-1;I++}}else{if(G){M=F-1;I++}}}G=A}switch(I){case 0:if(G){F=new b;this.ComputeMass(F,1);B.SetV(D.MulX(U,F.center));return F.mass}else{return 0}case 1:if(L==-1){L=this.m_vertexCount-1}else{M=this.m_vertexCount-1}}F=parseInt((L+1)%this.m_vertexCount);Q=parseInt((M+1)%this.m_vertexCount);K=(0-V[L])/(V[F]-V[L]);V=(0-V[M])/(V[Q]-V[M]);L=new N(this.m_vertices[L].x*(1-K)+this.m_vertices[F].x*K,this.m_vertices[L].y*(1-K)+this.m_vertices[F].y*K);M=new N(this.m_vertices[M].x*(1-V)+this.m_vertices[Q].x*V,this.m_vertices[M].y*(1-V)+this.m_vertices[Q].y*V);V=0;K=new N;I=this.m_vertices[F];for(F=F;F!=Q;){F=(F+1)%this.m_vertexCount;G=F==Q?M:this.m_vertices[F];A=0.5*((I.x-L.x)*(G.y-L.y)-(I.y-L.y)*(G.x-L.x));V+=A;K.x+=A*(L.x+I.x+G.x)/3;K.y+=A*(L.y+I.y+G.y)/3;I=G}K.Multiply(1/V);B.SetV(D.MulX(U,K));return V};H.prototype.GetVertexCount=function(){return this.m_vertexCount};H.prototype.GetVertices=function(){return this.m_vertices};H.prototype.GetNormals=function(){return this.m_normals};H.prototype.GetSupport=function(A){for(var I=0,B=this.m_vertices[0].x*A.x+this.m_vertices[0].y*A.y,G=1;G<this.m_vertexCount;++G){var F=this.m_vertices[G].x*A.x+this.m_vertices[G].y*A.y;if(F>B){I=G;B=F}}return I};H.prototype.GetSupportVertex=function(A){for(var I=0,B=this.m_vertices[0].x*A.x+this.m_vertices[0].y*A.y,G=1;G<this.m_vertexCount;++G){var F=this.m_vertices[G].x*A.x+this.m_vertices[G].y*A.y;if(F>B){I=G;B=F}}return this.m_vertices[I]};H.prototype.Validate=function(){return false};H.prototype.b2PolygonShape=function(){this.__super.b2Shape.call(this);this.m_type=O.e_polygonShape;this.m_centroid=new N;this.m_vertices=new Vector;this.m_normals=new Vector};H.prototype.Reserve=function(A){if(A===undefined){A=0}for(var B=parseInt(this.m_vertices.length);B<A;B++){this.m_vertices[B]=new N;this.m_normals[B]=new N}};H.ComputeCentroid=function(B,K){if(K===undefined){K=0}for(var M=new N,A=0,L=1/3,G=0;G<K;++G){var Q=B[G],F=G+1<K?B[parseInt(G+1)]:B[0],I=0.5*((Q.x-0)*(F.y-0)-(Q.y-0)*(F.x-0));A+=I;M.x+=I*L*(0+Q.x+F.x);M.y+=I*L*(0+Q.y+F.y)}M.x*=1/A;M.y*=1/A;return M};H.ComputeOBB=function(g,K,M){if(M===undefined){M=0}var U=0,L=new Vector(M+1);for(U=0;U<M;++U){L[U]=K[U]}L[M]=L[0];K=Number.MAX_VALUE;for(U=1;U<=M;++U){var G=L[parseInt(U-1)],Q=L[U].x-G.x,F=L[U].y-G.y,I=Math.sqrt(Q*Q+F*F);Q/=I;F/=I;for(var B=-F,t=Q,A=I=Number.MAX_VALUE,p=-Number.MAX_VALUE,n=-Number.MAX_VALUE,Y=0;Y<M;++Y){var m=L[Y].x-G.x,W=L[Y].y-G.y,V=Q*m+F*W;m=B*m+t*W;if(V<I){I=V}if(m<A){A=m}if(V>p){p=V}if(m>n){n=m}}Y=(p-I)*(n-A);if(Y<0.95*K){K=Y;g.R.col1.x=Q;g.R.col1.y=F;g.R.col2.x=B;g.R.col2.y=t;Q=0.5*(I+p);F=0.5*(A+n);B=g.R;g.center.x=G.x+(B.col1.x*Q+B.col2.x*F);g.center.y=G.y+(B.col1.y*Q+B.col2.y*F);g.extents.x=0.5*(p-I);g.extents.y=0.5*(n-A)}}};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2PolygonShape.s_mat=new E});O.b2Shape=function(){};O.prototype.Copy=function(){return null};O.prototype.Set=function(A){this.m_radius=A.m_radius};O.prototype.GetType=function(){return this.m_type};O.prototype.TestPoint=function(){return false};O.prototype.RayCast=function(){return false};O.prototype.ComputeAABB=function(){};O.prototype.ComputeMass=function(){};O.prototype.ComputeSubmergedArea=function(){return 0};O.TestOverlap=function(A,I,B,G){var F=new S;F.proxyA=new J;F.proxyA.Set(A);F.proxyB=new J;F.proxyB.Set(B);F.transformA=I;F.transformB=G;F.useRadii=true;A=new C;A.count=0;I=new Z;R.Distance(I,A,F);return I.distance<10*Number.MIN_VALUE};O.prototype.b2Shape=function(){this.m_type=O.e_unknownShape;this.m_radius=f.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2Shape.e_unknownShape=parseInt(-1);Box2D.Collision.Shapes.b2Shape.e_circleShape=0;Box2D.Collision.Shapes.b2Shape.e_polygonShape=1;Box2D.Collision.Shapes.b2Shape.e_edgeShape=2;Box2D.Collision.Shapes.b2Shape.e_shapeTypeCount=3;Box2D.Collision.Shapes.b2Shape.e_hitCollide=1;Box2D.Collision.Shapes.b2Shape.e_missCollide=0;Box2D.Collision.Shapes.b2Shape.e_startsInsideCollide=parseInt(-1)})})();(function(){var C=Box2D.Common.b2Color,B=Box2D.Common.b2Settings,A=Box2D.Common.Math.b2Math;C.b2Color=function(){this._b=this._g=this._r=0};C.prototype.b2Color=function(F,E,D){if(F===undefined){F=0}if(E===undefined){E=0}if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(F,0,1));this._g=Box2D.parseUInt(255*A.Clamp(E,0,1));this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))};C.prototype.Set=function(F,E,D){if(F===undefined){F=0}if(E===undefined){E=0}if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(F,0,1));this._g=Box2D.parseUInt(255*A.Clamp(E,0,1));this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))};Object.defineProperty(C.prototype,"r",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"g",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._g=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"b",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"color",{enumerable:false,configurable:true,get:function(){return this._r<<16|this._g<<8|this._b}});B.b2Settings=function(){};B.b2MixFriction=function(E,D){if(E===undefined){E=0}if(D===undefined){D=0}return Math.sqrt(E*D)};B.b2MixRestitution=function(E,D){if(E===undefined){E=0}if(D===undefined){D=0}return E>D?E:D};B.b2Assert=function(D){if(!D){throw"Assertion Failed"}};Box2D.postDefs.push(function(){Box2D.Common.b2Settings.VERSION="2.1alpha";Box2D.Common.b2Settings.USHRT_MAX=65535;Box2D.Common.b2Settings.b2_pi=Math.PI;Box2D.Common.b2Settings.b2_maxManifoldPoints=2;Box2D.Common.b2Settings.b2_aabbExtension=0.1;Box2D.Common.b2Settings.b2_aabbMultiplier=2;Box2D.Common.b2Settings.b2_polygonRadius=2*B.b2_linearSlop;Box2D.Common.b2Settings.b2_linearSlop=0.005;Box2D.Common.b2Settings.b2_angularSlop=2/180*B.b2_pi;Box2D.Common.b2Settings.b2_toiSlop=8*B.b2_linearSlop;Box2D.Common.b2Settings.b2_maxTOIContactsPerIsland=32;Box2D.Common.b2Settings.b2_maxTOIJointsPerIsland=32;Box2D.Common.b2Settings.b2_velocityThreshold=1;Box2D.Common.b2Settings.b2_maxLinearCorrection=0.2;Box2D.Common.b2Settings.b2_maxAngularCorrection=8/180*B.b2_pi;Box2D.Common.b2Settings.b2_maxTranslation=2;Box2D.Common.b2Settings.b2_maxTranslationSquared=B.b2_maxTranslation*B.b2_maxTranslation;Box2D.Common.b2Settings.b2_maxRotation=0.5*B.b2_pi;Box2D.Common.b2Settings.b2_maxRotationSquared=B.b2_maxRotation*B.b2_maxRotation;Box2D.Common.b2Settings.b2_contactBaumgarte=0.2;Box2D.Common.b2Settings.b2_timeToSleep=0.5;Box2D.Common.b2Settings.b2_linearSleepTolerance=0.01;Box2D.Common.b2Settings.b2_angularSleepTolerance=2/180*B.b2_pi})})();(function(){var I=Box2D.Common.Math.b2Mat22,H=Box2D.Common.Math.b2Mat33,D=Box2D.Common.Math.b2Math,J=Box2D.Common.Math.b2Sweep,C=Box2D.Common.Math.b2Transform,B=Box2D.Common.Math.b2Vec2,E=Box2D.Common.Math.b2Vec3;I.b2Mat22=function(){this.col1=new B;this.col2=new B};I.prototype.b2Mat22=function(){this.SetIdentity()};I.FromAngle=function(A){if(A===undefined){A=0}var F=new I;F.Set(A);return F};I.FromVV=function(F,G){var A=new I;A.SetVV(F,G);return A};I.prototype.Set=function(A){if(A===undefined){A=0}var F=Math.cos(A);A=Math.sin(A);this.col1.x=F;this.col2.x=-A;this.col1.y=A;this.col2.y=F};I.prototype.SetVV=function(A,F){this.col1.SetV(A);this.col2.SetV(F)};I.prototype.Copy=function(){var A=new I;A.SetM(this);return A};I.prototype.SetM=function(A){this.col1.SetV(A.col1);this.col2.SetV(A.col2)};I.prototype.AddM=function(A){this.col1.x+=A.col1.x;this.col1.y+=A.col1.y;this.col2.x+=A.col2.x;this.col2.y+=A.col2.y};I.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col1.y=0;this.col2.y=1};I.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col1.y=0;this.col2.y=0};I.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)};I.prototype.GetInverse=function(K){var O=this.col1.x,G=this.col2.x,F=this.col1.y,N=this.col2.y,A=O*N-G*F;if(A!=0){A=1/A}K.col1.x=A*N;K.col2.x=-A*G;K.col1.y=-A*F;K.col2.y=A*O;return K};I.prototype.Solve=function(O,R,N){if(R===undefined){R=0}if(N===undefined){N=0}var G=this.col1.x,P=this.col2.x,F=this.col1.y,K=this.col2.y,A=G*K-P*F;if(A!=0){A=1/A}O.x=A*(K*R-P*N);O.y=A*(G*N-F*R);return O};I.prototype.Abs=function(){this.col1.Abs();this.col2.Abs()};H.b2Mat33=function(){this.col1=new E;this.col2=new E;this.col3=new E};H.prototype.b2Mat33=function(F,G,A){if(F===undefined){F=null}if(G===undefined){G=null}if(A===undefined){A=null}if(!F&&!G&&!A){this.col1.SetZero();this.col2.SetZero();this.col3.SetZero()}else{this.col1.SetV(F);this.col2.SetV(G);this.col3.SetV(A)}};H.prototype.SetVVV=function(F,G,A){this.col1.SetV(F);this.col2.SetV(G);this.col3.SetV(A)};H.prototype.Copy=function(){return new H(this.col1,this.col2,this.col3)};H.prototype.SetM=function(A){this.col1.SetV(A.col1);this.col2.SetV(A.col2);this.col3.SetV(A.col3)};H.prototype.AddM=function(A){this.col1.x+=A.col1.x;this.col1.y+=A.col1.y;this.col1.z+=A.col1.z;this.col2.x+=A.col2.x;this.col2.y+=A.col2.y;this.col2.z+=A.col2.z;this.col3.x+=A.col3.x;this.col3.y+=A.col3.y;this.col3.z+=A.col3.z};H.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col3.x=0;this.col1.y=0;this.col2.y=1;this.col3.y=0;this.col1.z=0;this.col2.z=0;this.col3.z=1};H.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col3.x=0;this.col1.y=0;this.col2.y=0;this.col3.y=0;this.col1.z=0;this.col2.z=0;this.col3.z=0};H.prototype.Solve22=function(O,R,N){if(R===undefined){R=0}if(N===undefined){N=0}var G=this.col1.x,P=this.col2.x,F=this.col1.y,K=this.col2.y,A=G*K-P*F;if(A!=0){A=1/A}O.x=A*(K*R-P*N);O.y=A*(G*N-F*R);return O};H.prototype.Solve33=function(K,G,R,O){if(G===undefined){G=0}if(R===undefined){R=0}if(O===undefined){O=0}var S=this.col1.x,U=this.col1.y,X=this.col1.z,N=this.col2.x,F=this.col2.y,P=this.col2.z,T=this.col3.x,b=this.col3.y,A=this.col3.z,Z=S*(F*A-P*b)+U*(P*T-N*A)+X*(N*b-F*T);if(Z!=0){Z=1/Z}K.x=Z*(G*(F*A-P*b)+R*(P*T-N*A)+O*(N*b-F*T));K.y=Z*(S*(R*A-O*b)+U*(O*T-G*A)+X*(G*b-R*T));K.z=Z*(S*(F*O-P*R)+U*(P*G-N*O)+X*(N*R-F*G));return K};D.b2Math=function(){};D.IsValid=function(A){if(A===undefined){A=0}return isFinite(A)};D.Dot=function(A,F){return A.x*F.x+A.y*F.y};D.CrossVV=function(A,F){return A.x*F.y-A.y*F.x};D.CrossVF=function(A,F){if(F===undefined){F=0}return new B(F*A.y,-F*A.x)};D.CrossFV=function(A,F){if(A===undefined){A=0}return new B(-A*F.y,A*F.x)};D.MulMV=function(A,F){return new B(A.col1.x*F.x+A.col2.x*F.y,A.col1.y*F.x+A.col2.y*F.y)};D.MulTMV=function(A,F){return new B(D.Dot(F,A.col1),D.Dot(F,A.col2))};D.MulX=function(F,G){var A=D.MulMV(F.R,G);A.x+=F.position.x;A.y+=F.position.y;return A};D.MulXT=function(G,K){var F=D.SubtractVV(K,G.position),A=F.x*G.R.col1.x+F.y*G.R.col1.y;F.y=F.x*G.R.col2.x+F.y*G.R.col2.y;F.x=A;return F};D.AddVV=function(A,F){return new B(A.x+F.x,A.y+F.y)};D.SubtractVV=function(A,F){return new B(A.x-F.x,A.y-F.y)};D.Distance=function(G,K){var F=G.x-K.x,A=G.y-K.y;return Math.sqrt(F*F+A*A)};D.DistanceSquared=function(G,K){var F=G.x-K.x,A=G.y-K.y;return F*F+A*A};D.MulFV=function(A,F){if(A===undefined){A=0}return new B(A*F.x,A*F.y)};D.AddMM=function(A,F){return I.FromVV(D.AddVV(A.col1,F.col1),D.AddVV(A.col2,F.col2))};D.MulMM=function(A,F){return I.FromVV(D.MulMV(A,F.col1),D.MulMV(A,F.col2))};D.MulTMM=function(G,K){var F=new B(D.Dot(G.col1,K.col1),D.Dot(G.col2,K.col1)),A=new B(D.Dot(G.col1,K.col2),D.Dot(G.col2,K.col2));return I.FromVV(F,A)};D.Abs=function(A){if(A===undefined){A=0}return A>0?A:-A};D.AbsV=function(A){return new B(D.Abs(A.x),D.Abs(A.y))};D.AbsM=function(A){return I.FromVV(D.AbsV(A.col1),D.AbsV(A.col2))};D.Min=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}return A<F?A:F};D.MinV=function(A,F){return new B(D.Min(A.x,F.x),D.Min(A.y,F.y))};D.Max=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}return A>F?A:F};D.MaxV=function(A,F){return new B(D.Max(A.x,F.x),D.Max(A.y,F.y))};D.Clamp=function(F,G,A){if(F===undefined){F=0}if(G===undefined){G=0}if(A===undefined){A=0}return F<G?G:F>A?A:F};D.ClampV=function(F,G,A){return D.MaxV(G,D.MinV(F,A))};D.Swap=function(F,G){var A=F[0];F[0]=G[0];G[0]=A};D.Random=function(){return Math.random()*2-1};D.RandomRange=function(F,G){if(F===undefined){F=0}if(G===undefined){G=0}var A=Math.random();return A=(G-F)*A+F};D.NextPowerOfTwo=function(A){if(A===undefined){A=0}A|=A>>1&2147483647;A|=A>>2&1073741823;A|=A>>4&268435455;A|=A>>8&16777215;A|=A>>16&65535;return A+1};D.IsPowerOfTwo=function(A){if(A===undefined){A=0}return A>0&&(A&A-1)==0};Box2D.postDefs.push(function(){Box2D.Common.Math.b2Math.b2Vec2_zero=new B(0,0);Box2D.Common.Math.b2Math.b2Mat22_identity=I.FromVV(new B(1,0),new B(0,1));Box2D.Common.Math.b2Math.b2Transform_identity=new C(D.b2Vec2_zero,D.b2Mat22_identity)});J.b2Sweep=function(){this.localCenter=new B;this.c0=new B;this.c=new B};J.prototype.Set=function(A){this.localCenter.SetV(A.localCenter);this.c0.SetV(A.c0);this.c.SetV(A.c);this.a0=A.a0;this.a=A.a;this.t0=A.t0};J.prototype.Copy=function(){var A=new J;A.localCenter.SetV(this.localCenter);A.c0.SetV(this.c0);A.c.SetV(this.c);A.a0=this.a0;A.a=this.a;A.t0=this.t0;return A};J.prototype.GetTransform=function(F,G){if(G===undefined){G=0}F.position.x=(1-G)*this.c0.x+G*this.c.x;F.position.y=(1-G)*this.c0.y+G*this.c.y;F.R.Set((1-G)*this.a0+G*this.a);var A=F.R;F.position.x-=A.col1.x*this.localCenter.x+A.col2.x*this.localCenter.y;F.position.y-=A.col1.y*this.localCenter.x+A.col2.y*this.localCenter.y};J.prototype.Advance=function(A){if(A===undefined){A=0}if(this.t0<A&&1-this.t0>Number.MIN_VALUE){var F=(A-this.t0)/(1-this.t0);this.c0.x=(1-F)*this.c0.x+F*this.c.x;this.c0.y=(1-F)*this.c0.y+F*this.c.y;this.a0=(1-F)*this.a0+F*this.a;this.t0=A}};C.b2Transform=function(){this.position=new B;this.R=new I};C.prototype.b2Transform=function(A,F){if(A===undefined){A=null}if(F===undefined){F=null}if(A){this.position.SetV(A);this.R.SetM(F)}};C.prototype.Initialize=function(A,F){this.position.SetV(A);this.R.SetM(F)};C.prototype.SetIdentity=function(){this.position.SetZero();this.R.SetIdentity()};C.prototype.Set=function(A){this.position.SetV(A.position);this.R.SetM(A.R)};C.prototype.GetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)};B.b2Vec2=function(){};B.prototype.b2Vec2=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}this.x=A;this.y=F};B.prototype.SetZero=function(){this.y=this.x=0};B.prototype.Set=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}this.x=A;this.y=F};B.prototype.SetV=function(A){this.x=A.x;this.y=A.y};B.prototype.GetNegative=function(){return new B(-this.x,-this.y)};B.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y};B.Make=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}return new B(A,F)};B.prototype.Copy=function(){return new B(this.x,this.y)};B.prototype.Add=function(A){this.x+=A.x;this.y+=A.y};B.prototype.Subtract=function(A){this.x-=A.x;this.y-=A.y};B.prototype.Multiply=function(A){if(A===undefined){A=0}this.x*=A;this.y*=A};B.prototype.MulM=function(A){var F=this.x;this.x=A.col1.x*F+A.col2.x*this.y;this.y=A.col1.y*F+A.col2.y*this.y};B.prototype.MulTM=function(A){var F=D.Dot(this,A.col1);this.y=D.Dot(this,A.col2);this.x=F};B.prototype.CrossVF=function(A){if(A===undefined){A=0}var F=this.x;this.x=A*this.y;this.y=-A*F};B.prototype.CrossFV=function(A){if(A===undefined){A=0}var F=this.x;this.x=-A*this.y;this.y=A*F};B.prototype.MinV=function(A){this.x=this.x<A.x?this.x:A.x;this.y=this.y<A.y?this.y:A.y};B.prototype.MaxV=function(A){this.x=this.x>A.x?this.x:A.x;this.y=this.y>A.y?this.y:A.y};B.prototype.Abs=function(){if(this.x<0){this.x=-this.x}if(this.y<0){this.y=-this.y}};B.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};B.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y};B.prototype.Normalize=function(){var A=Math.sqrt(this.x*this.x+this.y*this.y);if(A<Number.MIN_VALUE){return 0}var F=1/A;this.x*=F;this.y*=F;return A};B.prototype.IsValid=function(){return D.IsValid(this.x)&&D.IsValid(this.y)};E.b2Vec3=function(){};E.prototype.b2Vec3=function(F,G,A){if(F===undefined){F=0}if(G===undefined){G=0}if(A===undefined){A=0}this.x=F;this.y=G;this.z=A};E.prototype.SetZero=function(){this.x=this.y=this.z=0};E.prototype.Set=function(F,G,A){if(F===undefined){F=0}if(G===undefined){G=0}if(A===undefined){A=0}this.x=F;this.y=G;this.z=A};E.prototype.SetV=function(A){this.x=A.x;this.y=A.y;this.z=A.z};E.prototype.GetNegative=function(){return new E(-this.x,-this.y,-this.z)};E.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z};E.prototype.Copy=function(){return new E(this.x,this.y,this.z)};E.prototype.Add=function(A){this.x+=A.x;this.y+=A.y;this.z+=A.z};E.prototype.Subtract=function(A){this.x-=A.x;this.y-=A.y;this.z-=A.z};E.prototype.Multiply=function(A){if(A===undefined){A=0}this.x*=A;this.y*=A;this.z*=A}})();(function(){var AI=Box2D.Common.Math.b2Math,AG=Box2D.Common.Math.b2Sweep,AB=Box2D.Common.Math.b2Transform,AC=Box2D.Common.Math.b2Vec2,AF=Box2D.Common.b2Color,AN=Box2D.Common.b2Settings,X=Box2D.Collision.b2AABB,AO=Box2D.Collision.b2ContactPoint,AM=Box2D.Collision.b2DynamicTreeBroadPhase,f=Box2D.Collision.b2RayCastInput,T=Box2D.Collision.b2RayCastOutput,t=Box2D.Collision.Shapes.b2CircleShape,x=Box2D.Collision.Shapes.b2EdgeShape,AD=Box2D.Collision.Shapes.b2MassData,P=Box2D.Collision.Shapes.b2PolygonShape,J=Box2D.Collision.Shapes.b2Shape,AS=Box2D.Dynamics.b2Body,AA=Box2D.Dynamics.b2BodyDef,AH=Box2D.Dynamics.b2ContactFilter,AK=Box2D.Dynamics.b2ContactImpulse,AE=Box2D.Dynamics.b2ContactListener,g=Box2D.Dynamics.b2ContactManager,AJ=Box2D.Dynamics.b2DebugDraw,e=Box2D.Dynamics.b2DestructionListener,m=Box2D.Dynamics.b2FilterData,b=Box2D.Dynamics.b2Fixture,AW=Box2D.Dynamics.b2FixtureDef,C=Box2D.Dynamics.b2Island,AV=Box2D.Dynamics.b2TimeStep,AU=Box2D.Dynamics.b2World,AR=Box2D.Dynamics.Contacts.b2Contact,AT=Box2D.Dynamics.Contacts.b2ContactFactory,AP=Box2D.Dynamics.Contacts.b2ContactSolver,AL=Box2D.Dynamics.Joints.b2Joint,AQ=Box2D.Dynamics.Joints.b2PulleyJoint;AS.b2Body=function(){this.m_xf=new AB;this.m_sweep=new AG;this.m_linearVelocity=new AC;this.m_force=new AC};AS.prototype.connectEdges=function(B,G,D){if(D===undefined){D=0}var A=Math.atan2(G.GetDirectionVector().y,G.GetDirectionVector().x);D=AI.MulFV(Math.tan((A-D)*0.5),G.GetDirectionVector());D=AI.SubtractVV(D,G.GetNormalVector());D=AI.MulFV(AN.b2_toiSlop,D);D=AI.AddVV(D,G.GetVertex1());var F=AI.AddVV(B.GetDirectionVector(),G.GetDirectionVector());F.Normalize();var E=AI.Dot(B.GetDirectionVector(),G.GetNormalVector())>0;B.SetNextEdge(G,D,F,E);G.SetPrevEdge(B,D,F,E);return A};AS.prototype.CreateFixture=function(A){if(this.m_world.IsLocked()==true){return null}var B=new b;B.Create(this,this.m_xf,A);this.m_flags&AS.e_activeFlag&&B.CreateProxy(this.m_world.m_contactManager.m_broadPhase,this.m_xf);B.m_next=this.m_fixtureList;this.m_fixtureList=B;++this.m_fixtureCount;B.m_body=this;B.m_density>0&&this.ResetMassData();this.m_world.m_flags|=AU.e_newFixture;return B};AS.prototype.CreateFixture2=function(A,D){if(D===undefined){D=0}var B=new AW;B.shape=A;B.density=D;return this.CreateFixture(B)};AS.prototype.DestroyFixture=function(B){if(this.m_world.IsLocked()!=true){for(var F=this.m_fixtureList,D=null;F!=null;){if(F==B){if(D){D.m_next=B.m_next}else{this.m_fixtureList=B.m_next}break}D=F;F=F.m_next}for(F=this.m_contactList;F;){D=F.contact;F=F.next;var A=D.GetFixtureA(),E=D.GetFixtureB();if(B==A||B==E){this.m_world.m_contactManager.Destroy(D)}}this.m_flags&AS.e_activeFlag&&B.DestroyProxy(this.m_world.m_contactManager.m_broadPhase);B.Destroy();B.m_body=null;B.m_next=null;--this.m_fixtureCount;this.ResetMassData()}};AS.prototype.SetPositionAndAngle=function(B,E){if(E===undefined){E=0}var D;if(this.m_world.IsLocked()!=true){this.m_xf.R.Set(E);this.m_xf.position.SetV(B);D=this.m_xf.R;var A=this.m_sweep.localCenter;this.m_sweep.c.x=D.col1.x*A.x+D.col2.x*A.y;this.m_sweep.c.y=D.col1.y*A.x+D.col2.y*A.y;this.m_sweep.c.x+=this.m_xf.position.x;this.m_sweep.c.y+=this.m_xf.position.y;this.m_sweep.c0.SetV(this.m_sweep.c);this.m_sweep.a0=this.m_sweep.a=E;A=this.m_world.m_contactManager.m_broadPhase;for(D=this.m_fixtureList;D;D=D.m_next){D.Synchronize(A,this.m_xf,this.m_xf)}this.m_world.m_contactManager.FindNewContacts()}};AS.prototype.SetTransform=function(A){this.SetPositionAndAngle(A.position,A.GetAngle())};AS.prototype.GetTransform=function(){return this.m_xf};AS.prototype.GetPosition=function(){return this.m_xf.position};AS.prototype.SetPosition=function(A){this.SetPositionAndAngle(A,this.GetAngle())};AS.prototype.GetAngle=function(){return this.m_sweep.a};AS.prototype.SetAngle=function(A){if(A===undefined){A=0}this.SetPositionAndAngle(this.GetPosition(),A)};AS.prototype.GetWorldCenter=function(){return this.m_sweep.c};AS.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter};AS.prototype.SetLinearVelocity=function(A){this.m_type!=AS.b2_staticBody&&this.m_linearVelocity.SetV(A)};AS.prototype.GetLinearVelocity=function(){return this.m_linearVelocity};AS.prototype.SetAngularVelocity=function(A){if(A===undefined){A=0}if(this.m_type!=AS.b2_staticBody){this.m_angularVelocity=A}};AS.prototype.GetAngularVelocity=function(){return this.m_angularVelocity};AS.prototype.GetDefinition=function(){var A=new AA;A.type=this.GetType();A.allowSleep=(this.m_flags&AS.e_allowSleepFlag)==AS.e_allowSleepFlag;A.angle=this.GetAngle();A.angularDamping=this.m_angularDamping;A.angularVelocity=this.m_angularVelocity;A.fixedRotation=(this.m_flags&AS.e_fixedRotationFlag)==AS.e_fixedRotationFlag;A.bullet=(this.m_flags&AS.e_bulletFlag)==AS.e_bulletFlag;A.awake=(this.m_flags&AS.e_awakeFlag)==AS.e_awakeFlag;A.linearDamping=this.m_linearDamping;A.linearVelocity.SetV(this.GetLinearVelocity());A.position=this.GetPosition();A.userData=this.GetUserData();return A};AS.prototype.ApplyForce=function(A,B){if(this.m_type==AS.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_force.x+=A.x;this.m_force.y+=A.y;this.m_torque+=(B.x-this.m_sweep.c.x)*A.y-(B.y-this.m_sweep.c.y)*A.x}};AS.prototype.ApplyTorque=function(A){if(A===undefined){A=0}if(this.m_type==AS.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_torque+=A}};AS.prototype.ApplyImpulse=function(A,B){if(this.m_type==AS.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_linearVelocity.x+=this.m_invMass*A.x;this.m_linearVelocity.y+=this.m_invMass*A.y;this.m_angularVelocity+=this.m_invI*((B.x-this.m_sweep.c.x)*A.y-(B.y-this.m_sweep.c.y)*A.x)}};AS.prototype.Split=function(D){for(var I=this.GetLinearVelocity().Copy(),F=this.GetAngularVelocity(),B=this.GetWorldCenter(),H=this.m_world.CreateBody(this.GetDefinition()),G,A=this.m_fixtureList;A;){if(D(A)){var E=A.m_next;if(G){G.m_next=E}else{this.m_fixtureList=E}this.m_fixtureCount--;A.m_next=H.m_fixtureList;H.m_fixtureList=A;H.m_fixtureCount++;A.m_body=H;A=E}else{G=A;A=A.m_next}}this.ResetMassData();H.ResetMassData();G=this.GetWorldCenter();D=H.GetWorldCenter();G=AI.AddVV(I,AI.CrossFV(F,AI.SubtractVV(G,B)));I=AI.AddVV(I,AI.CrossFV(F,AI.SubtractVV(D,B)));this.SetLinearVelocity(G);H.SetLinearVelocity(I);this.SetAngularVelocity(F);H.SetAngularVelocity(F);this.SynchronizeFixtures();H.SynchronizeFixtures();return H};AS.prototype.Merge=function(B){var F;for(F=B.m_fixtureList;F;){var D=F.m_next;B.m_fixtureCount--;F.m_next=this.m_fixtureList;this.m_fixtureList=F;this.m_fixtureCount++;F.m_body=E;F=D}A.m_fixtureCount=0;var A=this,E=B;A.GetWorldCenter();E.GetWorldCenter();A.GetLinearVelocity().Copy();E.GetLinearVelocity().Copy();A.GetAngularVelocity();E.GetAngularVelocity();A.ResetMassData();this.SynchronizeFixtures()};AS.prototype.GetMass=function(){return this.m_mass};AS.prototype.GetInertia=function(){return this.m_I};AS.prototype.GetMassData=function(A){A.mass=this.m_mass;A.I=this.m_I;A.center.SetV(this.m_sweep.localCenter)};AS.prototype.SetMassData=function(A){AN.b2Assert(this.m_world.IsLocked()==false);if(this.m_world.IsLocked()!=true){if(this.m_type==AS.b2_dynamicBody){this.m_invI=this.m_I=this.m_invMass=0;this.m_mass=A.mass;if(this.m_mass<=0){this.m_mass=1}this.m_invMass=1/this.m_mass;if(A.I>0&&(this.m_flags&AS.e_fixedRotationFlag)==0){this.m_I=A.I-this.m_mass*(A.center.x*A.center.x+A.center.y*A.center.y);this.m_invI=1/this.m_I}var B=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(A.center);this.m_sweep.c0.SetV(AI.MulX(this.m_xf,this.m_sweep.localCenter));this.m_sweep.c.SetV(this.m_sweep.c0);this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-B.y);this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-B.x)}}};AS.prototype.ResetMassData=function(){this.m_invI=this.m_I=this.m_invMass=this.m_mass=0;this.m_sweep.localCenter.SetZero();if(!(this.m_type==AS.b2_staticBody||this.m_type==AS.b2_kinematicBody)){for(var A=AC.Make(0,0),D=this.m_fixtureList;D;D=D.m_next){if(D.m_density!=0){var B=D.GetMassData();this.m_mass+=B.mass;A.x+=B.center.x*B.mass;A.y+=B.center.y*B.mass;this.m_I+=B.I}}if(this.m_mass>0){this.m_invMass=1/this.m_mass;A.x*=this.m_invMass;A.y*=this.m_invMass}else{this.m_invMass=this.m_mass=1}if(this.m_I>0&&(this.m_flags&AS.e_fixedRotationFlag)==0){this.m_I-=this.m_mass*(A.x*A.x+A.y*A.y);this.m_I*=this.m_inertiaScale;AN.b2Assert(this.m_I>0);this.m_invI=1/this.m_I}else{this.m_invI=this.m_I=0}D=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(A);this.m_sweep.c0.SetV(AI.MulX(this.m_xf,this.m_sweep.localCenter));this.m_sweep.c.SetV(this.m_sweep.c0);this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-D.y);this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-D.x)}};AS.prototype.GetWorldPoint=function(A){var B=this.m_xf.R;A=new AC(B.col1.x*A.x+B.col2.x*A.y,B.col1.y*A.x+B.col2.y*A.y);A.x+=this.m_xf.position.x;A.y+=this.m_xf.position.y;return A};AS.prototype.GetWorldVector=function(A){return AI.MulMV(this.m_xf.R,A)};AS.prototype.GetLocalPoint=function(A){return AI.MulXT(this.m_xf,A)};AS.prototype.GetLocalVector=function(A){return AI.MulTMV(this.m_xf.R,A)};AS.prototype.GetLinearVelocityFromWorldPoint=function(A){return new AC(this.m_linearVelocity.x-this.m_angularVelocity*(A.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(A.x-this.m_sweep.c.x))};AS.prototype.GetLinearVelocityFromLocalPoint=function(A){var B=this.m_xf.R;A=new AC(B.col1.x*A.x+B.col2.x*A.y,B.col1.y*A.x+B.col2.y*A.y);A.x+=this.m_xf.position.x;A.y+=this.m_xf.position.y;return new AC(this.m_linearVelocity.x-this.m_angularVelocity*(A.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(A.x-this.m_sweep.c.x))};AS.prototype.GetLinearDamping=function(){return this.m_linearDamping};AS.prototype.SetLinearDamping=function(A){if(A===undefined){A=0}this.m_linearDamping=A};AS.prototype.GetAngularDamping=function(){return this.m_angularDamping};AS.prototype.SetAngularDamping=function(A){if(A===undefined){A=0}this.m_angularDamping=A};AS.prototype.SetType=function(A){if(A===undefined){A=0}if(this.m_type!=A){this.m_type=A;this.ResetMassData();if(this.m_type==AS.b2_staticBody){this.m_linearVelocity.SetZero();this.m_angularVelocity=0}this.SetAwake(true);this.m_force.SetZero();this.m_torque=0;for(A=this.m_contactList;A;A=A.next){A.contact.FlagForFiltering()}}};AS.prototype.GetType=function(){return this.m_type};AS.prototype.SetBullet=function(A){if(A){this.m_flags|=AS.e_bulletFlag}else{this.m_flags&=~AS.e_bulletFlag}};AS.prototype.IsBullet=function(){return(this.m_flags&AS.e_bulletFlag)==AS.e_bulletFlag};AS.prototype.SetSleepingAllowed=function(A){if(A){this.m_flags|=AS.e_allowSleepFlag}else{this.m_flags&=~AS.e_allowSleepFlag;this.SetAwake(true)}};AS.prototype.SetAwake=function(A){if(A){this.m_flags|=AS.e_awakeFlag;this.m_sleepTime=0}else{this.m_flags&=~AS.e_awakeFlag;this.m_sleepTime=0;this.m_linearVelocity.SetZero();this.m_angularVelocity=0;this.m_force.SetZero();this.m_torque=0}};AS.prototype.IsAwake=function(){return(this.m_flags&AS.e_awakeFlag)==AS.e_awakeFlag};AS.prototype.SetFixedRotation=function(A){if(A){this.m_flags|=AS.e_fixedRotationFlag}else{this.m_flags&=~AS.e_fixedRotationFlag}this.ResetMassData()};AS.prototype.IsFixedRotation=function(){return(this.m_flags&AS.e_fixedRotationFlag)==AS.e_fixedRotationFlag};AS.prototype.SetActive=function(A){if(A!=this.IsActive()){var B;if(A){this.m_flags|=AS.e_activeFlag;A=this.m_world.m_contactManager.m_broadPhase;for(B=this.m_fixtureList;B;B=B.m_next){B.CreateProxy(A,this.m_xf)}}else{this.m_flags&=~AS.e_activeFlag;A=this.m_world.m_contactManager.m_broadPhase;for(B=this.m_fixtureList;B;B=B.m_next){B.DestroyProxy(A)}for(A=this.m_contactList;A;){B=A;A=A.next;this.m_world.m_contactManager.Destroy(B.contact)}this.m_contactList=null}}};AS.prototype.IsActive=function(){return(this.m_flags&AS.e_activeFlag)==AS.e_activeFlag};AS.prototype.IsSleepingAllowed=function(){return(this.m_flags&AS.e_allowSleepFlag)==AS.e_allowSleepFlag};AS.prototype.GetFixtureList=function(){return this.m_fixtureList};AS.prototype.GetJointList=function(){return this.m_jointList};AS.prototype.GetControllerList=function(){return this.m_controllerList};AS.prototype.GetContactList=function(){return this.m_contactList};AS.prototype.GetNext=function(){return this.m_next};AS.prototype.GetUserData=function(){return this.m_userData};AS.prototype.SetUserData=function(A){this.m_userData=A};AS.prototype.GetWorld=function(){return this.m_world};AS.prototype.b2Body=function(B,E){this.m_flags=0;if(B.bullet){this.m_flags|=AS.e_bulletFlag}if(B.fixedRotation){this.m_flags|=AS.e_fixedRotationFlag}if(B.allowSleep){this.m_flags|=AS.e_allowSleepFlag}if(B.awake){this.m_flags|=AS.e_awakeFlag}if(B.active){this.m_flags|=AS.e_activeFlag}this.m_world=E;this.m_xf.position.SetV(B.position);this.m_xf.R.Set(B.angle);this.m_sweep.localCenter.SetZero();this.m_sweep.t0=1;this.m_sweep.a0=this.m_sweep.a=B.angle;var D=this.m_xf.R,A=this.m_sweep.localCenter;this.m_sweep.c.x=D.col1.x*A.x+D.col2.x*A.y;this.m_sweep.c.y=D.col1.y*A.x+D.col2.y*A.y;this.m_sweep.c.x+=this.m_xf.position.x;this.m_sweep.c.y+=this.m_xf.position.y;this.m_sweep.c0.SetV(this.m_sweep.c);this.m_contactList=this.m_controllerList=this.m_jointList=null;this.m_controllerCount=0;this.m_next=this.m_prev=null;this.m_linearVelocity.SetV(B.linearVelocity);this.m_angularVelocity=B.angularVelocity;this.m_linearDamping=B.linearDamping;this.m_angularDamping=B.angularDamping;this.m_force.Set(0,0);this.m_sleepTime=this.m_torque=0;this.m_type=B.type;if(this.m_type==AS.b2_dynamicBody){this.m_invMass=this.m_mass=1}else{this.m_invMass=this.m_mass=0}this.m_invI=this.m_I=0;this.m_inertiaScale=B.inertiaScale;this.m_userData=B.userData;this.m_fixtureList=null;this.m_fixtureCount=0};AS.prototype.SynchronizeFixtures=function(){var A=AS.s_xf1;A.R.Set(this.m_sweep.a0);var D=A.R,B=this.m_sweep.localCenter;A.position.x=this.m_sweep.c0.x-(D.col1.x*B.x+D.col2.x*B.y);A.position.y=this.m_sweep.c0.y-(D.col1.y*B.x+D.col2.y*B.y);B=this.m_world.m_contactManager.m_broadPhase;for(D=this.m_fixtureList;D;D=D.m_next){D.Synchronize(B,A,this.m_xf)}};AS.prototype.SynchronizeTransform=function(){this.m_xf.R.Set(this.m_sweep.a);var A=this.m_xf.R,B=this.m_sweep.localCenter;this.m_xf.position.x=this.m_sweep.c.x-(A.col1.x*B.x+A.col2.x*B.y);this.m_xf.position.y=this.m_sweep.c.y-(A.col1.y*B.x+A.col2.y*B.y)};AS.prototype.ShouldCollide=function(A){if(this.m_type!=AS.b2_dynamicBody&&A.m_type!=AS.b2_dynamicBody){return false}for(var B=this.m_jointList;B;B=B.next){if(B.other==A){if(B.joint.m_collideConnected==false){return false}}}return true};AS.prototype.Advance=function(A){if(A===undefined){A=0}this.m_sweep.Advance(A);this.m_sweep.c.SetV(this.m_sweep.c0);this.m_sweep.a=this.m_sweep.a0;this.SynchronizeTransform()};Box2D.postDefs.push(function(){Box2D.Dynamics.b2Body.s_xf1=new AB;Box2D.Dynamics.b2Body.e_islandFlag=1;Box2D.Dynamics.b2Body.e_awakeFlag=2;Box2D.Dynamics.b2Body.e_allowSleepFlag=4;Box2D.Dynamics.b2Body.e_bulletFlag=8;Box2D.Dynamics.b2Body.e_fixedRotationFlag=16;Box2D.Dynamics.b2Body.e_activeFlag=32;Box2D.Dynamics.b2Body.b2_staticBody=0;Box2D.Dynamics.b2Body.b2_kinematicBody=1;Box2D.Dynamics.b2Body.b2_dynamicBody=2});AA.b2BodyDef=function(){this.position=new AC;this.linearVelocity=new AC};AA.prototype.b2BodyDef=function(){this.userData=null;this.position.Set(0,0);this.angle=0;this.linearVelocity.Set(0,0);this.angularDamping=this.linearDamping=this.angularVelocity=0;this.awake=this.allowSleep=true;this.bullet=this.fixedRotation=false;this.type=AS.b2_staticBody;this.active=true;this.inertiaScale=1};AH.b2ContactFilter=function(){};AH.prototype.ShouldCollide=function(B,E){var D=B.GetFilterData(),A=E.GetFilterData();if(D.groupIndex==A.groupIndex&&D.groupIndex!=0){return D.groupIndex>0}return(D.maskBits&A.categoryBits)!=0&&(D.categoryBits&A.maskBits)!=0};AH.prototype.RayCollide=function(A,B){if(!A){return true}return this.ShouldCollide(A instanceof b?A:null,B)};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactFilter.b2_defaultFilter=new AH});AK.b2ContactImpulse=function(){this.normalImpulses=new Vector_a2j_Number(AN.b2_maxManifoldPoints);this.tangentImpulses=new Vector_a2j_Number(AN.b2_maxManifoldPoints)};AE.b2ContactListener=function(){};AE.prototype.BeginContact=function(){};AE.prototype.EndContact=function(){};AE.prototype.PreSolve=function(){};AE.prototype.PostSolve=function(){};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactListener.b2_defaultListener=new AE});g.b2ContactManager=function(){};g.prototype.b2ContactManager=function(){this.m_world=null;this.m_contactCount=0;this.m_contactFilter=AH.b2_defaultFilter;this.m_contactListener=AE.b2_defaultListener;this.m_contactFactory=new AT(this.m_allocator);this.m_broadPhase=new AM};g.prototype.AddPair=function(I,G){var D=I instanceof b?I:null,H=G instanceof b?G:null,F=D.GetBody(),E=H.GetBody();if(F!=E){for(var B=E.GetContactList();B;){if(B.other==F){var A=B.contact.GetFixtureA(),K=B.contact.GetFixtureB();if(A==D&&K==H){return}if(A==H&&K==D){return}}B=B.next}if(E.ShouldCollide(F)!=false){if(this.m_contactFilter.ShouldCollide(D,H)!=false){B=this.m_contactFactory.Create(D,H);D=B.GetFixtureA();H=B.GetFixtureB();F=D.m_body;E=H.m_body;B.m_prev=null;B.m_next=this.m_world.m_contactList;if(this.m_world.m_contactList!=null){this.m_world.m_contactList.m_prev=B}this.m_world.m_contactList=B;B.m_nodeA.contact=B;B.m_nodeA.other=E;B.m_nodeA.prev=null;B.m_nodeA.next=F.m_contactList;if(F.m_contactList!=null){F.m_contactList.prev=B.m_nodeA}F.m_contactList=B.m_nodeA;B.m_nodeB.contact=B;B.m_nodeB.other=F;B.m_nodeB.prev=null;B.m_nodeB.next=E.m_contactList;if(E.m_contactList!=null){E.m_contactList.prev=B.m_nodeB}E.m_contactList=B.m_nodeB;++this.m_world.m_contactCount}}}};g.prototype.FindNewContacts=function(){this.m_broadPhase.UpdatePairs(Box2D.generateCallback(this,this.AddPair))};g.prototype.Destroy=function(A){var D=A.GetFixtureA(),B=A.GetFixtureB();D=D.GetBody();B=B.GetBody();A.IsTouching()&&this.m_contactListener.EndContact(A);if(A.m_prev){A.m_prev.m_next=A.m_next}if(A.m_next){A.m_next.m_prev=A.m_prev}if(A==this.m_world.m_contactList){this.m_world.m_contactList=A.m_next}if(A.m_nodeA.prev){A.m_nodeA.prev.next=A.m_nodeA.next}if(A.m_nodeA.next){A.m_nodeA.next.prev=A.m_nodeA.prev}if(A.m_nodeA==D.m_contactList){D.m_contactList=A.m_nodeA.next}if(A.m_nodeB.prev){A.m_nodeB.prev.next=A.m_nodeB.next}if(A.m_nodeB.next){A.m_nodeB.next.prev=A.m_nodeB.prev}if(A.m_nodeB==B.m_contactList){B.m_contactList=A.m_nodeB.next}this.m_contactFactory.Destroy(A);--this.m_contactCount};g.prototype.Collide=function(){for(var B=this.m_world.m_contactList;B;){var F=B.GetFixtureA(),D=B.GetFixtureB(),A=F.GetBody(),E=D.GetBody();if(A.IsAwake()==false&&E.IsAwake()==false){B=B.GetNext()}else{if(B.m_flags&AR.e_filterFlag){if(E.ShouldCollide(A)==false){F=B;B=F.GetNext();this.Destroy(F);continue}if(this.m_contactFilter.ShouldCollide(F,D)==false){F=B;B=F.GetNext();this.Destroy(F);continue}B.m_flags&=~AR.e_filterFlag}if(this.m_broadPhase.TestOverlap(F.m_proxy,D.m_proxy)==false){F=B;B=F.GetNext();this.Destroy(F)}else{B.Update(this.m_contactListener);B=B.GetNext()}}}};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactManager.s_evalCP=new AO});AJ.b2DebugDraw=function(){};AJ.prototype.b2DebugDraw=function(){};AJ.prototype.SetFlags=function(){};AJ.prototype.GetFlags=function(){};AJ.prototype.AppendFlags=function(){};AJ.prototype.ClearFlags=function(){};AJ.prototype.SetSprite=function(){};AJ.prototype.GetSprite=function(){};AJ.prototype.SetDrawScale=function(){};AJ.prototype.GetDrawScale=function(){};AJ.prototype.SetLineThickness=function(){};AJ.prototype.GetLineThickness=function(){};AJ.prototype.SetAlpha=function(){};AJ.prototype.GetAlpha=function(){};AJ.prototype.SetFillAlpha=function(){};AJ.prototype.GetFillAlpha=function(){};AJ.prototype.SetXFormScale=function(){};AJ.prototype.GetXFormScale=function(){};AJ.prototype.DrawPolygon=function(){};AJ.prototype.DrawSolidPolygon=function(){};AJ.prototype.DrawCircle=function(){};AJ.prototype.DrawSolidCircle=function(){};AJ.prototype.DrawSegment=function(){};AJ.prototype.DrawTransform=function(){};Box2D.postDefs.push(function(){Box2D.Dynamics.b2DebugDraw.e_shapeBit=1;Box2D.Dynamics.b2DebugDraw.e_jointBit=2;Box2D.Dynamics.b2DebugDraw.e_aabbBit=4;Box2D.Dynamics.b2DebugDraw.e_pairBit=8;Box2D.Dynamics.b2DebugDraw.e_centerOfMassBit=16;Box2D.Dynamics.b2DebugDraw.e_controllerBit=32});e.b2DestructionListener=function(){};e.prototype.SayGoodbyeJoint=function(){};e.prototype.SayGoodbyeFixture=function(){};m.b2FilterData=function(){this.categoryBits=1;this.maskBits=65535;this.groupIndex=0};m.prototype.Copy=function(){var A=new m;A.categoryBits=this.categoryBits;A.maskBits=this.maskBits;A.groupIndex=this.groupIndex;return A};b.b2Fixture=function(){this.m_filter=new m};b.prototype.GetType=function(){return this.m_shape.GetType()};b.prototype.GetShape=function(){return this.m_shape};b.prototype.SetSensor=function(B){if(this.m_isSensor!=B){this.m_isSensor=B;if(this.m_body!=null){for(B=this.m_body.GetContactList();B;){var E=B.contact,D=E.GetFixtureA(),A=E.GetFixtureB();if(D==this||A==this){E.SetSensor(D.IsSensor()||A.IsSensor())}B=B.next}}}};b.prototype.IsSensor=function(){return this.m_isSensor};b.prototype.SetFilterData=function(B){this.m_filter=B.Copy();if(!this.m_body){for(B=this.m_body.GetContactList();B;){var E=B.contact,D=E.GetFixtureA(),A=E.GetFixtureB();if(D==this||A==this){E.FlagForFiltering()}B=B.next}}};b.prototype.GetFilterData=function(){return this.m_filter.Copy()};b.prototype.GetBody=function(){return this.m_body};b.prototype.GetNext=function(){return this.m_next};b.prototype.GetUserData=function(){return this.m_userData};b.prototype.SetUserData=function(A){this.m_userData=A};b.prototype.TestPoint=function(A){return this.m_shape.TestPoint(this.m_body.GetTransform(),A)};b.prototype.RayCast=function(A,B){return this.m_shape.RayCast(A,B,this.m_body.GetTransform())};b.prototype.GetMassData=function(A){if(A===undefined){A=null}if(A==null){A=new AD}this.m_shape.ComputeMass(A,this.m_density);return A};b.prototype.SetDensity=function(A){if(A===undefined){A=0}this.m_density=A};b.prototype.GetDensity=function(){return this.m_density};b.prototype.GetFriction=function(){return this.m_friction};b.prototype.SetFriction=function(A){if(A===undefined){A=0}this.m_friction=A};b.prototype.GetRestitution=function(){return this.m_restitution};b.prototype.SetRestitution=function(A){if(A===undefined){A=0}this.m_restitution=A};b.prototype.GetAABB=function(){return this.m_aabb};b.prototype.b2Fixture=function(){this.m_aabb=new X;this.m_shape=this.m_next=this.m_body=this.m_userData=null;this.m_restitution=this.m_friction=this.m_density=0};b.prototype.Create=function(A,D,B){this.m_userData=B.userData;this.m_friction=B.friction;this.m_restitution=B.restitution;this.m_body=A;this.m_next=null;this.m_filter=B.filter.Copy();this.m_isSensor=B.isSensor;this.m_shape=B.shape.Copy();this.m_density=B.density};b.prototype.Destroy=function(){this.m_shape=null};b.prototype.CreateProxy=function(A,B){this.m_shape.ComputeAABB(this.m_aabb,B);this.m_proxy=A.CreateProxy(this.m_aabb,this)};b.prototype.DestroyProxy=function(A){if(this.m_proxy!=null){A.DestroyProxy(this.m_proxy);this.m_proxy=null}};b.prototype.Synchronize=function(B,F,D){if(this.m_proxy){var A=new X,E=new X;this.m_shape.ComputeAABB(A,F);this.m_shape.ComputeAABB(E,D);this.m_aabb.Combine(A,E);F=AI.SubtractVV(D.position,F.position);B.MoveProxy(this.m_proxy,this.m_aabb,F)}};AW.b2FixtureDef=function(){this.filter=new m};AW.prototype.b2FixtureDef=function(){this.userData=this.shape=null;this.friction=0.2;this.density=this.restitution=0;this.filter.categoryBits=1;this.filter.maskBits=65535;this.filter.groupIndex=0;this.isSensor=false};C.b2Island=function(){};C.prototype.b2Island=function(){this.m_bodies=new Vector;this.m_contacts=new Vector;this.m_joints=new Vector};C.prototype.Initialize=function(D,H,E,B,G,F){if(D===undefined){D=0}if(H===undefined){H=0}if(E===undefined){E=0}var A=0;this.m_bodyCapacity=D;this.m_contactCapacity=H;this.m_jointCapacity=E;this.m_jointCount=this.m_contactCount=this.m_bodyCount=0;this.m_allocator=B;this.m_listener=G;this.m_contactSolver=F;for(A=this.m_bodies.length;A<D;A++){this.m_bodies[A]=null}for(A=this.m_contacts.length;A<H;A++){this.m_contacts[A]=null}for(A=this.m_joints.length;A<E;A++){this.m_joints[A]=null}};C.prototype.Clear=function(){this.m_jointCount=this.m_contactCount=this.m_bodyCount=0};C.prototype.Solve=function(D,I,F){var B=0,H=0,G;for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];if(H.GetType()==AS.b2_dynamicBody){H.m_linearVelocity.x+=D.dt*(I.x+H.m_invMass*H.m_force.x);H.m_linearVelocity.y+=D.dt*(I.y+H.m_invMass*H.m_force.y);H.m_angularVelocity+=D.dt*H.m_invI*H.m_torque;H.m_linearVelocity.Multiply(AI.Clamp(1-D.dt*H.m_linearDamping,0,1));H.m_angularVelocity*=AI.Clamp(1-D.dt*H.m_angularDamping,0,1)}}this.m_contactSolver.Initialize(D,this.m_contacts,this.m_contactCount,this.m_allocator);I=this.m_contactSolver;I.InitVelocityConstraints(D);for(B=0;B<this.m_jointCount;++B){G=this.m_joints[B];G.InitVelocityConstraints(D)}for(B=0;B<D.velocityIterations;++B){for(H=0;H<this.m_jointCount;++H){G=this.m_joints[H];G.SolveVelocityConstraints(D)}I.SolveVelocityConstraints()}for(B=0;B<this.m_jointCount;++B){G=this.m_joints[B];G.FinalizeVelocityConstraints()}I.FinalizeVelocityConstraints();for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];if(H.GetType()!=AS.b2_staticBody){var A=D.dt*H.m_linearVelocity.x,E=D.dt*H.m_linearVelocity.y;if(A*A+E*E>AN.b2_maxTranslationSquared){H.m_linearVelocity.Normalize();H.m_linearVelocity.x*=AN.b2_maxTranslation*D.inv_dt;H.m_linearVelocity.y*=AN.b2_maxTranslation*D.inv_dt}A=D.dt*H.m_angularVelocity;if(A*A>AN.b2_maxRotationSquared){H.m_angularVelocity=H.m_angularVelocity<0?-AN.b2_maxRotation*D.inv_dt:AN.b2_maxRotation*D.inv_dt}H.m_sweep.c0.SetV(H.m_sweep.c);H.m_sweep.a0=H.m_sweep.a;H.m_sweep.c.x+=D.dt*H.m_linearVelocity.x;H.m_sweep.c.y+=D.dt*H.m_linearVelocity.y;H.m_sweep.a+=D.dt*H.m_angularVelocity;H.SynchronizeTransform()}}for(B=0;B<D.positionIterations;++B){A=I.SolvePositionConstraints(AN.b2_contactBaumgarte);E=true;for(H=0;H<this.m_jointCount;++H){G=this.m_joints[H];G=G.SolvePositionConstraints(AN.b2_contactBaumgarte);E=E&&G}if(A&&E){break}}this.Report(I.m_constraints);if(F){F=Number.MAX_VALUE;I=AN.b2_linearSleepTolerance*AN.b2_linearSleepTolerance;A=AN.b2_angularSleepTolerance*AN.b2_angularSleepTolerance;for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];if(H.GetType()!=AS.b2_staticBody){if((H.m_flags&AS.e_allowSleepFlag)==0){F=H.m_sleepTime=0}if((H.m_flags&AS.e_allowSleepFlag)==0||H.m_angularVelocity*H.m_angularVelocity>A||AI.Dot(H.m_linearVelocity,H.m_linearVelocity)>I){F=H.m_sleepTime=0}else{H.m_sleepTime+=D.dt;F=AI.Min(F,H.m_sleepTime)}}}if(F>=AN.b2_timeToSleep){for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];H.SetAwake(false)}}}};C.prototype.SolveTOI=function(D){var H=0,E=0;this.m_contactSolver.Initialize(D,this.m_contacts,this.m_contactCount,this.m_allocator);var B=this.m_contactSolver;for(H=0;H<this.m_jointCount;++H){this.m_joints[H].InitVelocityConstraints(D)}for(H=0;H<D.velocityIterations;++H){B.SolveVelocityConstraints();for(E=0;E<this.m_jointCount;++E){this.m_joints[E].SolveVelocityConstraints(D)}}for(H=0;H<this.m_bodyCount;++H){E=this.m_bodies[H];if(E.GetType()!=AS.b2_staticBody){var G=D.dt*E.m_linearVelocity.x,F=D.dt*E.m_linearVelocity.y;if(G*G+F*F>AN.b2_maxTranslationSquared){E.m_linearVelocity.Normalize();E.m_linearVelocity.x*=AN.b2_maxTranslation*D.inv_dt;E.m_linearVelocity.y*=AN.b2_maxTranslation*D.inv_dt}G=D.dt*E.m_angularVelocity;if(G*G>AN.b2_maxRotationSquared){E.m_angularVelocity=E.m_angularVelocity<0?-AN.b2_maxRotation*D.inv_dt:AN.b2_maxRotation*D.inv_dt}E.m_sweep.c0.SetV(E.m_sweep.c);E.m_sweep.a0=E.m_sweep.a;E.m_sweep.c.x+=D.dt*E.m_linearVelocity.x;E.m_sweep.c.y+=D.dt*E.m_linearVelocity.y;E.m_sweep.a+=D.dt*E.m_angularVelocity;E.SynchronizeTransform()}}for(H=0;H<D.positionIterations;++H){G=B.SolvePositionConstraints(0.75);F=true;for(E=0;E<this.m_jointCount;++E){var A=this.m_joints[E].SolvePositionConstraints(AN.b2_contactBaumgarte);F=F&&A}if(G&&F){break}}this.Report(B.m_constraints)};C.prototype.Report=function(B){if(this.m_listener!=null){for(var F=0;F<this.m_contactCount;++F){for(var D=this.m_contacts[F],A=B[F],E=0;E<A.pointCount;++E){C.s_impulse.normalImpulses[E]=A.points[E].normalImpulse;C.s_impulse.tangentImpulses[E]=A.points[E].tangentImpulse}this.m_listener.PostSolve(D,C.s_impulse)}}};C.prototype.AddBody=function(A){A.m_islandIndex=this.m_bodyCount;this.m_bodies[this.m_bodyCount++]=A};C.prototype.AddContact=function(A){this.m_contacts[this.m_contactCount++]=A};C.prototype.AddJoint=function(A){this.m_joints[this.m_jointCount++]=A};Box2D.postDefs.push(function(){Box2D.Dynamics.b2Island.s_impulse=new AK});AV.b2TimeStep=function(){};AV.prototype.Set=function(A){this.dt=A.dt;this.inv_dt=A.inv_dt;this.positionIterations=A.positionIterations;this.velocityIterations=A.velocityIterations;this.warmStarting=A.warmStarting};AU.b2World=function(){this.s_stack=new Vector;this.m_contactManager=new g;this.m_contactSolver=new AP;this.m_island=new C};AU.prototype.b2World=function(A,B){this.m_controllerList=this.m_jointList=this.m_contactList=this.m_bodyList=this.m_debugDraw=this.m_destructionListener=null;this.m_controllerCount=this.m_jointCount=this.m_contactCount=this.m_bodyCount=0;AU.m_warmStarting=true;AU.m_continuousPhysics=true;this.m_allowSleep=B;this.m_gravity=A;this.m_inv_dt0=0;this.m_contactManager.m_world=this;this.m_groundBody=this.CreateBody(new AA)};AU.prototype.SetDestructionListener=function(A){this.m_destructionListener=A};AU.prototype.SetContactFilter=function(A){this.m_contactManager.m_contactFilter=A};AU.prototype.SetContactListener=function(A){this.m_contactManager.m_contactListener=A};AU.prototype.SetDebugDraw=function(A){this.m_debugDraw=A};AU.prototype.SetBroadPhase=function(B){var E=this.m_contactManager.m_broadPhase;this.m_contactManager.m_broadPhase=B;for(var D=this.m_bodyList;D;D=D.m_next){for(var A=D.m_fixtureList;A;A=A.m_next){A.m_proxy=B.CreateProxy(E.GetFatAABB(A.m_proxy),A)}}};AU.prototype.Validate=function(){this.m_contactManager.m_broadPhase.Validate()};AU.prototype.GetProxyCount=function(){return this.m_contactManager.m_broadPhase.GetProxyCount()};AU.prototype.CreateBody=function(A){if(this.IsLocked()==true){return null}A=new AS(A,this);A.m_prev=null;if(A.m_next=this.m_bodyList){this.m_bodyList.m_prev=A}this.m_bodyList=A;++this.m_bodyCount;return A};AU.prototype.DestroyBody=function(A){if(this.IsLocked()!=true){for(var D=A.m_jointList;D;){var B=D;D=D.next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(B.joint);this.DestroyJoint(B.joint)}for(D=A.m_controllerList;D;){B=D;D=D.nextController;B.controller.RemoveBody(A)}for(D=A.m_contactList;D;){B=D;D=D.next;this.m_contactManager.Destroy(B.contact)}A.m_contactList=null;for(D=A.m_fixtureList;D;){B=D;D=D.m_next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(B);B.DestroyProxy(this.m_contactManager.m_broadPhase);B.Destroy()}A.m_fixtureList=null;A.m_fixtureCount=0;if(A.m_prev){A.m_prev.m_next=A.m_next}if(A.m_next){A.m_next.m_prev=A.m_prev}if(A==this.m_bodyList){this.m_bodyList=A.m_next}--this.m_bodyCount}};AU.prototype.CreateJoint=function(B){var E=AL.Create(B,null);E.m_prev=null;if(E.m_next=this.m_jointList){this.m_jointList.m_prev=E}this.m_jointList=E;++this.m_jointCount;E.m_edgeA.joint=E;E.m_edgeA.other=E.m_bodyB;E.m_edgeA.prev=null;if(E.m_edgeA.next=E.m_bodyA.m_jointList){E.m_bodyA.m_jointList.prev=E.m_edgeA}E.m_bodyA.m_jointList=E.m_edgeA;E.m_edgeB.joint=E;E.m_edgeB.other=E.m_bodyA;E.m_edgeB.prev=null;if(E.m_edgeB.next=E.m_bodyB.m_jointList){E.m_bodyB.m_jointList.prev=E.m_edgeB}E.m_bodyB.m_jointList=E.m_edgeB;var D=B.bodyA,A=B.bodyB;if(B.collideConnected==false){for(B=A.GetContactList();B;){B.other==D&&B.contact.FlagForFiltering();B=B.next}}return E};AU.prototype.DestroyJoint=function(B){var E=B.m_collideConnected;if(B.m_prev){B.m_prev.m_next=B.m_next}if(B.m_next){B.m_next.m_prev=B.m_prev}if(B==this.m_jointList){this.m_jointList=B.m_next}var D=B.m_bodyA,A=B.m_bodyB;D.SetAwake(true);A.SetAwake(true);if(B.m_edgeA.prev){B.m_edgeA.prev.next=B.m_edgeA.next}if(B.m_edgeA.next){B.m_edgeA.next.prev=B.m_edgeA.prev}if(B.m_edgeA==D.m_jointList){D.m_jointList=B.m_edgeA.next}B.m_edgeA.prev=null;B.m_edgeA.next=null;if(B.m_edgeB.prev){B.m_edgeB.prev.next=B.m_edgeB.next}if(B.m_edgeB.next){B.m_edgeB.next.prev=B.m_edgeB.prev}if(B.m_edgeB==A.m_jointList){A.m_jointList=B.m_edgeB.next}B.m_edgeB.prev=null;B.m_edgeB.next=null;AL.Destroy(B,null);--this.m_jointCount;if(E==false){for(B=A.GetContactList();B;){B.other==D&&B.contact.FlagForFiltering();B=B.next}}};AU.prototype.AddController=function(A){A.m_next=this.m_controllerList;A.m_prev=null;this.m_controllerList=A;A.m_world=this;this.m_controllerCount++;return A};AU.prototype.RemoveController=function(A){if(A.m_prev){A.m_prev.m_next=A.m_next}if(A.m_next){A.m_next.m_prev=A.m_prev}if(this.m_controllerList==A){this.m_controllerList=A.m_next}this.m_controllerCount--};AU.prototype.CreateController=function(A){if(A.m_world!=this){throw Error("Controller can only be a member of one world")}A.m_next=this.m_controllerList;A.m_prev=null;if(this.m_controllerList){this.m_controllerList.m_prev=A}this.m_controllerList=A;++this.m_controllerCount;A.m_world=this;return A};AU.prototype.DestroyController=function(A){A.Clear();if(A.m_next){A.m_next.m_prev=A.m_prev}if(A.m_prev){A.m_prev.m_next=A.m_next}if(A==this.m_controllerList){this.m_controllerList=A.m_next}--this.m_controllerCount};AU.prototype.SetWarmStarting=function(A){AU.m_warmStarting=A};AU.prototype.SetContinuousPhysics=function(A){AU.m_continuousPhysics=A};AU.prototype.GetBodyCount=function(){return this.m_bodyCount};AU.prototype.GetJointCount=function(){return this.m_jointCount};AU.prototype.GetContactCount=function(){return this.m_contactCount};AU.prototype.SetGravity=function(A){this.m_gravity=A};AU.prototype.GetGravity=function(){return this.m_gravity};AU.prototype.GetGroundBody=function(){return this.m_groundBody};AU.prototype.Step=function(B,E,D){if(B===undefined){B=0}if(E===undefined){E=0}if(D===undefined){D=0}if(this.m_flags&AU.e_newFixture){this.m_contactManager.FindNewContacts();this.m_flags&=~AU.e_newFixture}this.m_flags|=AU.e_locked;var A=AU.s_timestep2;A.dt=B;A.velocityIterations=E;A.positionIterations=D;A.inv_dt=B>0?1/B:0;A.dtRatio=this.m_inv_dt0*B;A.warmStarting=AU.m_warmStarting;this.m_contactManager.Collide();A.dt>0&&this.Solve(A);AU.m_continuousPhysics&&A.dt>0&&this.SolveTOI(A);if(A.dt>0){this.m_inv_dt0=A.inv_dt}this.m_flags&=~AU.e_locked};AU.prototype.ClearForces=function(){for(var A=this.m_bodyList;A;A=A.m_next){A.m_force.SetZero();A.m_torque=0}};AU.prototype.DrawDebugData=function(){if(this.m_debugDraw!=null){this.m_debugDraw.m_sprite.graphics.clear();var D=this.m_debugDraw.GetFlags(),H,E,B;new AC;new AC;new AC;var G;new X;new X;G=[new AC,new AC,new AC,new AC];var F=new AF(0,0,0);if(D&AJ.e_shapeBit){for(H=this.m_bodyList;H;H=H.m_next){G=H.m_xf;for(E=H.GetFixtureList();E;E=E.m_next){B=E.GetShape();if(H.IsActive()==false){F.Set(0.5,0.5,0.3)}else{if(H.GetType()==AS.b2_staticBody){F.Set(0.5,0.9,0.5)}else{if(H.GetType()==AS.b2_kinematicBody){F.Set(0.5,0.5,0.9)}else{H.IsAwake()==false?F.Set(0.6,0.6,0.6):F.Set(0.9,0.7,0.7)}}}this.DrawShape(B,G,F)}}}if(D&AJ.e_jointBit){for(H=this.m_jointList;H;H=H.m_next){this.DrawJoint(H)}}if(D&AJ.e_controllerBit){for(H=this.m_controllerList;H;H=H.m_next){H.Draw(this.m_debugDraw)}}if(D&AJ.e_pairBit){F.Set(0.3,0.9,0.9);for(H=this.m_contactManager.m_contactList;H;H=H.GetNext()){B=H.GetFixtureA();E=H.GetFixtureB();B=B.GetAABB().GetCenter();E=E.GetAABB().GetCenter();this.m_debugDraw.DrawSegment(B,E,F)}}if(D&AJ.e_aabbBit){B=this.m_contactManager.m_broadPhase;G=[new AC,new AC,new AC,new AC];for(H=this.m_bodyList;H;H=H.GetNext()){if(H.IsActive()!=false){for(E=H.GetFixtureList();E;E=E.GetNext()){var A=B.GetFatAABB(E.m_proxy);G[0].Set(A.lowerBound.x,A.lowerBound.y);G[1].Set(A.upperBound.x,A.lowerBound.y);G[2].Set(A.upperBound.x,A.upperBound.y);G[3].Set(A.lowerBound.x,A.upperBound.y);this.m_debugDraw.DrawPolygon(G,4,F)}}}}if(D&AJ.e_centerOfMassBit){for(H=this.m_bodyList;H;H=H.m_next){G=AU.s_xf;G.R=H.m_xf.R;G.position=H.GetWorldCenter();this.m_debugDraw.DrawTransform(G)}}}};AU.prototype.QueryAABB=function(A,D){var B=this.m_contactManager.m_broadPhase;B.Query(function(E){return A(B.GetUserData(E))},D)};AU.prototype.QueryShape=function(B,F,D){if(D===undefined){D=null}if(D==null){D=new AB;D.SetIdentity()}var A=this.m_contactManager.m_broadPhase,E=new X;F.ComputeAABB(E,D);A.Query(function(G){G=A.GetUserData(G) instanceof b?A.GetUserData(G):null;if(J.TestOverlap(F,D,G.GetShape(),G.GetBody().GetTransform())){return B(G)}return true},E)};AU.prototype.QueryPoint=function(B,E){var D=this.m_contactManager.m_broadPhase,A=new X;A.lowerBound.Set(E.x-AN.b2_linearSlop,E.y-AN.b2_linearSlop);A.upperBound.Set(E.x+AN.b2_linearSlop,E.y+AN.b2_linearSlop);D.Query(function(F){F=D.GetUserData(F) instanceof b?D.GetUserData(F):null;if(F.TestPoint(E)){return B(F)}return true},A)};AU.prototype.RayCast=function(B,G,D){var A=this.m_contactManager.m_broadPhase,F=new T,E=new f(G,D);A.RayCast(function(H,M){var L=A.GetUserData(M);L=L instanceof b?L:null;if(L.RayCast(F,H)){var I=F.fraction,K=new AC((1-I)*G.x+I*D.x,(1-I)*G.y+I*D.y);return B(L,K,F.normal,I)}return H.maxFraction},E)};AU.prototype.RayCastOne=function(A,D){var B;this.RayCast(function(F,H,G,E){if(E===undefined){E=0}B=F;return E},A,D);return B};AU.prototype.RayCastAll=function(A,D){var B=new Vector;this.RayCast(function(E){B[B.length]=E;return 1},A,D);return B};AU.prototype.GetBodyList=function(){return this.m_bodyList};AU.prototype.GetJointList=function(){return this.m_jointList};AU.prototype.GetContactList=function(){return this.m_contactList};AU.prototype.IsLocked=function(){return(this.m_flags&AU.e_locked)>0};AU.prototype.Solve=function(D){for(var I,F=this.m_controllerList;F;F=F.m_next){F.Step(D)}F=this.m_island;F.Initialize(this.m_bodyCount,this.m_contactCount,this.m_jointCount,null,this.m_contactManager.m_contactListener,this.m_contactSolver);for(I=this.m_bodyList;I;I=I.m_next){I.m_flags&=~AS.e_islandFlag}for(var B=this.m_contactList;B;B=B.m_next){B.m_flags&=~AR.e_islandFlag}for(B=this.m_jointList;B;B=B.m_next){B.m_islandFlag=false}parseInt(this.m_bodyCount);B=this.s_stack;for(var H=this.m_bodyList;H;H=H.m_next){if(!(H.m_flags&AS.e_islandFlag)){if(!(H.IsAwake()==false||H.IsActive()==false)){if(H.GetType()!=AS.b2_staticBody){F.Clear();var G=0;B[G++]=H;for(H.m_flags|=AS.e_islandFlag;G>0;){I=B[--G];F.AddBody(I);I.IsAwake()==false&&I.SetAwake(true);if(I.GetType()!=AS.b2_staticBody){for(var A,E=I.m_contactList;E;E=E.next){if(!(E.contact.m_flags&AR.e_islandFlag)){if(!(E.contact.IsSensor()==true||E.contact.IsEnabled()==false||E.contact.IsTouching()==false)){F.AddContact(E.contact);E.contact.m_flags|=AR.e_islandFlag;A=E.other;if(!(A.m_flags&AS.e_islandFlag)){B[G++]=A;A.m_flags|=AS.e_islandFlag}}}}for(I=I.m_jointList;I;I=I.next){if(I.joint.m_islandFlag!=true){A=I.other;if(A.IsActive()!=false){F.AddJoint(I.joint);I.joint.m_islandFlag=true;if(!(A.m_flags&AS.e_islandFlag)){B[G++]=A;A.m_flags|=AS.e_islandFlag}}}}}}F.Solve(D,this.m_gravity,this.m_allowSleep);for(G=0;G<F.m_bodyCount;++G){I=F.m_bodies[G];if(I.GetType()==AS.b2_staticBody){I.m_flags&=~AS.e_islandFlag}}}}}}for(G=0;G<B.length;++G){if(!B[G]){break}B[G]=null}for(I=this.m_bodyList;I;I=I.m_next){I.IsAwake()==false||I.IsActive()==false||I.GetType()!=AS.b2_staticBody&&I.SynchronizeFixtures()}this.m_contactManager.FindNewContacts()};AU.prototype.SolveTOI=function(I){var G,D,H,F=this.m_island;F.Initialize(this.m_bodyCount,AN.b2_maxTOIContactsPerIsland,AN.b2_maxTOIJointsPerIsland,null,this.m_contactManager.m_contactListener,this.m_contactSolver);var E=AU.s_queue;for(G=this.m_bodyList;G;G=G.m_next){G.m_flags&=~AS.e_islandFlag;G.m_sweep.t0=0}for(H=this.m_contactList;H;H=H.m_next){H.m_flags&=~(AR.e_toiFlag|AR.e_islandFlag)}for(H=this.m_jointList;H;H=H.m_next){H.m_islandFlag=false}for(;;){var B=null,A=1;for(H=this.m_contactList;H;H=H.m_next){if(!(H.IsSensor()==true||H.IsEnabled()==false||H.IsContinuous()==false)){G=1;if(H.m_flags&AR.e_toiFlag){G=H.m_toi}else{G=H.m_fixtureA;D=H.m_fixtureB;G=G.m_body;D=D.m_body;if((G.GetType()!=AS.b2_dynamicBody||G.IsAwake()==false)&&(D.GetType()!=AS.b2_dynamicBody||D.IsAwake()==false)){continue}var K=G.m_sweep.t0;if(G.m_sweep.t0<D.m_sweep.t0){K=D.m_sweep.t0;G.m_sweep.Advance(K)}else{if(D.m_sweep.t0<G.m_sweep.t0){K=G.m_sweep.t0;D.m_sweep.Advance(K)}}G=H.ComputeTOI(G.m_sweep,D.m_sweep);AN.b2Assert(0<=G&&G<=1);if(G>0&&G<1){G=(1-G)*K+G;if(G>1){G=1}}H.m_toi=G;H.m_flags|=AR.e_toiFlag}if(Number.MIN_VALUE<G&&G<A){B=H;A=G}}}if(B==null||1-100*Number.MIN_VALUE<A){break}G=B.m_fixtureA;D=B.m_fixtureB;G=G.m_body;D=D.m_body;AU.s_backupA.Set(G.m_sweep);AU.s_backupB.Set(D.m_sweep);G.Advance(A);D.Advance(A);B.Update(this.m_contactManager.m_contactListener);B.m_flags&=~AR.e_toiFlag;if(B.IsSensor()==true||B.IsEnabled()==false){G.m_sweep.Set(AU.s_backupA);D.m_sweep.Set(AU.s_backupB);G.SynchronizeTransform();D.SynchronizeTransform()}else{if(B.IsTouching()!=false){G=G;if(G.GetType()!=AS.b2_dynamicBody){G=D}F.Clear();B=H=0;E[H+B++]=G;for(G.m_flags|=AS.e_islandFlag;B>0;){G=E[H++];--B;F.AddBody(G);G.IsAwake()==false&&G.SetAwake(true);if(G.GetType()==AS.b2_dynamicBody){for(D=G.m_contactList;D;D=D.next){if(F.m_contactCount==F.m_contactCapacity){break}if(!(D.contact.m_flags&AR.e_islandFlag)){if(!(D.contact.IsSensor()==true||D.contact.IsEnabled()==false||D.contact.IsTouching()==false)){F.AddContact(D.contact);D.contact.m_flags|=AR.e_islandFlag;K=D.other;if(!(K.m_flags&AS.e_islandFlag)){if(K.GetType()!=AS.b2_staticBody){K.Advance(A);K.SetAwake(true)}E[H+B]=K;++B;K.m_flags|=AS.e_islandFlag}}}}for(G=G.m_jointList;G;G=G.next){if(F.m_jointCount!=F.m_jointCapacity){if(G.joint.m_islandFlag!=true){K=G.other;if(K.IsActive()!=false){F.AddJoint(G.joint);G.joint.m_islandFlag=true;if(!(K.m_flags&AS.e_islandFlag)){if(K.GetType()!=AS.b2_staticBody){K.Advance(A);K.SetAwake(true)}E[H+B]=K;++B;K.m_flags|=AS.e_islandFlag}}}}}}}H=AU.s_timestep;H.warmStarting=false;H.dt=(1-A)*I.dt;H.inv_dt=1/H.dt;H.dtRatio=0;H.velocityIterations=I.velocityIterations;H.positionIterations=I.positionIterations;F.SolveTOI(H);for(A=A=0;A<F.m_bodyCount;++A){G=F.m_bodies[A];G.m_flags&=~AS.e_islandFlag;if(G.IsAwake()!=false){if(G.GetType()==AS.b2_dynamicBody){G.SynchronizeFixtures();for(D=G.m_contactList;D;D=D.next){D.contact.m_flags&=~AR.e_toiFlag}}}}for(A=0;A<F.m_contactCount;++A){H=F.m_contacts[A];H.m_flags&=~(AR.e_toiFlag|AR.e_islandFlag)}for(A=0;A<F.m_jointCount;++A){H=F.m_joints[A];H.m_islandFlag=false}this.m_contactManager.FindNewContacts()}}}};AU.prototype.DrawJoint=function(D){var I=D.GetBodyA(),F=D.GetBodyB(),B=I.m_xf.position,H=F.m_xf.position,G=D.GetAnchorA(),A=D.GetAnchorB(),E=AU.s_jointColor;switch(D.m_type){case AL.e_distanceJoint:this.m_debugDraw.DrawSegment(G,A,E);break;case AL.e_pulleyJoint:I=D instanceof AQ?D:null;D=I.GetGroundAnchorA();I=I.GetGroundAnchorB();this.m_debugDraw.DrawSegment(D,G,E);this.m_debugDraw.DrawSegment(I,A,E);this.m_debugDraw.DrawSegment(D,I,E);break;case AL.e_mouseJoint:this.m_debugDraw.DrawSegment(G,A,E);break;default:I!=this.m_groundBody&&this.m_debugDraw.DrawSegment(B,G,E);this.m_debugDraw.DrawSegment(G,A,E);F!=this.m_groundBody&&this.m_debugDraw.DrawSegment(H,A,E)}};AU.prototype.DrawShape=function(B,G,D){switch(B.m_type){case J.e_circleShape:var A=B instanceof t?B:null;this.m_debugDraw.DrawSolidCircle(AI.MulX(G,A.m_p),A.m_radius,G.R.col1,D);break;case J.e_polygonShape:A=0;A=B instanceof P?B:null;B=parseInt(A.GetVertexCount());var F=A.GetVertices(),E=new Vector(B);for(A=0;A<B;++A){E[A]=AI.MulX(G,F[A])}this.m_debugDraw.DrawSolidPolygon(E,B,D);break;case J.e_edgeShape:A=B instanceof x?B:null;this.m_debugDraw.DrawSegment(AI.MulX(G,A.GetVertex1()),AI.MulX(G,A.GetVertex2()),D)}};Box2D.postDefs.push(function(){Box2D.Dynamics.b2World.s_timestep2=new AV;Box2D.Dynamics.b2World.s_xf=new AB;Box2D.Dynamics.b2World.s_backupA=new AG;Box2D.Dynamics.b2World.s_backupB=new AG;Box2D.Dynamics.b2World.s_timestep=new AV;Box2D.Dynamics.b2World.s_queue=new Vector;Box2D.Dynamics.b2World.s_jointColor=new AF(0.5,0.8,0.8);Box2D.Dynamics.b2World.e_newFixture=1;Box2D.Dynamics.b2World.e_locked=2})})();(function(){var AG=Box2D.Collision.Shapes.b2CircleShape,AE=Box2D.Collision.Shapes.b2EdgeShape,x=Box2D.Collision.Shapes.b2PolygonShape,AA=Box2D.Collision.Shapes.b2Shape,AD=Box2D.Dynamics.Contacts.b2CircleContact,AK=Box2D.Dynamics.Contacts.b2Contact,X=Box2D.Dynamics.Contacts.b2ContactConstraint,AL=Box2D.Dynamics.Contacts.b2ContactConstraintPoint,AJ=Box2D.Dynamics.Contacts.b2ContactEdge,f=Box2D.Dynamics.Contacts.b2ContactFactory,T=Box2D.Dynamics.Contacts.b2ContactRegister,n=Box2D.Dynamics.Contacts.b2ContactResult,o=Box2D.Dynamics.Contacts.b2ContactSolver,AB=Box2D.Dynamics.Contacts.b2EdgeAndCircleContact,P=Box2D.Dynamics.Contacts.b2NullContact,J=Box2D.Dynamics.Contacts.b2PolyAndCircleContact,AN=Box2D.Dynamics.Contacts.b2PolyAndEdgeContact,t=Box2D.Dynamics.Contacts.b2PolygonContact,AF=Box2D.Dynamics.Contacts.b2PositionSolverManifold,AI=Box2D.Dynamics.b2Body,AC=Box2D.Dynamics.b2TimeStep,g=Box2D.Common.b2Settings,AH=Box2D.Common.Math.b2Mat22,e=Box2D.Common.Math.b2Math,m=Box2D.Common.Math.b2Vec2,b=Box2D.Collision.b2Collision,AQ=Box2D.Collision.b2ContactID,C=Box2D.Collision.b2Manifold,AP=Box2D.Collision.b2TimeOfImpact,AO=Box2D.Collision.b2TOIInput,AM=Box2D.Collision.b2WorldManifold;Box2D.inherit(AD,Box2D.Dynamics.Contacts.b2Contact);AD.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AD.b2CircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AD.Create=function(){return new AD};AD.Destroy=function(){};AD.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};AD.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();b.CollideCircles(this.m_manifold,this.m_fixtureA.GetShape() instanceof AG?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AG?this.m_fixtureB.GetShape():null,B.m_xf)};AK.b2Contact=function(){this.m_nodeA=new AJ;this.m_nodeB=new AJ;this.m_manifold=new C;this.m_oldManifold=new C};AK.prototype.GetManifold=function(){return this.m_manifold};AK.prototype.GetWorldManifold=function(B){var E=this.m_fixtureA.GetBody(),D=this.m_fixtureB.GetBody(),F=this.m_fixtureA.GetShape(),A=this.m_fixtureB.GetShape();B.Initialize(this.m_manifold,E.GetTransform(),F.m_radius,D.GetTransform(),A.m_radius)};AK.prototype.IsTouching=function(){return(this.m_flags&AK.e_touchingFlag)==AK.e_touchingFlag};AK.prototype.IsContinuous=function(){return(this.m_flags&AK.e_continuousFlag)==AK.e_continuousFlag};AK.prototype.SetSensor=function(A){if(A){this.m_flags|=AK.e_sensorFlag}else{this.m_flags&=~AK.e_sensorFlag}};AK.prototype.IsSensor=function(){return(this.m_flags&AK.e_sensorFlag)==AK.e_sensorFlag};AK.prototype.SetEnabled=function(A){if(A){this.m_flags|=AK.e_enabledFlag}else{this.m_flags&=~AK.e_enabledFlag}};AK.prototype.IsEnabled=function(){return(this.m_flags&AK.e_enabledFlag)==AK.e_enabledFlag};AK.prototype.GetNext=function(){return this.m_next};AK.prototype.GetFixtureA=function(){return this.m_fixtureA};AK.prototype.GetFixtureB=function(){return this.m_fixtureB};AK.prototype.FlagForFiltering=function(){this.m_flags|=AK.e_filterFlag};AK.prototype.b2Contact=function(){};AK.prototype.Reset=function(A,D){if(A===undefined){A=null}if(D===undefined){D=null}this.m_flags=AK.e_enabledFlag;if(!A||!D){this.m_fixtureB=this.m_fixtureA=null}else{if(A.IsSensor()||D.IsSensor()){this.m_flags|=AK.e_sensorFlag}var B=A.GetBody(),E=D.GetBody();if(B.GetType()!=AI.b2_dynamicBody||B.IsBullet()||E.GetType()!=AI.b2_dynamicBody||E.IsBullet()){this.m_flags|=AK.e_continuousFlag}this.m_fixtureA=A;this.m_fixtureB=D;this.m_manifold.m_pointCount=0;this.m_next=this.m_prev=null;this.m_nodeA.contact=null;this.m_nodeA.prev=null;this.m_nodeA.next=null;this.m_nodeA.other=null;this.m_nodeB.contact=null;this.m_nodeB.prev=null;this.m_nodeB.next=null;this.m_nodeB.other=null}};AK.prototype.Update=function(E){var B=this.m_oldManifold;this.m_oldManifold=this.m_manifold;this.m_manifold=B;this.m_flags|=AK.e_enabledFlag;var A=false;B=(this.m_flags&AK.e_touchingFlag)==AK.e_touchingFlag;var D=this.m_fixtureA.m_body,L=this.m_fixtureB.m_body,I=this.m_fixtureA.m_aabb.TestOverlap(this.m_fixtureB.m_aabb);if(this.m_flags&AK.e_sensorFlag){if(I){A=this.m_fixtureA.GetShape();I=this.m_fixtureB.GetShape();D=D.GetTransform();L=L.GetTransform();A=AA.TestOverlap(A,D,I,L)}this.m_manifold.m_pointCount=0}else{if(D.GetType()!=AI.b2_dynamicBody||D.IsBullet()||L.GetType()!=AI.b2_dynamicBody||L.IsBullet()){this.m_flags|=AK.e_continuousFlag}else{this.m_flags&=~AK.e_continuousFlag}if(I){this.Evaluate();A=this.m_manifold.m_pointCount>0;for(I=0;I<this.m_manifold.m_pointCount;++I){var F=this.m_manifold.m_points[I];F.m_normalImpulse=0;F.m_tangentImpulse=0;for(var K=F.m_id,H=0;H<this.m_oldManifold.m_pointCount;++H){var G=this.m_oldManifold.m_points[H];if(G.m_id.key==K.key){F.m_normalImpulse=G.m_normalImpulse;F.m_tangentImpulse=G.m_tangentImpulse;break}}}}else{this.m_manifold.m_pointCount=0}if(A!=B){D.SetAwake(true);L.SetAwake(true)}}if(A){this.m_flags|=AK.e_touchingFlag}else{this.m_flags&=~AK.e_touchingFlag}B==false&&A==true&&E.BeginContact(this);B==true&&A==false&&E.EndContact(this);(this.m_flags&AK.e_sensorFlag)==0&&E.PreSolve(this,this.m_oldManifold)};AK.prototype.Evaluate=function(){};AK.prototype.ComputeTOI=function(A,B){AK.s_input.proxyA.Set(this.m_fixtureA.GetShape());AK.s_input.proxyB.Set(this.m_fixtureB.GetShape());AK.s_input.sweepA=A;AK.s_input.sweepB=B;AK.s_input.tolerance=g.b2_linearSlop;return AP.TimeOfImpact(AK.s_input)};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2Contact.e_sensorFlag=1;Box2D.Dynamics.Contacts.b2Contact.e_continuousFlag=2;Box2D.Dynamics.Contacts.b2Contact.e_islandFlag=4;Box2D.Dynamics.Contacts.b2Contact.e_toiFlag=8;Box2D.Dynamics.Contacts.b2Contact.e_touchingFlag=16;Box2D.Dynamics.Contacts.b2Contact.e_enabledFlag=32;Box2D.Dynamics.Contacts.b2Contact.e_filterFlag=64;Box2D.Dynamics.Contacts.b2Contact.s_input=new AO});X.b2ContactConstraint=function(){this.localPlaneNormal=new m;this.localPoint=new m;this.normal=new m;this.normalMass=new AH;this.K=new AH};X.prototype.b2ContactConstraint=function(){this.points=new Vector(g.b2_maxManifoldPoints);for(var A=0;A<g.b2_maxManifoldPoints;A++){this.points[A]=new AL}};AL.b2ContactConstraintPoint=function(){this.localPoint=new m;this.rA=new m;this.rB=new m};AJ.b2ContactEdge=function(){};f.b2ContactFactory=function(){};f.prototype.b2ContactFactory=function(A){this.m_allocator=A;this.InitializeRegisters()};f.prototype.AddType=function(A,D,B,E){if(B===undefined){B=0}if(E===undefined){E=0}this.m_registers[B][E].createFcn=A;this.m_registers[B][E].destroyFcn=D;this.m_registers[B][E].primary=true;if(B!=E){this.m_registers[E][B].createFcn=A;this.m_registers[E][B].destroyFcn=D;this.m_registers[E][B].primary=false}};f.prototype.InitializeRegisters=function(){this.m_registers=new Vector(AA.e_shapeTypeCount);for(var A=0;A<AA.e_shapeTypeCount;A++){this.m_registers[A]=new Vector(AA.e_shapeTypeCount);for(var B=0;B<AA.e_shapeTypeCount;B++){this.m_registers[A][B]=new T}}this.AddType(AD.Create,AD.Destroy,AA.e_circleShape,AA.e_circleShape);this.AddType(J.Create,J.Destroy,AA.e_polygonShape,AA.e_circleShape);this.AddType(t.Create,t.Destroy,AA.e_polygonShape,AA.e_polygonShape);this.AddType(AB.Create,AB.Destroy,AA.e_edgeShape,AA.e_circleShape);this.AddType(AN.Create,AN.Destroy,AA.e_polygonShape,AA.e_edgeShape)};f.prototype.Create=function(A,D){var B=parseInt(A.GetType()),E=parseInt(D.GetType());B=this.m_registers[B][E];if(B.pool){E=B.pool;B.pool=E.m_next;B.poolCount--;E.Reset(A,D);return E}E=B.createFcn;if(E!=null){if(B.primary){E=E(this.m_allocator);E.Reset(A,D)}else{E=E(this.m_allocator);E.Reset(D,A)}return E}else{return null}};f.prototype.Destroy=function(A){if(A.m_manifold.m_pointCount>0){A.m_fixtureA.m_body.SetAwake(true);A.m_fixtureB.m_body.SetAwake(true)}var D=parseInt(A.m_fixtureA.GetType()),B=parseInt(A.m_fixtureB.GetType());D=this.m_registers[D][B];D.poolCount++;A.m_next=D.pool;D.pool=A;D=D.destroyFcn;D(A,this.m_allocator)};T.b2ContactRegister=function(){};n.b2ContactResult=function(){this.position=new m;this.normal=new m;this.id=new AQ};o.b2ContactSolver=function(){this.m_step=new AC;this.m_constraints=new Vector};o.prototype.b2ContactSolver=function(){};o.prototype.Initialize=function(V,R,O,S){if(O===undefined){O=0}var l;this.m_step.Set(V);this.m_allocator=S;V=0;for(this.m_constraintCount=O;this.m_constraints.length<this.m_constraintCount;){this.m_constraints[this.m_constraints.length]=new X}for(V=0;V<O;++V){l=R[V];S=l.m_fixtureA;var h=l.m_fixtureB,W=S.m_shape.m_radius,k=h.m_shape.m_radius,Z=S.m_body,Y=h.m_body,U=l.GetManifold(),N=g.b2MixFriction(S.GetFriction(),h.GetFriction()),L=g.b2MixRestitution(S.GetRestitution(),h.GetRestitution()),I=Z.m_linearVelocity.x,K=Z.m_linearVelocity.y,H=Y.m_linearVelocity.x,M=Y.m_linearVelocity.y,G=Z.m_angularVelocity,B=Y.m_angularVelocity;g.b2Assert(U.m_pointCount>0);o.s_worldManifold.Initialize(U,Z.m_xf,W,Y.m_xf,k);h=o.s_worldManifold.m_normal.x;l=o.s_worldManifold.m_normal.y;S=this.m_constraints[V];S.bodyA=Z;S.bodyB=Y;S.manifold=U;S.normal.x=h;S.normal.y=l;S.pointCount=U.m_pointCount;S.friction=N;S.restitution=L;S.localPlaneNormal.x=U.m_localPlaneNormal.x;S.localPlaneNormal.y=U.m_localPlaneNormal.y;S.localPoint.x=U.m_localPoint.x;S.localPoint.y=U.m_localPoint.y;S.radius=W+k;S.type=U.m_type;for(W=0;W<S.pointCount;++W){N=U.m_points[W];k=S.points[W];k.normalImpulse=N.m_normalImpulse;k.tangentImpulse=N.m_tangentImpulse;k.localPoint.SetV(N.m_localPoint);N=k.rA.x=o.s_worldManifold.m_points[W].x-Z.m_sweep.c.x;L=k.rA.y=o.s_worldManifold.m_points[W].y-Z.m_sweep.c.y;var F=k.rB.x=o.s_worldManifold.m_points[W].x-Y.m_sweep.c.x,A=k.rB.y=o.s_worldManifold.m_points[W].y-Y.m_sweep.c.y,D=N*l-L*h,E=F*l-A*h;D*=D;E*=E;k.normalMass=1/(Z.m_invMass+Y.m_invMass+Z.m_invI*D+Y.m_invI*E);var Q=Z.m_mass*Z.m_invMass+Y.m_mass*Y.m_invMass;Q+=Z.m_mass*Z.m_invI*D+Y.m_mass*Y.m_invI*E;k.equalizedMass=1/Q;E=l;Q=-h;D=N*Q-L*E;E=F*Q-A*E;D*=D;E*=E;k.tangentMass=1/(Z.m_invMass+Y.m_invMass+Z.m_invI*D+Y.m_invI*E);k.velocityBias=0;N=S.normal.x*(H+-B*A-I- -G*L)+S.normal.y*(M+B*F-K-G*N);if(N<-g.b2_velocityThreshold){k.velocityBias+=-S.restitution*N}}if(S.pointCount==2){M=S.points[0];H=S.points[1];U=Z.m_invMass;Z=Z.m_invI;I=Y.m_invMass;Y=Y.m_invI;K=M.rA.x*l-M.rA.y*h;M=M.rB.x*l-M.rB.y*h;G=H.rA.x*l-H.rA.y*h;H=H.rB.x*l-H.rB.y*h;h=U+I+Z*K*K+Y*M*M;l=U+I+Z*G*G+Y*H*H;Y=U+I+Z*K*G+Y*M*H;if(h*h<100*(h*l-Y*Y)){S.K.col1.Set(h,Y);S.K.col2.Set(Y,l);S.K.GetInverse(S.normalMass)}else{S.pointCount=1}}}};o.prototype.InitVelocityConstraints=function(N){for(var K=0;K<this.m_constraintCount;++K){var I=this.m_constraints[K],L=I.bodyA,V=I.bodyB,S=L.m_invMass,O=L.m_invI,U=V.m_invMass,R=V.m_invI,Q=I.normal.x,M=I.normal.y,H=M,F=-Q,D=0,E=0;if(N.warmStarting){E=I.pointCount;for(D=0;D<E;++D){var B=I.points[D];B.normalImpulse*=N.dtRatio;B.tangentImpulse*=N.dtRatio;var G=B.normalImpulse*Q+B.tangentImpulse*H,A=B.normalImpulse*M+B.tangentImpulse*F;L.m_angularVelocity-=O*(B.rA.x*A-B.rA.y*G);L.m_linearVelocity.x-=S*G;L.m_linearVelocity.y-=S*A;V.m_angularVelocity+=R*(B.rB.x*A-B.rB.y*G);V.m_linearVelocity.x+=U*G;V.m_linearVelocity.y+=U*A}}else{E=I.pointCount;for(D=0;D<E;++D){L=I.points[D];L.normalImpulse=0;L.tangentImpulse=0}}}};o.prototype.SolveVelocityConstraints=function(){for(var V=0,R,O=0,S=0,l=0,h=S=S=O=O=0,W=O=O=0,k=O=l=0,Z=0,Y,U=0;U<this.m_constraintCount;++U){l=this.m_constraints[U];var N=l.bodyA,L=l.bodyB,I=N.m_angularVelocity,K=L.m_angularVelocity,H=N.m_linearVelocity,M=L.m_linearVelocity,G=N.m_invMass,B=N.m_invI,F=L.m_invMass,A=L.m_invI;k=l.normal.x;var D=Z=l.normal.y;Y=-k;W=l.friction;for(V=0;V<l.pointCount;V++){R=l.points[V];O=M.x-K*R.rB.y-H.x+I*R.rA.y;S=M.y+K*R.rB.x-H.y-I*R.rA.x;O=O*D+S*Y;O=R.tangentMass*-O;S=W*R.normalImpulse;S=e.Clamp(R.tangentImpulse+O,-S,S);O=S-R.tangentImpulse;h=O*D;O=O*Y;H.x-=G*h;H.y-=G*O;I-=B*(R.rA.x*O-R.rA.y*h);M.x+=F*h;M.y+=F*O;K+=A*(R.rB.x*O-R.rB.y*h);R.tangentImpulse=S}parseInt(l.pointCount);if(l.pointCount==1){R=l.points[0];O=M.x+-K*R.rB.y-H.x- -I*R.rA.y;S=M.y+K*R.rB.x-H.y-I*R.rA.x;l=O*k+S*Z;O=-R.normalMass*(l-R.velocityBias);S=R.normalImpulse+O;S=S>0?S:0;O=S-R.normalImpulse;h=O*k;O=O*Z;H.x-=G*h;H.y-=G*O;I-=B*(R.rA.x*O-R.rA.y*h);M.x+=F*h;M.y+=F*O;K+=A*(R.rB.x*O-R.rB.y*h);R.normalImpulse=S}else{R=l.points[0];V=l.points[1];O=R.normalImpulse;W=V.normalImpulse;var E=(M.x-K*R.rB.y-H.x+I*R.rA.y)*k+(M.y+K*R.rB.x-H.y-I*R.rA.x)*Z,Q=(M.x-K*V.rB.y-H.x+I*V.rA.y)*k+(M.y+K*V.rB.x-H.y-I*V.rA.x)*Z;S=E-R.velocityBias;h=Q-V.velocityBias;Y=l.K;S-=Y.col1.x*O+Y.col2.x*W;for(h-=Y.col1.y*O+Y.col2.y*W;;){Y=l.normalMass;D=-(Y.col1.x*S+Y.col2.x*h);Y=-(Y.col1.y*S+Y.col2.y*h);if(D>=0&&Y>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}D=-R.normalMass*S;Y=0;Q=l.K.col1.y*D+h;if(D>=0&&Q>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}D=0;Y=-V.normalMass*h;E=l.K.col2.x*Y+S;if(Y>=0&&E>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}Y=D=0;E=S;Q=h;if(E>=0&&Q>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}break}}N.m_angularVelocity=I;L.m_angularVelocity=K}};o.prototype.FinalizeVelocityConstraints=function(){for(var B=0;B<this.m_constraintCount;++B){for(var E=this.m_constraints[B],D=E.manifold,G=0;G<E.pointCount;++G){var A=D.m_points[G],F=E.points[G];A.m_normalImpulse=F.normalImpulse;A.m_tangentImpulse=F.tangentImpulse}}};o.prototype.SolvePositionConstraints=function(N){if(N===undefined){N=0}for(var K=0,I=0;I<this.m_constraintCount;I++){var L=this.m_constraints[I],V=L.bodyA,S=L.bodyB,O=V.m_mass*V.m_invMass,U=V.m_mass*V.m_invI,R=S.m_mass*S.m_invMass,Q=S.m_mass*S.m_invI;o.s_psm.Initialize(L);for(var M=o.s_psm.m_normal,H=0;H<L.pointCount;H++){var F=L.points[H],D=o.s_psm.m_points[H],E=o.s_psm.m_separations[H],B=D.x-V.m_sweep.c.x,G=D.y-V.m_sweep.c.y,A=D.x-S.m_sweep.c.x;D=D.y-S.m_sweep.c.y;K=K<E?K:E;E=e.Clamp(N*(E+g.b2_linearSlop),-g.b2_maxLinearCorrection,0);E=-F.equalizedMass*E;F=E*M.x;E=E*M.y;V.m_sweep.c.x-=O*F;V.m_sweep.c.y-=O*E;V.m_sweep.a-=U*(B*E-G*F);V.SynchronizeTransform();S.m_sweep.c.x+=R*F;S.m_sweep.c.y+=R*E;S.m_sweep.a+=Q*(A*E-D*F);S.SynchronizeTransform()}}return K>-1.5*g.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold=new AM;Box2D.Dynamics.Contacts.b2ContactSolver.s_psm=new AF});Box2D.inherit(AB,Box2D.Dynamics.Contacts.b2Contact);AB.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AB.b2EdgeAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AB.Create=function(){return new AB};AB.Destroy=function(){};AB.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};AB.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape() instanceof AE?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AG?this.m_fixtureB.GetShape():null,B.m_xf)};AB.prototype.b2CollideEdgeAndCircle=function(){};Box2D.inherit(P,Box2D.Dynamics.Contacts.b2Contact);P.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;P.b2NullContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};P.prototype.b2NullContact=function(){this.__super.b2Contact.call(this)};P.prototype.Evaluate=function(){};Box2D.inherit(J,Box2D.Dynamics.Contacts.b2Contact);J.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;J.b2PolyAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};J.Create=function(){return new J};J.Destroy=function(){};J.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B);g.b2Assert(A.GetType()==AA.e_polygonShape);g.b2Assert(B.GetType()==AA.e_circleShape)};J.prototype.Evaluate=function(){var A=this.m_fixtureA.m_body,B=this.m_fixtureB.m_body;b.CollidePolygonAndCircle(this.m_manifold,this.m_fixtureA.GetShape() instanceof x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AG?this.m_fixtureB.GetShape():null,B.m_xf)};Box2D.inherit(AN,Box2D.Dynamics.Contacts.b2Contact);AN.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AN.b2PolyAndEdgeContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AN.Create=function(){return new AN};AN.Destroy=function(){};AN.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B);g.b2Assert(A.GetType()==AA.e_polygonShape);g.b2Assert(B.GetType()==AA.e_edgeShape)};AN.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape() instanceof x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AE?this.m_fixtureB.GetShape():null,B.m_xf)};AN.prototype.b2CollidePolyAndEdge=function(){};Box2D.inherit(t,Box2D.Dynamics.Contacts.b2Contact);t.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;t.b2PolygonContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};t.Create=function(){return new t};t.Destroy=function(){};t.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};t.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();b.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape() instanceof x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof x?this.m_fixtureB.GetShape():null,B.m_xf)};AF.b2PositionSolverManifold=function(){};AF.prototype.b2PositionSolverManifold=function(){this.m_normal=new m;this.m_separations=new Vector_a2j_Number(g.b2_maxManifoldPoints);this.m_points=new Vector(g.b2_maxManifoldPoints);for(var A=0;A<g.b2_maxManifoldPoints;A++){this.m_points[A]=new m}};AF.prototype.Initialize=function(D){g.b2Assert(D.pointCount>0);var G=0,F=0,I=0,B,H=0,E=0;switch(D.type){case C.e_circles:B=D.bodyA.m_xf.R;I=D.localPoint;G=D.bodyA.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);F=D.bodyA.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);B=D.bodyB.m_xf.R;I=D.points[0].localPoint;H=D.bodyB.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);B=D.bodyB.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);I=H-G;E=B-F;var A=I*I+E*E;if(A>Number.MIN_VALUE*Number.MIN_VALUE){A=Math.sqrt(A);this.m_normal.x=I/A;this.m_normal.y=E/A}else{this.m_normal.x=1;this.m_normal.y=0}this.m_points[0].x=0.5*(G+H);this.m_points[0].y=0.5*(F+B);this.m_separations[0]=I*this.m_normal.x+E*this.m_normal.y-D.radius;break;case C.e_faceA:B=D.bodyA.m_xf.R;I=D.localPlaneNormal;this.m_normal.x=B.col1.x*I.x+B.col2.x*I.y;this.m_normal.y=B.col1.y*I.x+B.col2.y*I.y;B=D.bodyA.m_xf.R;I=D.localPoint;H=D.bodyA.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);E=D.bodyA.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);B=D.bodyB.m_xf.R;for(G=0;G<D.pointCount;++G){I=D.points[G].localPoint;F=D.bodyB.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);I=D.bodyB.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);this.m_separations[G]=(F-H)*this.m_normal.x+(I-E)*this.m_normal.y-D.radius;this.m_points[G].x=F;this.m_points[G].y=I}break;case C.e_faceB:B=D.bodyB.m_xf.R;I=D.localPlaneNormal;this.m_normal.x=B.col1.x*I.x+B.col2.x*I.y;this.m_normal.y=B.col1.y*I.x+B.col2.y*I.y;B=D.bodyB.m_xf.R;I=D.localPoint;H=D.bodyB.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);E=D.bodyB.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);B=D.bodyA.m_xf.R;for(G=0;G<D.pointCount;++G){I=D.points[G].localPoint;F=D.bodyA.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);I=D.bodyA.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);this.m_separations[G]=(F-H)*this.m_normal.x+(I-E)*this.m_normal.y-D.radius;this.m_points[G].Set(F,I)}this.m_normal.x*=-1;this.m_normal.y*=-1}};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointA=new m;Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointB=new m})})();(function(){var P=Box2D.Common.Math.b2Mat22,O=Box2D.Common.Math.b2Math,M=Box2D.Common.Math.b2Vec2,L=Box2D.Common.b2Color,N=Box2D.Dynamics.Controllers.b2BuoyancyController,E=Box2D.Dynamics.Controllers.b2ConstantAccelController,I=Box2D.Dynamics.Controllers.b2ConstantForceController,D=Box2D.Dynamics.Controllers.b2Controller,C=Box2D.Dynamics.Controllers.b2ControllerEdge,J=Box2D.Dynamics.Controllers.b2GravityController,H=Box2D.Dynamics.Controllers.b2TensorDampingController;Box2D.inherit(N,Box2D.Dynamics.Controllers.b2Controller);N.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;N.b2BuoyancyController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.normal=new M(0,-1);this.density=this.offset=0;this.velocity=new M(0,0);this.linearDrag=2;this.angularDrag=1;this.useDensity=false;this.useWorldGravity=true;this.gravity=null};N.prototype.Step=function(){if(this.m_bodyList){if(this.useWorldGravity){this.gravity=this.GetWorld().GetGravity().Copy()}for(var K=this.m_bodyList;K;K=K.nextBody){var R=K.body;if(R.IsAwake()!=false){for(var S=new M,F=new M,B=0,G=0,Q=R.GetFixtureList();Q;Q=Q.GetNext()){var U=new M,A=Q.GetShape().ComputeSubmergedArea(this.normal,this.offset,R.GetTransform(),U);B+=A;S.x+=A*U.x;S.y+=A*U.y;var T=0;T=1;G+=A*T;F.x+=A*U.x*T;F.y+=A*U.y*T}S.x/=B;S.y/=B;F.x/=G;F.y/=G;if(!(B<Number.MIN_VALUE)){G=this.gravity.GetNegative();G.Multiply(this.density*B);R.ApplyForce(G,F);F=R.GetLinearVelocityFromWorldPoint(S);F.Subtract(this.velocity);F.Multiply(-this.linearDrag*B);R.ApplyForce(F,S);R.ApplyTorque(-R.GetInertia()/R.GetMass()*B*R.GetAngularVelocity()*this.angularDrag)}}}}};N.prototype.Draw=function(G){var B=new M,F=new M;B.x=this.normal.x*this.offset+this.normal.y*1000;B.y=this.normal.y*this.offset-this.normal.x*1000;F.x=this.normal.x*this.offset-this.normal.y*1000;F.y=this.normal.y*this.offset+this.normal.x*1000;var A=new L(0,0,1);G.DrawSegment(B,F,A)};Box2D.inherit(E,Box2D.Dynamics.Controllers.b2Controller);E.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;E.b2ConstantAccelController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.A=new M(0,0)};E.prototype.Step=function(F){F=new M(this.A.x*F.dt,this.A.y*F.dt);for(var A=this.m_bodyList;A;A=A.nextBody){var B=A.body;B.IsAwake()&&B.SetLinearVelocity(new M(B.GetLinearVelocity().x+F.x,B.GetLinearVelocity().y+F.y))}};Box2D.inherit(I,Box2D.Dynamics.Controllers.b2Controller);I.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;I.b2ConstantForceController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.F=new M(0,0)};I.prototype.Step=function(){for(var B=this.m_bodyList;B;B=B.nextBody){var A=B.body;A.IsAwake()&&A.ApplyForce(this.F,A.GetWorldCenter())}};D.b2Controller=function(){};D.prototype.Step=function(){};D.prototype.Draw=function(){};D.prototype.AddBody=function(B){var A=new C;A.controller=this;A.body=B;A.nextBody=this.m_bodyList;A.prevBody=null;this.m_bodyList=A;if(A.nextBody){A.nextBody.prevBody=A}this.m_bodyCount++;A.nextController=B.m_controllerList;A.prevController=null;B.m_controllerList=A;if(A.nextController){A.nextController.prevController=A}B.m_controllerCount++};D.prototype.RemoveBody=function(B){for(var A=B.m_controllerList;A&&A.controller!=this;){A=A.nextController}if(A.prevBody){A.prevBody.nextBody=A.nextBody}if(A.nextBody){A.nextBody.prevBody=A.prevBody}if(A.nextController){A.nextController.prevController=A.prevController}if(A.prevController){A.prevController.nextController=A.nextController}if(this.m_bodyList==A){this.m_bodyList=A.nextBody}if(B.m_controllerList==A){B.m_controllerList=A.nextController}B.m_controllerCount--;this.m_bodyCount--};D.prototype.Clear=function(){for(;this.m_bodyList;){this.RemoveBody(this.m_bodyList.body)}};D.prototype.GetNext=function(){return this.m_next};D.prototype.GetWorld=function(){return this.m_world};D.prototype.GetBodyList=function(){return this.m_bodyList};C.b2ControllerEdge=function(){};Box2D.inherit(J,Box2D.Dynamics.Controllers.b2Controller);J.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;J.b2GravityController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.G=1;this.invSqr=true};J.prototype.Step=function(){var K=null,R=null,S=null,F=0,B=null,G=null,Q=null,U=0,A=0,T=0;U=null;if(this.invSqr){for(K=this.m_bodyList;K;K=K.nextBody){R=K.body;S=R.GetWorldCenter();F=R.GetMass();for(B=this.m_bodyList;B!=K;B=B.nextBody){G=B.body;Q=G.GetWorldCenter();U=Q.x-S.x;A=Q.y-S.y;T=U*U+A*A;if(!(T<Number.MIN_VALUE)){U=new M(U,A);U.Multiply(this.G/T/Math.sqrt(T)*F*G.GetMass());R.IsAwake()&&R.ApplyForce(U,S);U.Multiply(-1);G.IsAwake()&&G.ApplyForce(U,Q)}}}}else{for(K=this.m_bodyList;K;K=K.nextBody){R=K.body;S=R.GetWorldCenter();F=R.GetMass();for(B=this.m_bodyList;B!=K;B=B.nextBody){G=B.body;Q=G.GetWorldCenter();U=Q.x-S.x;A=Q.y-S.y;T=U*U+A*A;if(!(T<Number.MIN_VALUE)){U=new M(U,A);U.Multiply(this.G/T*F*G.GetMass());R.IsAwake()&&R.ApplyForce(U,S);U.Multiply(-1);G.IsAwake()&&G.ApplyForce(U,Q)}}}}};Box2D.inherit(H,Box2D.Dynamics.Controllers.b2Controller);H.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;H.b2TensorDampingController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.T=new P;this.maxTimestep=0};H.prototype.SetAxisAligned=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.T.col1.x=-B;this.T.col1.y=0;this.T.col2.x=0;this.T.col2.y=-A;this.maxTimestep=B>0||A>0?1/Math.max(B,A):0};H.prototype.Step=function(G){G=G.dt;if(!(G<=Number.MIN_VALUE)){if(G>this.maxTimestep&&this.maxTimestep>0){G=this.maxTimestep}for(var B=this.m_bodyList;B;B=B.nextBody){var F=B.body;if(F.IsAwake()){var A=F.GetWorldVector(O.MulMV(this.T,F.GetLocalVector(F.GetLinearVelocity())));F.SetLinearVelocity(new M(F.GetLinearVelocity().x+A.x*G,F.GetLinearVelocity().y+A.y*G))}}}}})();(function(){var AE=Box2D.Common.b2Settings,AC=Box2D.Common.Math.b2Mat22,o=Box2D.Common.Math.b2Mat33,t=Box2D.Common.Math.b2Math,AB=Box2D.Common.Math.b2Vec2,AI=Box2D.Common.Math.b2Vec3,X=Box2D.Dynamics.Joints.b2DistanceJoint,AJ=Box2D.Dynamics.Joints.b2DistanceJointDef,AH=Box2D.Dynamics.Joints.b2FrictionJoint,f=Box2D.Dynamics.Joints.b2FrictionJointDef,T=Box2D.Dynamics.Joints.b2GearJoint,l=Box2D.Dynamics.Joints.b2GearJointDef,m=Box2D.Dynamics.Joints.b2Jacobian,x=Box2D.Dynamics.Joints.b2Joint,P=Box2D.Dynamics.Joints.b2JointDef,J=Box2D.Dynamics.Joints.b2JointEdge,AK=Box2D.Dynamics.Joints.b2LineJoint,n=Box2D.Dynamics.Joints.b2LineJointDef,AD=Box2D.Dynamics.Joints.b2MouseJoint,AG=Box2D.Dynamics.Joints.b2MouseJointDef,AA=Box2D.Dynamics.Joints.b2PrismaticJoint,g=Box2D.Dynamics.Joints.b2PrismaticJointDef,AF=Box2D.Dynamics.Joints.b2PulleyJoint,e=Box2D.Dynamics.Joints.b2PulleyJointDef,h=Box2D.Dynamics.Joints.b2RevoluteJoint,b=Box2D.Dynamics.Joints.b2RevoluteJointDef,AL=Box2D.Dynamics.Joints.b2WeldJoint,C=Box2D.Dynamics.Joints.b2WeldJointDef;Box2D.inherit(X,Box2D.Dynamics.Joints.b2Joint);X.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;X.b2DistanceJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_u=new AB};X.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};X.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};X.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse*this.m_u.x,A*this.m_impulse*this.m_u.y)};X.prototype.GetReactionTorque=function(){return 0};X.prototype.GetLength=function(){return this.m_length};X.prototype.SetLength=function(A){if(A===undefined){A=0}this.m_length=A};X.prototype.GetFrequency=function(){return this.m_frequencyHz};X.prototype.SetFrequency=function(A){if(A===undefined){A=0}this.m_frequencyHz=A};X.prototype.GetDampingRatio=function(){return this.m_dampingRatio};X.prototype.SetDampingRatio=function(A){if(A===undefined){A=0}this.m_dampingRatio=A};X.prototype.b2DistanceJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_length=A.length;this.m_frequencyHz=A.frequencyHz;this.m_dampingRatio=A.dampingRatio;this.m_bias=this.m_gamma=this.m_impulse=0};X.prototype.InitVelocityConstraints=function(I){var G,E=0,F=this.m_bodyA,B=this.m_bodyB;G=F.m_xf.R;var A=this.m_localAnchor1.x-F.m_sweep.localCenter.x,D=this.m_localAnchor1.y-F.m_sweep.localCenter.y;E=G.col1.x*A+G.col2.x*D;D=G.col1.y*A+G.col2.y*D;A=E;G=B.m_xf.R;var M=this.m_localAnchor2.x-B.m_sweep.localCenter.x,K=this.m_localAnchor2.y-B.m_sweep.localCenter.y;E=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=E;this.m_u.x=B.m_sweep.c.x+M-F.m_sweep.c.x-A;this.m_u.y=B.m_sweep.c.y+K-F.m_sweep.c.y-D;E=Math.sqrt(this.m_u.x*this.m_u.x+this.m_u.y*this.m_u.y);E>AE.b2_linearSlop?this.m_u.Multiply(1/E):this.m_u.SetZero();G=A*this.m_u.y-D*this.m_u.x;var H=M*this.m_u.y-K*this.m_u.x;G=F.m_invMass+F.m_invI*G*G+B.m_invMass+B.m_invI*H*H;this.m_mass=G!=0?1/G:0;if(this.m_frequencyHz>0){E=E-this.m_length;H=2*Math.PI*this.m_frequencyHz;var L=this.m_mass*H*H;this.m_gamma=I.dt*(2*this.m_mass*this.m_dampingRatio*H+I.dt*L);this.m_gamma=this.m_gamma!=0?1/this.m_gamma:0;this.m_bias=E*I.dt*L*this.m_gamma;this.m_mass=G+this.m_gamma;this.m_mass=this.m_mass!=0?1/this.m_mass:0}if(I.warmStarting){this.m_impulse*=I.dtRatio;I=this.m_impulse*this.m_u.x;G=this.m_impulse*this.m_u.y;F.m_linearVelocity.x-=F.m_invMass*I;F.m_linearVelocity.y-=F.m_invMass*G;F.m_angularVelocity-=F.m_invI*(A*G-D*I);B.m_linearVelocity.x+=B.m_invMass*I;B.m_linearVelocity.y+=B.m_invMass*G;B.m_angularVelocity+=B.m_invI*(M*G-K*I)}else{this.m_impulse=0}};X.prototype.SolveVelocityConstraints=function(){var H,E=this.m_bodyA,B=this.m_bodyB;H=E.m_xf.R;var D=this.m_localAnchor1.x-E.m_sweep.localCenter.x,G=this.m_localAnchor1.y-E.m_sweep.localCenter.y,F=H.col1.x*D+H.col2.x*G;G=H.col1.y*D+H.col2.y*G;D=F;H=B.m_xf.R;var I=this.m_localAnchor2.x-B.m_sweep.localCenter.x,A=this.m_localAnchor2.y-B.m_sweep.localCenter.y;F=H.col1.x*I+H.col2.x*A;A=H.col1.y*I+H.col2.y*A;I=F;F=-this.m_mass*(this.m_u.x*(B.m_linearVelocity.x+-B.m_angularVelocity*A-(E.m_linearVelocity.x+-E.m_angularVelocity*G))+this.m_u.y*(B.m_linearVelocity.y+B.m_angularVelocity*I-(E.m_linearVelocity.y+E.m_angularVelocity*D))+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=F;H=F*this.m_u.x;F=F*this.m_u.y;E.m_linearVelocity.x-=E.m_invMass*H;E.m_linearVelocity.y-=E.m_invMass*F;E.m_angularVelocity-=E.m_invI*(D*F-G*H);B.m_linearVelocity.x+=B.m_invMass*H;B.m_linearVelocity.y+=B.m_invMass*F;B.m_angularVelocity+=B.m_invI*(I*F-A*H)};X.prototype.SolvePositionConstraints=function(){var I;if(this.m_frequencyHz>0){return true}var G=this.m_bodyA,E=this.m_bodyB;I=G.m_xf.R;var F=this.m_localAnchor1.x-G.m_sweep.localCenter.x,B=this.m_localAnchor1.y-G.m_sweep.localCenter.y,A=I.col1.x*F+I.col2.x*B;B=I.col1.y*F+I.col2.y*B;F=A;I=E.m_xf.R;var D=this.m_localAnchor2.x-E.m_sweep.localCenter.x,L=this.m_localAnchor2.y-E.m_sweep.localCenter.y;A=I.col1.x*D+I.col2.x*L;L=I.col1.y*D+I.col2.y*L;D=A;A=E.m_sweep.c.x+D-G.m_sweep.c.x-F;var K=E.m_sweep.c.y+L-G.m_sweep.c.y-B;I=Math.sqrt(A*A+K*K);A/=I;K/=I;I=I-this.m_length;I=t.Clamp(I,-AE.b2_maxLinearCorrection,AE.b2_maxLinearCorrection);var H=-this.m_mass*I;this.m_u.Set(A,K);A=H*this.m_u.x;K=H*this.m_u.y;G.m_sweep.c.x-=G.m_invMass*A;G.m_sweep.c.y-=G.m_invMass*K;G.m_sweep.a-=G.m_invI*(F*K-B*A);E.m_sweep.c.x+=E.m_invMass*A;E.m_sweep.c.y+=E.m_invMass*K;E.m_sweep.a+=E.m_invI*(D*K-L*A);G.SynchronizeTransform();E.SynchronizeTransform();return t.Abs(I)<AE.b2_linearSlop};Box2D.inherit(AJ,Box2D.Dynamics.Joints.b2JointDef);AJ.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;AJ.b2DistanceJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB};AJ.prototype.b2DistanceJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_distanceJoint;this.length=1;this.dampingRatio=this.frequencyHz=0};AJ.prototype.Initialize=function(E,D,A,B){this.bodyA=E;this.bodyB=D;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(A));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(B));E=B.x-A.x;A=B.y-A.y;this.length=Math.sqrt(E*E+A*A);this.dampingRatio=this.frequencyHz=0};Box2D.inherit(AH,Box2D.Dynamics.Joints.b2Joint);AH.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AH.b2FrictionJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new AB;this.m_localAnchorB=new AB;this.m_linearMass=new AC;this.m_linearImpulse=new AB};AH.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};AH.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};AH.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_linearImpulse.x,A*this.m_linearImpulse.y)};AH.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_angularImpulse};AH.prototype.SetMaxForce=function(A){if(A===undefined){A=0}this.m_maxForce=A};AH.prototype.GetMaxForce=function(){return this.m_maxForce};AH.prototype.SetMaxTorque=function(A){if(A===undefined){A=0}this.m_maxTorque=A};AH.prototype.GetMaxTorque=function(){return this.m_maxTorque};AH.prototype.b2FrictionJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchorA.SetV(A.localAnchorA);this.m_localAnchorB.SetV(A.localAnchorB);this.m_linearMass.SetZero();this.m_angularMass=0;this.m_linearImpulse.SetZero();this.m_angularImpulse=0;this.m_maxForce=A.maxForce;this.m_maxTorque=A.maxTorque};AH.prototype.InitVelocityConstraints=function(K){var G,E=0,F=this.m_bodyA,B=this.m_bodyB;G=F.m_xf.R;var A=this.m_localAnchorA.x-F.m_sweep.localCenter.x,D=this.m_localAnchorA.y-F.m_sweep.localCenter.y;E=G.col1.x*A+G.col2.x*D;D=G.col1.y*A+G.col2.y*D;A=E;G=B.m_xf.R;var N=this.m_localAnchorB.x-B.m_sweep.localCenter.x,L=this.m_localAnchorB.y-B.m_sweep.localCenter.y;E=G.col1.x*N+G.col2.x*L;L=G.col1.y*N+G.col2.y*L;N=E;G=F.m_invMass;E=B.m_invMass;var H=F.m_invI,M=B.m_invI,I=new AC;I.col1.x=G+E;I.col2.x=0;I.col1.y=0;I.col2.y=G+E;I.col1.x+=H*D*D;I.col2.x+=-H*A*D;I.col1.y+=-H*A*D;I.col2.y+=H*A*A;I.col1.x+=M*L*L;I.col2.x+=-M*N*L;I.col1.y+=-M*N*L;I.col2.y+=M*N*N;I.GetInverse(this.m_linearMass);this.m_angularMass=H+M;if(this.m_angularMass>0){this.m_angularMass=1/this.m_angularMass}if(K.warmStarting){this.m_linearImpulse.x*=K.dtRatio;this.m_linearImpulse.y*=K.dtRatio;this.m_angularImpulse*=K.dtRatio;K=this.m_linearImpulse;F.m_linearVelocity.x-=G*K.x;F.m_linearVelocity.y-=G*K.y;F.m_angularVelocity-=H*(A*K.y-D*K.x+this.m_angularImpulse);B.m_linearVelocity.x+=E*K.x;B.m_linearVelocity.y+=E*K.y;B.m_angularVelocity+=M*(N*K.y-L*K.x+this.m_angularImpulse)}else{this.m_linearImpulse.SetZero();this.m_angularImpulse=0}};AH.prototype.SolveVelocityConstraints=function(R){var M,K=0,L=this.m_bodyA,G=this.m_bodyB,F=L.m_linearVelocity,H=L.m_angularVelocity,V=G.m_linearVelocity,S=G.m_angularVelocity,N=L.m_invMass,U=G.m_invMass,Q=L.m_invI,O=G.m_invI;M=L.m_xf.R;var I=this.m_localAnchorA.x-L.m_sweep.localCenter.x,E=this.m_localAnchorA.y-L.m_sweep.localCenter.y;K=M.col1.x*I+M.col2.x*E;E=M.col1.y*I+M.col2.y*E;I=K;M=G.m_xf.R;var D=this.m_localAnchorB.x-G.m_sweep.localCenter.x,A=this.m_localAnchorB.y-G.m_sweep.localCenter.y;K=M.col1.x*D+M.col2.x*A;A=M.col1.y*D+M.col2.y*A;D=K;M=0;K=-this.m_angularMass*(S-H);var B=this.m_angularImpulse;M=R.dt*this.m_maxTorque;this.m_angularImpulse=t.Clamp(this.m_angularImpulse+K,-M,M);K=this.m_angularImpulse-B;H-=Q*K;S+=O*K;M=t.MulMV(this.m_linearMass,new AB(-(V.x-S*A-F.x+H*E),-(V.y+S*D-F.y-H*I)));K=this.m_linearImpulse.Copy();this.m_linearImpulse.Add(M);M=R.dt*this.m_maxForce;if(this.m_linearImpulse.LengthSquared()>M*M){this.m_linearImpulse.Normalize();this.m_linearImpulse.Multiply(M)}M=t.SubtractVV(this.m_linearImpulse,K);F.x-=N*M.x;F.y-=N*M.y;H-=Q*(I*M.y-E*M.x);V.x+=U*M.x;V.y+=U*M.y;S+=O*(D*M.y-A*M.x);L.m_angularVelocity=H;G.m_angularVelocity=S};AH.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(f,Box2D.Dynamics.Joints.b2JointDef);f.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;f.b2FrictionJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB};f.prototype.b2FrictionJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_frictionJoint;this.maxTorque=this.maxForce=0};f.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(A));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(A))};Box2D.inherit(T,Box2D.Dynamics.Joints.b2Joint);T.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;T.b2GearJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new AB;this.m_groundAnchor2=new AB;this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_J=new m};T.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};T.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};T.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse*this.m_J.linearB.x,A*this.m_impulse*this.m_J.linearB.y)};T.prototype.GetReactionTorque=function(F){if(F===undefined){F=0}var D=this.m_bodyB.m_xf.R,A=this.m_localAnchor1.x-this.m_bodyB.m_sweep.localCenter.x,B=this.m_localAnchor1.y-this.m_bodyB.m_sweep.localCenter.y,E=D.col1.x*A+D.col2.x*B;B=D.col1.y*A+D.col2.y*B;A=E;return F*(this.m_impulse*this.m_J.angularB-A*this.m_impulse*this.m_J.linearB.y+B*this.m_impulse*this.m_J.linearB.x)};T.prototype.GetRatio=function(){return this.m_ratio};T.prototype.SetRatio=function(A){if(A===undefined){A=0}this.m_ratio=A};T.prototype.b2GearJoint=function(F){this.__super.b2Joint.call(this,F);var D=parseInt(F.joint1.m_type),A=parseInt(F.joint2.m_type);this.m_prismatic2=this.m_revolute2=this.m_prismatic1=this.m_revolute1=null;var B=0,E=0;this.m_ground1=F.joint1.GetBodyA();this.m_bodyA=F.joint1.GetBodyB();if(D==x.e_revoluteJoint){this.m_revolute1=F.joint1 instanceof h?F.joint1:null;this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2);B=this.m_revolute1.GetJointAngle()}else{this.m_prismatic1=F.joint1 instanceof AA?F.joint1:null;this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2);B=this.m_prismatic1.GetJointTranslation()}this.m_ground2=F.joint2.GetBodyA();this.m_bodyB=F.joint2.GetBodyB();if(A==x.e_revoluteJoint){this.m_revolute2=F.joint2 instanceof h?F.joint2:null;this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2);E=this.m_revolute2.GetJointAngle()}else{this.m_prismatic2=F.joint2 instanceof AA?F.joint2:null;this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2);E=this.m_prismatic2.GetJointTranslation()}this.m_ratio=F.ratio;this.m_constant=B+this.m_ratio*E;this.m_impulse=0};T.prototype.InitVelocityConstraints=function(I){var G=this.m_ground1,E=this.m_ground2,F=this.m_bodyA,B=this.m_bodyB,A=0,D=0,M=0,K=0,H=M=0,L=0;this.m_J.SetZero();if(this.m_revolute1){this.m_J.angularA=-1;L+=F.m_invI}else{G=G.m_xf.R;D=this.m_prismatic1.m_localXAxis1;A=G.col1.x*D.x+G.col2.x*D.y;D=G.col1.y*D.x+G.col2.y*D.y;G=F.m_xf.R;M=this.m_localAnchor1.x-F.m_sweep.localCenter.x;K=this.m_localAnchor1.y-F.m_sweep.localCenter.y;H=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=H;M=M*D-K*A;this.m_J.linearA.Set(-A,-D);this.m_J.angularA=-M;L+=F.m_invMass+F.m_invI*M*M}if(this.m_revolute2){this.m_J.angularB=-this.m_ratio;L+=this.m_ratio*this.m_ratio*B.m_invI}else{G=E.m_xf.R;D=this.m_prismatic2.m_localXAxis1;A=G.col1.x*D.x+G.col2.x*D.y;D=G.col1.y*D.x+G.col2.y*D.y;G=B.m_xf.R;M=this.m_localAnchor2.x-B.m_sweep.localCenter.x;K=this.m_localAnchor2.y-B.m_sweep.localCenter.y;H=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=H;M=M*D-K*A;this.m_J.linearB.Set(-this.m_ratio*A,-this.m_ratio*D);this.m_J.angularB=-this.m_ratio*M;L+=this.m_ratio*this.m_ratio*(B.m_invMass+B.m_invI*M*M)}this.m_mass=L>0?1/L:0;if(I.warmStarting){F.m_linearVelocity.x+=F.m_invMass*this.m_impulse*this.m_J.linearA.x;F.m_linearVelocity.y+=F.m_invMass*this.m_impulse*this.m_J.linearA.y;F.m_angularVelocity+=F.m_invI*this.m_impulse*this.m_J.angularA;B.m_linearVelocity.x+=B.m_invMass*this.m_impulse*this.m_J.linearB.x;B.m_linearVelocity.y+=B.m_invMass*this.m_impulse*this.m_J.linearB.y;B.m_angularVelocity+=B.m_invI*this.m_impulse*this.m_J.angularB}else{this.m_impulse=0}};T.prototype.SolveVelocityConstraints=function(){var D=this.m_bodyA,B=this.m_bodyB,A=-this.m_mass*this.m_J.Compute(D.m_linearVelocity,D.m_angularVelocity,B.m_linearVelocity,B.m_angularVelocity);this.m_impulse+=A;D.m_linearVelocity.x+=D.m_invMass*A*this.m_J.linearA.x;D.m_linearVelocity.y+=D.m_invMass*A*this.m_J.linearA.y;D.m_angularVelocity+=D.m_invI*A*this.m_J.angularA;B.m_linearVelocity.x+=B.m_invMass*A*this.m_J.linearB.x;B.m_linearVelocity.y+=B.m_invMass*A*this.m_J.linearB.y;B.m_angularVelocity+=B.m_invI*A*this.m_J.angularB};T.prototype.SolvePositionConstraints=function(){var E=this.m_bodyA,D=this.m_bodyB,A=0,B=0;A=this.m_revolute1?this.m_revolute1.GetJointAngle():this.m_prismatic1.GetJointTranslation();B=this.m_revolute2?this.m_revolute2.GetJointAngle():this.m_prismatic2.GetJointTranslation();A=-this.m_mass*(this.m_constant-(A+this.m_ratio*B));E.m_sweep.c.x+=E.m_invMass*A*this.m_J.linearA.x;E.m_sweep.c.y+=E.m_invMass*A*this.m_J.linearA.y;E.m_sweep.a+=E.m_invI*A*this.m_J.angularA;D.m_sweep.c.x+=D.m_invMass*A*this.m_J.linearB.x;D.m_sweep.c.y+=D.m_invMass*A*this.m_J.linearB.y;D.m_sweep.a+=D.m_invI*A*this.m_J.angularB;E.SynchronizeTransform();D.SynchronizeTransform();return 0<AE.b2_linearSlop};Box2D.inherit(l,Box2D.Dynamics.Joints.b2JointDef);l.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;l.b2GearJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments)};l.prototype.b2GearJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_gearJoint;this.joint2=this.joint1=null;this.ratio=1};m.b2Jacobian=function(){this.linearA=new AB;this.linearB=new AB};m.prototype.SetZero=function(){this.linearA.SetZero();this.angularA=0;this.linearB.SetZero();this.angularB=0};m.prototype.Set=function(E,D,A,B){if(D===undefined){D=0}if(B===undefined){B=0}this.linearA.SetV(E);this.angularA=D;this.linearB.SetV(A);this.angularB=B};m.prototype.Compute=function(E,D,A,B){if(D===undefined){D=0}if(B===undefined){B=0}return this.linearA.x*E.x+this.linearA.y*E.y+this.angularA*D+(this.linearB.x*A.x+this.linearB.y*A.y)+this.angularB*B};x.b2Joint=function(){this.m_edgeA=new J;this.m_edgeB=new J;this.m_localCenterA=new AB;this.m_localCenterB=new AB};x.prototype.GetType=function(){return this.m_type};x.prototype.GetAnchorA=function(){return null};x.prototype.GetAnchorB=function(){return null};x.prototype.GetReactionForce=function(){return null};x.prototype.GetReactionTorque=function(){return 0};x.prototype.GetBodyA=function(){return this.m_bodyA};x.prototype.GetBodyB=function(){return this.m_bodyB};x.prototype.GetNext=function(){return this.m_next};x.prototype.GetUserData=function(){return this.m_userData};x.prototype.SetUserData=function(A){this.m_userData=A};x.prototype.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()};x.Create=function(B){var A=null;switch(B.type){case x.e_distanceJoint:A=new X(B instanceof AJ?B:null);break;case x.e_mouseJoint:A=new AD(B instanceof AG?B:null);break;case x.e_prismaticJoint:A=new AA(B instanceof g?B:null);break;case x.e_revoluteJoint:A=new h(B instanceof b?B:null);break;case x.e_pulleyJoint:A=new AF(B instanceof e?B:null);break;case x.e_gearJoint:A=new T(B instanceof l?B:null);break;case x.e_lineJoint:A=new AK(B instanceof n?B:null);break;case x.e_weldJoint:A=new AL(B instanceof C?B:null);break;case x.e_frictionJoint:A=new AH(B instanceof f?B:null)}return A};x.Destroy=function(){};x.prototype.b2Joint=function(A){AE.b2Assert(A.bodyA!=A.bodyB);this.m_type=A.type;this.m_next=this.m_prev=null;this.m_bodyA=A.bodyA;this.m_bodyB=A.bodyB;this.m_collideConnected=A.collideConnected;this.m_islandFlag=false;this.m_userData=A.userData};x.prototype.InitVelocityConstraints=function(){};x.prototype.SolveVelocityConstraints=function(){};x.prototype.FinalizeVelocityConstraints=function(){};x.prototype.SolvePositionConstraints=function(){return false};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2Joint.e_unknownJoint=0;Box2D.Dynamics.Joints.b2Joint.e_revoluteJoint=1;Box2D.Dynamics.Joints.b2Joint.e_prismaticJoint=2;Box2D.Dynamics.Joints.b2Joint.e_distanceJoint=3;Box2D.Dynamics.Joints.b2Joint.e_pulleyJoint=4;Box2D.Dynamics.Joints.b2Joint.e_mouseJoint=5;Box2D.Dynamics.Joints.b2Joint.e_gearJoint=6;Box2D.Dynamics.Joints.b2Joint.e_lineJoint=7;Box2D.Dynamics.Joints.b2Joint.e_weldJoint=8;Box2D.Dynamics.Joints.b2Joint.e_frictionJoint=9;Box2D.Dynamics.Joints.b2Joint.e_inactiveLimit=0;Box2D.Dynamics.Joints.b2Joint.e_atLowerLimit=1;Box2D.Dynamics.Joints.b2Joint.e_atUpperLimit=2;Box2D.Dynamics.Joints.b2Joint.e_equalLimits=3});P.b2JointDef=function(){};P.prototype.b2JointDef=function(){this.type=x.e_unknownJoint;this.bodyB=this.bodyA=this.userData=null;this.collideConnected=false};J.b2JointEdge=function(){};Box2D.inherit(AK,Box2D.Dynamics.Joints.b2Joint);AK.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AK.b2LineJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_localXAxis1=new AB;this.m_localYAxis1=new AB;this.m_axis=new AB;this.m_perp=new AB;this.m_K=new AC;this.m_impulse=new AB};AK.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AK.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AK.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x),A*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y))};AK.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.y};AK.prototype.GetJointTranslation=function(){var E=this.m_bodyA,D=this.m_bodyB,A=E.GetWorldPoint(this.m_localAnchor1),B=D.GetWorldPoint(this.m_localAnchor2);D=B.x-A.x;A=B.y-A.y;E=E.GetWorldVector(this.m_localXAxis1);return E.x*D+E.y*A};AK.prototype.GetJointSpeed=function(){var I=this.m_bodyA,G=this.m_bodyB,E;E=I.m_xf.R;var F=this.m_localAnchor1.x-I.m_sweep.localCenter.x,B=this.m_localAnchor1.y-I.m_sweep.localCenter.y,A=E.col1.x*F+E.col2.x*B;B=E.col1.y*F+E.col2.y*B;F=A;E=G.m_xf.R;var D=this.m_localAnchor2.x-G.m_sweep.localCenter.x,M=this.m_localAnchor2.y-G.m_sweep.localCenter.y;A=E.col1.x*D+E.col2.x*M;M=E.col1.y*D+E.col2.y*M;D=A;E=G.m_sweep.c.x+D-(I.m_sweep.c.x+F);A=G.m_sweep.c.y+M-(I.m_sweep.c.y+B);var K=I.GetWorldVector(this.m_localXAxis1),H=I.m_linearVelocity,L=G.m_linearVelocity;I=I.m_angularVelocity;G=G.m_angularVelocity;return E*-I*K.y+A*I*K.x+(K.x*(L.x+-G*M-H.x- -I*B)+K.y*(L.y+G*D-H.y-I*F))};AK.prototype.IsLimitEnabled=function(){return this.m_enableLimit};AK.prototype.EnableLimit=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=A};AK.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};AK.prototype.GetUpperLimit=function(){return this.m_upperTranslation};AK.prototype.SetLimits=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_lowerTranslation=B;this.m_upperTranslation=A};AK.prototype.IsMotorEnabled=function(){return this.m_enableMotor};AK.prototype.EnableMotor=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=A};AK.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};AK.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};AK.prototype.SetMaxMotorForce=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=A};AK.prototype.GetMaxMotorForce=function(){return this.m_maxMotorForce};AK.prototype.GetMotorForce=function(){return this.m_motorImpulse};AK.prototype.b2LineJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_localXAxis1.SetV(A.localAxisA);this.m_localYAxis1.x=-this.m_localXAxis1.y;this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_impulse.SetZero();this.m_motorImpulse=this.m_motorMass=0;this.m_lowerTranslation=A.lowerTranslation;this.m_upperTranslation=A.upperTranslation;this.m_maxMotorForce=A.maxMotorForce;this.m_motorSpeed=A.motorSpeed;this.m_enableLimit=A.enableLimit;this.m_enableMotor=A.enableMotor;this.m_limitState=x.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};AK.prototype.InitVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F,B=0;this.m_localCenterA.SetV(G.GetLocalCenter());this.m_localCenterB.SetV(E.GetLocalCenter());var A=G.GetTransform();E.GetTransform();F=G.m_xf.R;var D=this.m_localAnchor1.x-this.m_localCenterA.x,L=this.m_localAnchor1.y-this.m_localCenterA.y;B=F.col1.x*D+F.col2.x*L;L=F.col1.y*D+F.col2.y*L;D=B;F=E.m_xf.R;var K=this.m_localAnchor2.x-this.m_localCenterB.x,H=this.m_localAnchor2.y-this.m_localCenterB.y;B=F.col1.x*K+F.col2.x*H;H=F.col1.y*K+F.col2.y*H;K=B;F=E.m_sweep.c.x+K-G.m_sweep.c.x-D;B=E.m_sweep.c.y+H-G.m_sweep.c.y-L;this.m_invMassA=G.m_invMass;this.m_invMassB=E.m_invMass;this.m_invIA=G.m_invI;this.m_invIB=E.m_invI;this.m_axis.SetV(t.MulMV(A.R,this.m_localXAxis1));this.m_a1=(F+D)*this.m_axis.y-(B+L)*this.m_axis.x;this.m_a2=K*this.m_axis.y-H*this.m_axis.x;this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2;this.m_motorMass=this.m_motorMass>Number.MIN_VALUE?1/this.m_motorMass:0;this.m_perp.SetV(t.MulMV(A.R,this.m_localYAxis1));this.m_s1=(F+D)*this.m_perp.y-(B+L)*this.m_perp.x;this.m_s2=K*this.m_perp.y-H*this.m_perp.x;A=this.m_invMassA;D=this.m_invMassB;L=this.m_invIA;K=this.m_invIB;this.m_K.col1.x=A+D+L*this.m_s1*this.m_s1+K*this.m_s2*this.m_s2;this.m_K.col1.y=L*this.m_s1*this.m_a1+K*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=A+D+L*this.m_a1*this.m_a1+K*this.m_a2*this.m_a2;if(this.m_enableLimit){F=this.m_axis.x*F+this.m_axis.y*B;if(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){this.m_limitState=x.e_equalLimits}else{if(F<=this.m_lowerTranslation){if(this.m_limitState!=x.e_atLowerLimit){this.m_limitState=x.e_atLowerLimit;this.m_impulse.y=0}}else{if(F>=this.m_upperTranslation){if(this.m_limitState!=x.e_atUpperLimit){this.m_limitState=x.e_atUpperLimit;this.m_impulse.y=0}}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.y=0}}}}else{this.m_limitState=x.e_inactiveLimit}if(this.m_enableMotor==false){this.m_motorImpulse=0}if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_motorImpulse*=I.dtRatio;I=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x;F=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y;B=this.m_impulse.x*this.m_s1+(this.m_motorImpulse+this.m_impulse.y)*this.m_a1;A=this.m_impulse.x*this.m_s2+(this.m_motorImpulse+this.m_impulse.y)*this.m_a2;G.m_linearVelocity.x-=this.m_invMassA*I;G.m_linearVelocity.y-=this.m_invMassA*F;G.m_angularVelocity-=this.m_invIA*B;E.m_linearVelocity.x+=this.m_invMassB*I;E.m_linearVelocity.y+=this.m_invMassB*F;E.m_angularVelocity+=this.m_invIB*A}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};AK.prototype.SolveVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F=G.m_linearVelocity,B=G.m_angularVelocity,A=E.m_linearVelocity,D=E.m_angularVelocity,M=0,K=0,H=0,L=0;if(this.m_enableMotor&&this.m_limitState!=x.e_equalLimits){L=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B));M=this.m_motorImpulse;K=I.dt*this.m_maxMotorForce;this.m_motorImpulse=t.Clamp(this.m_motorImpulse+L,-K,K);L=this.m_motorImpulse-M;M=L*this.m_axis.x;K=L*this.m_axis.y;H=L*this.m_a1;L=L*this.m_a2;F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L}K=this.m_perp.x*(A.x-F.x)+this.m_perp.y*(A.y-F.y)+this.m_s2*D-this.m_s1*B;if(this.m_enableLimit&&this.m_limitState!=x.e_inactiveLimit){H=this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B;M=this.m_impulse.Copy();I=this.m_K.Solve(new AB,-K,-H);this.m_impulse.Add(I);if(this.m_limitState==x.e_atLowerLimit){this.m_impulse.y=t.Max(this.m_impulse.y,0)}else{if(this.m_limitState==x.e_atUpperLimit){this.m_impulse.y=t.Min(this.m_impulse.y,0)}}K=-K-(this.m_impulse.y-M.y)*this.m_K.col2.x;H=0;H=this.m_K.col1.x!=0?K/this.m_K.col1.x+M.x:M.x;this.m_impulse.x=H;I.x=this.m_impulse.x-M.x;I.y=this.m_impulse.y-M.y;M=I.x*this.m_perp.x+I.y*this.m_axis.x;K=I.x*this.m_perp.y+I.y*this.m_axis.y;H=I.x*this.m_s1+I.y*this.m_a1;L=I.x*this.m_s2+I.y*this.m_a2}else{I=0;I=this.m_K.col1.x!=0?-K/this.m_K.col1.x:0;this.m_impulse.x+=I;M=I*this.m_perp.x;K=I*this.m_perp.y;H=I*this.m_s1;L=I*this.m_s2}F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L;G.m_linearVelocity.SetV(F);G.m_angularVelocity=B;E.m_linearVelocity.SetV(A);E.m_angularVelocity=D};AK.prototype.SolvePositionConstraints=function(){var N=this.m_bodyA,I=this.m_bodyB,G=N.m_sweep.c,H=N.m_sweep.a,D=I.m_sweep.c,B=I.m_sweep.a,E,R=0,O=0,K=0,Q=0,M=E=0,L=0;O=false;var F=0,A=AC.FromAngle(H);K=AC.FromAngle(B);E=A;L=this.m_localAnchor1.x-this.m_localCenterA.x;var U=this.m_localAnchor1.y-this.m_localCenterA.y;R=E.col1.x*L+E.col2.x*U;U=E.col1.y*L+E.col2.y*U;L=R;E=K;K=this.m_localAnchor2.x-this.m_localCenterB.x;Q=this.m_localAnchor2.y-this.m_localCenterB.y;R=E.col1.x*K+E.col2.x*Q;Q=E.col1.y*K+E.col2.y*Q;K=R;E=D.x+K-G.x-L;R=D.y+Q-G.y-U;if(this.m_enableLimit){this.m_axis=t.MulMV(A,this.m_localXAxis1);this.m_a1=(E+L)*this.m_axis.y-(R+U)*this.m_axis.x;this.m_a2=K*this.m_axis.y-Q*this.m_axis.x;var S=this.m_axis.x*E+this.m_axis.y*R;if(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){F=t.Clamp(S,-AE.b2_maxLinearCorrection,AE.b2_maxLinearCorrection);M=t.Abs(S);O=true}else{if(S<=this.m_lowerTranslation){F=t.Clamp(S-this.m_lowerTranslation+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);M=this.m_lowerTranslation-S;O=true}else{if(S>=this.m_upperTranslation){F=t.Clamp(S-this.m_upperTranslation+AE.b2_linearSlop,0,AE.b2_maxLinearCorrection);M=S-this.m_upperTranslation;O=true}}}}this.m_perp=t.MulMV(A,this.m_localYAxis1);this.m_s1=(E+L)*this.m_perp.y-(R+U)*this.m_perp.x;this.m_s2=K*this.m_perp.y-Q*this.m_perp.x;A=new AB;U=this.m_perp.x*E+this.m_perp.y*R;M=t.Max(M,t.Abs(U));L=0;if(O){O=this.m_invMassA;K=this.m_invMassB;Q=this.m_invIA;E=this.m_invIB;this.m_K.col1.x=O+K+Q*this.m_s1*this.m_s1+E*this.m_s2*this.m_s2;this.m_K.col1.y=Q*this.m_s1*this.m_a1+E*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=O+K+Q*this.m_a1*this.m_a1+E*this.m_a2*this.m_a2;this.m_K.Solve(A,-U,-F)}else{O=this.m_invMassA;K=this.m_invMassB;Q=this.m_invIA;E=this.m_invIB;F=O+K+Q*this.m_s1*this.m_s1+E*this.m_s2*this.m_s2;O=0;O=F!=0?-U/F:0;A.x=O;A.y=0}F=A.x*this.m_perp.x+A.y*this.m_axis.x;O=A.x*this.m_perp.y+A.y*this.m_axis.y;U=A.x*this.m_s1+A.y*this.m_a1;A=A.x*this.m_s2+A.y*this.m_a2;G.x-=this.m_invMassA*F;G.y-=this.m_invMassA*O;H-=this.m_invIA*U;D.x+=this.m_invMassB*F;D.y+=this.m_invMassB*O;B+=this.m_invIB*A;N.m_sweep.a=H;I.m_sweep.a=B;N.SynchronizeTransform();I.SynchronizeTransform();return M<=AE.b2_linearSlop&&L<=AE.b2_angularSlop};Box2D.inherit(n,Box2D.Dynamics.Joints.b2JointDef);n.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;n.b2LineJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB;this.localAxisA=new AB};n.prototype.b2LineJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_lineJoint;this.localAxisA.Set(1,0);this.enableLimit=false;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=false;this.motorSpeed=this.maxMotorForce=0};n.prototype.Initialize=function(E,D,A,B){this.bodyA=E;this.bodyB=D;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.localAxisA=this.bodyA.GetLocalVector(B)};Box2D.inherit(AD,Box2D.Dynamics.Joints.b2Joint);AD.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AD.b2MouseJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new AC;this.K1=new AC;this.K2=new AC;this.m_localAnchor=new AB;this.m_target=new AB;this.m_impulse=new AB;this.m_mass=new AC;this.m_C=new AB};AD.prototype.GetAnchorA=function(){return this.m_target};AD.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)};AD.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse.x,A*this.m_impulse.y)};AD.prototype.GetReactionTorque=function(){return 0};AD.prototype.GetTarget=function(){return this.m_target};AD.prototype.SetTarget=function(A){this.m_bodyB.IsAwake()==false&&this.m_bodyB.SetAwake(true);this.m_target=A};AD.prototype.GetMaxForce=function(){return this.m_maxForce};AD.prototype.SetMaxForce=function(A){if(A===undefined){A=0}this.m_maxForce=A};AD.prototype.GetFrequency=function(){return this.m_frequencyHz};AD.prototype.SetFrequency=function(A){if(A===undefined){A=0}this.m_frequencyHz=A};AD.prototype.GetDampingRatio=function(){return this.m_dampingRatio};AD.prototype.SetDampingRatio=function(A){if(A===undefined){A=0}this.m_dampingRatio=A};AD.prototype.b2MouseJoint=function(E){this.__super.b2Joint.call(this,E);this.m_target.SetV(E.target);var D=this.m_target.x-this.m_bodyB.m_xf.position.x,A=this.m_target.y-this.m_bodyB.m_xf.position.y,B=this.m_bodyB.m_xf.R;this.m_localAnchor.x=D*B.col1.x+A*B.col1.y;this.m_localAnchor.y=D*B.col2.x+A*B.col2.y;this.m_maxForce=E.maxForce;this.m_impulse.SetZero();this.m_frequencyHz=E.frequencyHz;this.m_dampingRatio=E.dampingRatio;this.m_gamma=this.m_beta=0};AD.prototype.InitVelocityConstraints=function(G){var D=this.m_bodyB,A=D.GetMass(),B=2*Math.PI*this.m_frequencyHz,F=A*B*B;this.m_gamma=G.dt*(2*A*this.m_dampingRatio*B+G.dt*F);this.m_gamma=this.m_gamma!=0?1/this.m_gamma:0;this.m_beta=G.dt*F*this.m_gamma;F=D.m_xf.R;A=this.m_localAnchor.x-D.m_sweep.localCenter.x;B=this.m_localAnchor.y-D.m_sweep.localCenter.y;var E=F.col1.x*A+F.col2.x*B;B=F.col1.y*A+F.col2.y*B;A=E;F=D.m_invMass;E=D.m_invI;this.K1.col1.x=F;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=F;this.K2.col1.x=E*B*B;this.K2.col2.x=-E*A*B;this.K2.col1.y=-E*A*B;this.K2.col2.y=E*A*A;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.col1.x+=this.m_gamma;this.K.col2.y+=this.m_gamma;this.K.GetInverse(this.m_mass);this.m_C.x=D.m_sweep.c.x+A-this.m_target.x;this.m_C.y=D.m_sweep.c.y+B-this.m_target.y;D.m_angularVelocity*=0.98;this.m_impulse.x*=G.dtRatio;this.m_impulse.y*=G.dtRatio;D.m_linearVelocity.x+=F*this.m_impulse.x;D.m_linearVelocity.y+=F*this.m_impulse.y;D.m_angularVelocity+=E*(A*this.m_impulse.y-B*this.m_impulse.x)};AD.prototype.SolveVelocityConstraints=function(H){var E=this.m_bodyB,B,D=0,G=0;B=E.m_xf.R;var F=this.m_localAnchor.x-E.m_sweep.localCenter.x,I=this.m_localAnchor.y-E.m_sweep.localCenter.y;D=B.col1.x*F+B.col2.x*I;I=B.col1.y*F+B.col2.y*I;F=D;D=E.m_linearVelocity.x+-E.m_angularVelocity*I;var A=E.m_linearVelocity.y+E.m_angularVelocity*F;B=this.m_mass;D=D+this.m_beta*this.m_C.x+this.m_gamma*this.m_impulse.x;G=A+this.m_beta*this.m_C.y+this.m_gamma*this.m_impulse.y;A=-(B.col1.x*D+B.col2.x*G);G=-(B.col1.y*D+B.col2.y*G);B=this.m_impulse.x;D=this.m_impulse.y;this.m_impulse.x+=A;this.m_impulse.y+=G;H=H.dt*this.m_maxForce;this.m_impulse.LengthSquared()>H*H&&this.m_impulse.Multiply(H/this.m_impulse.Length());A=this.m_impulse.x-B;G=this.m_impulse.y-D;E.m_linearVelocity.x+=E.m_invMass*A;E.m_linearVelocity.y+=E.m_invMass*G;E.m_angularVelocity+=E.m_invI*(F*G-I*A)};AD.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(AG,Box2D.Dynamics.Joints.b2JointDef);AG.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;AG.b2MouseJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.target=new AB};AG.prototype.b2MouseJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_mouseJoint;this.maxForce=0;this.frequencyHz=5;this.dampingRatio=0.7};Box2D.inherit(AA,Box2D.Dynamics.Joints.b2Joint);AA.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AA.b2PrismaticJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_localXAxis1=new AB;this.m_localYAxis1=new AB;this.m_axis=new AB;this.m_perp=new AB;this.m_K=new o;this.m_impulse=new AI};AA.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AA.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AA.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),A*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))};AA.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.y};AA.prototype.GetJointTranslation=function(){var E=this.m_bodyA,D=this.m_bodyB,A=E.GetWorldPoint(this.m_localAnchor1),B=D.GetWorldPoint(this.m_localAnchor2);D=B.x-A.x;A=B.y-A.y;E=E.GetWorldVector(this.m_localXAxis1);return E.x*D+E.y*A};AA.prototype.GetJointSpeed=function(){var I=this.m_bodyA,G=this.m_bodyB,E;E=I.m_xf.R;var F=this.m_localAnchor1.x-I.m_sweep.localCenter.x,B=this.m_localAnchor1.y-I.m_sweep.localCenter.y,A=E.col1.x*F+E.col2.x*B;B=E.col1.y*F+E.col2.y*B;F=A;E=G.m_xf.R;var D=this.m_localAnchor2.x-G.m_sweep.localCenter.x,M=this.m_localAnchor2.y-G.m_sweep.localCenter.y;A=E.col1.x*D+E.col2.x*M;M=E.col1.y*D+E.col2.y*M;D=A;E=G.m_sweep.c.x+D-(I.m_sweep.c.x+F);A=G.m_sweep.c.y+M-(I.m_sweep.c.y+B);var K=I.GetWorldVector(this.m_localXAxis1),H=I.m_linearVelocity,L=G.m_linearVelocity;I=I.m_angularVelocity;G=G.m_angularVelocity;return E*-I*K.y+A*I*K.x+(K.x*(L.x+-G*M-H.x- -I*B)+K.y*(L.y+G*D-H.y-I*F))};AA.prototype.IsLimitEnabled=function(){return this.m_enableLimit};AA.prototype.EnableLimit=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=A};AA.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};AA.prototype.GetUpperLimit=function(){return this.m_upperTranslation};AA.prototype.SetLimits=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_lowerTranslation=B;this.m_upperTranslation=A};AA.prototype.IsMotorEnabled=function(){return this.m_enableMotor};AA.prototype.EnableMotor=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=A};AA.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};AA.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};AA.prototype.SetMaxMotorForce=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=A};AA.prototype.GetMotorForce=function(){return this.m_motorImpulse};AA.prototype.b2PrismaticJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_localXAxis1.SetV(A.localAxisA);this.m_localYAxis1.x=-this.m_localXAxis1.y;this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_refAngle=A.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=this.m_motorMass=0;this.m_lowerTranslation=A.lowerTranslation;this.m_upperTranslation=A.upperTranslation;this.m_maxMotorForce=A.maxMotorForce;this.m_motorSpeed=A.motorSpeed;this.m_enableLimit=A.enableLimit;this.m_enableMotor=A.enableMotor;this.m_limitState=x.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};AA.prototype.InitVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F,B=0;this.m_localCenterA.SetV(G.GetLocalCenter());this.m_localCenterB.SetV(E.GetLocalCenter());var A=G.GetTransform();E.GetTransform();F=G.m_xf.R;var D=this.m_localAnchor1.x-this.m_localCenterA.x,L=this.m_localAnchor1.y-this.m_localCenterA.y;B=F.col1.x*D+F.col2.x*L;L=F.col1.y*D+F.col2.y*L;D=B;F=E.m_xf.R;var K=this.m_localAnchor2.x-this.m_localCenterB.x,H=this.m_localAnchor2.y-this.m_localCenterB.y;B=F.col1.x*K+F.col2.x*H;H=F.col1.y*K+F.col2.y*H;K=B;F=E.m_sweep.c.x+K-G.m_sweep.c.x-D;B=E.m_sweep.c.y+H-G.m_sweep.c.y-L;this.m_invMassA=G.m_invMass;this.m_invMassB=E.m_invMass;this.m_invIA=G.m_invI;this.m_invIB=E.m_invI;this.m_axis.SetV(t.MulMV(A.R,this.m_localXAxis1));this.m_a1=(F+D)*this.m_axis.y-(B+L)*this.m_axis.x;this.m_a2=K*this.m_axis.y-H*this.m_axis.x;this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2;if(this.m_motorMass>Number.MIN_VALUE){this.m_motorMass=1/this.m_motorMass}this.m_perp.SetV(t.MulMV(A.R,this.m_localYAxis1));this.m_s1=(F+D)*this.m_perp.y-(B+L)*this.m_perp.x;this.m_s2=K*this.m_perp.y-H*this.m_perp.x;A=this.m_invMassA;D=this.m_invMassB;L=this.m_invIA;K=this.m_invIB;this.m_K.col1.x=A+D+L*this.m_s1*this.m_s1+K*this.m_s2*this.m_s2;this.m_K.col1.y=L*this.m_s1+K*this.m_s2;this.m_K.col1.z=L*this.m_s1*this.m_a1+K*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=L+K;this.m_K.col2.z=L*this.m_a1+K*this.m_a2;this.m_K.col3.x=this.m_K.col1.z;this.m_K.col3.y=this.m_K.col2.z;this.m_K.col3.z=A+D+L*this.m_a1*this.m_a1+K*this.m_a2*this.m_a2;if(this.m_enableLimit){F=this.m_axis.x*F+this.m_axis.y*B;if(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){this.m_limitState=x.e_equalLimits}else{if(F<=this.m_lowerTranslation){if(this.m_limitState!=x.e_atLowerLimit){this.m_limitState=x.e_atLowerLimit;this.m_impulse.z=0}}else{if(F>=this.m_upperTranslation){if(this.m_limitState!=x.e_atUpperLimit){this.m_limitState=x.e_atUpperLimit;this.m_impulse.z=0}}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.z=0}}}}else{this.m_limitState=x.e_inactiveLimit}if(this.m_enableMotor==false){this.m_motorImpulse=0}if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_motorImpulse*=I.dtRatio;I=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x;F=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y;B=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1;A=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;G.m_linearVelocity.x-=this.m_invMassA*I;G.m_linearVelocity.y-=this.m_invMassA*F;G.m_angularVelocity-=this.m_invIA*B;E.m_linearVelocity.x+=this.m_invMassB*I;E.m_linearVelocity.y+=this.m_invMassB*F;E.m_angularVelocity+=this.m_invIB*A}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};AA.prototype.SolveVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F=G.m_linearVelocity,B=G.m_angularVelocity,A=E.m_linearVelocity,D=E.m_angularVelocity,M=0,K=0,H=0,L=0;if(this.m_enableMotor&&this.m_limitState!=x.e_equalLimits){L=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B));M=this.m_motorImpulse;I=I.dt*this.m_maxMotorForce;this.m_motorImpulse=t.Clamp(this.m_motorImpulse+L,-I,I);L=this.m_motorImpulse-M;M=L*this.m_axis.x;K=L*this.m_axis.y;H=L*this.m_a1;L=L*this.m_a2;F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L}H=this.m_perp.x*(A.x-F.x)+this.m_perp.y*(A.y-F.y)+this.m_s2*D-this.m_s1*B;K=D-B;if(this.m_enableLimit&&this.m_limitState!=x.e_inactiveLimit){I=this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B;M=this.m_impulse.Copy();I=this.m_K.Solve33(new AI,-H,-K,-I);this.m_impulse.Add(I);if(this.m_limitState==x.e_atLowerLimit){this.m_impulse.z=t.Max(this.m_impulse.z,0)}else{if(this.m_limitState==x.e_atUpperLimit){this.m_impulse.z=t.Min(this.m_impulse.z,0)}}H=-H-(this.m_impulse.z-M.z)*this.m_K.col3.x;K=-K-(this.m_impulse.z-M.z)*this.m_K.col3.y;K=this.m_K.Solve22(new AB,H,K);K.x+=M.x;K.y+=M.y;this.m_impulse.x=K.x;this.m_impulse.y=K.y;I.x=this.m_impulse.x-M.x;I.y=this.m_impulse.y-M.y;I.z=this.m_impulse.z-M.z;M=I.x*this.m_perp.x+I.z*this.m_axis.x;K=I.x*this.m_perp.y+I.z*this.m_axis.y;H=I.x*this.m_s1+I.y+I.z*this.m_a1;L=I.x*this.m_s2+I.y+I.z*this.m_a2}else{I=this.m_K.Solve22(new AB,-H,-K);this.m_impulse.x+=I.x;this.m_impulse.y+=I.y;M=I.x*this.m_perp.x;K=I.x*this.m_perp.y;H=I.x*this.m_s1+I.y;L=I.x*this.m_s2+I.y}F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L;G.m_linearVelocity.SetV(F);G.m_angularVelocity=B;E.m_linearVelocity.SetV(A);E.m_angularVelocity=D};AA.prototype.SolvePositionConstraints=function(){var N=this.m_bodyA,I=this.m_bodyB,G=N.m_sweep.c,H=N.m_sweep.a,D=I.m_sweep.c,B=I.m_sweep.a,E,R=0,O=0,K=0,Q=R=E=0,M=0;O=false;var L=0,F=AC.FromAngle(H),A=AC.FromAngle(B);E=F;M=this.m_localAnchor1.x-this.m_localCenterA.x;var U=this.m_localAnchor1.y-this.m_localCenterA.y;R=E.col1.x*M+E.col2.x*U;U=E.col1.y*M+E.col2.y*U;M=R;E=A;A=this.m_localAnchor2.x-this.m_localCenterB.x;K=this.m_localAnchor2.y-this.m_localCenterB.y;R=E.col1.x*A+E.col2.x*K;K=E.col1.y*A+E.col2.y*K;A=R;E=D.x+A-G.x-M;R=D.y+K-G.y-U;if(this.m_enableLimit){this.m_axis=t.MulMV(F,this.m_localXAxis1);this.m_a1=(E+M)*this.m_axis.y-(R+U)*this.m_axis.x;this.m_a2=A*this.m_axis.y-K*this.m_axis.x;var S=this.m_axis.x*E+this.m_axis.y*R;if(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){L=t.Clamp(S,-AE.b2_maxLinearCorrection,AE.b2_maxLinearCorrection);Q=t.Abs(S);O=true}else{if(S<=this.m_lowerTranslation){L=t.Clamp(S-this.m_lowerTranslation+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);Q=this.m_lowerTranslation-S;O=true}else{if(S>=this.m_upperTranslation){L=t.Clamp(S-this.m_upperTranslation+AE.b2_linearSlop,0,AE.b2_maxLinearCorrection);Q=S-this.m_upperTranslation;O=true}}}}this.m_perp=t.MulMV(F,this.m_localYAxis1);this.m_s1=(E+M)*this.m_perp.y-(R+U)*this.m_perp.x;this.m_s2=A*this.m_perp.y-K*this.m_perp.x;F=new AI;U=this.m_perp.x*E+this.m_perp.y*R;A=B-H-this.m_refAngle;Q=t.Max(Q,t.Abs(U));M=t.Abs(A);if(O){O=this.m_invMassA;K=this.m_invMassB;E=this.m_invIA;R=this.m_invIB;this.m_K.col1.x=O+K+E*this.m_s1*this.m_s1+R*this.m_s2*this.m_s2;this.m_K.col1.y=E*this.m_s1+R*this.m_s2;this.m_K.col1.z=E*this.m_s1*this.m_a1+R*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=E+R;this.m_K.col2.z=E*this.m_a1+R*this.m_a2;this.m_K.col3.x=this.m_K.col1.z;this.m_K.col3.y=this.m_K.col2.z;this.m_K.col3.z=O+K+E*this.m_a1*this.m_a1+R*this.m_a2*this.m_a2;this.m_K.Solve33(F,-U,-A,-L)}else{O=this.m_invMassA;K=this.m_invMassB;E=this.m_invIA;R=this.m_invIB;L=E*this.m_s1+R*this.m_s2;S=E+R;this.m_K.col1.Set(O+K+E*this.m_s1*this.m_s1+R*this.m_s2*this.m_s2,L,0);this.m_K.col2.Set(L,S,0);L=this.m_K.Solve22(new AB,-U,-A);F.x=L.x;F.y=L.y;F.z=0}L=F.x*this.m_perp.x+F.z*this.m_axis.x;O=F.x*this.m_perp.y+F.z*this.m_axis.y;U=F.x*this.m_s1+F.y+F.z*this.m_a1;F=F.x*this.m_s2+F.y+F.z*this.m_a2;G.x-=this.m_invMassA*L;G.y-=this.m_invMassA*O;H-=this.m_invIA*U;D.x+=this.m_invMassB*L;D.y+=this.m_invMassB*O;B+=this.m_invIB*F;N.m_sweep.a=H;I.m_sweep.a=B;N.SynchronizeTransform();I.SynchronizeTransform();return Q<=AE.b2_linearSlop&&M<=AE.b2_angularSlop};Box2D.inherit(g,Box2D.Dynamics.Joints.b2JointDef);g.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;g.b2PrismaticJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB;this.localAxisA=new AB};g.prototype.b2PrismaticJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_prismaticJoint;this.localAxisA.Set(1,0);this.referenceAngle=0;this.enableLimit=false;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=false;this.motorSpeed=this.maxMotorForce=0};g.prototype.Initialize=function(E,D,A,B){this.bodyA=E;this.bodyB=D;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.localAxisA=this.bodyA.GetLocalVector(B);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(AF,Box2D.Dynamics.Joints.b2Joint);AF.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AF.b2PulleyJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new AB;this.m_groundAnchor2=new AB;this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_u1=new AB;this.m_u2=new AB};AF.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AF.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AF.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse*this.m_u2.x,A*this.m_impulse*this.m_u2.y)};AF.prototype.GetReactionTorque=function(){return 0};AF.prototype.GetGroundAnchorA=function(){var A=this.m_ground.m_xf.position.Copy();A.Add(this.m_groundAnchor1);return A};AF.prototype.GetGroundAnchorB=function(){var A=this.m_ground.m_xf.position.Copy();A.Add(this.m_groundAnchor2);return A};AF.prototype.GetLength1=function(){var B=this.m_bodyA.GetWorldPoint(this.m_localAnchor1),A=B.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x);B=B.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y);return Math.sqrt(A*A+B*B)};AF.prototype.GetLength2=function(){var B=this.m_bodyB.GetWorldPoint(this.m_localAnchor2),A=B.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor2.x);B=B.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor2.y);return Math.sqrt(A*A+B*B)};AF.prototype.GetRatio=function(){return this.m_ratio};AF.prototype.b2PulleyJoint=function(A){this.__super.b2Joint.call(this,A);this.m_ground=this.m_bodyA.m_world.m_groundBody;this.m_groundAnchor1.x=A.groundAnchorA.x-this.m_ground.m_xf.position.x;this.m_groundAnchor1.y=A.groundAnchorA.y-this.m_ground.m_xf.position.y;this.m_groundAnchor2.x=A.groundAnchorB.x-this.m_ground.m_xf.position.x;this.m_groundAnchor2.y=A.groundAnchorB.y-this.m_ground.m_xf.position.y;this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_ratio=A.ratio;this.m_constant=A.lengthA+this.m_ratio*A.lengthB;this.m_maxLength1=t.Min(A.maxLengthA,this.m_constant-this.m_ratio*AF.b2_minPulleyLength);this.m_maxLength2=t.Min(A.maxLengthB,(this.m_constant-AF.b2_minPulleyLength)/this.m_ratio);this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0};AF.prototype.InitVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F;F=G.m_xf.R;var B=this.m_localAnchor1.x-G.m_sweep.localCenter.x,A=this.m_localAnchor1.y-G.m_sweep.localCenter.y,D=F.col1.x*B+F.col2.x*A;A=F.col1.y*B+F.col2.y*A;B=D;F=E.m_xf.R;var M=this.m_localAnchor2.x-E.m_sweep.localCenter.x,K=this.m_localAnchor2.y-E.m_sweep.localCenter.y;D=F.col1.x*M+F.col2.x*K;K=F.col1.y*M+F.col2.y*K;M=D;F=E.m_sweep.c.x+M;D=E.m_sweep.c.y+K;var H=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,L=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y;this.m_u1.Set(G.m_sweep.c.x+B-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x),G.m_sweep.c.y+A-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y));this.m_u2.Set(F-H,D-L);F=this.m_u1.Length();D=this.m_u2.Length();F>AE.b2_linearSlop?this.m_u1.Multiply(1/F):this.m_u1.SetZero();D>AE.b2_linearSlop?this.m_u2.Multiply(1/D):this.m_u2.SetZero();if(this.m_constant-F-this.m_ratio*D>0){this.m_state=x.e_inactiveLimit;this.m_impulse=0}else{this.m_state=x.e_atUpperLimit}if(F<this.m_maxLength1){this.m_limitState1=x.e_inactiveLimit;this.m_limitImpulse1=0}else{this.m_limitState1=x.e_atUpperLimit}if(D<this.m_maxLength2){this.m_limitState2=x.e_inactiveLimit;this.m_limitImpulse2=0}else{this.m_limitState2=x.e_atUpperLimit}F=B*this.m_u1.y-A*this.m_u1.x;D=M*this.m_u2.y-K*this.m_u2.x;this.m_limitMass1=G.m_invMass+G.m_invI*F*F;this.m_limitMass2=E.m_invMass+E.m_invI*D*D;this.m_pulleyMass=this.m_limitMass1+this.m_ratio*this.m_ratio*this.m_limitMass2;this.m_limitMass1=1/this.m_limitMass1;this.m_limitMass2=1/this.m_limitMass2;this.m_pulleyMass=1/this.m_pulleyMass;if(I.warmStarting){this.m_impulse*=I.dtRatio;this.m_limitImpulse1*=I.dtRatio;this.m_limitImpulse2*=I.dtRatio;I=(-this.m_impulse-this.m_limitImpulse1)*this.m_u1.x;F=(-this.m_impulse-this.m_limitImpulse1)*this.m_u1.y;D=(-this.m_ratio*this.m_impulse-this.m_limitImpulse2)*this.m_u2.x;H=(-this.m_ratio*this.m_impulse-this.m_limitImpulse2)*this.m_u2.y;G.m_linearVelocity.x+=G.m_invMass*I;G.m_linearVelocity.y+=G.m_invMass*F;G.m_angularVelocity+=G.m_invI*(B*F-A*I);E.m_linearVelocity.x+=E.m_invMass*D;E.m_linearVelocity.y+=E.m_invMass*H;E.m_angularVelocity+=E.m_invI*(M*H-K*D)}else{this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0}};AF.prototype.SolveVelocityConstraints=function(){var I=this.m_bodyA,G=this.m_bodyB,E;E=I.m_xf.R;var F=this.m_localAnchor1.x-I.m_sweep.localCenter.x,B=this.m_localAnchor1.y-I.m_sweep.localCenter.y,A=E.col1.x*F+E.col2.x*B;B=E.col1.y*F+E.col2.y*B;F=A;E=G.m_xf.R;var D=this.m_localAnchor2.x-G.m_sweep.localCenter.x,L=this.m_localAnchor2.y-G.m_sweep.localCenter.y;A=E.col1.x*D+E.col2.x*L;L=E.col1.y*D+E.col2.y*L;D=A;var K=A=E=0,H=0;E=H=E=H=K=A=E=0;if(this.m_state==x.e_atUpperLimit){E=I.m_linearVelocity.x+-I.m_angularVelocity*B;A=I.m_linearVelocity.y+I.m_angularVelocity*F;K=G.m_linearVelocity.x+-G.m_angularVelocity*L;H=G.m_linearVelocity.y+G.m_angularVelocity*D;E=-(this.m_u1.x*E+this.m_u1.y*A)-this.m_ratio*(this.m_u2.x*K+this.m_u2.y*H);H=this.m_pulleyMass*-E;E=this.m_impulse;this.m_impulse=t.Max(0,this.m_impulse+H);H=this.m_impulse-E;E=-H*this.m_u1.x;A=-H*this.m_u1.y;K=-this.m_ratio*H*this.m_u2.x;H=-this.m_ratio*H*this.m_u2.y;I.m_linearVelocity.x+=I.m_invMass*E;I.m_linearVelocity.y+=I.m_invMass*A;I.m_angularVelocity+=I.m_invI*(F*A-B*E);G.m_linearVelocity.x+=G.m_invMass*K;G.m_linearVelocity.y+=G.m_invMass*H;G.m_angularVelocity+=G.m_invI*(D*H-L*K)}if(this.m_limitState1==x.e_atUpperLimit){E=I.m_linearVelocity.x+-I.m_angularVelocity*B;A=I.m_linearVelocity.y+I.m_angularVelocity*F;E=-(this.m_u1.x*E+this.m_u1.y*A);H=-this.m_limitMass1*E;E=this.m_limitImpulse1;this.m_limitImpulse1=t.Max(0,this.m_limitImpulse1+H);H=this.m_limitImpulse1-E;E=-H*this.m_u1.x;A=-H*this.m_u1.y;I.m_linearVelocity.x+=I.m_invMass*E;I.m_linearVelocity.y+=I.m_invMass*A;I.m_angularVelocity+=I.m_invI*(F*A-B*E)}if(this.m_limitState2==x.e_atUpperLimit){K=G.m_linearVelocity.x+-G.m_angularVelocity*L;H=G.m_linearVelocity.y+G.m_angularVelocity*D;E=-(this.m_u2.x*K+this.m_u2.y*H);H=-this.m_limitMass2*E;E=this.m_limitImpulse2;this.m_limitImpulse2=t.Max(0,this.m_limitImpulse2+H);H=this.m_limitImpulse2-E;K=-H*this.m_u2.x;H=-H*this.m_u2.y;G.m_linearVelocity.x+=G.m_invMass*K;G.m_linearVelocity.y+=G.m_invMass*H;G.m_angularVelocity+=G.m_invI*(D*H-L*K)}};AF.prototype.SolvePositionConstraints=function(){var N=this.m_bodyA,I=this.m_bodyB,G,H=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,D=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,B=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,E=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y,R=0,O=0,K=0,Q=0,M=G=0,L=0,F=0,A=M=F=G=M=G=0;if(this.m_state==x.e_atUpperLimit){G=N.m_xf.R;R=this.m_localAnchor1.x-N.m_sweep.localCenter.x;O=this.m_localAnchor1.y-N.m_sweep.localCenter.y;M=G.col1.x*R+G.col2.x*O;O=G.col1.y*R+G.col2.y*O;R=M;G=I.m_xf.R;K=this.m_localAnchor2.x-I.m_sweep.localCenter.x;Q=this.m_localAnchor2.y-I.m_sweep.localCenter.y;M=G.col1.x*K+G.col2.x*Q;Q=G.col1.y*K+G.col2.y*Q;K=M;G=N.m_sweep.c.x+R;M=N.m_sweep.c.y+O;L=I.m_sweep.c.x+K;F=I.m_sweep.c.y+Q;this.m_u1.Set(G-H,M-D);this.m_u2.Set(L-B,F-E);G=this.m_u1.Length();M=this.m_u2.Length();G>AE.b2_linearSlop?this.m_u1.Multiply(1/G):this.m_u1.SetZero();M>AE.b2_linearSlop?this.m_u2.Multiply(1/M):this.m_u2.SetZero();G=this.m_constant-G-this.m_ratio*M;A=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);F=-this.m_pulleyMass*G;G=-F*this.m_u1.x;M=-F*this.m_u1.y;L=-this.m_ratio*F*this.m_u2.x;F=-this.m_ratio*F*this.m_u2.y;N.m_sweep.c.x+=N.m_invMass*G;N.m_sweep.c.y+=N.m_invMass*M;N.m_sweep.a+=N.m_invI*(R*M-O*G);I.m_sweep.c.x+=I.m_invMass*L;I.m_sweep.c.y+=I.m_invMass*F;I.m_sweep.a+=I.m_invI*(K*F-Q*L);N.SynchronizeTransform();I.SynchronizeTransform()}if(this.m_limitState1==x.e_atUpperLimit){G=N.m_xf.R;R=this.m_localAnchor1.x-N.m_sweep.localCenter.x;O=this.m_localAnchor1.y-N.m_sweep.localCenter.y;M=G.col1.x*R+G.col2.x*O;O=G.col1.y*R+G.col2.y*O;R=M;G=N.m_sweep.c.x+R;M=N.m_sweep.c.y+O;this.m_u1.Set(G-H,M-D);G=this.m_u1.Length();if(G>AE.b2_linearSlop){this.m_u1.x*=1/G;this.m_u1.y*=1/G}else{this.m_u1.SetZero()}G=this.m_maxLength1-G;A=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);F=-this.m_limitMass1*G;G=-F*this.m_u1.x;M=-F*this.m_u1.y;N.m_sweep.c.x+=N.m_invMass*G;N.m_sweep.c.y+=N.m_invMass*M;N.m_sweep.a+=N.m_invI*(R*M-O*G);N.SynchronizeTransform()}if(this.m_limitState2==x.e_atUpperLimit){G=I.m_xf.R;K=this.m_localAnchor2.x-I.m_sweep.localCenter.x;Q=this.m_localAnchor2.y-I.m_sweep.localCenter.y;M=G.col1.x*K+G.col2.x*Q;Q=G.col1.y*K+G.col2.y*Q;K=M;L=I.m_sweep.c.x+K;F=I.m_sweep.c.y+Q;this.m_u2.Set(L-B,F-E);M=this.m_u2.Length();if(M>AE.b2_linearSlop){this.m_u2.x*=1/M;this.m_u2.y*=1/M}else{this.m_u2.SetZero()}G=this.m_maxLength2-M;A=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);F=-this.m_limitMass2*G;L=-F*this.m_u2.x;F=-F*this.m_u2.y;I.m_sweep.c.x+=I.m_invMass*L;I.m_sweep.c.y+=I.m_invMass*F;I.m_sweep.a+=I.m_invI*(K*F-Q*L);I.SynchronizeTransform()}return A<AE.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2PulleyJoint.b2_minPulleyLength=2});Box2D.inherit(e,Box2D.Dynamics.Joints.b2JointDef);e.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;e.b2PulleyJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.groundAnchorA=new AB;this.groundAnchorB=new AB;this.localAnchorA=new AB;this.localAnchorB=new AB};e.prototype.b2PulleyJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_pulleyJoint;this.groundAnchorA.Set(-1,1);this.groundAnchorB.Set(1,1);this.localAnchorA.Set(-1,0);this.localAnchorB.Set(1,0);this.maxLengthB=this.lengthB=this.maxLengthA=this.lengthA=0;this.ratio=1;this.collideConnected=true};e.prototype.Initialize=function(G,D,A,B,F,E,H){if(H===undefined){H=0}this.bodyA=G;this.bodyB=D;this.groundAnchorA.SetV(A);this.groundAnchorB.SetV(B);this.localAnchorA=this.bodyA.GetLocalPoint(F);this.localAnchorB=this.bodyB.GetLocalPoint(E);G=F.x-A.x;A=F.y-A.y;this.lengthA=Math.sqrt(G*G+A*A);A=E.x-B.x;B=E.y-B.y;this.lengthB=Math.sqrt(A*A+B*B);this.ratio=H;H=this.lengthA+this.ratio*this.lengthB;this.maxLengthA=H-this.ratio*AF.b2_minPulleyLength;this.maxLengthB=(H-AF.b2_minPulleyLength)/this.ratio};Box2D.inherit(h,Box2D.Dynamics.Joints.b2Joint);h.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;h.b2RevoluteJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new AC;this.K1=new AC;this.K2=new AC;this.K3=new AC;this.impulse3=new AI;this.impulse2=new AB;this.reduced=new AB;this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_impulse=new AI;this.m_mass=new o};h.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};h.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};h.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse.x,A*this.m_impulse.y)};h.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.z};h.prototype.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle};h.prototype.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity};h.prototype.IsLimitEnabled=function(){return this.m_enableLimit};h.prototype.EnableLimit=function(A){this.m_enableLimit=A};h.prototype.GetLowerLimit=function(){return this.m_lowerAngle};h.prototype.GetUpperLimit=function(){return this.m_upperAngle};h.prototype.SetLimits=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.m_lowerAngle=B;this.m_upperAngle=A};h.prototype.IsMotorEnabled=function(){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);return this.m_enableMotor};h.prototype.EnableMotor=function(A){this.m_enableMotor=A};h.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};h.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};h.prototype.SetMaxMotorTorque=function(A){if(A===undefined){A=0}this.m_maxMotorTorque=A};h.prototype.GetMotorTorque=function(){return this.m_maxMotorTorque};h.prototype.b2RevoluteJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_referenceAngle=A.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=0;this.m_lowerAngle=A.lowerAngle;this.m_upperAngle=A.upperAngle;this.m_maxMotorTorque=A.maxMotorTorque;this.m_motorSpeed=A.motorSpeed;this.m_enableLimit=A.enableLimit;this.m_enableMotor=A.enableMotor;this.m_limitState=x.e_inactiveLimit};h.prototype.InitVelocityConstraints=function(K){var G=this.m_bodyA,E=this.m_bodyB,F,B=0;F=G.m_xf.R;var A=this.m_localAnchor1.x-G.m_sweep.localCenter.x,D=this.m_localAnchor1.y-G.m_sweep.localCenter.y;B=F.col1.x*A+F.col2.x*D;D=F.col1.y*A+F.col2.y*D;A=B;F=E.m_xf.R;var N=this.m_localAnchor2.x-E.m_sweep.localCenter.x,L=this.m_localAnchor2.y-E.m_sweep.localCenter.y;B=F.col1.x*N+F.col2.x*L;L=F.col1.y*N+F.col2.y*L;N=B;F=G.m_invMass;B=E.m_invMass;var H=G.m_invI,M=E.m_invI;this.m_mass.col1.x=F+B+D*D*H+L*L*M;this.m_mass.col2.x=-D*A*H-L*N*M;this.m_mass.col3.x=-D*H-L*M;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=F+B+A*A*H+N*N*M;this.m_mass.col3.y=A*H+N*M;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=H+M;this.m_motorMass=1/(H+M);if(this.m_enableMotor==false){this.m_motorImpulse=0}if(this.m_enableLimit){var I=E.m_sweep.a-G.m_sweep.a-this.m_referenceAngle;if(t.Abs(this.m_upperAngle-this.m_lowerAngle)<2*AE.b2_angularSlop){this.m_limitState=x.e_equalLimits}else{if(I<=this.m_lowerAngle){if(this.m_limitState!=x.e_atLowerLimit){this.m_impulse.z=0}this.m_limitState=x.e_atLowerLimit}else{if(I>=this.m_upperAngle){if(this.m_limitState!=x.e_atUpperLimit){this.m_impulse.z=0}this.m_limitState=x.e_atUpperLimit}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.z=0}}}}else{this.m_limitState=x.e_inactiveLimit}if(K.warmStarting){this.m_impulse.x*=K.dtRatio;this.m_impulse.y*=K.dtRatio;this.m_motorImpulse*=K.dtRatio;K=this.m_impulse.x;I=this.m_impulse.y;G.m_linearVelocity.x-=F*K;G.m_linearVelocity.y-=F*I;G.m_angularVelocity-=H*(A*I-D*K+this.m_motorImpulse+this.m_impulse.z);E.m_linearVelocity.x+=B*K;E.m_linearVelocity.y+=B*I;E.m_angularVelocity+=M*(N*I-L*K+this.m_motorImpulse+this.m_impulse.z)}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};h.prototype.SolveVelocityConstraints=function(N){var I=this.m_bodyA,G=this.m_bodyB,H=0,D=H=0,B=0,E=0,R=0,O=I.m_linearVelocity,K=I.m_angularVelocity,Q=G.m_linearVelocity,M=G.m_angularVelocity,L=I.m_invMass,F=G.m_invMass,A=I.m_invI,U=G.m_invI;if(this.m_enableMotor&&this.m_limitState!=x.e_equalLimits){D=this.m_motorMass*-(M-K-this.m_motorSpeed);B=this.m_motorImpulse;E=N.dt*this.m_maxMotorTorque;this.m_motorImpulse=t.Clamp(this.m_motorImpulse+D,-E,E);D=this.m_motorImpulse-B;K-=A*D;M+=U*D}if(this.m_enableLimit&&this.m_limitState!=x.e_inactiveLimit){N=I.m_xf.R;D=this.m_localAnchor1.x-I.m_sweep.localCenter.x;B=this.m_localAnchor1.y-I.m_sweep.localCenter.y;H=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=H;N=G.m_xf.R;E=this.m_localAnchor2.x-G.m_sweep.localCenter.x;R=this.m_localAnchor2.y-G.m_sweep.localCenter.y;H=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=H;N=Q.x+-M*R-O.x- -K*B;var S=Q.y+M*E-O.y-K*D;this.m_mass.Solve33(this.impulse3,-N,-S,-(M-K));if(this.m_limitState==x.e_equalLimits){this.m_impulse.Add(this.impulse3)}else{if(this.m_limitState==x.e_atLowerLimit){H=this.m_impulse.z+this.impulse3.z;if(H<0){this.m_mass.Solve22(this.reduced,-N,-S);this.impulse3.x=this.reduced.x;this.impulse3.y=this.reduced.y;this.impulse3.z=-this.m_impulse.z;this.m_impulse.x+=this.reduced.x;this.m_impulse.y+=this.reduced.y;this.m_impulse.z=0}}else{if(this.m_limitState==x.e_atUpperLimit){H=this.m_impulse.z+this.impulse3.z;if(H>0){this.m_mass.Solve22(this.reduced,-N,-S);this.impulse3.x=this.reduced.x;this.impulse3.y=this.reduced.y;this.impulse3.z=-this.m_impulse.z;this.m_impulse.x+=this.reduced.x;this.m_impulse.y+=this.reduced.y;this.m_impulse.z=0}}}}O.x-=L*this.impulse3.x;O.y-=L*this.impulse3.y;K-=A*(D*this.impulse3.y-B*this.impulse3.x+this.impulse3.z);Q.x+=F*this.impulse3.x;Q.y+=F*this.impulse3.y;M+=U*(E*this.impulse3.y-R*this.impulse3.x+this.impulse3.z)}else{N=I.m_xf.R;D=this.m_localAnchor1.x-I.m_sweep.localCenter.x;B=this.m_localAnchor1.y-I.m_sweep.localCenter.y;H=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=H;N=G.m_xf.R;E=this.m_localAnchor2.x-G.m_sweep.localCenter.x;R=this.m_localAnchor2.y-G.m_sweep.localCenter.y;H=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=H;this.m_mass.Solve22(this.impulse2,-(Q.x+-M*R-O.x- -K*B),-(Q.y+M*E-O.y-K*D));this.m_impulse.x+=this.impulse2.x;this.m_impulse.y+=this.impulse2.y;O.x-=L*this.impulse2.x;O.y-=L*this.impulse2.y;K-=A*(D*this.impulse2.y-B*this.impulse2.x);Q.x+=F*this.impulse2.x;Q.y+=F*this.impulse2.y;M+=U*(E*this.impulse2.y-R*this.impulse2.x)}I.m_linearVelocity.SetV(O);I.m_angularVelocity=K;G.m_linearVelocity.SetV(Q);G.m_angularVelocity=M};h.prototype.SolvePositionConstraints=function(){var N=0,I,G=this.m_bodyA,H=this.m_bodyB,D=0,B=I=0,E=0,R=0;if(this.m_enableLimit&&this.m_limitState!=x.e_inactiveLimit){N=H.m_sweep.a-G.m_sweep.a-this.m_referenceAngle;var O=0;if(this.m_limitState==x.e_equalLimits){N=t.Clamp(N-this.m_lowerAngle,-AE.b2_maxAngularCorrection,AE.b2_maxAngularCorrection);O=-this.m_motorMass*N;D=t.Abs(N)}else{if(this.m_limitState==x.e_atLowerLimit){N=N-this.m_lowerAngle;D=-N;N=t.Clamp(N+AE.b2_angularSlop,-AE.b2_maxAngularCorrection,0);O=-this.m_motorMass*N}else{if(this.m_limitState==x.e_atUpperLimit){D=N=N-this.m_upperAngle;N=t.Clamp(N-AE.b2_angularSlop,0,AE.b2_maxAngularCorrection);O=-this.m_motorMass*N}}}G.m_sweep.a-=G.m_invI*O;H.m_sweep.a+=H.m_invI*O;G.SynchronizeTransform();H.SynchronizeTransform()}I=G.m_xf.R;O=this.m_localAnchor1.x-G.m_sweep.localCenter.x;N=this.m_localAnchor1.y-G.m_sweep.localCenter.y;B=I.col1.x*O+I.col2.x*N;N=I.col1.y*O+I.col2.y*N;O=B;I=H.m_xf.R;var K=this.m_localAnchor2.x-H.m_sweep.localCenter.x,Q=this.m_localAnchor2.y-H.m_sweep.localCenter.y;B=I.col1.x*K+I.col2.x*Q;Q=I.col1.y*K+I.col2.y*Q;K=B;E=H.m_sweep.c.x+K-G.m_sweep.c.x-O;R=H.m_sweep.c.y+Q-G.m_sweep.c.y-N;var M=E*E+R*R;I=Math.sqrt(M);B=G.m_invMass;var L=H.m_invMass,F=G.m_invI,A=H.m_invI,S=10*AE.b2_linearSlop;if(M>S*S){M=1/(B+L);E=M*-E;R=M*-R;G.m_sweep.c.x-=0.5*B*E;G.m_sweep.c.y-=0.5*B*R;H.m_sweep.c.x+=0.5*L*E;H.m_sweep.c.y+=0.5*L*R;E=H.m_sweep.c.x+K-G.m_sweep.c.x-O;R=H.m_sweep.c.y+Q-G.m_sweep.c.y-N}this.K1.col1.x=B+L;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=B+L;this.K2.col1.x=F*N*N;this.K2.col2.x=-F*O*N;this.K2.col1.y=-F*O*N;this.K2.col2.y=F*O*O;this.K3.col1.x=A*Q*Q;this.K3.col2.x=-A*K*Q;this.K3.col1.y=-A*K*Q;this.K3.col2.y=A*K*K;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.AddM(this.K3);this.K.Solve(h.tImpulse,-E,-R);E=h.tImpulse.x;R=h.tImpulse.y;G.m_sweep.c.x-=G.m_invMass*E;G.m_sweep.c.y-=G.m_invMass*R;G.m_sweep.a-=G.m_invI*(O*R-N*E);H.m_sweep.c.x+=H.m_invMass*E;H.m_sweep.c.y+=H.m_invMass*R;H.m_sweep.a+=H.m_invI*(K*R-Q*E);G.SynchronizeTransform();H.SynchronizeTransform();return I<=AE.b2_linearSlop&&D<=AE.b2_angularSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse=new AB});Box2D.inherit(b,Box2D.Dynamics.Joints.b2JointDef);b.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;b.b2RevoluteJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB};b.prototype.b2RevoluteJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_revoluteJoint;this.localAnchorA.Set(0,0);this.localAnchorB.Set(0,0);this.motorSpeed=this.maxMotorTorque=this.upperAngle=this.lowerAngle=this.referenceAngle=0;this.enableMotor=this.enableLimit=false};b.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(AL,Box2D.Dynamics.Joints.b2Joint);AL.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AL.b2WeldJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new AB;this.m_localAnchorB=new AB;this.m_impulse=new AI;this.m_mass=new o};AL.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};AL.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};AL.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse.x,A*this.m_impulse.y)};AL.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.z};AL.prototype.b2WeldJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchorA.SetV(A.localAnchorA);this.m_localAnchorB.SetV(A.localAnchorB);this.m_referenceAngle=A.referenceAngle;this.m_impulse.SetZero();this.m_mass=new o};AL.prototype.InitVelocityConstraints=function(I){var G,E=0,F=this.m_bodyA,B=this.m_bodyB;G=F.m_xf.R;var A=this.m_localAnchorA.x-F.m_sweep.localCenter.x,D=this.m_localAnchorA.y-F.m_sweep.localCenter.y;E=G.col1.x*A+G.col2.x*D;D=G.col1.y*A+G.col2.y*D;A=E;G=B.m_xf.R;var M=this.m_localAnchorB.x-B.m_sweep.localCenter.x,K=this.m_localAnchorB.y-B.m_sweep.localCenter.y;E=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=E;G=F.m_invMass;E=B.m_invMass;var H=F.m_invI,L=B.m_invI;this.m_mass.col1.x=G+E+D*D*H+K*K*L;this.m_mass.col2.x=-D*A*H-K*M*L;this.m_mass.col3.x=-D*H-K*L;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=G+E+A*A*H+M*M*L;this.m_mass.col3.y=A*H+M*L;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=H+L;if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_impulse.z*=I.dtRatio;F.m_linearVelocity.x-=G*this.m_impulse.x;F.m_linearVelocity.y-=G*this.m_impulse.y;F.m_angularVelocity-=H*(A*this.m_impulse.y-D*this.m_impulse.x+this.m_impulse.z);B.m_linearVelocity.x+=E*this.m_impulse.x;B.m_linearVelocity.y+=E*this.m_impulse.y;B.m_angularVelocity+=L*(M*this.m_impulse.y-K*this.m_impulse.x+this.m_impulse.z)}else{this.m_impulse.SetZero()}};AL.prototype.SolveVelocityConstraints=function(){var R,M=0,K=this.m_bodyA,L=this.m_bodyB,G=K.m_linearVelocity,F=K.m_angularVelocity,H=L.m_linearVelocity,V=L.m_angularVelocity,S=K.m_invMass,N=L.m_invMass,U=K.m_invI,Q=L.m_invI;R=K.m_xf.R;var O=this.m_localAnchorA.x-K.m_sweep.localCenter.x,I=this.m_localAnchorA.y-K.m_sweep.localCenter.y;M=R.col1.x*O+R.col2.x*I;I=R.col1.y*O+R.col2.y*I;O=M;R=L.m_xf.R;var E=this.m_localAnchorB.x-L.m_sweep.localCenter.x,D=this.m_localAnchorB.y-L.m_sweep.localCenter.y;M=R.col1.x*E+R.col2.x*D;D=R.col1.y*E+R.col2.y*D;E=M;R=H.x-V*D-G.x+F*I;M=H.y+V*E-G.y-F*O;var A=V-F,B=new AI;this.m_mass.Solve33(B,-R,-M,-A);this.m_impulse.Add(B);G.x-=S*B.x;G.y-=S*B.y;F-=U*(O*B.y-I*B.x+B.z);H.x+=N*B.x;H.y+=N*B.y;V+=Q*(E*B.y-D*B.x+B.z);K.m_angularVelocity=F;L.m_angularVelocity=V};AL.prototype.SolvePositionConstraints=function(){var N,I=0,G=this.m_bodyA,H=this.m_bodyB;N=G.m_xf.R;var D=this.m_localAnchorA.x-G.m_sweep.localCenter.x,B=this.m_localAnchorA.y-G.m_sweep.localCenter.y;I=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=I;N=H.m_xf.R;var E=this.m_localAnchorB.x-H.m_sweep.localCenter.x,R=this.m_localAnchorB.y-H.m_sweep.localCenter.y;I=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=I;N=G.m_invMass;I=H.m_invMass;var O=G.m_invI,K=H.m_invI,Q=H.m_sweep.c.x+E-G.m_sweep.c.x-D,M=H.m_sweep.c.y+R-G.m_sweep.c.y-B,L=H.m_sweep.a-G.m_sweep.a-this.m_referenceAngle,F=10*AE.b2_linearSlop,A=Math.sqrt(Q*Q+M*M),S=t.Abs(L);if(A>F){O*=1;K*=1}this.m_mass.col1.x=N+I+B*B*O+R*R*K;this.m_mass.col2.x=-B*D*O-R*E*K;this.m_mass.col3.x=-B*O-R*K;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=N+I+D*D*O+E*E*K;this.m_mass.col3.y=D*O+E*K;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=O+K;F=new AI;this.m_mass.Solve33(F,-Q,-M,-L);G.m_sweep.c.x-=N*F.x;G.m_sweep.c.y-=N*F.y;G.m_sweep.a-=O*(D*F.y-B*F.x+F.z);H.m_sweep.c.x+=I*F.x;H.m_sweep.c.y+=I*F.y;H.m_sweep.a+=K*(E*F.y-R*F.x+F.z);G.SynchronizeTransform();H.SynchronizeTransform();return A<=AE.b2_linearSlop&&S<=AE.b2_angularSlop};Box2D.inherit(C,Box2D.Dynamics.Joints.b2JointDef);C.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;C.b2WeldJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB};C.prototype.b2WeldJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_weldJoint;this.referenceAngle=0};C.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(A));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(A));this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()}})();(function(){var A=Box2D.Dynamics.b2DebugDraw;A.b2DebugDraw=function(){this.m_xformScale=this.m_fillAlpha=this.m_alpha=this.m_lineThickness=this.m_drawScale=1;var B=this;this.m_sprite={graphics:{clear:function(){B.m_ctx.clearRect(0,0,B.m_ctx.canvas.width,B.m_ctx.canvas.height)}}}};A.prototype._color=function(C,B){return"rgba("+((C&16711680)>>16)+","+((C&65280)>>8)+","+(C&255)+","+B+")"};A.prototype.b2DebugDraw=function(){this.m_drawFlags=0};A.prototype.SetFlags=function(B){if(B===undefined){B=0}this.m_drawFlags=B};A.prototype.GetFlags=function(){return this.m_drawFlags};A.prototype.AppendFlags=function(B){if(B===undefined){B=0}this.m_drawFlags|=B};A.prototype.ClearFlags=function(B){if(B===undefined){B=0}this.m_drawFlags&=~B};A.prototype.SetSprite=function(B){this.m_ctx=B};A.prototype.GetSprite=function(){return this.m_ctx};A.prototype.SetDrawScale=function(B){if(B===undefined){B=0}this.m_drawScale=B};A.prototype.GetDrawScale=function(){return this.m_drawScale};A.prototype.SetLineThickness=function(B){if(B===undefined){B=0}this.m_lineThickness=B;this.m_ctx.strokeWidth=B};A.prototype.GetLineThickness=function(){return this.m_lineThickness};A.prototype.SetAlpha=function(B){if(B===undefined){B=0}this.m_alpha=B};A.prototype.GetAlpha=function(){return this.m_alpha};A.prototype.SetFillAlpha=function(B){if(B===undefined){B=0}this.m_fillAlpha=B};A.prototype.GetFillAlpha=function(){return this.m_fillAlpha};A.prototype.SetXFormScale=function(B){if(B===undefined){B=0}this.m_xformScale=B};A.prototype.GetXFormScale=function(){return this.m_xformScale};A.prototype.DrawPolygon=function(E,D,F){if(D){var C=this.m_ctx,B=this.m_drawScale;C.beginPath();C.strokeStyle=this._color(F.color,this.m_alpha);C.moveTo(E[0].x*B,E[0].y*B);for(F=1;F<D;F++){C.lineTo(E[F].x*B,E[F].y*B)}C.lineTo(E[0].x*B,E[0].y*B);C.closePath();C.stroke()}};A.prototype.DrawSolidPolygon=function(E,D,F){if(D){var C=this.m_ctx,B=this.m_drawScale;C.beginPath();C.strokeStyle=this._color(F.color,this.m_alpha);C.fillStyle=this._color(F.color,this.m_fillAlpha);C.moveTo(E[0].x*B,E[0].y*B);for(F=1;F<D;F++){C.lineTo(E[F].x*B,E[F].y*B)}C.lineTo(E[0].x*B,E[0].y*B);C.closePath();C.fill();C.stroke()}};A.prototype.DrawCircle=function(E,D,F){if(D){var C=this.m_ctx,B=this.m_drawScale;C.beginPath();C.strokeStyle=this._color(F.color,this.m_alpha);C.arc(E.x*B,E.y*B,D*B,0,Math.PI*2,true);C.closePath();C.stroke()}};A.prototype.DrawSolidCircle=function(H,E,L,D){if(E){var C=this.m_ctx,F=this.m_drawScale,I=H.x*F,J=H.y*F;C.moveTo(0,0);C.beginPath();C.strokeStyle=this._color(D.color,this.m_alpha);C.fillStyle=this._color(D.color,this.m_fillAlpha);C.arc(I,J,E*F,0,Math.PI*2,true);C.moveTo(I,J);C.lineTo((H.x+L.x*E)*F,(H.y+L.y*E)*F);C.closePath();C.fill();C.stroke()}};A.prototype.DrawSegment=function(E,D,F){var C=this.m_ctx,B=this.m_drawScale;C.strokeStyle=this._color(F.color,this.m_alpha);C.beginPath();C.moveTo(E.x*B,E.y*B);C.lineTo(D.x*B,D.y*B);C.closePath();C.stroke()};A.prototype.DrawTransform=function(C){var B=this.m_ctx,D=this.m_drawScale;B.beginPath();B.strokeStyle=this._color(16711680,this.m_alpha);B.moveTo(C.position.x*D,C.position.y*D);B.lineTo((C.position.x+this.m_xformScale*C.R.col1.x)*D,(C.position.y+this.m_xformScale*C.R.col1.y)*D);B.strokeStyle=this._color(65280,this.m_alpha);B.moveTo(C.position.x*D,C.position.y*D);B.lineTo((C.position.x+this.m_xformScale*C.R.col2.x)*D,(C.position.y+this.m_xformScale*C.R.col2.y)*D);B.closePath();B.stroke()}})();var i;for(i=0;i<Box2D.postDefs.length;++i){Box2D.postDefs[i]()}delete Box2D.postDefs;(function(B){B.fn.vs=function(){};B.fn._vs={};B.fn._vs.token={};B.fn._vs.draw={};B.fn._vs.stream={};B.fn._vs.chart={};B.fn._vs.phy={};B.fn._vs.decay={};B.fn._vs.flocculate={};B.fn._vs.strata={};B.fn._vs.aggregate={};var A=function(E,O){this.token=B.fn._vs.token;this.draw=B.fn._vs.draw;this.stream=B.fn._vs.stream;this.chart=B.fn._vs.chart;this.phy=B.fn._vs.phy;this.decay=B.fn._vs.decay;this.flocculate=B.fn._vs.flocculate;this.strata=B.fn._vs.strata;this.requestAnimFrame;this.mouse={};this.mouse.x=0;this.mouse.y=0;this.mouse.isMouseDragging=false;this.mouse.isMouseDown=false;this.mouse.selectedBody=null;this.dataFlow=[];this.chartPhySetup={};this.tokens=[];this.world=null;this.ctx=null;var D=B(E);var M=this;var L=[];var N;var C;var H={x:0,y:0,width:290.5,height:300.5,DOMelement:null,chart:{x:undefined,y:undefined,width:undefined,height:undefined,colorRange:d3.scale.category10(),scale:d3.scale,type:"StackedAreaChart",spacer:5,column:3,wallColor:"rgba(230,230,230,0)",label:true,radius:10},data:{model:[{label:"Column A"},{label:"Column B"},{label:"Column C"},],strata:[[{initValue:100,label:"Strata 1 col A"}],[{initValue:20,label:"Strata 1 col B"}],[{initValue:175,label:"Strata 2 col C"}]],token:[{timestamp:1,category:1,value:1,userdata:{},callback:{}}],tokenPast:0,stream:{provider:"generator",refresh:10000/8,now:0},},sedimentation:{token:{size:{original:4,minimum:2},visible:true},incoming:{strategy:1,point:[{x:50,y:0},{x:100,y:0},{x:150,y:0}],target:[{x:50,y:0},{x:100,y:0},{x:150,y:0}]},granulate:{visible:false},flocculate:{number:1,action:"buffer",strategy:"Size",bufferSize:5,bufferTime:1000,bufferHeight:50,bufferFrameRate:25,buffer:[]},suspension:{height:null,incomming:"top",decay:{power:1.001},refresh:200},accumulation:{height:null},aggregation:{height:0,maxData:0,invertStrata:false},},options:{refresh:1000/25,panel:false,scale:30,layout:false,canvasFirst:true}};this.now=function(){return(new Date().getTime())};this.globalDecay=function(P){if(typeof(P)=="undefined"){return this.settings.sedimentation.suspension.decay.power}else{return this.settings.sedimentation.suspension.decay.power=P}};this.getWorld=function(){return this.world};this.chartUpdate=function(P,R){var Q={cat:P,y:R};this.chart[this.settings.chart.type](M,"update",Q)};this.flocculateTokens=function(P){return this.flocculate.update(M,P)};this.flocculateAll=function(){return this.flocculate.all(M)};this.addToken=function(P){return this.token.addToken(M,P)};this.selectAll=function(P,Q){return this.token.selectAll(M,P,Q)};this.select=function(P,Q){return this.token.select(M,P,Q)};this.updateAll=function(P){var Q=this.chart.updateAll(M,key,value);return Q};this.update=function(P,Q){var R=this.chart.update(M,P,Q);return R};function J(S,R){var Q={};for(var P in S){Q[P]=S[P]}for(var P in R){Q[P]=R[P]}return Q}J(H,O);if(O.data!=undefined){H.data=O.data}this.settings=B.extend(true,H,O);this.settings.DOMelement=E;if(typeof(this.settings.chart.width)=="undefined"){this.settings.chart.width=this.settings.width}if(typeof(this.settings.chart.x)=="undefined"){this.settings.chart.x=0}if(typeof(this.settings.chart.y)=="undefined"){this.settings.chart.y=0}if(typeof(this.settings.chart.height)=="undefined"){this.settings.chart.height=this.settings.height}if(typeof(this.settings.stream)=="undefined"){this.settings.stream={}}if(typeof(this.settings.stream.now)=="undefined"){this.settings.stream.now=0}if(typeof(this.settings.stream.provider)=="undefined"){this.settings.stream.provider="generator"}if(typeof(this.settings.stream.refresh)=="undefined"){this.settings.stream.refresh=1000}if(typeof(this.settings.data.tokenPast)=="undefined"){this.settings.data.tokenPast=0}if(typeof(this.settings.data.tokens)=="undefined"){this.settings.data.tokens=[]}if(typeof(this.settings.data.strata)!="undefined"&&this.settings.data.strata.length!=0){if(typeof(this.settings.sedimentation.aggregation)=="undefined"){this.settings.sedimentation.aggregation={}}if(typeof(this.settings.sedimentation.aggregation.height)=="undefined"){this.settings.sedimentation.aggregation.height=this.settings.chart.height/2}if(typeof(this.settings.sedimentation.aggregation.maxData)=="undefined"){this.settings.sedimentation.aggregation.maxData=10}}this.init=function(){this.requestAnimFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(W,V){window.setTimeout(W,1000/60)}})();this.world=new this.phy.b2World(new this.phy.b2Vec2(0,0),true);var Q=E.appendChild(document.createElement("div"));Q.id="box_sediviz_"+I();Q.width=this.settings.width;Q.height=this.settings.height;this.settings.DOMelement=Q;C=Q.appendChild(document.createElement("canvas"));C.id="canvas";C.width=this.settings.width;C.height=this.settings.height;C.style.position="absolute";this.ctx=C.getContext("2d");this.chart[this.settings.chart.type](M,"init");this.stream.init(M);this.flocculate.init(M);this.stream.update(M);this.token.init(M);this.strata.init(this);window.setInterval(function(){M.update(M)},M.settings.options.refresh/2);window.setInterval(function(){M.draw.update(M)},M.settings.options.refresh);window.setInterval(function(){M.decay.update(M)},M.settings.sedimentation.suspension.refresh);M.strata.update(M);this.getBodyAtMouse=function(b){var V=b.mouse.x/b.settings.options.scale;var Z=b.mouse.y/b.settings.options.scale;var Y=new b.phy.b2Vec2(V,Z);var W=new b.phy.b2AABB();var X=0.001;W.lowerBound.Set(V-X,Z-X);W.upperBound.Set(V+X,Z+X);b.mouse.selectedToken=null;b.world.QueryAABB(function(e){return T(e,b,Y)},W);return b.mouse.selectedToken};function T(W,X,V){X.mouse.selectedToken=W;if(W.GetBody().GetType()!=X.phy.b2Body.b2_staticBody){if(W.GetShape().TestPoint(W.GetBody().GetTransform(),V)){X.mouse.selectedToken=W;return false}}return true}this.handleMouseMove=function(V,W){canvasPosition=F(W.settings.DOMelement);W.mouse.x=(V.clientX-(canvasPosition.offsetLeft-this.getScrollPosition()[0]));W.mouse.y=(V.clientY-(canvasPosition.offsetTop-this.getScrollPosition()[1]))};this.getScrollPosition=function(){return Array((document.documentElement&&document.documentElement.scrollLeft)||window.pageXOffset||M.pageXOffset||document.body.scrollLeft,(document.documentElement&&document.documentElement.scrollTop)||window.pageYOffset||M.pageYOffset||document.body.scrollTop)};document.addEventListener("mousemove",function(V){S(V,M)});document.addEventListener("mouseup",function(V){U(V,M)});document.addEventListener("mousedown",function(V){R(V,M)});function P(Y,b){var W=b.getBodyAtMouse(b);if(W!=null){if(typeof(W.m_userData)!="undefined"){if(typeof(W.m_userData.callback)!="undefined"){if(typeof(W.m_userData.callback.mouseover)=="function"){var V=b.select("ID",W.m_userData.ID);W.m_userData.callback.mouseover(V)}if(typeof(W.m_userData.callback.mouseout)=="function"){var V=b.select("ID",W.m_userData.ID);var Z;var X=function(){var f=Z;var h=V;var e=b;var g=W;return function(){var k=e.getBodyAtMouse(e);var l=false;if(k!=null){if(typeof(k.m_userData)!="undefined"){if(k.m_userData.ID==h.attr("ID")){l=false}else{l=true}}else{l=true}}else{l=true}if(l){g.m_userData.callback.mouseout(h);clearInterval(Z)}}};Z=window.setInterval(X(),100)}}}}}function R(X,Y){Y.mouse.isMouseDown=true;Y.handleMouseMove(X,Y);var W=Y.getBodyAtMouse(Y);if(W!=null){if(typeof(W.m_userData)!="undefined"){if(typeof(W.m_userData.callback)!="undefined"){if(typeof(W.m_userData.callback.onclick)=="function"){var V=Y.select("ID",W.m_userData.ID);W.m_userData.callback.onclick(V)}}}}}function U(V,W){W.mouse.isMouseDown=false}function S(V,W){if(W.mouse.isMouseDown){W.mouse.isMouseDragging=true;W.mouse.x=V.clientX;W.mouse.y=V.clientY}else{W.handleMouseMove(V,W);P("move",W)}}};this.mouse.update=function(Q){if(isMouseDown&&(!mouseJoint)){var P=getBodyAtMouse();if(P){var R=new b2MouseJointDef();R.bodyA=world.GetGroundBody();R.bodyB=P;R.target.Set(mouseX,mouseY);R.collideConnected=true;R.maxForce=300*P.GetMass();mouseJoint=world.CreateJoint(R);P.SetAwake(true)}}if(mouseJoint){if(isMouseDown){mouseJoint.SetTarget(new b2Vec2(mouseX,mouseY))}else{world.DestroyJoint(mouseJoint);mouseJoint=null}}};this.update=function(P){this.world.Step(1/60,10,10);this.world.DrawDebugData();this.world.ClearForces()};var G=function(){ctx.fillStyle="rgb(200,0,0)";this.ctx.font="14pt Calibri,Geneva,Arial";this.ctx.fillText("Canvas ready for Visual Sedimentation ",10,20);window.setInterval(B.fn.vs.draw.refresh(ctx,world,this.settings),this.settings.options.refresh);console.log("draw Init ")};var F=function(R){var Q=R.offsetTop;var P=R.offsetLeft;while(R=R.offsetParent){Q+=R.offsetTop;P+=R.offsetLeft}return{offsetLeft:P,offsetTop:Q}};var I=function(){var P=function(){return Math.floor(Math.random()*65536).toString(16)};return(P()+P()+"-"+P()+"-"+P()+"-"+P()+"-"+P()+P()+P())};function K(Q){if(null==Q||"object"!=typeof Q){return Q}var R=Q.constructor();for(var P in Q){if(Q.hasOwnProperty(P)){R[P]=Q[P]}}return R}this.utile={};this.utile.GUID=I;this.utile.clone=K;this.settings=B.extend(this.settings,{}||{});this.init()};B.fn.vs=function(C){if(!arguments.length){var C={}}return this.each(function(){var D=B(this);if(D.data("VisualSedimentation")){return}var E=new A(this,C);D.data("visualSedimentation",E)})}})(jQuery);(function(A){A.fn._vs.phy={b2Vec2:Box2D.Common.Math.b2Vec2,b2AABB:Box2D.Collision.b2AABB,b2BodyDef:Box2D.Dynamics.b2BodyDef,b2Body:Box2D.Dynamics.b2Body,b2FixtureDef:Box2D.Dynamics.b2FixtureDef,b2Fixture:Box2D.Dynamics.b2Fixture,b2World:Box2D.Dynamics.b2World,b2MassData:Box2D.Collision.Shapes.b2MassData,b2PolygonShape:Box2D.Collision.Shapes.b2PolygonShape,b2CircleShape:Box2D.Collision.Shapes.b2CircleShape,b2DebugDraw:Box2D.Dynamics.b2DebugDraw,b2MouseJointDef:Box2D.Dynamics.Joints.b2MouseJointDef,b2Shape:Box2D.Collision.Shapes.b2Shape,b2DistanceJointDef:Box2D.Dynamics.Joints.b2DistanceJointDef,b2RevoluteJointDef:Box2D.Dynamics.Joints.b2RevoluteJointDef,b2Joint:Box2D.Dynamics.Joints.b2Joint,b2PrismaticJointDef:Box2D.Dynamics.Joints.b2PrismaticJointDef,b2ContactListener:Box2D.Dynamics.b2ContactListener,b2Settings:Box2D.Common.b2Settings}})(jQuery);(function(A){A.fn.vs.chart={}})(jQuery);(function(A){A.fn._vs.draw={settings:{draw:{trail:1,showLayout:false}},update:function(D){if(this.settings.draw.trail==1){D.ctx.clearRect(0,0,D.ctx.canvas.clientWidth,D.ctx.canvas.clientHeight)}else{debugDrawChart(0,0,ctx.canvas.clientWidth,ctx.canvas.clientHeight,"rgba(255,255,255,"+this.settings.draw.trail+")",ctx)}for(var B=D.world.GetBodyList();B;B=B.GetNext()){for(var C=B.GetFixtureList();C!=null;C=C.GetNext()){this.drawShape(D,C)}}if(this.settings.draw.showLayout==true){this.debugDrawChart(chart.position.x,chart.position.y,chart.position.width,chart.position.height,"rgba(255,0,0,0.2)",ctx)}},debugDrawChart:function(B,G,D,F,E,C){C.save();C.translate(0,0);C.fillStyle=E;C.beginPath();C.rect(B,G,D,F);C.closePath();C.strokeStyle="#000";C.lineWidth=0.5;C.stroke();C.restore()},clippedBackgroundImage:function(C,D,B,E){C.save();C.clip();C.drawImage(D,B-(D.height/2),E-(D.width/2),D.width,D.height);C.restore()},haveTexture:function(C){var B=false;if(typeof(C.m_userData.texture)!="undefined"){if(typeof(C.m_userData.texture.img)!="undefined"){if(C.m_userData.texture.img.complete){B=true}}}return B},drawShape:function(K,F){var Q=F.GetBody();var R=Q.GetPosition();var P=Q.GetAngle();var D=9;var C=10;var S=K.settings.options.scale;F.m_userData.x=Q.GetWorldCenter().x*S;F.m_userData.y=Q.GetWorldCenter().y*S;if(typeof(F)!="undefined"){switch(F.GetType()){case 0:switch(F.m_userData){case null:K.ctx.fillStyle="rgba(255,0,0,1)";break;default:K.ctx.fillStyle=F.m_userData.fillStyle;break}var B=F.m_shape.m_radius;if(K.settings.sedimentation.token.visible==true){K.ctx.save();K.ctx.translate(R.x*S,R.y*S);K.ctx.rotate(P);K.ctx.beginPath();var O=(B/C*D)*S;if(typeof(F.m_userData.strokeStyle)!="undefined"){K.ctx.strokeStyle=F.m_userData.strokeStyle}else{K.ctx.strokeStyle="rgba(0,0,0,0)"}if(typeof(F.m_userData.lineWidth)!="undefined"){K.ctx.lineWidth=F.m_userData.lineWidth}else{K.ctx.lineWidth=0}K.ctx.arc(0,0,O,0,Math.PI*2,true);if(this.haveTexture(F)){this.clippedBackgroundImage(K.ctx,F.m_userData.texture.img,0,0)}K.ctx.closePath();if(K.settings.options.layout==true){K.ctx.strokeStyle="#000";K.ctx.lineWidth=0.5;K.ctx.stroke()}else{if(!this.haveTexture(F)){K.ctx.fill()}K.ctx.stroke()}K.ctx.restore()}break;case 1:switch(F.m_userData){case null:K.ctx.fillStyle="rgba(255,0,0,1)";break;default:K.ctx.fillStyle=F.m_userData.fillStyle;break}var I=F.m_shape.m_vertices[0].x*S;var G=F.m_shape.m_vertices[0].y*S;var J=R.x*S-F.m_shape.m_vertices[0].x*S;var H=R.y*S-F.m_shape.m_vertices[0].y*S;K.ctx.save();K.ctx.translate(R.x*S,R.y*S);K.ctx.rotate(P);K.ctx.beginPath();if(typeof(F.m_userData.strokeStyle)!="undefined"){K.ctx.strokeStyle=F.m_userData.strokeStyle}else{K.ctx.strokeStyle=F.m_userData.fillStyle}if(typeof(F.m_userData.lineWidth)!="undefined"){K.ctx.lineWidth=F.m_userData.lineWidth}else{K.ctx.lineWidth=0}for(var N=0;N<F.m_shape.m_vertices.length;N++){var M=F.m_shape.m_vertices;K.ctx.moveTo((M[0].x)*S,(M[0].y)*S);for(var L=1;L<M.length;L++){K.ctx.lineTo((M[L].x)*S,(M[L].y)*S)}K.ctx.lineTo((M[0].x)*S,(M[0].y)*S)}K.ctx.closePath();K.ctx.fill();if(K.settings.options.layout==true){K.ctx.lineWidth=0.25;K.ctx.strokeStyle="rgb(0,0,0)";K.ctx.stroke()}else{K.ctx.stroke()}K.ctx.restore();break;case 2:break;K.ctx.fillStyle="rgb(0,0,0)"}}if(typeof(F.m_userData.callback)!="undefined"){if(typeof(F.m_userData.callback.draw)=="function"){var E=K.select("ID",F.m_userData.ID);F.m_userData.callback.draw(E)}}}}})(jQuery);(function(A){A.fn._vs.token={colorRange:function(){},init:function(B){this.colorRange=B.settings.chart.colorRange},ID:function(B){B.settings.data.tokenPast+=1;return B.settings.data.tokenPast},selectAll:function(G,D,F){var B=[];var E=false;B.flocculate=function(){var H=[];B.forEach(function(I){q=I.flocculate();H.push(q)});return H};B.attr=function(H,J,K){var I=[];B.forEach(function(L){q=L.attr(H,J,K);I.push(q)});return I};B.b2dObj=function(H,J,K){var I=[];B.forEach(function(L){q=L.myobj;I.push(q)});return I};if(typeof(F)=="undefined"&&typeof(D)=="undefined"){E=true}for(var C=G.tokens.length-1;C>=0;C--){if(G.tokens[C].attr(D)==F||E==true){B.push(G.tokens[C])}}return B},select:function(E,C,D){result=[];if(typeof(D)=="undefined"&&typeof(C)=="undefined"){return E.tokens}else{for(var B=E.tokens.length-1;B>=0;B--){if(E.tokens[B].attr(C)==D){result.push(E.tokens[B]);break}}}if(typeof(result[0])=="undefined"){return false}else{return result[0]}},addToken:function(H,G){var C={x:50,y:50,t:null,category:1,state:0,size:10,fillStyle:"###",strokeStyle:"rgba(0,0,0,0)",lineWidth:0,texture:undefined,shape:{type:"round"},userdata:{},callback:{},phy:{density:10,friction:0,restitution:0},targets:[],elbow:{}};var B=null;var D=null;var F={};F.toString=function(){return"Token ID="+this.setting.ID};if(typeof(G)=="undefined"){F.setting=C;F.setting.ID=this.ID(H)}else{F.setting=G;if(typeof(F.setting.phy)=="undefined"){F.setting.phy=C.phy}if(typeof(F.setting.t)=="undefined"){F.setting.t=H.settings.stream.now}if(typeof(F.setting.x)=="undefined"){F.setting.x=H.settings.sedimentation.incoming.point[G.category].x+(Math.random()*2)}if(typeof(F.setting.y)=="undefined"){F.setting.y=H.settings.sedimentation.incoming.point[G.category].y+(Math.random()*2)}if(typeof(F.setting.size)=="undefined"){F.setting.size=H.settings.sedimentation.token.size.original}if(typeof(F.setting.targets)=="undefined"){F.setting.targets=[]}F.setting.ID=F.setting.ID=this.ID(H);if(typeof(F.setting.state)=="undefined"){F.setting.state=0}if(typeof(F.setting.shape)=="undefined"){F.setting.shape=C.shape}}F.myobj=this.create(H,F.setting);F.flocculate=function(){H.tokens.indexOf(this);H.flocculate.destroyIt(H,this);return this};F.attr=function(I,J,K){if(typeof(J)=="undefined"){if(typeof(this[I])!="undefined"){return this[I]()}else{return this.myobj.m_userData[I]}}else{if(typeof(this[I])!="undefined"){this[I](J,K)}else{this.myobj.m_userData[I]=J}}return this};F.callback=function(I,J){if(!arguments.length){return this.myobj.m_userData.callback}if(typeof(this.myobj.m_userData.callback[I])=="function"){return this.myobj.m_userData.callback[I](J)}else{return function(K){console.log("callback undefined")}}};F.size=function(I){if(this.myobj!=null&&this.attr("state")<2){if(!arguments.length){return this.myobj.m_shape.m_radius*this.myobj.m_userData.scale}this.myobj.m_shape.m_radius=I/this.myobj.m_userData.scale}};F.b2dObj=function(){if(this.myobj!=null&&this.attr("state")<2){return this.myobj}};F.texture=function(I){if(!arguments.length){return this.myobj.m_userData.texture.img.src}console.log("texture",I);this.myobj.m_userData.texture={};this.myobj.m_userData.texture.img=new Image();this.myobj.m_userData.texture.img.src=I};H.tokens.push(F);H.decay.tokens.push(F);if(typeof(this.myobj.m_userData.callback)!="undefined"){if(typeof(this.myobj.m_userData.callback.suspension)=="function"){var E=H.select("ID",F.setting.ID);this.myobj.m_userData.callback.suspension(E)}}return F},create:function(H,C){C.scale=scale=H.settings.options.scale;var G=C.x/scale+(Math.random()*0.1);var D=C.y/scale+(Math.random()*0.1);var F=new Box2D.Dynamics.b2FixtureDef;F.density=0.1;F.friction=0;F.restitution=0;if(C.shape.type=="round"){F.shape=new Box2D.Collision.Shapes.b2CircleShape(C.size/scale)}else{if(C.shape.type=="polygons"){F=this.setPolygons(H,C,F)}else{if(C.shape.type=="box"){F.shape=new Box2D.Collision.Shapes.b2PolygonShape;F.shape.SetAsBox(C.shape.width/scale,C.shape.height/scale)}}}var B=new Box2D.Dynamics.b2BodyDef;B.type=Box2D.Dynamics.b2Body.b2_dynamicBody;B.position.x=C.x/scale;B.position.y=C.y/scale;this.myobj=H.world.CreateBody(B).CreateFixture(F);if(typeof(C.texture)!="undefined"){C.texture.img=new Image();C.texture.img.src=C.texture.src}if(typeof(C.impulse)!="undefined"){this.applyImpulse(this.myobj,C.impulse.angle,C.impulse.power)}if(typeof(C.fillStyle)=="undefined"){C.fillStyle=this.colorRange(C.category)}if(typeof(C.lineWidth)=="undefined"){C.lineWidth=0}if(typeof(C.type)=="undefined"){C.type="token"}if(typeof(C.callback)=="undefined"){C.callback={}}this.myobj.m_userData=C;this.myobj.attr=this.attr;this.myobj.m_userData.mouse={};this.myobj.m_userData.mouse.over=false;this.myobj.m_userData.mouse.down=false;this.myobj.m_userData.mouse.dragging=false;this.myobj.m_userData.mouse.statebefore=false;this.myobj.m_userData.state=1;if(C.targets.length==0&&H.settings.chart.type=="CircleLayout"){C.targets[0]={x:H.settings.sedimentation.incoming.target[C.category].x,y:H.settings.sedimentation.incoming.target[C.category].y}}if(C.targets.length>0){var E=new H.phy.b2MouseJointDef();E.bodyA=H.world.GetGroundBody();E.bodyB=this.myobj.GetBody();E.target.Set(G,D);E.collideConnected=true;E.maxForce=50*this.myobj.GetBody().GetMass();mouseJoint=H.world.CreateJoint(E);mouseJoint.SetTarget(new H.phy.b2Vec2(C.targets[0].x/scale,C.targets[0].y/scale))}return this.myobj},applyImpulse:function(D,E,C){var B=D.GetBody();B.ApplyImpulse(new Box2D.Common.Math.b2Vec2(Math.cos(E*(Math.PI/180))*C,Math.sin(E*(Math.PI/180))*C),B.GetWorldCenter())},setPolygons:function(F,D,E){E.shape=new Box2D.Collision.Shapes.b2PolygonShape;if(D.shape.points==null){D.shape.points=[{x:-1,y:-1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:-1}]}for(var C=0;C<D.shape.points.length;C++){var B=new Box2D.Common.Math.b2Vec2();B.Set(D.shape.points[C].x/scale,D.shape.points[C].y/scale);D.shape.points[C]=B}E.shape.SetAsArray(D.shape.points,D.shape.points.length);return E},createDataBarBall:function(I,B,H,E,F){var G=new Box2D.Dynamics.b2FixtureDef;G.density=10;G.friction=0.5;G.restitution=0.2;G.shape=new Box2D.Collision.Shapes.b2CircleShape(E/I.settings.options.scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B/I.settings.options.scale;D.position.y=H/I.settings.options.scale;var C=I.world.CreateBody(D).CreateFixture(G);C.m_userData={type:"BarChartBall",familyID:"family",fillColor:this.colorRange(F)};return C},createBox:function(I,K,J,D,L,F,C,G){if(typeof(G)=="undefined"){G=true}var B=new b2FixtureDef;if(!G){B.density=100}B.friction=0.6;B.restitution=0.3;var E=new b2BodyDef;E.type=b2Body.b2_staticBody;E.angle=F;B.shape=new b2PolygonShape;B.shape.SetAsBox(D/scale,L/scale);E.position.Set(K/scale,J/scale);var H=I.CreateBody(E).CreateFixture(B);H.m_userData={type:"Wall",fillColor:C};console.log(H.m_userData);return H},createBoxPie:function(I,E,K,J,D,L,G,C){var F=new b2BodyDef;F.type=Box2D.Dynamics.b2Body.b2_dynamicBody;var B=new Box2D.Dynamics.b2FixtureDef;B.shape=new b2PolygonShape;B.shape.SetAsBox(D/scale,L/scale);B.density=1000000;B.friction=0.5;B.restitution=0.2;F.position.Set(K/scale,J/scale);F.angle=0;var H=I.CreateBody(F).CreateFixture(B);H.m_userData={type:"Wall",fillColor:C};return H},createBox0D:function(H,C,I,F,B,G){if(typeof(G)=="undefined"){G=true}var E=new b2BoxDef();E.restitution=-0.6;E.friction=0.3;if(!G){E.density=0.01}E.extents.Set(F,B);var D=new b2BodyDef();D.AddShape(E);D.position.Set(C,I);return H.CreateBody(D)},createHiddenBox:function(G,I,H,B,J,D){if(typeof(D)=="undefined"){D=true}var E=new b2BoxDef();E.restitution=0.6;E.friction=0.3;if(!D){E.density=1}E.extents.Set(B,J);var C=new b2BodyDef();C.AddShape(E);C.position.Set(I,H);var F=G.CreateBody(C);F.m_shapeList.visibility="hidden";console.log(F);return F},createBigBall:function(E,B,G){var F=new Box2D.Dynamics.b2FixtureDef;F.density=1000000;F.friction=0.5;F.restitution=0.2;F.shape=new Box2D.Collision.Shapes.b2CircleShape(20/30);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B;D.position.y=G;var C=E.CreateBody(D).CreateFixture(F);return C},createPieBox:function(G,J,I,C,K,L,D,M){M=A.extend(true,{density:10000000,friction:1,restitution:0.2,linearDamping:0,angularDamping:0,gravityScale:0,type:b2Body.b2_dynamicBody},M);var B=new b2BodyDef();var E=new b2FixtureDef;E.density=M.density;E.friction=M.friction;E.restitution=M.restitution;E.shape=new b2PolygonShape();E.shape.SetAsBox(C/scale,K/scale);B.position.Set(J/scale,I/scale);B.linearDamping=M.linearDamping;B.angularDamping=M.angularDamping;B.angle=L;B.type=M.type;var H=G.CreateBody(B);var F=H.CreateFixture(E);F.m_userData={type:"box",familyID:null,fillColor:D};return H},createDataBallTarget:function(H,L,I,M,K,N,F){var G=M/scale+(Math.random()*0.1);var C=K/scale+(Math.random()*0.1);var B=new Box2D.Dynamics.b2FixtureDef;B.density=0.1;B.friction=0;B.restitution=0;B.shape=new Box2D.Collision.Shapes.b2CircleShape(N/scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=G;D.position.y=C;var E=H.CreateBody(D).CreateFixture(B);var J=new b2MouseJointDef();J.bodyA=H.GetGroundBody();J.bodyB=E.GetBody();J.target.Set(G,C);J.collideConnected=true;J.maxForce=50*E.GetBody().GetMass();mouseJoint=H.CreateJoint(J);mouseJoint.SetTarget(new b2Vec2(L/scale,I/scale));E.m_userData={type:"PieBall",familyID:F,fillColor:colorScale(F)};categorys[F].value+=1;categorys[F].joins.push(mouseJoint);return E},createDataBallPie:function(H,I,M,K,N,F){console.log(I);var G=categorys[F].incomingPoint.x/scale+(Math.random()*2/scale);var C=categorys[F].incomingPoint.y/scale;var B=new Box2D.Dynamics.b2FixtureDef;B.density=0.1;B.friction=0;B.restitution=0;B.shape=new Box2D.Collision.Shapes.b2CircleShape(N/scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=G;D.position.y=C;var L=H.CreateBody(D);L.m_userData={type:"PieBall",familyID:F,fillColor:categorys[F].color};listBodies.push(L);var E=L.CreateFixture(B);var J=new b2MouseJointDef();J.bodyA=H.GetGroundBody();J.bodyB=E.GetBody();J.target.Set(G,C);J.collideConnected=true;J.maxForce=100*E.GetBody().GetMass();mouseJoint=H.CreateJoint(J);mouseJoint.SetTarget(new b2Vec2(I.position.x/scale,I.position.y/scale));E.m_userData={type:"PieBall",familyID:F,fillColor:colorScale(F)};categorys[F].value+=1;return E},createDataBall:function(H,B,G,E){var F=new Box2D.Dynamics.b2FixtureDef;F.density=1;F.friction=0.5;F.restitution=0.2;F.shape=new Box2D.Collision.Shapes.b2CircleShape(E/H.settings.options.scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B;D.position.y=G;var C=H.world.CreateBody(D).CreateFixture(F);C.m_userData={type:"PieBall",familyID:"family",fillColor:"rgb(200,0,0)"};return C},}})(jQuery);(function(A){A.fn._vs.stream={i:null,buffer:[],speed:10000/6,strategy:null,type:null,init:function(B){this.speed=B.settings.data.stream.refresh;type=B.settings.data.stream.provider},push:function(C){console.log(C);for(var B=C.length-1;B>=0;B--){buffer.push(C)}},update:function(C){if(type=="generator"){for(var B=0;B<C.settings.data.model.length;B++){C.dataFlow[B]=setInterval((function(D,E){return function(){E.settings.data.stream.now++;var F=E.chart[E.settings.chart.type](E,"token",D);E.addToken(F)}})(B,C),this.speed)}}else{if(type=="tokens"){C.dataFlow[0]=setInterval((function(D,E){return function(){E.settings.data.stream.now++;for(var F=0;F<E.settings.data.tokens.length;F++){if(E.settings.data.tokens[F].t==E.settings.data.stream.now){E.addToken(E.settings.data.tokens[F])}}}})(B,C),this.speed)}else{}}},generator:function(C,B){},test:function(B){B.tokens.push(B.token.createDataBarBall(B,(B.settings.sedimentation.incoming[i].x+(Math.random()*2)),(B.settings.sedimentation.incoming[i].y+(Math.random()*1)),B.settings.sedimentation.token.size,i))},setSpeed:function(D,C){speedFlow=C;for(var B=0;B<categorys.length;B++){window.clearInterval(dataFlow[B])}window.clearInterval(decayFlow);dataFlow(categorys)}}})(jQuery);(function(A){A.fn._vs.decay={tokens:[],update:function(G){var D=1;var J=G.settings.sedimentation.suspension.height;var K=G.settings.height;var H=G.settings.sedimentation.token.size/4;var B=G.settings.sedimentation.suspension.decay.power;var E=G.settings.options.scale;var F=G.settings.sedimentation.token.size.minimum;if(B==null){var B=0}for(var I=0;I<this.tokens.length;I++){var C=this.tokens[I].attr("size");if(B!=0){this.tokens[I].attr("size",C/B)}if(C<=F){if(G.settings.sedimentation.flocculate.strategy!=null){G.flocculate.destroyIt(G,this.tokens[I]);G.strata.update(G)}}}}}})(jQuery);(function(A){A.fn._vs.flocculate={buffer:[],init:function(C){for(var B=0;B<C.settings.data.model.length;B++){this.buffer[B]=[]}},addtobuffer:function(C,B){c=B.attr("category");bufferSize=C.settings.sedimentation.flocculate.bufferSize;this.buffer[c].push(B);C.decay.tokens.splice(C.decay.tokens.indexOf(B),1);B.attr("callback","bufferFlocculation",B);if(this.buffer[c].length>bufferSize){this.update(C,c,bufferSize)}},destroyIt:function(D,C){C.attr("callback","flocculation",C);C.attr("state",2);var B=D.world.DestroyBody(C.myobj.GetBody());return B},update:function(E,D,B){if(E.settings.sedimentation.flocculate.number==1){while(this.buffer[D].length>B){var C=this.buffer[D].shift();this.destroyIt(E,C)}}else{while(this.buffer[D].length>E.settings.sedimentation.flocculate.number){var C=this.buffer[D].shift();this.destroyIt(E,C)}}},disapear:function(C,B){window.setInterval(function(){B.update(self)},self.settings.options.refresh/2)},all:function(C){for(var B=C.decay.tokens-1;B>=0;B--){this.update(C,B,C.tokens.length)}},strategy:function(){if(flocullateBuffer.length>0){if(chart.flocullate.strategy=="Size"&&flocullateBuffer.length>=chart.flocullate.bufferSize){flocullateByArray(flocullateBuffer)}else{if(chart.flocullate.strategy=="Time"){}else{if(chart.flocullate.strategy=="Height"){}}}}}}})(jQuery);(function(A){A.fn._vs.aggregate={defaultSettings:{},strata_layers:function(H,G,B,D){var F=d3.scale.linear().domain([1,B-2]).range([Math.PI/2,2*Math.PI-Math.PI/2]);var C=d3.scale.pow().exponent(10).domain([0,B]).range([0,1]);return d3.range(G).map(function(I){var J=5*Math.random();return d3.range(B).map(function(L){if(H.settings.sedimentation.aggregation.strataType=="sin"){if(I==1){return 20}var K=5+J*5*Math.sin(F(L))+(I*50);if(K<0){return -K}else{return K}}else{if(H.settings.sedimentation.aggregation.strataType=="log"){return I+1}else{if(typeof(D)=="undefined"){D=0}return H.settings.data.strata[D][I].value}}}).map(E)});function E(J,I){return{x:I,y:Math.max(0,J)}}},init:function(L){if(typeof(L.settings.data.strata)=="undefined"||L.settings.data.strata.length==0||L.settings.data.strata[0].length==0){return}var M=L.token.colorRange;if(L.settings.chart.type=="StackedAreaChart"){var E=L.settings.chart.width/L.settings.data.model.length,O=L.settings.sedimentation.aggregation.height;var G=d3.select("#"+L.settings.DOMelement.id).append("div").attr("class","vis").style("z-index",10).append("svg").attr("width",L.settings.width).attr("height",L.settings.height).append("g").attr("transform","translate("+L.settings.chart.x+","+L.settings.chart.y+")");var Q=G.selectAll("g.gcol").data(L.settings.data.strata,function(V){return[V]}).enter().append("g").attr("transform",function(W,V){return"translate("+(V*E)+", "+(L.settings.chart.height-L.settings.sedimentation.aggregation.height)+")"}).attr("class",function(W,V){return"gcol col_"+V});var U=L.settings.data.strata.map(function(V){return{value:V[0].value}});var R=L.settings.data.strata[0].length,S=20;smx=S-1,smy=0;var D=0;var T=d3.svg.area().x(function(V){return L.settings.chart.spacer+V.x*(E-2*L.settings.chart.spacer)/smx}).y0(function(V){return(O-V.y0*D)}).y1(function(V){return(O-(V.y+V.y0)*D)});var K=[];var B=Q.selectAll("gpath").data(function(X,V){var W=d3.layout.stack().offset("expand")(L.aggregate.strata_layers(L,X.length,S,V));smy=d3.max(W,function(Y){return d3.max(Y,function(Z){return Z.y0+Z.y})});W.map(function(Y){Y.map(function(Z){Z.col=V;return Z})});return W}).enter().append("g").attr("class","gpath");B.append("path").attr("d",function(W,V){D=L.settings.chart.height-L.chart.getPosition(L)[W[0].col].y;return T(W)}).style("fill",function(W,V){if(L.settings.data.strata[W[0].col][V].texture!=null){return"url(#RectanglePattern_"+W[0].col+"_"+V+")"}else{return d3.rgb(M(W[0].col)).darker(L.settings.data.strata[W[0].col].length/2-(V+1)/2)}}).attr("class",function(W,V){return"layer"}).attr("class",function(W,V){return"col_"+W[0].col+" layer_"+V});var C=E/1;var I=C;for(var F=0;F<L.settings.data.strata.length;F++){for(var J=0;J<L.settings.data.strata[F].length;J++){if(L.settings.data.strata[F][J].texture!=null){var P=G.append("pattern").attr("id","RectanglePattern_"+F+"_"+J).attr("height",I).attr("width",C).attr("patternTransform","translate(0, 0) scale("+L.settings.data.strata[F][J].texture.size+", "+L.settings.data.strata[F][J].texture.size+") rotate(0)").attr("patternUnits","userSpaceOnUse");P.append("image").attr("x",0).attr("y",0).attr("height",I).attr("width",C).attr("xlink:href",function(){return L.settings.data.strata[F][J].texture.url})}}}}else{if(L.settings.chart.type=="CircleLayout"){var H=d3.select("#"+L.settings.DOMelement.id).append("div").attr("class","vis").attr("width",L.settings.width).attr("height",L.settings.height).append("svg").attr("width",L.settings.width).attr("height",L.settings.height);if(typeof(L.settings.chart.treeLayout)!="undefined"){for(var N=0;N<L.settings.data.model.length;N++){var U=L.settings.data.strata[N];var M=function(V){return L.token.colorRange(N)};L.aggregate.create_pie_chart(L,U,H,U[0].value,M,((N+1/2))*L.settings.chart.width/(L.settings.data.model.length)+L.settings.chart.x,L.settings.chart.y+L.settings.chart.height/6)}}else{var U=L.settings.data.strata.map(function(V){return{value:V[0].value}});console.log(L.settings.data.strata,U);var M=L.token.colorRange;L.aggregate.create_pie_chart(L,U,H,L.settings.chart.radius,M,L.settings.chart.x+L.settings.chart.width/2,L.settings.chart.y+L.settings.chart.height/2)}}}},create_pie_chart:function(O,T,K,J,P,N,M){var H=O.settings.width/O.settings.data.model.length,R=O.settings.sedimentation.aggregation.height;var G=d3.scale.linear().domain([0,O.settings.data.strata.length-1]).range([0,O.settings.width]);var F=d3.scale.linear().domain([0,d3.max(T,function(U){return U.value})]).rangeRound([0,R]);var C=O.settings.width,B=O.settings.height,I=O.settings.sedimentation.aggregation.height;labelr=J+30,donut=d3.layout.pie().sort(null),arc=d3.svg.arc().innerRadius(0).outerRadius(J);var L=Math.random();K.append("g.arcs_"+L).attr("class","arcs_"+L);var E=K.selectAll(".arcs").data(donut(T.map(function(V,U){return V.value}))).enter().append("svg:g").attr("transform","translate("+N+","+M+")");var D=0;var S=d3.svg.area().x(function(U){return O.settings.chart.spacer+U.x*(H-2*O.settings.chart.spacer)/smx}).y0(function(U){return(R-U.y0*D)}).y1(function(U){return(R-(U.y+U.y0)*D)});var Q=E.append("path").attr("fill",function(V,U){return P(U)}).attr("d",function(V,U){return arc(V)}).each(function(U){this._current=U})},update:function(K){if(typeof(K.settings.data.strata)=="undefined"||K.settings.data.strata.length==0||K.settings.data.strata[0].length==0){return}var N=K.settings.chart.width/K.settings.data.model.length;var I=K.settings.sedimentation.aggregation.height;var M=d3.scale.linear().domain([0,K.settings.data.strata.length-1]).range([0,K.settings.width]);var H=K.settings.data.strata.map(function(P){return{value:P[0].value}});var O=K.settings.data.strata.map(function(R){for(var P=0,Q=0;P<R.length;P++){Q+=R[P].value}return Q});var L=d3.scale.linear().domain([0,d3.max(O)]).range([0,K.settings.sedimentation.aggregation.height]);var E=K.settings.data.strata[0].length,F=20;smx=F-1,smy=0;var G=0;var D=d3.svg.area().x(function(P){return K.settings.chart.spacer+P.x*(N-2*K.settings.chart.spacer)/smx}).y0(function(P){return(I-P.y0*G)}).y1(function(P){return(I-(P.y+P.y0)*G)});var C=d3.select("svg");var J=C.selectAll(".gcol");J.data(K.settings.data.strata,function(Q,P){return[Q]});var B=J.selectAll(".gpath").data(function(R,P){var Q=d3.layout.stack().offset("expand")(K.aggregate.strata_layers(K,R.length,F,P));smy=d3.max(Q,function(S){return d3.max(S,function(T){return T.y0+T.y})});Q.map(function(S){S.map(function(T){T.col=P;return T})});return Q});B.select("path").transition().duration(100).attr("d",function(Q,P){K.chartUpdate(P,-L(O[P])-(I-K.settings.chart.height));G=K.settings.chart.height-K.chart.getPosition(K)[Q[0].col].y;return D(Q)})}}})(jQuery);(function($){$.fn._vs.strata={stratas:[],init:function(_this){if(_this.settings.chart.type!="StackedAreaChart"){_this.strata.create_strata(_this);return}settings=_this.settings;if((typeof(settings.data.strata)!="function")&&(typeof(settings.data.strata)=="undefined"||settings.data.strata.length==0)){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,value:function(t,s){return 0},};_this.strata.stratas[i]=[defaultStrata]}_this.strata.create_strata(_this);return}if(typeof settings.data.strata!="function"){if(typeof(settings.data.strata=="object")&&typeof(settings.data.strata[0])!="undefined"&&(typeof settings.data.strata[0][0].value!="undefined")&&typeof(settings.data.strata[0][0].value=="string")){var NB_STRATA=settings.data.strata[0].length;for(var i=0;i<settings.data.model.length;i++){_this.strata.stratas[i]=[];for(var n=0;n<NB_STRATA;n++){(function(a,b){var t=null;if((typeof settings.data.strata[a]!="undefined")&&(typeof settings.data.strata[a][b]!="undefined")&&(typeof settings.data.strata[a][b].texture!="undefined")){t=settings.data.strata[a][b].texture}var defaultStrata={};defaultStrata={label:settings.data.model[i].label+"_"+a,category:a,texture:t,value:function(){r=eval("f="+settings.data.strata[a][b].value);return r()}};_this.strata.stratas[a].push(defaultStrata)})(i,n)}}_this.strata.create_strata(_this);return}if(typeof(settings.data.strata[0])!="undefined"&&typeof(settings.data.strata[0][0])!="undefined"&&typeof(settings.data.strata[0][0].initValue!="undefined")){for(var c=0;c<settings.data.model.length;c++){var defaultStrata={label:settings.data.model[c].label+"_"+c,category:i,value:function(t,s){if(t.selectAll("category",s)){return settings.data.strata[s][0].initValue+t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return settings.data.strata[s][0].initValue}},};_this.strata.stratas[c]=[defaultStrata]}_this.strata.create_strata(_this);return}else{if(settings.data.strata[0].length==0){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,value:function(t,s){if(t.selectAll("category",s)){return t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return 0}},};_this.strata.stratas[i]=[defaultStrata]}_this.strata.create_strata(_this);return}else{var NB_STRATA=settings.data.strata[0].length;settings.data.strata_param=settings.data.strata;function fstrata(){var a=Array();for(var s=0;s<mySettings.data.model.length;s++){a.push(fstratum(s))}return a}function fstratum(a){var b=Array(NB_STRATA);for(var r=0;r<b.length;r++){b[r]=Array()}if(typeof _this!="undefined"){var tokens=_this.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length;for(var k=0;k<tokens.length;k++){var tk=tokens[k];for(var r=0;r<b.length;r++){if(tk<_this.settings.stream.now-2*(r)&&tk>=_this.settings.stream.now-2*(r+1)){b[b.length-r-1].push(tk)}}}}var res=Array();for(var j=0;j<NB_STRATA;j++){var val=b[j].length;(function(v){res.push({value:function(){return v},label:"Strata "+j,category:a})})(val)}return res}_this.settings.data.strata=function(){return fstrata()};_this.strata.stratas=_this.settings.data.strata();_this.strata.create_strata(_this);return}}}if((typeof settings.data.strata=="function")||settings.data.strata[0].length>0||_this.strata.stratas.length>0){if(typeof settings.data.strata=="function"||(settings.data.strata[0].length>0&&typeof(settings.data.strata[0])=="object")){if(typeof settings.data.strata=="function"){_this.strata.stratas=settings.data.strata()}else{if(typeof settings.data.strata[0].value=="function"){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,initValue:settings.data.model[i].value,value:function(t,s){return settings.data.strata[i]},};_this.strata.stratas[i]=[defaultStrata]}}else{for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,initValue:settings.data.model[i].value,value:function(t,s){if(typeof(t.selectAll("category",s).length)=="undefined"){return this.initValue}if(t.selectAll("category",s)){return this.initValue+t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return 0}},};_this.strata.stratas[i]=[defaultStrata]}}}}_this.strata.create_strata(_this)}},selectAll:function(_this,key,value){result=[];result.attr=function(key,value,param){var r=[];result.forEach(function(i){q=i.attr(key,value,param);r.push(q)});return r};if(typeof(value)=="undefined"&&typeof(key)=="undefined"){return this.stratas}else{for(var i=_this.strata.stratas.length-1;i>=0;i--){if(_this.strata.stratas[i].attr(key)==value){result.push(_this.strata.stratas[i]);break}}}if(typeof(result[0])=="undefined"){return false}else{return result[0]}},add:function(_this,setting){var strata=function(){};strata.myobj=setting;strata.attr=function(key,value,param){if(typeof(value)=="undefined"){if(typeof(this[key])!="undefined"){return this[key]()}else{return this.myobj[key]}}else{if(typeof(this[key])!="undefined"){this[key](value,param)}else{this.myobj[key]=value}}return this};return strata},remove:function(_this,key,value){},strata_layers:function(_this,n,m,p){var sn=d3.scale.linear().domain([1,m-2]).range([Math.PI/2,2*Math.PI-Math.PI/2]);var logscale=d3.scale.pow().exponent(10).domain([0,m]).range([0,1]);return d3.range(n).map(function(i){var r=5*Math.random();return d3.range(m).map(function(j){if(_this.settings.sedimentation.aggregation.strataType=="sin"){if(i==1){return 20}var x=5+r*5*Math.sin(sn(j))+(i*50);if(x<0){return -x}else{return x}}else{if(_this.settings.sedimentation.aggregation.strataType=="log"){return i+1}else{if(typeof(p)=="undefined"){p=0}return _this.strata.stratas[p][i].value(_this,p)}}}).map(stream_index)});function stream_index(d,i){return{x:i,y:Math.max(0,d)}}},create_strata:function(_this){if(_this.settings.chart.type=="StackedAreaChart"){var w=_this.settings.chart.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var color=_this.token.colorRange;if(typeof _this.settings.options.canvasFirst!="undefined"&&_this.settings.options.canvasFirst==false){var vis=d3.select("#"+_this.settings.DOMelement.id).insert("div",":first-child").style("position","absolute").attr("class","vis").style("z-index",10).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height).append("g").attr("transform","translate("+_this.settings.chart.x+","+_this.settings.chart.y+")")}else{var vis=d3.select("#"+_this.settings.DOMelement.id).append("div").attr("class","vis").style("z-index",10).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height).append("g").attr("transform","translate("+_this.settings.chart.x+","+_this.settings.chart.y+")")}var sn=_this.strata.stratas[0].length,sm=20;smx=sm-1,smy=0;var sum_strata=_this.strata.stratas.map(function(d,i){for(var v=0,res=0;v<d.length;v++){res+=d[v].value(_this,i)}return res});var y=d3.scale.linear().domain([0,Math.max(d3.max(sum_strata),_this.settings.sedimentation.aggregation.maxData)]).range([0,_this.settings.sedimentation.aggregation.height]);var g=vis.selectAll("g.gcol").data(_this.strata.stratas,function(d){return[d]}).enter().append("g").attr("transform",function(d,i){var align=_this.settings.sedimentation.aggregation.height;if(_this.settings.sedimentation.aggregation.invertStrata){align=2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i])}return"translate("+(i*w)+", "+(_this.settings.chart.height-align)+")"}).attr("class",function(d,i){return"gcol col_"+i});var gpath=g.selectAll(".gpath").data(function(d,i){var sd=d3.layout.stack().offset("expand")(_this.strata.strata_layers(_this,d.length,sm,i));smy=d3.max(sd,function(d){return d3.max(d,function(d){return d.y0+d.y})});sd.map(function(d){d.map(function(d){d.col=i;return d})});return sd}).enter().append("g").attr("class","gpath");var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*d.offshit)}).y1(function(d){return(h-(d.y+d.y0)*d.offshit)});var pathlayer=gpath.append("path").attr("d",function(d,i){_this.chartUpdate(i,-y(sum_strata[i])-(h-_this.settings.chart.height));hh=0;d.map(function(dd){dd.offshit=hh;return dd});return area(d)});pathlayer.style("fill",function(d,i){if(_this.strata.stratas[d[0].col][i].texture!=null){return"url(#RectanglePattern_"+d[0].col+"_"+i+")"}else{return d3.rgb(color(d[0].col)).darker(_this.strata.stratas[d[0].col].length/2-(i+1)/2)}}).attr("class",function(d,i){return"gcol col_"+d[0].col+" layer_"+i});var patternWidth=w/1;var patternHeight=patternWidth;if(typeof _this.settings.data.strata!="undefined"){for(var s=0;s<_this.settings.data.strata.length;s++){for(var l=0;l<_this.settings.data.strata[s].length;l++){if(_this.settings.data.strata[s][l].texture!=null){var pattern=vis.append("pattern").attr("id","RectanglePattern_"+s+"_"+l).attr("height",patternHeight).attr("width",patternWidth).attr("patternTransform","translate(0, 0) scale("+_this.settings.data.strata[s][l].texture.size+", "+_this.settings.data.strata[s][l].texture.size+") rotate(0)").attr("patternUnits","userSpaceOnUse");pattern.append("image").attr("x",0).attr("y",0).attr("height",patternHeight).attr("width",patternWidth).attr("xlink:href",function(){return _this.settings.data.strata[s][l].texture.url})}}}}}else{if(_this.settings.chart.type=="CircleLayout"){var svg=d3.select("#"+_this.settings.DOMelement.id).append("div").attr("class","vis").attr("width",_this.settings.width).attr("height",_this.settings.height).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height);if(typeof(_this.settings.chart.treeLayout)!="undefined"){for(var i=0;i<_this.settings.data.model.length;i++){var data=_this.settings.data.strata[i];var color=function(s){return _this.token.colorRange(i)};_this.strata.create_pie_chart(_this,data,svg,data[0].value,color,((i+1/2))*_this.settings.chart.width/(_this.settings.data.model.length)+_this.settings.chart.x,_this.settings.chart.y+_this.settings.chart.height/6)}}else{var data=_this.settings.data.strata.map(function(d){return{value:d[0].value}});var color=_this.token.colorRange;_this.strata.create_pie_chart(_this,data,svg,_this.settings.chart.radius,color,_this.settings.chart.x+_this.settings.chart.width/2,_this.settings.chart.y+_this.settings.chart.height/2)}}}},create_pie_chart:function(_this,data,svg,r,color,posx,posy){var w=_this.settings.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var x=d3.scale.linear().domain([0,_this.settings.data.strata.length-1]).range([0,_this.settings.width]);var y=d3.scale.linear().domain([0,d3.max(data,function(d){return d.value})]).rangeRound([0,h]);var wp=_this.settings.width,hp=_this.settings.height,hhp=_this.settings.sedimentation.aggregation.height;labelr=r+30,donut=d3.layout.pie().sort(null),arc=d3.svg.arc().innerRadius(0).outerRadius(r);var id=Math.random();svg.append("g.arcs_"+id).attr("class","arcs_"+id);var garcs=svg.selectAll(".arcs").data(donut(data.map(function(d,i){return d.value}))).enter().append("svg:g").attr("transform","translate("+posx+","+posy+")");var hh=0;var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*hh)}).y1(function(d){return(h-(d.y+d.y0)*hh)});var arcs=garcs.append("path").attr("fill",function(d,i){return color(i)}).attr("d",function(d,i){return arc(d)}).each(function(d){this._current=d})},update:function(_this){if(typeof(_this.strata.stratas)=="undefined"||_this.strata.stratas.length==0){return}if(typeof settings.data.strata=="function"){_this.strata.stratas=settings.data.strata()}var sn=_this.strata.stratas[0].length,sm=20;smx=sm-1,smy=0;var w=_this.settings.chart.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var color=_this.token.colorRange;var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*d.offshit)}).y1(function(d){return(h-(d.y+d.y0)*d.offshit)});var sum_strata=_this.strata.stratas.map(function(d,i){for(var v=0,res=0;v<d.length;v++){res+=d[v].value(_this,i)}return res});var y=d3.scale.linear().domain([0,Math.max(d3.max(sum_strata),_this.settings.sedimentation.aggregation.maxData)]).range([0,_this.settings.sedimentation.aggregation.height]);var vis=d3.select("#"+_this.settings.DOMelement.id);var g=vis.selectAll("g.gcol");if(_this.settings.sedimentation.aggregation.invertStrata){g.transition().duration(100).attr("transform",function(d,i){var align=_this.settings.sedimentation.aggregation.height;align=2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i]);return"translate("+(i*w)+", "+(_this.settings.chart.height-(2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i])))+")"})}var gpath=g.selectAll("path").data(function(d,i){var sd=d3.layout.stack().offset("expand")(_this.strata.strata_layers(_this,d.length,sm,i));smy=d3.max(sd,function(d){return d3.max(d,function(d){return d.y0+d.y})});sd.map(function(d){d.map(function(d){d.col=i;return d})});return sd});if(_this.settings.chart.type=="StackedAreaChart"){var pathlayer=vis.selectAll("path").transition().duration(100).attr("d",function(d,i){if(!_this.settings.sedimentation.aggregation.invertStrata){_this.chartUpdate(i,-y(sum_strata[i])-(h-_this.settings.chart.height));hh=_this.settings.chart.height-_this.chart.getPosition(_this)[d[0].col].y}else{_this.chartUpdate(i,-2*h+_this.settings.chart.height);hh=y(sum_strata[d[0].col])}d.map(function(dd){dd.offshit=hh;return dd});return area(d)})}}}})(jQuery);(function(A){A.fn._vs.chart.StackedAreaChart=function(F,E,D){var C;this.init=function(G){gravity=new G.phy.b2Vec2(0.001,10);G.world.m_gravity=gravity;G.chartPhySetup={grounds:[],wall:[]};this.setupChartPhysics(G)};this.setupChartPhysics=function(L){var M=L.settings.chart.spacer;var O=(L.settings.chart.width/L.settings.data.model.length);var H=M;var P=L.settings.chart.height/2+L.settings.chart.y;var N=L.settings.chart.height-L.settings.sedimentation.aggregation.height;var I=0;for(var K=0;K<L.settings.data.model.length;K++){L.settings.data.model[K].value=0;if(typeof(L.settings.data.strata)!="undefined"){if(typeof(L.settings.data.strata[K])!="undefined"){for(var J=0;J<L.settings.data.strata[K].length;J++){L.settings.data.model[K].value+=L.settings.data.strata[K][J].value}}}I+=L.settings.data.model[K].value}for(var K=0;K<L.settings.data.model.length+1;K++){var G=L.settings.chart.x+(K*O);L.chartPhySetup.wall[K]=this.createMyChartBox(L,G,P,H,L.settings.chart.height/2,"wall",L.settings.chart.wallColor);if(K<L.settings.data.model.length){L.settings.sedimentation.incoming.point[K]={x:G+(O/2),y:L.settings.y}}if(K<L.settings.data.model.length){L.chartPhySetup.grounds[K]=this.createMyChartBox(L,G+(O/2),L.settings.chart.height+L.settings.chart.y+L.settings.sedimentation.aggregation.height,O/2,L.settings.chart.height,"lift","rgba(250,250,250,0)");this.update(L,{cat:K,y:L.settings.chart.height})}}};this.token=function(J,G){var I=G;var H={x:(J.settings.sedimentation.incoming.point[I].x+(Math.random()*2)),y:(J.settings.sedimentation.incoming.point[I].y+(Math.random()*1)),t:J.now(),size:J.settings.sedimentation.token.size.original,category:I,lineWidth:0,};return H};this.createMyChartBox=function(M,P,O,Q,L,N,J){var I=M.settings.options.scale;var G=new M.phy.b2FixtureDef;G.density=1;G.friction=0.5;G.restitution=0.2;var H=new M.phy.b2BodyDef;H.type=M.phy.b2Body.b2_staticBody;G.shape=new M.phy.b2PolygonShape;G.shape.SetAsBox(Q/I,L/I);H.position.Set(P/I,O/I);var K=M.world.CreateBody(H).CreateFixture(G);K.m_userData={type:N,fillStyle:J,w:Q,h:L,x:P,y:O};return K};this.update=function(K,J){var I={cat:0,y:0};if(K.chartPhySetup.grounds[J.cat]!=null){var H=K.chartPhySetup.grounds[J.cat].GetBody();var G=H.GetWorldCenter();G.y=(J.y+K.settings.chart.height+K.settings.chart.y+K.settings.sedimentation.aggregation.height)/K.settings.options.scale;H.SetPosition(G)}};this.getPositionOld=function(I){var G=[];for(var H=0;H<I.chartPhySetup.grounds.length;H++){myElement=I.chartPhySetup.grounds[H];myBody=myElement.GetBody();G.push({x:(myBody.GetWorldCenter().x*I.settings.options.scale),y:(myBody.GetWorldCenter().y*I.settings.options.scale),a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return G};this.getPosition=function(I){var G=[];for(var H=0;H<I.chartPhySetup.grounds.length;H++){myElement=I.chartPhySetup.grounds[H];myBody=myElement.GetBody();G.push({x:(myBody.GetWorldCenter().x*I.settings.options.scale),y:(myBody.GetWorldCenter().y*I.settings.options.scale)-I.settings.chart.height-I.settings.chart.y,a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return G};if(typeof(E)!=undefined){var B=this[E](F,D);if(typeof(B)!=undefined){return B}}}})(jQuery);(function(A){A.fn._vs.chart.CircleLayout=function(I,M,Q){var H;var K;var J;var G;var N=[];var E=0;var I;this.init=function(U,S){console.log("Circle Layout Init");this._this=U;gravity=new U.phy.b2Vec2(0,0);U.world.m_gravity=gravity;U.chartPhySetup={grounds:[],wall:[]};this.treeLayout=U.settings.chart.treeLayout;for(var T=0;T<U.settings.data.model.length;T++){U.settings.data.strata[T][0].value=U.settings.data.strata[T][0].initValue}for(var T=0;T<U.settings.data.model.length;T++){U.settings.data.model[T].value=0;for(var R=0;R<U.settings.data.strata[T].length;R++){U.settings.data.model[T].value+=U.settings.data.strata[T][R].value}N.push(U.settings.data.model[T].value);E+=U.settings.data.model[T].value}if(this.treeLayout){console.log("ici");this.setupBubbleChartPhysics(U)}else{this.setupPieChartPhysics(U)}};this.setupPieChartPhysics=function(X){console.log("w",X.settings.width);var S=X.settings.chart.radius;K=X.settings.chart.width/2+X.settings.chart.x;J=X.settings.chart.height/2+X.settings.chart.y;var V=O(K,J,S,X.settings.chart.wallColor);for(var U=0;U<X.settings.data.model.length;U++){X.settings.sedimentation.incoming.target[U]={x:K,y:J}}var R=[];var T=X.settings.chart.spacer;var W=0;console.log("tdv",E);if(E==0){for(var U=0;U<X.settings.data.length;U++){N[U]=1}E=N.length}for(var U=0;U<N.length;U++){v=N[U];a2=((v/2+W)/E)*360-90;W+=v;a=(W/E)*360-90;c=L(a2,S*5,K,J);console.log(c);X.settings.sedimentation.incoming.point[U]=c;X.chartPhySetup.grounds[U]=this.createBox(X,K,J,T,S,a,S,"wall",X.settings.chart.wallColor)}console.log("w",X.settings.chart.width)};this.update=function(Y,U){console.log("update");var T={cat:0,r:0};U.r-=90;var W=(U.r+90)*(Math.PI/180);var X=L(U.r,Y.settings.chart.radius,Y.settings.chart.width/2+Y.settings.chart.x,Y.settings.chart.height/2+Y.settings.chart.y);if(Y.chartPhySetup.grounds[U.cat]!=null){var S=Y.chartPhySetup.grounds[U.cat].GetBody();var R=S.GetWorldCenter();var V=S.GetAngle();R.y=X.y/Y.settings.options.scale;R.x=X.x/Y.settings.options.scale;V=W;S.SetPosition(R);S.SetAngle(V)}};this.token=function(U,R){var T=R;var S={x:(U.settings.sedimentation.incoming.point[T].x+(Math.random()*2)),y:(U.settings.sedimentation.incoming.point[T].y+(Math.random()*1)),t:U.now(),size:U.settings.sedimentation.token.size.original,category:T,phy:{density:10,friction:0,restitution:0},targets:[{x:U.settings.sedimentation.incoming.target[T].x,y:U.settings.sedimentation.incoming.target[T].y}]};return S};function L(T,S,X,U){j=T*Math.PI/180;var R=(Math.cos(j)*S)+X;var W=(Math.sin(j)*S)+U;var V={x:R,y:W};return V}function O(W,V,R,T){var Y=I.settings.options.scale;var X=new I.phy.b2FixtureDef;X.density=1;X.friction=0.5;X.restitution=0.2;var S=new I.phy.b2BodyDef;X.shape=new I.phy.b2CircleShape(R/Y);S.position.Set(W/Y,V/Y);var U=I.world.CreateBody(S).CreateFixture(X);U.m_userData={type:"wall",familyID:null,fillStyle:T,strokeStyle:T,r:R};return U}this.createBox=function(Z,k,f,l,Y,g,R,e,W){var V=Z.settings.options.scale;var S=new Z.phy.b2FixtureDef;var b=L(g,R,k,f);S.density=1;S.friction=0.5;S.restitution=0.2;var U=new Z.phy.b2BodyDef;var T=(g+90)*(Math.PI/180);U.angle=T;U.type=Z.phy.b2Body.b2_staticBody;S.shape=new Z.phy.b2PolygonShape;S.shape.SetAsBox(l/V,Y/V);U.position.Set(b.x/V,b.y/V);var X=Z.world.CreateBody(U).CreateFixture(S);X.m_userData={type:e,fillStyle:W,w:l,h:Y,r:R};return X};this.getPosition=function(T){var R=[];for(var S=0;S<T.chartPhySetup.grounds.length;S++){myElement=T.chartPhySetup.grounds[S];myBody=myElement.GetBody();R.push({x:(myBody.GetWorldCenter().x*T.settings.options.scale),y:(myBody.GetWorldCenter().y*T.settings.options.scale),a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return R};this.setupBubbleChartPhysics=function(Y){console.log("setupBubbleChartPhysics");var V=(Y.settings.chart.width/Y.settings.data.model.length);var T=Y.settings.chart.spacer;var S=Y.settings.chart.height/2+Y.settings.y+T;var W=0;var X=0;var R=Y.settings.chart.column;for(var U=0;U<Y.settings.data.model.length;U++){X=Y.settings.chart.x+(U%R*T)+(T/2);W=Y.settings.chart.y+Math.floor(U/R)*T+(T/2);Y.settings.sedimentation.incoming.target[U]={x:X,y:W};O[U]=C(X,W,Y.settings.chart.spacer,U);Y.settings.data.model[U].incomingPoint={x:X,y:W}}};function C(b,W,X,S){console.log("CreatMyBubblePivot",b,W,X,S);var U=I.settings.options.scale;var R=new I.phy.b2FixtureDef;var Z=d3.scale.category10();R.density=10000;R.friction=0;R.restitution=0;var V=new I.phy.b2BodyDef;R.shape=new I.phy.b2CircleShape(X*U);V.position.Set(b/U,W/U);var T=I.world.CreateBody(V);var Y=T.CreateFixture(R);console.log(S,Z(S));Y.m_userData={type:"BubblePivot",familyID:S,fillStyle:I.settings.chart.wallColor};console.log(S,Y);Y.m_shape.m_radius=I.settings.data.model[S].value/U;return Y}this.getPivotPosition=function(T){if(typeof(T)!="undefined"){return this.pivot}else{var R=[];for(var S=0;S<I.settings.data.model.length;S++){R.push(I.settings.data.model[S])}return R}};function D(S,U,T){var R=O[T].GetBody();R.SetPosition(new b2Vec2(S/scale,U/scale));I.settings.data.model[T].incomingPoint.x=S;I.settings.data.model[T].incomingPoint.y=U;setFlowSpeed(speedFlow)}function B(R,U,T){for(var S=0;S<categorys[T].joins.length;S++){categorys[T].joins[S].SetTarget(new b2Vec2(R/scale,U/scale))}}function F(R,S){O[S].m_shape.m_radius=R}if(typeof(M)!=undefined){var P=this[M](I,Q);if(typeof(P)!=undefined){return P}}}})(jQuery);
    46 var Box2D={};
       
    47 (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)}};
       
    48 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={};
       
    49 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={};
       
    50 (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,
       
    51 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)}
       
    52 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===
       
    53 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);
       
    54 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===
       
    55 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,
       
    56 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,
       
    57 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);
       
    58 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,
       
    59 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,
       
    60 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,
       
    61 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)}
       
    62 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,
       
    63 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)}
       
    64 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,
       
    65 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);
       
    66 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=
       
    67 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=
       
    68 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=
       
    69 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=
       
    70 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=
       
    71 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=
       
    72 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;
       
    73 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=
       
    74 Ba;Box2D.Dynamics.Joints.b2RevoluteJointDef=Ca;Box2D.Dynamics.Joints.b2WeldJoint=Da;Box2D.Dynamics.Joints.b2WeldJointDef=Ea})();Box2D.postDefs=[];
       
    75 (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,
       
    76 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=
       
    77 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+
       
    78 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-
       
    79 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=
       
    80 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);
       
    81 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=
       
    82 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=
       
    83 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+
       
    84 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];
       
    85 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);
       
    86 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];
       
    87 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,
       
    88 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*
       
    89 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);
       
    90 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+
       
    91 (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*
       
    92 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);
       
    93 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+
       
    94 (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=
       
    95 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=
       
    96 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,
       
    97 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=
       
    98 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();
       
    99 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,
       
   100 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=
       
   101 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=
       
   102 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]};
       
   103 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=
       
   104 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+
       
   105 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++]=
       
   106 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>
       
   107 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=
       
   108 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)/
       
   109 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=
       
   110 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};
       
   111 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)};
       
   112 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},
       
   113 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=
       
   114 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);
       
   115 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]);
       
   116 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=
       
   117 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=
       
   118 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,
       
   119 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,
       
   120 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==
       
   121 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]);
       
   122 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]);
       
   123 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-
       
   124 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-
       
   125 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);
       
   126 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}};
       
   127 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;
       
   128 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=
       
   129 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=
       
   130 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+
       
   131 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,
       
   132 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,
       
   133 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=
       
   134 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);
       
   135 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=
       
   136 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);
       
   137 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=
       
   138 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=
       
   139 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*
       
   140 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*
       
   141 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*
       
   142 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)};
       
   143 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,
       
   144 "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|
       
   145 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}})})();
       
   146 (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,
       
   147 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+
       
   148 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*
       
   149 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*
       
   150 (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=
       
   151 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);
       
   152 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+
       
   153 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,
       
   154 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=
       
   155 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=
       
   156 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=
       
   157 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),
       
   158 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-
       
   159 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)};
       
   160 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)};
       
   161 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,
       
   162 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,
       
   163 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,
       
   164 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);
       
   165 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);
       
   166 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];
       
   167 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==
       
   168 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*
       
   169 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=
       
   170 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=
       
   171 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*
       
   172 (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};
       
   173 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*
       
   174 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/
       
   175 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-
       
   176 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=
       
   177 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};
       
   178 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=
       
   179 parseInt(-1)})})();
       
   180 (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,
       
   181 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===
       
   182 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=
       
   183 "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=
       
   184 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=
       
   185 0.5;Box2D.Common.b2Settings.b2_linearSleepTolerance=0.01;Box2D.Common.b2Settings.b2_angularSleepTolerance=2/180*G.b2_pi})})();
       
   186 (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;
       
   187 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=
       
   188 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!=
       
   189 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)};
       
   190 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=
       
   191 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;
       
   192 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*
       
   193 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*
       
   194 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,
       
   195 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))};
       
   196 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=
       
   197 (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=
       
   198 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);
       
   199 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=
       
   200 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};
       
   201 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;
       
   202 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=
       
   203 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+
       
   204 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=
       
   205 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}})();
       
   206 (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,
       
   207 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,
       
   208 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(),
       
   209 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|=
       
   210 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&
       
   211 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+=
       
   212 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,
       
   213 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=
       
   214 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&
       
   215 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===
       
   216 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(),
       
   217 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);
       
   218 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()};
       
   219 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)==
       
   220 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();
       
   221 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>
       
   222 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;
       
   223 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=
       
   224 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};
       
   225 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|=
       
   226 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=
       
   227 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=
       
   228 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=
       
   229 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;
       
   230 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*
       
   231 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==
       
   232 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=
       
   233 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;
       
   234 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=
       
   235 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=
       
   236 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=
       
   237 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;
       
   238 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();
       
   239 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=
       
   240 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;
       
   241 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()==
       
   242 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(){};
       
   243 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=
       
   244 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=
       
   245 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=
       
   246 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=
       
   247 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(),
       
   248 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=
       
   249 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();
       
   250 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);
       
   251 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};
       
   252 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=
       
   253 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,
       
   254 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()!=
       
   255 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+=
       
   256 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=
       
   257 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,
       
   258 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*
       
   259 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<
       
   260 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=
       
   261 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=
       
   262 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)};
       
   263 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=
       
   264 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=
       
   265 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=
       
   266 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;
       
   267 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=
       
   268 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=
       
   269 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");
       
   270 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=
       
   271 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();
       
   272 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=
       
   273 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?
       
   274 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,
       
   275 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=
       
   276 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,
       
   277 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,
       
   278 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&
       
   279 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=
       
   280 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;
       
   281 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=
       
   282 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|
       
   283 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<
       
   284 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()==
       
   285 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()==
       
   286 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+
       
   287 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|
       
   288 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,
       
   289 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;
       
   290 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;
       
   291 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})})();
       
   292 (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,
       
   293 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,
       
   294 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=
       
   295 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(),
       
   296 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&
       
   297 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(){};
       
   298 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=
       
   299 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=
       
   300 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=
       
   301 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=
       
   302 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=
       
   303 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;
       
   304 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=
       
   305 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,
       
   306 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()),
       
   307 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=
       
   308 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>
       
   309 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=
       
   310 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;
       
   311 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*
       
   312 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*
       
   313 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,
       
   314 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=
       
   315 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+
       
   316 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;
       
   317 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=
       
   318 $-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=
       
   319 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=
       
   320 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);
       
   321 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,
       
   322 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=
       
   323 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
       
   324 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);
       
   325 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=
       
   326 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=
       
   327 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*
       
   328 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;
       
   329 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=
       
   330 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+
       
   331 (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})})();
       
   332 (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);
       
   333 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=
       
   334 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*
       
   335 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;
       
   336 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=
       
   337 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++;
       
   338 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==
       
   339 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;
       
   340 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)*
       
   341 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=
       
   342 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;
       
   343 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))}}}}})();
       
   344 (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,
       
   345 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;
       
   346 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=
       
   347 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===
       
   348 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-
       
   349 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;
       
   350 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-=
       
   351 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-
       
   352 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*
       
   353 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,
       
   354 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;
       
   355 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=
       
   356 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;
       
   357 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=
       
   358 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=
       
   359 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;
       
   360 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;
       
   361 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=
       
   362 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,
       
   363 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);
       
   364 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))};
       
   365 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=
       
   366 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=
       
   367 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);
       
   368 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);
       
   369 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,
       
   370 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;
       
   371 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+=
       
   372 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,
       
   373 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?
       
   374 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();
       
   375 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();
       
   376 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=
       
   377 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=
       
   378 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=
       
   379 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=
       
   380 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=
       
   381 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);
       
   382 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=
       
   383 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);
       
   384 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),
       
   385 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,
       
   386 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};
       
   387 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;
       
   388 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());
       
   389 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=
       
   390 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-
       
   391 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!=
       
   392 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+
       
   393 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*
       
   394 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+
       
   395 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);
       
   396 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/
       
   397 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;
       
   398 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-
       
   399 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;
       
   400 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,
       
   401 -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<=
       
   402 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=
       
   403 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;
       
   404 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()==
       
   405 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=
       
   406 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(),
       
   407 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=
       
   408 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=
       
   409 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+=
       
   410 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,
       
   411 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;
       
   412 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=
       
   413 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;
       
   414 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};
       
   415 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};
       
   416 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};
       
   417 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=
       
   418 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*
       
   419 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=
       
   420 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*
       
   421 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=
       
   422 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;
       
   423 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*
       
   424 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+
       
   425 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);
       
   426 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*
       
   427 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=
       
   428 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=
       
   429 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=
       
   430 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+
       
   431 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,
       
   432 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);
       
   433 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=
       
   434 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=
       
   435 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=
       
   436 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),
       
   437 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-
       
   438 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=
       
   439 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+
       
   440 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=
       
   441 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;
       
   442 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+=
       
   443 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;
       
   444 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;
       
   445 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=
       
   446 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;
       
   447 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=
       
   448 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/
       
   449 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();
       
   450 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;
       
   451 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();
       
   452 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=
       
   453 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=
       
   454 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);
       
   455 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)};
       
   456 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=
       
   457 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===
       
   458 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;
       
   459 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*
       
   460 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;
       
   461 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=
       
   462 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();
       
   463 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-=
       
   464 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==
       
   465 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=
       
   466 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+
       
   467 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-
       
   468 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==
       
   469 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*
       
   470 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+
       
   471 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*
       
   472 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=
       
   473 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()-
       
   474 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=
       
   475 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;
       
   476 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;
       
   477 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;
       
   478 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=
       
   479 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;
       
   480 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,
       
   481 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;
       
   482 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=
       
   483 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()}})();
       
   484 (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=
       
   485 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===
       
   486 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};
       
   487 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=
       
   488 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=
       
   489 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);
       
   490 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;
       
   491 
       
   492 /*
       
   493  * Main VS Code
       
   494  * 
       
   495  */
       
   496 (function(B){B.fn.vs=function(){};B.fn._vs={};B.fn._vs.token={};B.fn._vs.draw={};B.fn._vs.stream={};B.fn._vs.chart={};B.fn._vs.phy={};B.fn._vs.decay={};B.fn._vs.flocculate={};B.fn._vs.strata={};B.fn._vs.aggregate={};var A=function(E,O){this.token=B.fn._vs.token;this.draw=B.fn._vs.draw;this.stream=B.fn._vs.stream;this.chart=B.fn._vs.chart;this.phy=B.fn._vs.phy;this.decay=B.fn._vs.decay;this.flocculate=B.fn._vs.flocculate;this.strata=B.fn._vs.strata;this.requestAnimFrame;this.mouse={};this.mouse.x=0;this.mouse.y=0;this.mouse.isMouseDragging=false;this.mouse.isMouseDown=false;this.mouse.selectedBody=null;this.dataFlow=[];this.chartPhySetup={};this.tokens=[];this.world=null;this.ctx=null;var D=B(E);var M=this;var L=[];var N;var C;var H={x:0,y:0,width:290.5,height:300.5,DOMelement:null,chart:{x:undefined,y:undefined,width:undefined,height:undefined,colorRange:d3.scale.category10(),scale:d3.scale,type:"StackedAreaChart",spacer:5,column:3,wallColor:"rgba(230,230,230,0)",label:true,radius:10},data:{model:[{label:"Column A"},{label:"Column B"},{label:"Column C"},],strata:[[{initValue:100,label:"Strata 1 col A"}],[{initValue:20,label:"Strata 1 col B"}],[{initValue:175,label:"Strata 2 col C"}]],token:[{timestamp:1,category:1,value:1,userdata:{},callback:{}}],tokenPast:0,stream:{provider:"generator",refresh:10000/8,now:0},},sedimentation:{token:{size:{original:4,minimum:2},visible:true},incoming:{strategy:1,point:[{x:50,y:0},{x:100,y:0},{x:150,y:0}],target:[{x:50,y:0},{x:100,y:0},{x:150,y:0}]},granulate:{visible:false},flocculate:{number:1,action:"buffer",strategy:"Size",bufferSize:5,bufferTime:1000,bufferHeight:50,bufferFrameRate:25,buffer:[]},suspension:{height:null,incomming:"top",decay:{power:1.001},refresh:200},accumulation:{height:null},aggregation:{height:0,maxData:0,invertStrata:false},},options:{refresh:1000/25,panel:false,scale:30,layout:false,canvasFirst:true}};this.now=function(){return(new Date().getTime())};this.globalDecay=function(P){if(typeof(P)=="undefined"){return this.settings.sedimentation.suspension.decay.power}else{return this.settings.sedimentation.suspension.decay.power=P}};this.getWorld=function(){return this.world};this.chartUpdate=function(P,R){var Q={cat:P,y:R};this.chart[this.settings.chart.type](M,"update",Q)};this.flocculateTokens=function(P){return this.flocculate.update(M,P)};this.flocculateAll=function(){return this.flocculate.all(M)};this.addToken=function(P){return this.token.addToken(M,P)};this.selectAll=function(P,Q){return this.token.selectAll(M,P,Q)};this.select=function(P,Q){return this.token.select(M,P,Q)};this.updateAll=function(P){var Q=this.chart.updateAll(M,key,value);return Q};this.update=function(P,Q){var R=this.chart.update(M,P,Q);return R};function J(S,R){var Q={};for(var P in S){Q[P]=S[P]}for(var P in R){Q[P]=R[P]}return Q}J(H,O);if(O.data!=undefined){H.data=O.data}this.settings=B.extend(true,H,O);this.settings.DOMelement=E;if(typeof(this.settings.chart.width)=="undefined"){this.settings.chart.width=this.settings.width}if(typeof(this.settings.chart.x)=="undefined"){this.settings.chart.x=0}if(typeof(this.settings.chart.y)=="undefined"){this.settings.chart.y=0}if(typeof(this.settings.chart.height)=="undefined"){this.settings.chart.height=this.settings.height}if(typeof(this.settings.stream)=="undefined"){this.settings.stream={}}if(typeof(this.settings.stream.now)=="undefined"){this.settings.stream.now=0}if(typeof(this.settings.stream.provider)=="undefined"){this.settings.stream.provider="generator"}if(typeof(this.settings.stream.refresh)=="undefined"){this.settings.stream.refresh=1000}if(typeof(this.settings.data.tokenPast)=="undefined"){this.settings.data.tokenPast=0}if(typeof(this.settings.data.tokens)=="undefined"){this.settings.data.tokens=[]}if(typeof(this.settings.data.strata)!="undefined"&&this.settings.data.strata.length!=0){if(typeof(this.settings.sedimentation.aggregation)=="undefined"){this.settings.sedimentation.aggregation={}}if(typeof(this.settings.sedimentation.aggregation.height)=="undefined"){this.settings.sedimentation.aggregation.height=this.settings.chart.height/2}if(typeof(this.settings.sedimentation.aggregation.maxData)=="undefined"){this.settings.sedimentation.aggregation.maxData=10}}this.init=function(){this.requestAnimFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(W,V){window.setTimeout(W,1000/60)}})();this.world=new this.phy.b2World(new this.phy.b2Vec2(0,0),true);var Q=E.appendChild(document.createElement("div"));Q.id="box_sediviz_"+I();Q.width=this.settings.width;Q.height=this.settings.height;this.settings.DOMelement=Q;C=Q.appendChild(document.createElement("canvas"));C.id="canvas";C.width=this.settings.width;C.height=this.settings.height;C.style.position="absolute";this.ctx=C.getContext("2d");this.chart[this.settings.chart.type](M,"init");this.stream.init(M);this.flocculate.init(M);this.stream.update(M);this.token.init(M);this.strata.init(this);window.setInterval(function(){M.update(M)},M.settings.options.refresh/2);window.setInterval(function(){M.draw.update(M)},M.settings.options.refresh);window.setInterval(function(){M.decay.update(M)},M.settings.sedimentation.suspension.refresh);M.strata.update(M);this.getBodyAtMouse=function(b){var V=b.mouse.x/b.settings.options.scale;var Z=b.mouse.y/b.settings.options.scale;var Y=new b.phy.b2Vec2(V,Z);var W=new b.phy.b2AABB();var X=0.001;W.lowerBound.Set(V-X,Z-X);W.upperBound.Set(V+X,Z+X);b.mouse.selectedToken=null;b.world.QueryAABB(function(d){return T(d,b,Y)},W);return b.mouse.selectedToken};function T(W,X,V){X.mouse.selectedToken=W;if(W.GetBody().GetType()!=X.phy.b2Body.b2_staticBody){if(W.GetShape().TestPoint(W.GetBody().GetTransform(),V)){X.mouse.selectedToken=W;return false}}return true}this.handleMouseMove=function(V,W){canvasPosition=F(W.settings.DOMelement);W.mouse.x=(V.clientX-(canvasPosition.offsetLeft-this.getScrollPosition()[0]));W.mouse.y=(V.clientY-(canvasPosition.offsetTop-this.getScrollPosition()[1]))};this.getScrollPosition=function(){return Array((document.documentElement&&document.documentElement.scrollLeft)||window.pageXOffset||M.pageXOffset||document.body.scrollLeft,(document.documentElement&&document.documentElement.scrollTop)||window.pageYOffset||M.pageYOffset||document.body.scrollTop)};document.addEventListener("mousemove",function(V){S(V,M)});document.addEventListener("mouseup",function(V){U(V,M)});document.addEventListener("mousedown",function(V){R(V,M)});function P(Y,b){var W=b.getBodyAtMouse(b);if(W!=null){if(typeof(W.m_userData)!="undefined"){if(typeof(W.m_userData.callback)!="undefined"){if(typeof(W.m_userData.callback.mouseover)=="function"){var V=b.select("ID",W.m_userData.ID);W.m_userData.callback.mouseover(V)}if(typeof(W.m_userData.callback.mouseout)=="function"){var V=b.select("ID",W.m_userData.ID);var Z;var X=function(){var e=Z;var g=V;var d=b;var f=W;return function(){var h=d.getBodyAtMouse(d);var k=false;if(h!=null){if(typeof(h.m_userData)!="undefined"){if(h.m_userData.ID==g.attr("ID")){k=false}else{k=true}}else{k=true}}else{k=true}if(k){f.m_userData.callback.mouseout(g);clearInterval(Z)}}};Z=window.setInterval(X(),100)}}}}}function R(X,Y){Y.mouse.isMouseDown=true;Y.handleMouseMove(X,Y);var W=Y.getBodyAtMouse(Y);if(W!=null){if(typeof(W.m_userData)!="undefined"){if(typeof(W.m_userData.callback)!="undefined"){if(typeof(W.m_userData.callback.onclick)=="function"){var V=Y.select("ID",W.m_userData.ID);W.m_userData.callback.onclick(V)}}}}}function U(V,W){W.mouse.isMouseDown=false}function S(V,W){if(W.mouse.isMouseDown){W.mouse.isMouseDragging=true;W.mouse.x=V.clientX;W.mouse.y=V.clientY}else{W.handleMouseMove(V,W);P("move",W)}}};this.mouse.update=function(Q){if(isMouseDown&&(!mouseJoint)){var P=getBodyAtMouse();if(P){var R=new b2MouseJointDef();R.bodyA=world.GetGroundBody();R.bodyB=P;R.target.Set(mouseX,mouseY);R.collideConnected=true;R.maxForce=300*P.GetMass();mouseJoint=world.CreateJoint(R);P.SetAwake(true)}}if(mouseJoint){if(isMouseDown){mouseJoint.SetTarget(new b2Vec2(mouseX,mouseY))}else{world.DestroyJoint(mouseJoint);mouseJoint=null}}};this.update=function(P){this.world.Step(1/60,10,10);this.world.DrawDebugData();this.world.ClearForces()};var G=function(){ctx.fillStyle="rgb(200,0,0)";this.ctx.font="14pt Calibri,Geneva,Arial";this.ctx.fillText("Canvas ready for Visual Sedimentation ",10,20);window.setInterval(B.fn.vs.draw.refresh(ctx,world,this.settings),this.settings.options.refresh);console.log("draw Init ")};var F=function(R){var Q=R.offsetTop;var P=R.offsetLeft;while(R=R.offsetParent){Q+=R.offsetTop;P+=R.offsetLeft}return{offsetLeft:P,offsetTop:Q}};var I=function(){var P=function(){return Math.floor(Math.random()*65536).toString(16)};return(P()+P()+"-"+P()+"-"+P()+"-"+P()+"-"+P()+P()+P())};function K(Q){if(null==Q||"object"!=typeof Q){return Q}var R=Q.constructor();for(var P in Q){if(Q.hasOwnProperty(P)){R[P]=Q[P]}}return R}this.utile={};this.utile.GUID=I;this.utile.clone=K;this.settings=B.extend(this.settings,{}||{});this.init()};B.fn.vs=function(C){if(!arguments.length){var C={}}return this.each(function(){var D=B(this);if(D.data("VisualSedimentation")){return}var E=new A(this,C);D.data("visualSedimentation",E)})}})(jQuery);(function(A){A.fn._vs.phy={b2Vec2:Box2D.Common.Math.b2Vec2,b2AABB:Box2D.Collision.b2AABB,b2BodyDef:Box2D.Dynamics.b2BodyDef,b2Body:Box2D.Dynamics.b2Body,b2FixtureDef:Box2D.Dynamics.b2FixtureDef,b2Fixture:Box2D.Dynamics.b2Fixture,b2World:Box2D.Dynamics.b2World,b2MassData:Box2D.Collision.Shapes.b2MassData,b2PolygonShape:Box2D.Collision.Shapes.b2PolygonShape,b2CircleShape:Box2D.Collision.Shapes.b2CircleShape,b2DebugDraw:Box2D.Dynamics.b2DebugDraw,b2MouseJointDef:Box2D.Dynamics.Joints.b2MouseJointDef,b2Shape:Box2D.Collision.Shapes.b2Shape,b2DistanceJointDef:Box2D.Dynamics.Joints.b2DistanceJointDef,b2RevoluteJointDef:Box2D.Dynamics.Joints.b2RevoluteJointDef,b2Joint:Box2D.Dynamics.Joints.b2Joint,b2PrismaticJointDef:Box2D.Dynamics.Joints.b2PrismaticJointDef,b2ContactListener:Box2D.Dynamics.b2ContactListener,b2Settings:Box2D.Common.b2Settings}})(jQuery);(function(A){A.fn.vs.chart={}})(jQuery);(function(A){A.fn._vs.draw={settings:{draw:{trail:1,showLayout:false}},update:function(D){if(this.settings.draw.trail==1){D.ctx.clearRect(0,0,D.ctx.canvas.clientWidth,D.ctx.canvas.clientHeight)}else{debugDrawChart(0,0,ctx.canvas.clientWidth,ctx.canvas.clientHeight,"rgba(255,255,255,"+this.settings.draw.trail+")",ctx)}for(var B=D.world.GetBodyList();B;B=B.GetNext()){for(var C=B.GetFixtureList();C!=null;C=C.GetNext()){this.drawShape(D,C)}}if(this.settings.draw.showLayout==true){this.debugDrawChart(chart.position.x,chart.position.y,chart.position.width,chart.position.height,"rgba(255,0,0,0.2)",ctx)}},debugDrawChart:function(B,G,D,F,E,C){C.save();C.translate(0,0);C.fillStyle=E;C.beginPath();C.rect(B,G,D,F);C.closePath();C.strokeStyle="#000";C.lineWidth=0.5;C.stroke();C.restore()},clippedBackgroundImage:function(C,D,B,E){C.save();C.clip();C.drawImage(D,B-(D.height/2),E-(D.width/2),D.width,D.height);C.restore()},haveTexture:function(C){var B=false;if(typeof(C.m_userData.texture)!="undefined"){if(typeof(C.m_userData.texture.img)!="undefined"){if(C.m_userData.texture.img.complete){B=true}}}return B},drawShape:function(K,F){var Q=F.GetBody();var R=Q.GetPosition();var P=Q.GetAngle();var D=9;var C=10;var S=K.settings.options.scale;F.m_userData.x=Q.GetWorldCenter().x*S;F.m_userData.y=Q.GetWorldCenter().y*S;if(typeof(F)!="undefined"){switch(F.GetType()){case 0:switch(F.m_userData){case null:K.ctx.fillStyle="rgba(255,0,0,1)";break;default:K.ctx.fillStyle=F.m_userData.fillStyle;break}var B=F.m_shape.m_radius;if(K.settings.sedimentation.token.visible==true){K.ctx.save();K.ctx.translate(R.x*S,R.y*S);K.ctx.rotate(P);K.ctx.beginPath();var O=(B/C*D)*S;if(typeof(F.m_userData.strokeStyle)!="undefined"){K.ctx.strokeStyle=F.m_userData.strokeStyle}else{K.ctx.strokeStyle="rgba(0,0,0,0)"}if(typeof(F.m_userData.lineWidth)!="undefined"){K.ctx.lineWidth=F.m_userData.lineWidth}else{K.ctx.lineWidth=0}K.ctx.arc(0,0,O,0,Math.PI*2,true);if(this.haveTexture(F)){this.clippedBackgroundImage(K.ctx,F.m_userData.texture.img,0,0)}K.ctx.closePath();if(K.settings.options.layout==true){K.ctx.strokeStyle="#000";K.ctx.lineWidth=0.5;K.ctx.stroke()}else{if(!this.haveTexture(F)){K.ctx.fill()}K.ctx.stroke()}K.ctx.restore()}break;case 1:switch(F.m_userData){case null:K.ctx.fillStyle="rgba(255,0,0,1)";break;default:K.ctx.fillStyle=F.m_userData.fillStyle;break}var I=F.m_shape.m_vertices[0].x*S;var G=F.m_shape.m_vertices[0].y*S;var J=R.x*S-F.m_shape.m_vertices[0].x*S;var H=R.y*S-F.m_shape.m_vertices[0].y*S;K.ctx.save();K.ctx.translate(R.x*S,R.y*S);K.ctx.rotate(P);K.ctx.beginPath();if(typeof(F.m_userData.strokeStyle)!="undefined"){K.ctx.strokeStyle=F.m_userData.strokeStyle}else{K.ctx.strokeStyle=F.m_userData.fillStyle}if(typeof(F.m_userData.lineWidth)!="undefined"){K.ctx.lineWidth=F.m_userData.lineWidth}else{K.ctx.lineWidth=0}for(var N=0;N<F.m_shape.m_vertices.length;N++){var M=F.m_shape.m_vertices;K.ctx.moveTo((M[0].x)*S,(M[0].y)*S);for(var L=1;L<M.length;L++){K.ctx.lineTo((M[L].x)*S,(M[L].y)*S)}K.ctx.lineTo((M[0].x)*S,(M[0].y)*S)}K.ctx.closePath();K.ctx.fill();if(K.settings.options.layout==true){K.ctx.lineWidth=0.25;K.ctx.strokeStyle="rgb(0,0,0)";K.ctx.stroke()}else{K.ctx.stroke()}K.ctx.restore();break;case 2:break;K.ctx.fillStyle="rgb(0,0,0)"}}if(typeof(F.m_userData.callback)!="undefined"){if(typeof(F.m_userData.callback.draw)=="function"){var E=K.select("ID",F.m_userData.ID);F.m_userData.callback.draw(E)}}}}})(jQuery);(function(A){A.fn._vs.token={colorRange:function(){},init:function(B){this.colorRange=B.settings.chart.colorRange},ID:function(B){B.settings.data.tokenPast+=1;return B.settings.data.tokenPast},selectAll:function(G,D,F){var B=[];var E=false;B.flocculate=function(){var H=[];B.forEach(function(I){q=I.flocculate();H.push(q)});return H};B.attr=function(H,J,K){var I=[];B.forEach(function(L){q=L.attr(H,J,K);I.push(q)});return I};B.b2dObj=function(H,J,K){var I=[];B.forEach(function(L){q=L.myobj;I.push(q)});return I};if(typeof(F)=="undefined"&&typeof(D)=="undefined"){E=true}for(var C=G.tokens.length-1;C>=0;C--){if(G.tokens[C].attr(D)==F||E==true){B.push(G.tokens[C])}}return B},select:function(E,C,D){result=[];if(typeof(D)=="undefined"&&typeof(C)=="undefined"){return E.tokens}else{for(var B=E.tokens.length-1;B>=0;B--){if(E.tokens[B].attr(C)==D){result.push(E.tokens[B]);break}}}if(typeof(result[0])=="undefined"){return false}else{return result[0]}},addToken:function(H,G){var C={x:50,y:50,t:null,category:1,state:0,size:10,fillStyle:"###",strokeStyle:"rgba(0,0,0,0)",lineWidth:0,texture:undefined,shape:{type:"round"},userdata:{},callback:{},phy:{density:10,friction:0,restitution:0},targets:[],elbow:{}};var B=null;var D=null;var F={};F.toString=function(){return"Token ID="+this.setting.ID};if(typeof(G)=="undefined"){F.setting=C;F.setting.ID=this.ID(H)}else{F.setting=G;if(typeof(F.setting.phy)=="undefined"){F.setting.phy=C.phy}if(typeof(F.setting.t)=="undefined"){F.setting.t=H.settings.stream.now}if(typeof(F.setting.x)=="undefined"){F.setting.x=H.settings.sedimentation.incoming.point[G.category].x+(Math.random()*2)}if(typeof(F.setting.y)=="undefined"){F.setting.y=H.settings.sedimentation.incoming.point[G.category].y+(Math.random()*2)}if(typeof(F.setting.size)=="undefined"){F.setting.size=H.settings.sedimentation.token.size.original}if(typeof(F.setting.targets)=="undefined"){F.setting.targets=[]}F.setting.ID=F.setting.ID=this.ID(H);if(typeof(F.setting.state)=="undefined"){F.setting.state=0}if(typeof(F.setting.shape)=="undefined"){F.setting.shape=C.shape}}F.myobj=this.create(H,F.setting);F.flocculate=function(){H.tokens.indexOf(this);H.flocculate.destroyIt(H,this);return this};F.attr=function(I,J,K){if(typeof(J)=="undefined"){if(typeof(this[I])!="undefined"){return this[I]()}else{return this.myobj.m_userData[I]}}else{if(typeof(this[I])!="undefined"){this[I](J,K)}else{this.myobj.m_userData[I]=J}}return this};F.callback=function(I,J){if(!arguments.length){return this.myobj.m_userData.callback}if(typeof(this.myobj.m_userData.callback[I])=="function"){return this.myobj.m_userData.callback[I](J)}else{return function(K){console.log("callback undefined")}}};F.size=function(I){if(this.myobj!=null&&this.attr("state")<2){if(!arguments.length){return this.myobj.m_shape.m_radius*this.myobj.m_userData.scale}this.myobj.m_shape.m_radius=I/this.myobj.m_userData.scale}};F.b2dObj=function(){if(this.myobj!=null&&this.attr("state")<2){return this.myobj}};F.texture=function(I){if(!arguments.length){return this.myobj.m_userData.texture.img.src}console.log("texture",I);this.myobj.m_userData.texture={};this.myobj.m_userData.texture.img=new Image();this.myobj.m_userData.texture.img.src=I};H.tokens.push(F);H.decay.tokens.push(F);if(typeof(this.myobj.m_userData.callback)!="undefined"){if(typeof(this.myobj.m_userData.callback.suspension)=="function"){var E=H.select("ID",F.setting.ID);this.myobj.m_userData.callback.suspension(E)}}return F},create:function(H,C){C.scale=scale=H.settings.options.scale;var G=C.x/scale+(Math.random()*0.1);var D=C.y/scale+(Math.random()*0.1);var F=new Box2D.Dynamics.b2FixtureDef;F.density=0.1;F.friction=0;F.restitution=0;if(C.shape.type=="round"){F.shape=new Box2D.Collision.Shapes.b2CircleShape(C.size/scale)}else{if(C.shape.type=="polygons"){F=this.setPolygons(H,C,F)}else{if(C.shape.type=="box"){F.shape=new Box2D.Collision.Shapes.b2PolygonShape;F.shape.SetAsBox(C.shape.width/scale,C.shape.height/scale)}}}var B=new Box2D.Dynamics.b2BodyDef;B.type=Box2D.Dynamics.b2Body.b2_dynamicBody;B.position.x=C.x/scale;B.position.y=C.y/scale;this.myobj=H.world.CreateBody(B).CreateFixture(F);if(typeof(C.texture)!="undefined"){C.texture.img=new Image();C.texture.img.src=C.texture.src}if(typeof(C.impulse)!="undefined"){this.applyImpulse(this.myobj,C.impulse.angle,C.impulse.power)}if(typeof(C.fillStyle)=="undefined"){C.fillStyle=this.colorRange(C.category)}if(typeof(C.lineWidth)=="undefined"){C.lineWidth=0}if(typeof(C.type)=="undefined"){C.type="token"}if(typeof(C.callback)=="undefined"){C.callback={}}this.myobj.m_userData=C;this.myobj.attr=this.attr;this.myobj.m_userData.mouse={};this.myobj.m_userData.mouse.over=false;this.myobj.m_userData.mouse.down=false;this.myobj.m_userData.mouse.dragging=false;this.myobj.m_userData.mouse.statebefore=false;this.myobj.m_userData.state=1;if(C.targets.length==0&&H.settings.chart.type=="CircleLayout"){C.targets[0]={x:H.settings.sedimentation.incoming.target[C.category].x,y:H.settings.sedimentation.incoming.target[C.category].y}}if(C.targets.length>0){var E=new H.phy.b2MouseJointDef();E.bodyA=H.world.GetGroundBody();E.bodyB=this.myobj.GetBody();E.target.Set(G,D);E.collideConnected=true;E.maxForce=50*this.myobj.GetBody().GetMass();mouseJoint=H.world.CreateJoint(E);mouseJoint.SetTarget(new H.phy.b2Vec2(C.targets[0].x/scale,C.targets[0].y/scale))}return this.myobj},applyImpulse:function(D,E,C){var B=D.GetBody();B.ApplyImpulse(new Box2D.Common.Math.b2Vec2(Math.cos(E*(Math.PI/180))*C,Math.sin(E*(Math.PI/180))*C),B.GetWorldCenter())},setPolygons:function(F,D,E){E.shape=new Box2D.Collision.Shapes.b2PolygonShape;if(D.shape.points==null){D.shape.points=[{x:-1,y:-1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:-1}]}for(var C=0;C<D.shape.points.length;C++){var B=new Box2D.Common.Math.b2Vec2();B.Set(D.shape.points[C].x/scale,D.shape.points[C].y/scale);D.shape.points[C]=B}E.shape.SetAsArray(D.shape.points,D.shape.points.length);return E},createDataBarBall:function(I,B,H,E,F){var G=new Box2D.Dynamics.b2FixtureDef;G.density=10;G.friction=0.5;G.restitution=0.2;G.shape=new Box2D.Collision.Shapes.b2CircleShape(E/I.settings.options.scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B/I.settings.options.scale;D.position.y=H/I.settings.options.scale;var C=I.world.CreateBody(D).CreateFixture(G);C.m_userData={type:"BarChartBall",familyID:"family",fillColor:this.colorRange(F)};return C},createBox:function(I,K,J,D,L,F,C,G){if(typeof(G)=="undefined"){G=true}var B=new b2FixtureDef;if(!G){B.density=100}B.friction=0.6;B.restitution=0.3;var E=new b2BodyDef;E.type=b2Body.b2_staticBody;E.angle=F;B.shape=new b2PolygonShape;B.shape.SetAsBox(D/scale,L/scale);E.position.Set(K/scale,J/scale);var H=I.CreateBody(E).CreateFixture(B);H.m_userData={type:"Wall",fillColor:C};console.log(H.m_userData);return H},createBoxPie:function(I,E,K,J,D,L,G,C){var F=new b2BodyDef;F.type=Box2D.Dynamics.b2Body.b2_dynamicBody;var B=new Box2D.Dynamics.b2FixtureDef;B.shape=new b2PolygonShape;B.shape.SetAsBox(D/scale,L/scale);B.density=1000000;B.friction=0.5;B.restitution=0.2;F.position.Set(K/scale,J/scale);F.angle=0;var H=I.CreateBody(F).CreateFixture(B);H.m_userData={type:"Wall",fillColor:C};return H},createBox0D:function(H,C,I,F,B,G){if(typeof(G)=="undefined"){G=true}var E=new b2BoxDef();E.restitution=-0.6;E.friction=0.3;if(!G){E.density=0.01}E.extents.Set(F,B);var D=new b2BodyDef();D.AddShape(E);D.position.Set(C,I);return H.CreateBody(D)},createHiddenBox:function(G,I,H,B,J,D){if(typeof(D)=="undefined"){D=true}var E=new b2BoxDef();E.restitution=0.6;E.friction=0.3;if(!D){E.density=1}E.extents.Set(B,J);var C=new b2BodyDef();C.AddShape(E);C.position.Set(I,H);var F=G.CreateBody(C);F.m_shapeList.visibility="hidden";console.log(F);return F},createBigBall:function(E,B,G){var F=new Box2D.Dynamics.b2FixtureDef;F.density=1000000;F.friction=0.5;F.restitution=0.2;F.shape=new Box2D.Collision.Shapes.b2CircleShape(20/30);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B;D.position.y=G;var C=E.CreateBody(D).CreateFixture(F);return C},createPieBox:function(G,J,I,C,K,L,D,M){M=A.extend(true,{density:10000000,friction:1,restitution:0.2,linearDamping:0,angularDamping:0,gravityScale:0,type:b2Body.b2_dynamicBody},M);var B=new b2BodyDef();var E=new b2FixtureDef;E.density=M.density;E.friction=M.friction;E.restitution=M.restitution;E.shape=new b2PolygonShape();E.shape.SetAsBox(C/scale,K/scale);B.position.Set(J/scale,I/scale);B.linearDamping=M.linearDamping;B.angularDamping=M.angularDamping;B.angle=L;B.type=M.type;var H=G.CreateBody(B);var F=H.CreateFixture(E);F.m_userData={type:"box",familyID:null,fillColor:D};return H},createDataBallTarget:function(H,L,I,M,K,N,F){var G=M/scale+(Math.random()*0.1);var C=K/scale+(Math.random()*0.1);var B=new Box2D.Dynamics.b2FixtureDef;B.density=0.1;B.friction=0;B.restitution=0;B.shape=new Box2D.Collision.Shapes.b2CircleShape(N/scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=G;D.position.y=C;var E=H.CreateBody(D).CreateFixture(B);var J=new b2MouseJointDef();J.bodyA=H.GetGroundBody();J.bodyB=E.GetBody();J.target.Set(G,C);J.collideConnected=true;J.maxForce=50*E.GetBody().GetMass();mouseJoint=H.CreateJoint(J);mouseJoint.SetTarget(new b2Vec2(L/scale,I/scale));E.m_userData={type:"PieBall",familyID:F,fillColor:colorScale(F)};categorys[F].value+=1;categorys[F].joins.push(mouseJoint);return E},createDataBallPie:function(H,I,M,K,N,F){console.log(I);var G=categorys[F].incomingPoint.x/scale+(Math.random()*2/scale);var C=categorys[F].incomingPoint.y/scale;var B=new Box2D.Dynamics.b2FixtureDef;B.density=0.1;B.friction=0;B.restitution=0;B.shape=new Box2D.Collision.Shapes.b2CircleShape(N/scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=G;D.position.y=C;var L=H.CreateBody(D);L.m_userData={type:"PieBall",familyID:F,fillColor:categorys[F].color};listBodies.push(L);var E=L.CreateFixture(B);var J=new b2MouseJointDef();J.bodyA=H.GetGroundBody();J.bodyB=E.GetBody();J.target.Set(G,C);J.collideConnected=true;J.maxForce=100*E.GetBody().GetMass();mouseJoint=H.CreateJoint(J);mouseJoint.SetTarget(new b2Vec2(I.position.x/scale,I.position.y/scale));E.m_userData={type:"PieBall",familyID:F,fillColor:colorScale(F)};categorys[F].value+=1;return E},createDataBall:function(H,B,G,E){var F=new Box2D.Dynamics.b2FixtureDef;F.density=1;F.friction=0.5;F.restitution=0.2;F.shape=new Box2D.Collision.Shapes.b2CircleShape(E/H.settings.options.scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B;D.position.y=G;var C=H.world.CreateBody(D).CreateFixture(F);C.m_userData={type:"PieBall",familyID:"family",fillColor:"rgb(200,0,0)"};return C},}})(jQuery);(function(A){A.fn._vs.stream={i:null,buffer:[],speed:10000/6,strategy:null,type:null,init:function(B){this.speed=B.settings.data.stream.refresh;type=B.settings.data.stream.provider},push:function(C){console.log(C);for(var B=C.length-1;B>=0;B--){buffer.push(C)}},update:function(C){if(type=="generator"){for(var B=0;B<C.settings.data.model.length;B++){C.dataFlow[B]=setInterval((function(D,E){return function(){E.settings.data.stream.now++;var F=E.chart[E.settings.chart.type](E,"token",D);E.addToken(F)}})(B,C),this.speed)}}else{if(type=="tokens"){C.dataFlow[0]=setInterval((function(D,E){return function(){E.settings.data.stream.now++;for(var F=0;F<E.settings.data.tokens.length;F++){if(E.settings.data.tokens[F].t==E.settings.data.stream.now){E.addToken(E.settings.data.tokens[F])}}}})(B,C),this.speed)}else{}}},generator:function(C,B){},test:function(B){B.tokens.push(B.token.createDataBarBall(B,(B.settings.sedimentation.incoming[i].x+(Math.random()*2)),(B.settings.sedimentation.incoming[i].y+(Math.random()*1)),B.settings.sedimentation.token.size,i))},setSpeed:function(D,C){speedFlow=C;for(var B=0;B<categorys.length;B++){window.clearInterval(dataFlow[B])}window.clearInterval(decayFlow);dataFlow(categorys)}}})(jQuery);(function(A){A.fn._vs.decay={tokens:[],update:function(G){var D=1;var J=G.settings.sedimentation.suspension.height;var K=G.settings.height;var H=G.settings.sedimentation.token.size/4;var B=G.settings.sedimentation.suspension.decay.power;var E=G.settings.options.scale;var F=G.settings.sedimentation.token.size.minimum;if(B==null){var B=0}for(var I=0;I<this.tokens.length;I++){var C=this.tokens[I].attr("size");if(B!=0){this.tokens[I].attr("size",C/B)}if(C<=F){if(G.settings.sedimentation.flocculate.strategy!=null){G.flocculate.destroyIt(G,this.tokens[I]);G.strata.update(G)}}}}}})(jQuery);(function(A){A.fn._vs.flocculate={buffer:[],init:function(C){for(var B=0;B<C.settings.data.model.length;B++){this.buffer[B]=[]}},addtobuffer:function(C,B){c=B.attr("category");bufferSize=C.settings.sedimentation.flocculate.bufferSize;this.buffer[c].push(B);C.decay.tokens.splice(C.decay.tokens.indexOf(B),1);B.attr("callback","bufferFlocculation",B);if(this.buffer[c].length>bufferSize){this.update(C,c,bufferSize)}},destroyIt:function(D,C){C.attr("callback","flocculation",C);C.attr("state",2);var B=D.world.DestroyBody(C.myobj.GetBody());return B},update:function(E,D,B){if(E.settings.sedimentation.flocculate.number==1){while(this.buffer[D].length>B){var C=this.buffer[D].shift();this.destroyIt(E,C)}}else{while(this.buffer[D].length>E.settings.sedimentation.flocculate.number){var C=this.buffer[D].shift();this.destroyIt(E,C)}}},disapear:function(C,B){window.setInterval(function(){B.update(self)},self.settings.options.refresh/2)},all:function(C){for(var B=C.decay.tokens-1;B>=0;B--){this.update(C,B,C.tokens.length)}},strategy:function(){if(flocullateBuffer.length>0){if(chart.flocullate.strategy=="Size"&&flocullateBuffer.length>=chart.flocullate.bufferSize){flocullateByArray(flocullateBuffer)}else{if(chart.flocullate.strategy=="Time"){}else{if(chart.flocullate.strategy=="Height"){}}}}}}})(jQuery);(function(A){A.fn._vs.aggregate={defaultSettings:{},strata_layers:function(H,G,B,D){var F=d3.scale.linear().domain([1,B-2]).range([Math.PI/2,2*Math.PI-Math.PI/2]);var C=d3.scale.pow().exponent(10).domain([0,B]).range([0,1]);return d3.range(G).map(function(I){var J=5*Math.random();return d3.range(B).map(function(L){if(H.settings.sedimentation.aggregation.strataType=="sin"){if(I==1){return 20}var K=5+J*5*Math.sin(F(L))+(I*50);if(K<0){return -K}else{return K}}else{if(H.settings.sedimentation.aggregation.strataType=="log"){return I+1}else{if(typeof(D)=="undefined"){D=0}return H.settings.data.strata[D][I].value}}}).map(E)});function E(J,I){return{x:I,y:Math.max(0,J)}}},init:function(L){if(typeof(L.settings.data.strata)=="undefined"||L.settings.data.strata.length==0||L.settings.data.strata[0].length==0){return}var M=L.token.colorRange;if(L.settings.chart.type=="StackedAreaChart"){var E=L.settings.chart.width/L.settings.data.model.length,O=L.settings.sedimentation.aggregation.height;var G=d3.select("#"+L.settings.DOMelement.id).append("div").attr("class","vis").style("z-index",10).append("svg").attr("width",L.settings.width).attr("height",L.settings.height).append("g").attr("transform","translate("+L.settings.chart.x+","+L.settings.chart.y+")");var Q=G.selectAll("g.gcol").data(L.settings.data.strata,function(V){return[V]}).enter().append("g").attr("transform",function(W,V){return"translate("+(V*E)+", "+(L.settings.chart.height-L.settings.sedimentation.aggregation.height)+")"}).attr("class",function(W,V){return"gcol col_"+V});var U=L.settings.data.strata.map(function(V){return{value:V[0].value}});var R=L.settings.data.strata[0].length,S=20;smx=S-1,smy=0;var D=0;var T=d3.svg.area().x(function(V){return L.settings.chart.spacer+V.x*(E-2*L.settings.chart.spacer)/smx}).y0(function(V){return(O-V.y0*D)}).y1(function(V){return(O-(V.y+V.y0)*D)});var K=[];var B=Q.selectAll("gpath").data(function(X,V){var W=d3.layout.stack().offset("expand")(L.aggregate.strata_layers(L,X.length,S,V));smy=d3.max(W,function(Y){return d3.max(Y,function(Z){return Z.y0+Z.y})});W.map(function(Y){Y.map(function(Z){Z.col=V;return Z})});return W}).enter().append("g").attr("class","gpath");B.append("path").attr("d",function(W,V){D=L.settings.chart.height-L.chart.getPosition(L)[W[0].col].y;return T(W)}).style("fill",function(W,V){if(L.settings.data.strata[W[0].col][V].texture!=null){return"url(#RectanglePattern_"+W[0].col+"_"+V+")"}else{return d3.rgb(M(W[0].col)).darker(L.settings.data.strata[W[0].col].length/2-(V+1)/2)}}).attr("class",function(W,V){return"layer"}).attr("class",function(W,V){return"col_"+W[0].col+" layer_"+V});var C=E/1;var I=C;for(var F=0;F<L.settings.data.strata.length;F++){for(var J=0;J<L.settings.data.strata[F].length;J++){if(L.settings.data.strata[F][J].texture!=null){var P=G.append("pattern").attr("id","RectanglePattern_"+F+"_"+J).attr("height",I).attr("width",C).attr("patternTransform","translate(0, 0) scale("+L.settings.data.strata[F][J].texture.size+", "+L.settings.data.strata[F][J].texture.size+") rotate(0)").attr("patternUnits","userSpaceOnUse");P.append("image").attr("x",0).attr("y",0).attr("height",I).attr("width",C).attr("xlink:href",function(){return L.settings.data.strata[F][J].texture.url})}}}}else{if(L.settings.chart.type=="CircleLayout"){var H=d3.select("#"+L.settings.DOMelement.id).append("div").attr("class","vis").attr("width",L.settings.width).attr("height",L.settings.height).append("svg").attr("width",L.settings.width).attr("height",L.settings.height);if(typeof(L.settings.chart.treeLayout)!="undefined"){for(var N=0;N<L.settings.data.model.length;N++){var U=L.settings.data.strata[N];var M=function(V){return L.token.colorRange(N)};L.aggregate.create_pie_chart(L,U,H,U[0].value,M,((N+1/2))*L.settings.chart.width/(L.settings.data.model.length)+L.settings.chart.x,L.settings.chart.y+L.settings.chart.height/6)}}else{var U=L.settings.data.strata.map(function(V){return{value:V[0].value}});console.log(L.settings.data.strata,U);var M=L.token.colorRange;L.aggregate.create_pie_chart(L,U,H,L.settings.chart.radius,M,L.settings.chart.x+L.settings.chart.width/2,L.settings.chart.y+L.settings.chart.height/2)}}}},create_pie_chart:function(O,T,K,J,P,N,M){var H=O.settings.width/O.settings.data.model.length,R=O.settings.sedimentation.aggregation.height;var G=d3.scale.linear().domain([0,O.settings.data.strata.length-1]).range([0,O.settings.width]);var F=d3.scale.linear().domain([0,d3.max(T,function(U){return U.value})]).rangeRound([0,R]);var C=O.settings.width,B=O.settings.height,I=O.settings.sedimentation.aggregation.height;labelr=J+30,donut=d3.layout.pie().sort(null),arc=d3.svg.arc().innerRadius(0).outerRadius(J);var L=Math.random();K.append("g.arcs_"+L).attr("class","arcs_"+L);var E=K.selectAll(".arcs").data(donut(T.map(function(V,U){return V.value}))).enter().append("svg:g").attr("transform","translate("+N+","+M+")");var D=0;var S=d3.svg.area().x(function(U){return O.settings.chart.spacer+U.x*(H-2*O.settings.chart.spacer)/smx}).y0(function(U){return(R-U.y0*D)}).y1(function(U){return(R-(U.y+U.y0)*D)});var Q=E.append("path").attr("fill",function(V,U){return P(U)}).attr("d",function(V,U){return arc(V)}).each(function(U){this._current=U})},update:function(K){if(typeof(K.settings.data.strata)=="undefined"||K.settings.data.strata.length==0||K.settings.data.strata[0].length==0){return}var N=K.settings.chart.width/K.settings.data.model.length;var I=K.settings.sedimentation.aggregation.height;var M=d3.scale.linear().domain([0,K.settings.data.strata.length-1]).range([0,K.settings.width]);var H=K.settings.data.strata.map(function(P){return{value:P[0].value}});var O=K.settings.data.strata.map(function(R){for(var P=0,Q=0;P<R.length;P++){Q+=R[P].value}return Q});var L=d3.scale.linear().domain([0,d3.max(O)]).range([0,K.settings.sedimentation.aggregation.height]);var E=K.settings.data.strata[0].length,F=20;smx=F-1,smy=0;var G=0;var D=d3.svg.area().x(function(P){return K.settings.chart.spacer+P.x*(N-2*K.settings.chart.spacer)/smx}).y0(function(P){return(I-P.y0*G)}).y1(function(P){return(I-(P.y+P.y0)*G)});var C=d3.select("svg");var J=C.selectAll(".gcol");J.data(K.settings.data.strata,function(Q,P){return[Q]});var B=J.selectAll(".gpath").data(function(R,P){var Q=d3.layout.stack().offset("expand")(K.aggregate.strata_layers(K,R.length,F,P));smy=d3.max(Q,function(S){return d3.max(S,function(T){return T.y0+T.y})});Q.map(function(S){S.map(function(T){T.col=P;return T})});return Q});B.select("path").transition().duration(100).attr("d",function(Q,P){K.chartUpdate(P,-L(O[P])-(I-K.settings.chart.height));G=K.settings.chart.height-K.chart.getPosition(K)[Q[0].col].y;return D(Q)})}}})(jQuery);(function($){$.fn._vs.strata={stratas:[],init:function(_this){if(_this.settings.chart.type!="StackedAreaChart"){_this.strata.create_strata(_this);return}settings=_this.settings;if((typeof(settings.data.strata)!="function")&&(typeof(settings.data.strata)=="undefined"||settings.data.strata.length==0)){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,value:function(t,s){return 0},};_this.strata.stratas[i]=[defaultStrata]}_this.strata.create_strata(_this);return}if(typeof settings.data.strata!="function"){if(typeof(settings.data.strata=="object")&&typeof(settings.data.strata[0])!="undefined"&&(typeof settings.data.strata[0][0].value!="undefined")&&typeof(settings.data.strata[0][0].value=="string")){var NB_STRATA=settings.data.strata[0].length;for(var i=0;i<settings.data.model.length;i++){_this.strata.stratas[i]=[];for(var n=0;n<NB_STRATA;n++){(function(a,b){var t=null;if((typeof settings.data.strata[a]!="undefined")&&(typeof settings.data.strata[a][b]!="undefined")&&(typeof settings.data.strata[a][b].texture!="undefined")){t=settings.data.strata[a][b].texture}var defaultStrata={};defaultStrata={label:settings.data.model[i].label+"_"+a,category:a,texture:t,value:function(){r=eval("f="+settings.data.strata[a][b].value);return r()}};_this.strata.stratas[a].push(defaultStrata)})(i,n)}}_this.strata.create_strata(_this);return}if(typeof(settings.data.strata[0])!="undefined"&&typeof(settings.data.strata[0][0])!="undefined"&&typeof(settings.data.strata[0][0].initValue!="undefined")){for(var c=0;c<settings.data.model.length;c++){var defaultStrata={label:settings.data.model[c].label+"_"+c,category:i,value:function(t,s){if(t.selectAll("category",s)){return settings.data.strata[s][0].initValue+t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return settings.data.strata[s][0].initValue}},};_this.strata.stratas[c]=[defaultStrata]}_this.strata.create_strata(_this);return}else{if(settings.data.strata[0].length==0){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,value:function(t,s){if(t.selectAll("category",s)){return t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return 0}},};_this.strata.stratas[i]=[defaultStrata]}_this.strata.create_strata(_this);return}else{var NB_STRATA=settings.data.strata[0].length;settings.data.strata_param=settings.data.strata;function fstrata(){var a=Array();for(var s=0;s<mySettings.data.model.length;s++){a.push(fstratum(s))}return a}function fstratum(a){var b=Array(NB_STRATA);for(var r=0;r<b.length;r++){b[r]=Array()}if(typeof _this!="undefined"){var tokens=_this.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length;for(var k=0;k<tokens.length;k++){var tk=tokens[k];for(var r=0;r<b.length;r++){if(tk<_this.settings.stream.now-2*(r)&&tk>=_this.settings.stream.now-2*(r+1)){b[b.length-r-1].push(tk)}}}}var res=Array();for(var j=0;j<NB_STRATA;j++){var val=b[j].length;(function(v){res.push({value:function(){return v},label:"Strata "+j,category:a})})(val)}return res}_this.settings.data.strata=function(){return fstrata()};_this.strata.stratas=_this.settings.data.strata();_this.strata.create_strata(_this);return}}}if((typeof settings.data.strata=="function")||settings.data.strata[0].length>0||_this.strata.stratas.length>0){if(typeof settings.data.strata=="function"||(settings.data.strata[0].length>0&&typeof(settings.data.strata[0])=="object")){if(typeof settings.data.strata=="function"){_this.strata.stratas=settings.data.strata()}else{if(typeof settings.data.strata[0].value=="function"){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,initValue:settings.data.model[i].value,value:function(t,s){return settings.data.strata[i]},};_this.strata.stratas[i]=[defaultStrata]}}else{for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,initValue:settings.data.model[i].value,value:function(t,s){if(typeof(t.selectAll("category",s).length)=="undefined"){return this.initValue}if(t.selectAll("category",s)){return this.initValue+t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return 0}},};_this.strata.stratas[i]=[defaultStrata]}}}}_this.strata.create_strata(_this)}},selectAll:function(_this,key,value){result=[];result.attr=function(key,value,param){var r=[];result.forEach(function(i){q=i.attr(key,value,param);r.push(q)});return r};if(typeof(value)=="undefined"&&typeof(key)=="undefined"){return this.stratas}else{for(var i=_this.strata.stratas.length-1;i>=0;i--){if(_this.strata.stratas[i].attr(key)==value){result.push(_this.strata.stratas[i]);break}}}if(typeof(result[0])=="undefined"){return false}else{return result[0]}},add:function(_this,setting){var strata=function(){};strata.myobj=setting;strata.attr=function(key,value,param){if(typeof(value)=="undefined"){if(typeof(this[key])!="undefined"){return this[key]()}else{return this.myobj[key]}}else{if(typeof(this[key])!="undefined"){this[key](value,param)}else{this.myobj[key]=value}}return this};return strata},remove:function(_this,key,value){},strata_layers:function(_this,n,m,p){var sn=d3.scale.linear().domain([1,m-2]).range([Math.PI/2,2*Math.PI-Math.PI/2]);var logscale=d3.scale.pow().exponent(10).domain([0,m]).range([0,1]);return d3.range(n).map(function(i){var r=5*Math.random();return d3.range(m).map(function(j){if(_this.settings.sedimentation.aggregation.strataType=="sin"){if(i==1){return 20}var x=5+r*5*Math.sin(sn(j))+(i*50);if(x<0){return -x}else{return x}}else{if(_this.settings.sedimentation.aggregation.strataType=="log"){return i+1}else{if(typeof(p)=="undefined"){p=0}return _this.strata.stratas[p][i].value(_this,p)}}}).map(stream_index)});function stream_index(d,i){return{x:i,y:Math.max(0,d)}}},create_strata:function(_this){if(_this.settings.chart.type=="StackedAreaChart"){var w=_this.settings.chart.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var color=_this.token.colorRange;if(typeof _this.settings.options.canvasFirst!="undefined"&&_this.settings.options.canvasFirst==false){var vis=d3.select("#"+_this.settings.DOMelement.id).insert("div",":first-child").style("position","absolute").attr("class","vis").style("z-index",10).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height).append("g").attr("transform","translate("+_this.settings.chart.x+","+_this.settings.chart.y+")")}else{var vis=d3.select("#"+_this.settings.DOMelement.id).append("div").attr("class","vis").style("z-index",10).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height).append("g").attr("transform","translate("+_this.settings.chart.x+","+_this.settings.chart.y+")")}var sn=_this.strata.stratas[0].length,sm=20;smx=sm-1,smy=0;var sum_strata=_this.strata.stratas.map(function(d,i){for(var v=0,res=0;v<d.length;v++){res+=d[v].value(_this,i)}return res});var y=d3.scale.linear().domain([0,Math.max(d3.max(sum_strata),_this.settings.sedimentation.aggregation.maxData)]).range([0,_this.settings.sedimentation.aggregation.height]);var g=vis.selectAll("g.gcol").data(_this.strata.stratas,function(d){return[d]}).enter().append("g").attr("transform",function(d,i){var align=_this.settings.sedimentation.aggregation.height;if(_this.settings.sedimentation.aggregation.invertStrata){align=2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i])}return"translate("+(i*w)+", "+(_this.settings.chart.height-align)+")"}).attr("class",function(d,i){return"gcol col_"+i});var gpath=g.selectAll(".gpath").data(function(d,i){var sd=d3.layout.stack().offset("expand")(_this.strata.strata_layers(_this,d.length,sm,i));smy=d3.max(sd,function(d){return d3.max(d,function(d){return d.y0+d.y})});sd.map(function(d){d.map(function(d){d.col=i;return d})});return sd}).enter().append("g").attr("class","gpath");var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*d.offshit)}).y1(function(d){return(h-(d.y+d.y0)*d.offshit)});var pathlayer=gpath.append("path").attr("d",function(d,i){_this.chartUpdate(i,-y(sum_strata[i])-(h-_this.settings.chart.height));hh=0;d.map(function(dd){dd.offshit=hh;return dd});return area(d)});pathlayer.style("fill",function(d,i){if(_this.strata.stratas[d[0].col][i].texture!=null){return"url(#RectanglePattern_"+d[0].col+"_"+i+")"}else{return d3.rgb(color(d[0].col)).darker(_this.strata.stratas[d[0].col].length/2-(i+1)/2)}}).attr("class",function(d,i){return"gcol col_"+d[0].col+" layer_"+i});var patternWidth=w/1;var patternHeight=patternWidth;if(typeof _this.settings.data.strata!="undefined"){for(var s=0;s<_this.settings.data.strata.length;s++){for(var l=0;l<_this.settings.data.strata[s].length;l++){if(_this.settings.data.strata[s][l].texture!=null){var pattern=vis.append("pattern").attr("id","RectanglePattern_"+s+"_"+l).attr("height",patternHeight).attr("width",patternWidth).attr("patternTransform","translate(0, 0) scale("+_this.settings.data.strata[s][l].texture.size+", "+_this.settings.data.strata[s][l].texture.size+") rotate(0)").attr("patternUnits","userSpaceOnUse");pattern.append("image").attr("x",0).attr("y",0).attr("height",patternHeight).attr("width",patternWidth).attr("xlink:href",function(){return _this.settings.data.strata[s][l].texture.url})}}}}}else{if(_this.settings.chart.type=="CircleLayout"){var svg=d3.select("#"+_this.settings.DOMelement.id).append("div").attr("class","vis").attr("width",_this.settings.width).attr("height",_this.settings.height).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height);if(typeof(_this.settings.chart.treeLayout)!="undefined"){for(var i=0;i<_this.settings.data.model.length;i++){var data=_this.settings.data.strata[i];var color=function(s){return _this.token.colorRange(i)};_this.strata.create_pie_chart(_this,data,svg,data[0].value,color,((i+1/2))*_this.settings.chart.width/(_this.settings.data.model.length)+_this.settings.chart.x,_this.settings.chart.y+_this.settings.chart.height/6)}}else{var data=_this.settings.data.strata.map(function(d){return{value:d[0].value}});var color=_this.token.colorRange;_this.strata.create_pie_chart(_this,data,svg,_this.settings.chart.radius,color,_this.settings.chart.x+_this.settings.chart.width/2,_this.settings.chart.y+_this.settings.chart.height/2)}}}},create_pie_chart:function(_this,data,svg,r,color,posx,posy){var w=_this.settings.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var x=d3.scale.linear().domain([0,_this.settings.data.strata.length-1]).range([0,_this.settings.width]);var y=d3.scale.linear().domain([0,d3.max(data,function(d){return d.value})]).rangeRound([0,h]);var wp=_this.settings.width,hp=_this.settings.height,hhp=_this.settings.sedimentation.aggregation.height;labelr=r+30,donut=d3.layout.pie().sort(null),arc=d3.svg.arc().innerRadius(0).outerRadius(r);var id=Math.random();svg.append("g.arcs_"+id).attr("class","arcs_"+id);var garcs=svg.selectAll(".arcs").data(donut(data.map(function(d,i){return d.value}))).enter().append("svg:g").attr("transform","translate("+posx+","+posy+")");var hh=0;var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*hh)}).y1(function(d){return(h-(d.y+d.y0)*hh)});var arcs=garcs.append("path").attr("fill",function(d,i){return color(i)}).attr("d",function(d,i){return arc(d)}).each(function(d){this._current=d})},update:function(_this){if(typeof(_this.strata.stratas)=="undefined"||_this.strata.stratas.length==0){return}if(typeof settings.data.strata=="function"){_this.strata.stratas=settings.data.strata()}var sn=_this.strata.stratas[0].length,sm=20;smx=sm-1,smy=0;var w=_this.settings.chart.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var color=_this.token.colorRange;var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*d.offshit)}).y1(function(d){return(h-(d.y+d.y0)*d.offshit)});var sum_strata=_this.strata.stratas.map(function(d,i){for(var v=0,res=0;v<d.length;v++){res+=d[v].value(_this,i)}return res});var y=d3.scale.linear().domain([0,Math.max(d3.max(sum_strata),_this.settings.sedimentation.aggregation.maxData)]).range([0,_this.settings.sedimentation.aggregation.height]);var vis=d3.select("#"+_this.settings.DOMelement.id);var g=vis.selectAll("g.gcol");if(_this.settings.sedimentation.aggregation.invertStrata){g.transition().duration(100).attr("transform",function(d,i){var align=_this.settings.sedimentation.aggregation.height;align=2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i]);return"translate("+(i*w)+", "+(_this.settings.chart.height-(2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i])))+")"})}var gpath=g.selectAll("path").data(function(d,i){var sd=d3.layout.stack().offset("expand")(_this.strata.strata_layers(_this,d.length,sm,i));smy=d3.max(sd,function(d){return d3.max(d,function(d){return d.y0+d.y})});sd.map(function(d){d.map(function(d){d.col=i;return d})});return sd});if(_this.settings.chart.type=="StackedAreaChart"){var pathlayer=vis.selectAll("path").transition().duration(100).attr("d",function(d,i){if(!_this.settings.sedimentation.aggregation.invertStrata){_this.chartUpdate(i,-y(sum_strata[i])-(h-_this.settings.chart.height));hh=_this.settings.chart.height-_this.chart.getPosition(_this)[d[0].col].y}else{_this.chartUpdate(i,-2*h+_this.settings.chart.height);hh=y(sum_strata[d[0].col])}d.map(function(dd){dd.offshit=hh;return dd});return area(d)})}}}})(jQuery);(function(A){A.fn._vs.chart.StackedAreaChart=function(F,E,D){var C;this.init=function(G){gravity=new G.phy.b2Vec2(0.001,10);G.world.m_gravity=gravity;G.chartPhySetup={grounds:[],wall:[]};this.setupChartPhysics(G)};this.setupChartPhysics=function(L){var M=L.settings.chart.spacer;var O=(L.settings.chart.width/L.settings.data.model.length);var H=M;var P=L.settings.chart.height/2+L.settings.chart.y;var N=L.settings.chart.height-L.settings.sedimentation.aggregation.height;var I=0;for(var K=0;K<L.settings.data.model.length;K++){L.settings.data.model[K].value=0;if(typeof(L.settings.data.strata)!="undefined"){if(typeof(L.settings.data.strata[K])!="undefined"){for(var J=0;J<L.settings.data.strata[K].length;J++){L.settings.data.model[K].value+=L.settings.data.strata[K][J].value}}}I+=L.settings.data.model[K].value}for(var K=0;K<L.settings.data.model.length+1;K++){var G=L.settings.chart.x+(K*O);L.chartPhySetup.wall[K]=this.createMyChartBox(L,G,P,H,L.settings.chart.height/2,"wall",L.settings.chart.wallColor);if(K<L.settings.data.model.length){L.settings.sedimentation.incoming.point[K]={x:G+(O/2),y:L.settings.y}}if(K<L.settings.data.model.length){L.chartPhySetup.grounds[K]=this.createMyChartBox(L,G+(O/2),L.settings.chart.height+L.settings.chart.y+L.settings.sedimentation.aggregation.height,O/2,L.settings.chart.height,"lift","rgba(250,250,250,0)");this.update(L,{cat:K,y:L.settings.chart.height})}}};this.token=function(J,G){var I=G;var H={x:(J.settings.sedimentation.incoming.point[I].x+(Math.random()*2)),y:(J.settings.sedimentation.incoming.point[I].y+(Math.random()*1)),t:J.now(),size:J.settings.sedimentation.token.size.original,category:I,lineWidth:0,};return H};this.createMyChartBox=function(M,P,O,Q,L,N,J){var I=M.settings.options.scale;var G=new M.phy.b2FixtureDef;G.density=1;G.friction=0.5;G.restitution=0.2;var H=new M.phy.b2BodyDef;H.type=M.phy.b2Body.b2_staticBody;G.shape=new M.phy.b2PolygonShape;G.shape.SetAsBox(Q/I,L/I);H.position.Set(P/I,O/I);var K=M.world.CreateBody(H).CreateFixture(G);K.m_userData={type:N,fillStyle:J,w:Q,h:L,x:P,y:O};return K};this.update=function(K,J){var I={cat:0,y:0};if(K.chartPhySetup.grounds[J.cat]!=null){var H=K.chartPhySetup.grounds[J.cat].GetBody();var G=H.GetWorldCenter();G.y=(J.y+K.settings.chart.height+K.settings.chart.y+K.settings.sedimentation.aggregation.height)/K.settings.options.scale;H.SetPosition(G)}};this.getPositionOld=function(I){var G=[];for(var H=0;H<I.chartPhySetup.grounds.length;H++){myElement=I.chartPhySetup.grounds[H];myBody=myElement.GetBody();G.push({x:(myBody.GetWorldCenter().x*I.settings.options.scale),y:(myBody.GetWorldCenter().y*I.settings.options.scale),a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return G};this.getPosition=function(I){var G=[];for(var H=0;H<I.chartPhySetup.grounds.length;H++){myElement=I.chartPhySetup.grounds[H];myBody=myElement.GetBody();G.push({x:(myBody.GetWorldCenter().x*I.settings.options.scale),y:(myBody.GetWorldCenter().y*I.settings.options.scale)-I.settings.chart.height-I.settings.chart.y,a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return G};if(typeof(E)!=undefined){var B=this[E](F,D);if(typeof(B)!=undefined){return B}}}})(jQuery);(function(A){A.fn._vs.chart.CircleLayout=function(I,M,Q){var H;var K;var J;var G;var N=[];var E=0;var I;this.init=function(U,S){console.log("Circle Layout Init");this._this=U;gravity=new U.phy.b2Vec2(0,0);U.world.m_gravity=gravity;U.chartPhySetup={grounds:[],wall:[]};this.treeLayout=U.settings.chart.treeLayout;for(var T=0;T<U.settings.data.model.length;T++){U.settings.data.strata[T][0].value=U.settings.data.strata[T][0].initValue}for(var T=0;T<U.settings.data.model.length;T++){U.settings.data.model[T].value=0;for(var R=0;R<U.settings.data.strata[T].length;R++){U.settings.data.model[T].value+=U.settings.data.strata[T][R].value}N.push(U.settings.data.model[T].value);E+=U.settings.data.model[T].value}if(this.treeLayout){console.log("ici");this.setupBubbleChartPhysics(U)}else{this.setupPieChartPhysics(U)}};this.setupPieChartPhysics=function(X){console.log("w",X.settings.width);var S=X.settings.chart.radius;K=X.settings.chart.width/2+X.settings.chart.x;J=X.settings.chart.height/2+X.settings.chart.y;var V=O(K,J,S,X.settings.chart.wallColor);for(var U=0;U<X.settings.data.model.length;U++){X.settings.sedimentation.incoming.target[U]={x:K,y:J}}var R=[];var T=X.settings.chart.spacer;var W=0;console.log("tdv",E);if(E==0){for(var U=0;U<X.settings.data.length;U++){N[U]=1}E=N.length}for(var U=0;U<N.length;U++){v=N[U];a2=((v/2+W)/E)*360-90;W+=v;a=(W/E)*360-90;c=L(a2,S*5,K,J);console.log(c);X.settings.sedimentation.incoming.point[U]=c;X.chartPhySetup.grounds[U]=this.createBox(X,K,J,T,S,a,S,"wall",X.settings.chart.wallColor)}console.log("w",X.settings.chart.width)};this.update=function(Y,U){console.log("update");var T={cat:0,r:0};U.r-=90;var W=(U.r+90)*(Math.PI/180);var X=L(U.r,Y.settings.chart.radius,Y.settings.chart.width/2+Y.settings.chart.x,Y.settings.chart.height/2+Y.settings.chart.y);if(Y.chartPhySetup.grounds[U.cat]!=null){var S=Y.chartPhySetup.grounds[U.cat].GetBody();var R=S.GetWorldCenter();var V=S.GetAngle();R.y=X.y/Y.settings.options.scale;R.x=X.x/Y.settings.options.scale;V=W;S.SetPosition(R);S.SetAngle(V)}};this.token=function(U,R){var T=R;var S={x:(U.settings.sedimentation.incoming.point[T].x+(Math.random()*2)),y:(U.settings.sedimentation.incoming.point[T].y+(Math.random()*1)),t:U.now(),size:U.settings.sedimentation.token.size.original,category:T,phy:{density:10,friction:0,restitution:0},targets:[{x:U.settings.sedimentation.incoming.target[T].x,y:U.settings.sedimentation.incoming.target[T].y}]};return S};function L(T,S,X,U){j=T*Math.PI/180;var R=(Math.cos(j)*S)+X;var W=(Math.sin(j)*S)+U;var V={x:R,y:W};return V}function O(W,V,R,T){var Y=I.settings.options.scale;var X=new I.phy.b2FixtureDef;X.density=1;X.friction=0.5;X.restitution=0.2;var S=new I.phy.b2BodyDef;X.shape=new I.phy.b2CircleShape(R/Y);S.position.Set(W/Y,V/Y);var U=I.world.CreateBody(S).CreateFixture(X);U.m_userData={type:"wall",familyID:null,fillStyle:T,strokeStyle:T,r:R};return U}this.createBox=function(Z,g,e,k,Y,f,R,d,W){var V=Z.settings.options.scale;var S=new Z.phy.b2FixtureDef;var b=L(f,R,g,e);S.density=1;S.friction=0.5;S.restitution=0.2;var U=new Z.phy.b2BodyDef;var T=(f+90)*(Math.PI/180);U.angle=T;U.type=Z.phy.b2Body.b2_staticBody;S.shape=new Z.phy.b2PolygonShape;S.shape.SetAsBox(k/V,Y/V);U.position.Set(b.x/V,b.y/V);var X=Z.world.CreateBody(U).CreateFixture(S);X.m_userData={type:d,fillStyle:W,w:k,h:Y,r:R};return X};this.getPosition=function(T){var R=[];for(var S=0;S<T.chartPhySetup.grounds.length;S++){myElement=T.chartPhySetup.grounds[S];myBody=myElement.GetBody();R.push({x:(myBody.GetWorldCenter().x*T.settings.options.scale),y:(myBody.GetWorldCenter().y*T.settings.options.scale),a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return R};this.setupBubbleChartPhysics=function(Y){console.log("setupBubbleChartPhysics");var V=(Y.settings.chart.width/Y.settings.data.model.length);var T=Y.settings.chart.spacer;var S=Y.settings.chart.height/2+Y.settings.y+T;var W=0;var X=0;var R=Y.settings.chart.column;for(var U=0;U<Y.settings.data.model.length;U++){X=Y.settings.chart.x+(U%R*T)+(T/2);W=Y.settings.chart.y+Math.floor(U/R)*T+(T/2);Y.settings.sedimentation.incoming.target[U]={x:X,y:W};O[U]=C(X,W,Y.settings.chart.spacer,U);Y.settings.data.model[U].incomingPoint={x:X,y:W}}};function C(b,W,X,S){console.log("CreatMyBubblePivot",b,W,X,S);var U=I.settings.options.scale;var R=new I.phy.b2FixtureDef;var Z=d3.scale.category10();R.density=10000;R.friction=0;R.restitution=0;var V=new I.phy.b2BodyDef;R.shape=new I.phy.b2CircleShape(X*U);V.position.Set(b/U,W/U);var T=I.world.CreateBody(V);var Y=T.CreateFixture(R);console.log(S,Z(S));Y.m_userData={type:"BubblePivot",familyID:S,fillStyle:I.settings.chart.wallColor};console.log(S,Y);Y.m_shape.m_radius=I.settings.data.model[S].value/U;return Y}this.getPivotPosition=function(T){if(typeof(T)!="undefined"){return this.pivot}else{var R=[];for(var S=0;S<I.settings.data.model.length;S++){R.push(I.settings.data.model[S])}return R}};function D(S,U,T){var R=O[T].GetBody();R.SetPosition(new b2Vec2(S/scale,U/scale));I.settings.data.model[T].incomingPoint.x=S;I.settings.data.model[T].incomingPoint.y=U;setFlowSpeed(speedFlow)}function B(R,U,T){for(var S=0;S<categorys[T].joins.length;S++){categorys[T].joins[S].SetTarget(new b2Vec2(R/scale,U/scale))}}function F(R,S){O[S].m_shape.m_radius=R}if(typeof(M)!=undefined){var P=this[M](I,Q);if(typeof(P)!=undefined){return P}}}})(jQuery);