===========================================================
                                      .___ __  __   
          _________________  __ __  __| _/|__|/  |_ 
         / ___\_` __ \__  \ |  |  \/ __ | | \\_  __\
        / /_/  >  | \// __ \|  |  / /_/ | |  ||  |  
        \___  /|__|  (____  /____/\____ | |__||__|  
       /_____/            \/           \/           
              grep rough audit - static analysis tool
                  v2.8 written by @Wireghoul
=================================[justanotherhacker.com]===
ntopng-3.8.1+dfsg1/attic/src/HTTPBL.cpp-135-
ntopng-3.8.1+dfsg1/attic/src/HTTPBL.cpp:136:static void *get_in_addr(struct sockaddr *sa) {
ntopng-3.8.1+dfsg1/attic/src/HTTPBL.cpp-137-  if(sa->sa_family == AF_INET)
##############################################
ntopng-3.8.1+dfsg1/attic/src/HTTPBL.cpp-171-
ntopng-3.8.1+dfsg1/attic/src/HTTPBL.cpp:172:    inet_ntop(cur->ai_family, get_in_addr((struct sockaddr *)cur->ai_addr), dotted, sizeof(dotted));
ntopng-3.8.1+dfsg1/attic/src/HTTPBL.cpp-173-    snprintf(resp, resp_len, "%s", dotted);
##############################################
ntopng-3.8.1+dfsg1/config.guess-34-
ntopng-3.8.1+dfsg1/config.guess:35:me=`echo "$0" | sed -e 's,.*/,,'`
ntopng-3.8.1+dfsg1/config.guess-36-
##############################################
ntopng-3.8.1+dfsg1/config.guess-102-: ${TMPDIR=/tmp} ;
ntopng-3.8.1+dfsg1/config.guess:103: { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
ntopng-3.8.1+dfsg1/config.guess-104- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
##############################################
ntopng-3.8.1+dfsg1/config.guess-151-	EOF
ntopng-3.8.1+dfsg1/config.guess:152:	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
ntopng-3.8.1+dfsg1/config.guess-153-	;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-181-	    earmv*)
ntopng-3.8.1+dfsg1/config.guess:182:		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
ntopng-3.8.1+dfsg1/config.guess:183:		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
ntopng-3.8.1+dfsg1/config.guess-184-		machine=${arch}${endian}-unknown
##############################################
ntopng-3.8.1+dfsg1/config.guess-210-		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
ntopng-3.8.1+dfsg1/config.guess:211:		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
ntopng-3.8.1+dfsg1/config.guess-212-		;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-223-	    *)
ntopng-3.8.1+dfsg1/config.guess:224:		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
ntopng-3.8.1+dfsg1/config.guess-225-		;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-254-	*4.0)
ntopng-3.8.1+dfsg1/config.guess:255:		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
ntopng-3.8.1+dfsg1/config.guess-256-		;;
ntopng-3.8.1+dfsg1/config.guess-257-	*5.*)
ntopng-3.8.1+dfsg1/config.guess:258:		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
ntopng-3.8.1+dfsg1/config.guess-259-		;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-264-	# types through head -n 1, so we only detect the type of CPU 0.
ntopng-3.8.1+dfsg1/config.guess:265:	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
ntopng-3.8.1+dfsg1/config.guess-266-	case "$ALPHA_CPU_TYPE" in
##############################################
ntopng-3.8.1+dfsg1/config.guess-302-	# 1.2 uses "1.2" for uname -r.
ntopng-3.8.1+dfsg1/config.guess:303:	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
ntopng-3.8.1+dfsg1/config.guess-304-	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
##############################################
ntopng-3.8.1+dfsg1/config.guess-362-    s390x:SunOS:*:*)
ntopng-3.8.1+dfsg1/config.guess:363:	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
ntopng-3.8.1+dfsg1/config.guess-364-	exit ;;
ntopng-3.8.1+dfsg1/config.guess-365-    sun4H:SunOS:5.*:*)
ntopng-3.8.1+dfsg1/config.guess:366:	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
ntopng-3.8.1+dfsg1/config.guess-367-	exit ;;
ntopng-3.8.1+dfsg1/config.guess-368-    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
ntopng-3.8.1+dfsg1/config.guess:369:	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
ntopng-3.8.1+dfsg1/config.guess-370-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-387-	fi
ntopng-3.8.1+dfsg1/config.guess:388:	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
ntopng-3.8.1+dfsg1/config.guess-389-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-393-	# it's likely to be more like Solaris than SunOS4.
ntopng-3.8.1+dfsg1/config.guess:394:	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
ntopng-3.8.1+dfsg1/config.guess-395-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-402-	# Japanese Language versions have a version number like `4.1.3-JL'.
ntopng-3.8.1+dfsg1/config.guess:403:	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
ntopng-3.8.1+dfsg1/config.guess-404-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-408-    sun*:*:4.2BSD:*)
ntopng-3.8.1+dfsg1/config.guess:409:	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
ntopng-3.8.1+dfsg1/config.guess-410-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
##############################################
ntopng-3.8.1+dfsg1/config.guess-490-	$CC_FOR_BUILD -o $dummy $dummy.c &&
ntopng-3.8.1+dfsg1/config.guess:491:	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
ntopng-3.8.1+dfsg1/config.guess:492:	  SYSTEM_NAME=`$dummy $dummyarg` &&
ntopng-3.8.1+dfsg1/config.guess-493-	    { echo "$SYSTEM_NAME"; exit; }
##############################################
ntopng-3.8.1+dfsg1/config.guess-546-    *:IRIX*:*:*)
ntopng-3.8.1+dfsg1/config.guess:547:	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
ntopng-3.8.1+dfsg1/config.guess-548-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-576-EOF
ntopng-3.8.1+dfsg1/config.guess:577:		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
ntopng-3.8.1+dfsg1/config.guess-578-		then
##############################################
ntopng-3.8.1+dfsg1/config.guess-589-    *:AIX:*:[4567])
ntopng-3.8.1+dfsg1/config.guess:590:	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
ntopng-3.8.1+dfsg1/config.guess-591-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
##############################################
ntopng-3.8.1+dfsg1/config.guess-625-    9000/[34678]??:HP-UX:*:*)
ntopng-3.8.1+dfsg1/config.guess:626:	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
ntopng-3.8.1+dfsg1/config.guess-627-	case "${UNAME_MACHINE}" in
##############################################
ntopng-3.8.1+dfsg1/config.guess-679-EOF
ntopng-3.8.1+dfsg1/config.guess:680:		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
ntopng-3.8.1+dfsg1/config.guess-681-		    test -z "$HP_ARCH" && HP_ARCH=hppa
##############################################
ntopng-3.8.1+dfsg1/config.guess-707-    ia64:HP-UX:*:*)
ntopng-3.8.1+dfsg1/config.guess:708:	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
ntopng-3.8.1+dfsg1/config.guess-709-	echo ia64-hp-hpux${HPUX_REV}
##############################################
ntopng-3.8.1+dfsg1/config.guess-737-EOF
ntopng-3.8.1+dfsg1/config.guess:738:	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
ntopng-3.8.1+dfsg1/config.guess-739-		{ echo "$SYSTEM_NAME"; exit; }
##############################################
ntopng-3.8.1+dfsg1/config.guess-808-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
ntopng-3.8.1+dfsg1/config.guess:809:	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
ntopng-3.8.1+dfsg1/config.guess-810-	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
##############################################
ntopng-3.8.1+dfsg1/config.guess-813-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
ntopng-3.8.1+dfsg1/config.guess:814:	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
ntopng-3.8.1+dfsg1/config.guess-815-	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
##############################################
ntopng-3.8.1+dfsg1/config.guess-829-	    amd64)
ntopng-3.8.1+dfsg1/config.guess:830:		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
ntopng-3.8.1+dfsg1/config.guess-831-	    *)
ntopng-3.8.1+dfsg1/config.guess:832:		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
ntopng-3.8.1+dfsg1/config.guess-833-	esac
##############################################
ntopng-3.8.1+dfsg1/config.guess-887-    prep*:SunOS:5.*:*)
ntopng-3.8.1+dfsg1/config.guess:888:	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
ntopng-3.8.1+dfsg1/config.guess-889-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-891-	# the GNU system
ntopng-3.8.1+dfsg1/config.guess:892:	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
ntopng-3.8.1+dfsg1/config.guess-893-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-895-	# other systems with GNU libc and userland
ntopng-3.8.1+dfsg1/config.guess:896:	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
ntopng-3.8.1+dfsg1/config.guess-897-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-986-EOF
ntopng-3.8.1+dfsg1/config.guess:987:	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
ntopng-3.8.1+dfsg1/config.guess-988-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
##############################################
ntopng-3.8.1+dfsg1/config.guess-1080-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
ntopng-3.8.1+dfsg1/config.guess:1081:	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
ntopng-3.8.1+dfsg1/config.guess-1082-	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
##############################################
ntopng-3.8.1+dfsg1/config.guess-1280-	fi
ntopng-3.8.1+dfsg1/config.guess:1281:	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
ntopng-3.8.1+dfsg1/config.guess-1282-	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
##############################################
ntopng-3.8.1+dfsg1/config.guess-1365-    *:DragonFly:*:*)
ntopng-3.8.1+dfsg1/config.guess:1366:	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
ntopng-3.8.1+dfsg1/config.guess-1367-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/config.guess-1378-    i*86:skyos:*:*)
ntopng-3.8.1+dfsg1/config.guess:1379:	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
ntopng-3.8.1+dfsg1/config.guess-1380-	exit ;;
##############################################
ntopng-3.8.1+dfsg1/contrib/Grafana-Dashboard-NTOPNG-Telegraf-SNMP-UNFI-3369-          "policy": "default",
ntopng-3.8.1+dfsg1/contrib/Grafana-Dashboard-NTOPNG-Telegraf-SNMP-UNFI:3370:          "query": "SELECT non_negative_derivative(last(\"ifInDiscards\"), 1s) AS \"Drop:In\", non_negative_derivative(last(\"ifOutDiscards\"), 1s) AS \"Drop:Out\", non_negative_derivative(last(\"ifInErrors\"), 1s) AS \"Error:In\", non_negative_derivative(last(\"ifOutErrors\"), 1s) AS \"Error:Out\", non_negative_derivative(last(\"ifInUnknownProtos\"), 1s) AS \"Unkwn:In\" FROM \"ifTable\" WHERE \"agent_host\" =~ /^$host$/ AND \"ifOperStatus\" = 1 AND $timeFilter GROUP BY time($interval), \"ifDescr\" fill(null)",
ntopng-3.8.1+dfsg1/contrib/Grafana-Dashboard-NTOPNG-Telegraf-SNMP-UNFI-3371-          "rawQuery": false,
##############################################
ntopng-3.8.1+dfsg1/doc/README.nagios-108-
ntopng-3.8.1+dfsg1/doc/README.nagios:109:RESULT_JSON=`curl -s -u ${NTOPNG_USER}:${NTOPNG_PASS} 'http://'${NTOPNG_HOST}':'${NTOPNG_PORT}'/lua/host_get_json.lua?ifname='${CHECK_INTF}'&host='${CHECK_HOST}`
ntopng-3.8.1+dfsg1/doc/README.nagios-110-
##############################################
ntopng-3.8.1+dfsg1/httpdocs/js/deps.min.js:1:if(typeof Math.sign==="undefined"){Math.sign=function(x){return x>=0?1:-1}}if(typeof Math.trunc==="undefined"){Math.trunc=function(x){if(isNaN(x)){return NaN}if(x>0){return Math.floor(x)}return Math.ceil(x)}}if(typeof Math.log2==="undefined"){Math.log2=function(x){return Math.log(x)*Math.LOG2E}}if(!Array.prototype.fill){Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null){throw new TypeError("this is null or not defined")}var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k<final){O[k]=value;k++}return O}})}if(!Array.prototype.find){Object.defineProperty(Array.prototype,"find",{value:function(predicate){if(this==null){throw new TypeError('"this" is null or not defined')}var o=Object(this);var len=o.length>>>0;if(typeof predicate!=="function"){throw new TypeError("predicate must be a function")}var thisArg=arguments[1];var k=0;while(k<len){var kValue=o[k];if(predicate.call(thisArg,kValue,k,o)){return kValue}k++}return undefined},configurable:true,writable:true})}(function(root,factory){if(typeof define==="function"&&define.amd){define(["d3"],function(d3){return root.Rickshaw=factory(d3)})}else if(typeof exports==="object"){module.exports=factory(require("d3"))}else{root.Rickshaw=factory(d3)}})(this,function(d3){var Rickshaw={namespace:function(namespace,obj){var parts=namespace.split(".");var parent=Rickshaw;for(var i=1,length=parts.length;i<length;i++){var currentPart=parts[i];parent[currentPart]=parent[currentPart]||{};parent=parent[currentPart]}return parent},keys:function(obj){var keys=[];for(var key in obj)keys.push(key);return keys},extend:function(destination,source){for(var property in source){destination[property]=source[property]}return destination},clone:function(obj){return JSON.parse(JSON.stringify(obj))}};(function(globalContext){var _toString=Object.prototype.toString,NULL_TYPE="Null",UNDEFINED_TYPE="Undefined",BOOLEAN_TYPE="Boolean",NUMBER_TYPE="Number",STRING_TYPE="String",OBJECT_TYPE="Object",FUNCTION_CLASS="[object Function]";function isFunction(object){return _toString.call(object)===FUNCTION_CLASS}function extend(destination,source){for(var property in source)if(source.hasOwnProperty(property))destination[property]=source[property];return destination}function keys(object){if(Type(object)!==OBJECT_TYPE){throw new TypeError}var results=[];for(var property in object){if(object.hasOwnProperty(property)){results.push(property)}}return results}function Type(o){switch(o){case null:return NULL_TYPE;case void 0:return UNDEFINED_TYPE}var type=typeof o;switch(type){case"boolean":return BOOLEAN_TYPE;case"number":return NUMBER_TYPE;case"string":return STRING_TYPE}return OBJECT_TYPE}function isUndefined(object){return typeof object==="undefined"}var slice=Array.prototype.slice;function argumentNames(fn){var names=fn.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return names.length==1&&!names[0]?[]:names}function wrap(fn,wrapper){var __method=fn;return function(){var a=update([bind(__method,this)],arguments);return wrapper.apply(this,a)}}function update(array,args){var arrayLength=array.length,length=args.length;while(length--)array[arrayLength+length]=args[length];return array}function merge(array,args){array=slice.call(array,0);return update(array,args)}function bind(fn,context){if(arguments.length<2&&isUndefined(arguments[0]))return this;var __method=fn,args=slice.call(arguments,2);return function(){var a=merge(args,arguments);return __method.apply(context,a)}}var emptyFunction=function(){};var Class=function(){var IS_DONTENUM_BUGGY=function(){for(var p in{toString:1}){if(p==="toString")return false}return true}();function subclass(){}function create(){var parent=null,properties=[].slice.apply(arguments);if(isFunction(properties[0]))parent=properties.shift();function klass(){this.initialize.apply(this,arguments)}extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){subclass.prototype=parent.prototype;klass.prototype=new subclass;try{parent.subclasses.push(klass)}catch(e){}}for(var i=0,length=properties.length;i<length;i++)klass.addMethods(properties[i]);if(!klass.prototype.initialize)klass.prototype.initialize=emptyFunction;klass.prototype.constructor=klass;return klass}function addMethods(source){var ancestor=this.superclass&&this.superclass.prototype,properties=keys(source);if(IS_DONTENUM_BUGGY){if(source.toString!=Object.prototype.toString)properties.push("toString");if(source.valueOf!=Object.prototype.valueOf)properties.push("valueOf")}for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&isFunction(value)&&argumentNames(value)[0]=="$super"){var method=value;value=wrap(function(m){return function(){return ancestor[m].apply(this,arguments)}}(property),method);value.valueOf=bind(method.valueOf,method);value.toString=bind(method.toString,method)}this.prototype[property]=value}return this}return{create:create,Methods:{addMethods:addMethods}}}();if(globalContext.exports){globalContext.exports.Class=Class}else{globalContext.Class=Class}})(Rickshaw);Rickshaw.namespace("Rickshaw.Compat.ClassList");Rickshaw.Compat.ClassList=function(){if(typeof document!=="undefined"&&!("classList"in document.createElement("a"))){(function(view){"use strict";var classListProp="classList",protoProp="prototype",elemCtrProto=(view.HTMLElement||view.Element)[protoProp],objCtr=Object,strTrim=String[protoProp].trim||function(){return this.replace(/^\s+|\s+$/g,"")},arrIndexOf=Array[protoProp].indexOf||function(item){var i=0,len=this.length;for(;i<len;i++){if(i in this&&this[i]===item){return i}}return-1},DOMEx=function(type,message){this.name=type;this.code=DOMException[type];this.message=message},checkTokenAndGetIndex=function(classList,token){if(token===""){throw new DOMEx("SYNTAX_ERR","An invalid or illegal string was specified")}if(/\s/.test(token)){throw new DOMEx("INVALID_CHARACTER_ERR","String contains an invalid character")}return arrIndexOf.call(classList,token)},ClassList=function(elem){var trimmedClasses=strTrim.call(elem.className),classes=trimmedClasses?trimmedClasses.split(/\s+/):[],i=0,len=classes.length;for(;i<len;i++){this.push(classes[i])}this._updateClassName=function(){elem.className=this.toString()}},classListProto=ClassList[protoProp]=[],classListGetter=function(){return new ClassList(this)};DOMEx[protoProp]=Error[protoProp];classListProto.item=function(i){return this[i]||null};classListProto.contains=function(token){token+="";return checkTokenAndGetIndex(this,token)!==-1};classListProto.add=function(token){token+="";if(checkTokenAndGetIndex(this,token)===-1){this.push(token);this._updateClassName()}};classListProto.remove=function(token){token+="";var index=checkTokenAndGetIndex(this,token);if(index!==-1){this.splice(index,1);this._updateClassName()}};classListProto.toggle=function(token){token+="";if(checkTokenAndGetIndex(this,token)===-1){this.add(token)}else{this.remove(token)}};classListProto.toString=function(){return this.join(" ")};if(objCtr.defineProperty){var classListPropDesc={get:classListGetter,enumerable:true,configurable:true};try{objCtr.defineProperty(elemCtrProto,classListProp,classListPropDesc)}catch(ex){if(ex.number===-2146823252){classListPropDesc.enumerable=false;objCtr.defineProperty(elemCtrProto,classListProp,classListPropDesc)}}}else if(objCtr[protoProp].__defineGetter__){elemCtrProto.__defineGetter__(classListProp,classListGetter)}})(window)}};if(typeof RICKSHAW_NO_COMPAT!=="undefined"&&!RICKSHAW_NO_COMPAT||typeof RICKSHAW_NO_COMPAT==="undefined"){new Rickshaw.Compat.ClassList}Rickshaw.namespace("Rickshaw.Graph");Rickshaw.Graph=function(args){var self=this;this.initialize=function(args){if(!args.element)throw"Rickshaw.Graph needs a reference to an element";if(args.element.nodeType!==1)throw"Rickshaw.Graph element was defined but not an HTML element";this.element=args.element;this.series=args.series;this.window={};this.updateCallbacks=[];this.configureCallbacks=[];this.defaults={interpolation:"cardinal",offset:"zero",min:undefined,max:undefined,preserve:false,xScale:undefined,yScale:undefined,stack:true};this._loadRenderers();this.configure(args);this.validateSeries(args.series);this.series.active=function(){return self.series.filter(function(s){return!s.disabled})};this.setSize({width:args.width,height:args.height});this.element.classList.add("rickshaw_graph");this.vis=d3.select(this.element).append("svg:svg").attr("width",this.width).attr("height",this.height);this.discoverRange()};this._loadRenderers=function(){for(var name in Rickshaw.Graph.Renderer){if(!name||!Rickshaw.Graph.Renderer.hasOwnProperty(name))continue;var r=Rickshaw.Graph.Renderer[name];if(!r||!r.prototype||!r.prototype.render)continue;self.registerRenderer(new r({graph:self}))}};this.validateSeries=function(series){if(!Array.isArray(series)&&!(series instanceof Rickshaw.Series)){var seriesSignature=Object.prototype.toString.apply(series);throw"series is not an array: "+seriesSignature}var pointsCount;series.forEach(function(s){if(!(s instanceof Object)){throw"series element is not an object: "+s}if(!s.data){throw"series has no data: "+JSON.stringify(s)}if(!Array.isArray(s.data)){throw"series data is not an array: "+JSON.stringify(s.data)}if(s.data.length>0){var x=s.data[0].x;var y=s.data[0].y;if(typeof x!="number"||typeof y!="number"&&y!==null){throw"x and y properties of points should be numbers instead of "+typeof x+" and "+typeof y}}if(s.data.length>=3){if(s.data[2].x<s.data[1].x||s.data[1].x<s.data[0].x||s.data[s.data.length-1].x<s.data[0].x){throw"series data needs to be sorted on x values for series name: "+s.name}}},this)};this.dataDomain=function(){var data=this.series.map(function(s){return s.data});var min=d3.min(data.map(function(d){return d[0].x}));var max=d3.max(data.map(function(d){return d[d.length-1].x}));return[min,max]};this.discoverRange=function(){var domain=this.renderer.domain();this.x=(this.xScale||d3.scale.linear()).copy().domain(domain.x).range([0,this.width]);this.y=(this.yScale||d3.scale.linear()).copy().domain(domain.y).range([this.height,0]);this.x.magnitude=d3.scale.linear().domain([domain.x[0]-domain.x[0],domain.x[1]-domain.x[0]]).range([0,this.width]);this.y.magnitude=d3.scale.linear().domain([domain.y[0]-domain.y[0],domain.y[1]-domain.y[0]]).range([0,this.height])};this.render=function(){var stackedData=this.stackData();this.discoverRange();this.renderer.render();this.updateCallbacks.forEach(function(callback){callback()})};this.update=this.render;this.stackData=function(){var data=this.series.active().map(function(d){return d.data}).map(function(d){return d.filter(function(d){return this._slice(d)},this)},this);var preserve=this.preserve;if(!preserve){this.series.forEach(function(series){if(series.scale){preserve=true}})}data=preserve?Rickshaw.clone(data):data;this.series.active().forEach(function(series,index){if(series.scale){var seriesData=data[index];if(seriesData){seriesData.forEach(function(d){d.y=series.scale(d.y)})}}});this.stackData.hooks.data.forEach(function(entry){data=entry.f.apply(self,[data])});var stackedData;if(!this.renderer.unstack){this._validateStackable();var layout=d3.layout.stack();layout.offset(self.offset);stackedData=layout(data)}stackedData=stackedData||data;if(this.renderer.unstack){stackedData.forEach(function(seriesData){seriesData.forEach(function(d){d.y0=d.y0===undefined?0:d.y0})})}this.stackData.hooks.after.forEach(function(entry){stackedData=entry.f.apply(self,[data])});var i=0;this.series.forEach(function(series){if(series.disabled)return;series.stack=stackedData[i++]});this.stackedData=stackedData;return stackedData};this._validateStackable=function(){var series=this.series;var pointsCount;series.forEach(function(s){pointsCount=pointsCount||s.data.length;if(pointsCount&&s.data.length!=pointsCount){throw"stacked series cannot have differing numbers of points: "+pointsCount+" vs "+s.data.length+"; see Rickshaw.Series.fill()"}},this)};this.stackData.hooks={data:[],after:[]};this._slice=function(d){if(this.window.xMin||this.window.xMax){var isInRange=true;if(this.window.xMin&&d.x<this.window.xMin)isInRange=false;if(this.window.xMax&&d.x>this.window.xMax)isInRange=false;return isInRange}return true};this.onUpdate=function(callback){this.updateCallbacks.push(callback)};this.onConfigure=function(callback){this.configureCallbacks.push(callback)};this.registerRenderer=function(renderer){this._renderers=this._renderers||{};this._renderers[renderer.name]=renderer};this.configure=function(args){this.config=this.config||{};if(args.width||args.height){this.setSize(args)}Rickshaw.keys(this.defaults).forEach(function(k){this.config[k]=k in args?args[k]:k in this?this[k]:this.defaults[k]},this);Rickshaw.keys(this.config).forEach(function(k){this[k]=this.config[k]},this);if("stack"in args)args.unstack=!args.stack;var renderer=args.renderer||this.renderer&&this.renderer.name||"stack";this.setRenderer(renderer,args);this.configureCallbacks.forEach(function(callback){callback(args)})};this.setRenderer=function(r,args){if(typeof r=="function"){this.renderer=new r({graph:self});this.registerRenderer(this.renderer)}else{if(!this._renderers[r]){throw"couldn't find renderer "+r}this.renderer=this._renderers[r]}if(typeof args=="object"){this.renderer.configure(args)}};this.setSize=function(args){args=args||{};if(typeof window!==undefined){var style=window.getComputedStyle(this.element,null);var elementWidth=parseInt(style.getPropertyValue("width"),10);var elementHeight=parseInt(style.getPropertyValue("height"),10)}this.width=args.width||elementWidth||400;this.height=args.height||elementHeight||250;this.vis&&this.vis.attr("width",this.width).attr("height",this.height)};this.initialize(args)};Rickshaw.namespace("Rickshaw.Fixtures.Color");Rickshaw.Fixtures.Color=function(){this.schemes={};this.schemes.spectrum14=["#ecb796","#dc8f70","#b2a470","#92875a","#716c49","#d2ed82","#bbe468","#a1d05d","#e7cbe6","#d8aad6","#a888c2","#9dc2d3","#649eb9","#387aa3"].reverse();this.schemes.spectrum2000=["#57306f","#514c76","#646583","#738394","#6b9c7d","#84b665","#a7ca50","#bfe746","#e2f528","#fff726","#ecdd00","#d4b11d","#de8800","#de4800","#c91515","#9a0000","#7b0429","#580839","#31082b"];this.schemes.spectrum2001=["#2f243f","#3c2c55","#4a3768","#565270","#6b6b7c","#72957f","#86ad6e","#a1bc5e","#b8d954","#d3e04e","#ccad2a","#cc8412","#c1521d","#ad3821","#8a1010","#681717","#531e1e","#3d1818","#320a1b"];this.schemes.classic9=["#423d4f","#4a6860","#848f39","#a2b73c","#ddcb53","#c5a32f","#7d5836","#963b20","#7c2626","#491d37","#2f254a"].reverse();this.schemes.httpStatus={503:"#ea5029",502:"#d23f14",500:"#bf3613",410:"#efacea",409:"#e291dc",403:"#f457e8",408:"#e121d2",401:"#b92dae",405:"#f47ceb",404:"#a82a9f",400:"#b263c6",301:"#6fa024",302:"#87c32b",307:"#a0d84c",304:"#28b55c",200:"#1a4f74",206:"#27839f",201:"#52adc9",202:"#7c979f",203:"#a5b8bd",204:"#c1cdd1"};this.schemes.colorwheel=["#b5b6a9","#858772","#785f43","#96557e","#4682b4","#65b9ac","#73c03a","#cb513a"].reverse();this.schemes.cool=["#5e9d2f","#73c03a","#4682b4","#7bc3b8","#a9884e","#c1b266","#a47493","#c09fb5"];this.schemes.munin=["#00cc00","#0066b3","#ff8000","#ffcc00","#330099","#990099","#ccff00","#ff0000","#808080","#008f00","#00487d","#b35a00","#b38f00","#6b006b","#8fb300","#b30000","#bebebe","#80ff80","#80c9ff","#ffc080","#ffe680","#aa80ff","#ee00cc","#ff8080","#666600","#ffbfff","#00ffcc","#cc6699","#999900"]};Rickshaw.namespace("Rickshaw.Fixtures.RandomData");Rickshaw.Fixtures.RandomData=function(timeInterval){var addData;timeInterval=timeInterval||1;var lastRandomValue=200;var timeBase=Math.floor((new Date).getTime()/1e3);this.addData=function(data){var randomValue=Math.random()*100+15+lastRandomValue;var index=data[0].length;var counter=1;data.forEach(function(series){var randomVariance=Math.random()*20;var v=randomValue/25+counter+++(Math.cos(index*counter*11/960)+2)*15+(Math.cos(index/7)+2)*7+(Math.cos(index/17)+2)*1;series.push({x:index*timeInterval+timeBase,y:v+randomVariance})});lastRandomValue=randomValue*.85};this.removeData=function(data){data.forEach(function(series){series.shift()});timeBase+=timeInterval}};Rickshaw.namespace("Rickshaw.Fixtures.Time");Rickshaw.Fixtures.Time=function(){var self=this;this.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this.units=[{name:"decade",seconds:86400*365.25*10,formatter:function(d){return parseInt(d.getUTCFullYear()/10,10)*10}},{name:"year",seconds:86400*365.25,formatter:function(d){return d.getUTCFullYear()}},{name:"month",seconds:86400*30.5,formatter:function(d){return self.months[d.getUTCMonth()]}},{name:"week",seconds:86400*7,formatter:function(d){return self.formatDate(d)}},{name:"day",seconds:86400,formatter:function(d){return d.getUTCDate()}},{name:"6 hour",seconds:3600*6,formatter:function(d){return self.formatTime(d)}},{name:"hour",seconds:3600,formatter:function(d){return self.formatTime(d)}},{name:"15 minute",seconds:60*15,formatter:function(d){return self.formatTime(d)}},{name:"minute",seconds:60,formatter:function(d){return d.getUTCMinutes()}},{name:"15 second",seconds:15,formatter:function(d){return d.getUTCSeconds()+"s"}},{name:"second",seconds:1,formatter:function(d){return d.getUTCSeconds()+"s"}},{name:"decisecond",seconds:1/10,formatter:function(d){return d.getUTCMilliseconds()+"ms"}},{name:"centisecond",seconds:1/100,formatter:function(d){return d.getUTCMilliseconds()+"ms"}}];this.unit=function(unitName){return this.units.filter(function(unit){return unitName==unit.name}).shift()};this.formatDate=function(d){return d3.time.format("%b %e")(d)};this.formatTime=function(d){return d.toUTCString().match(/(\d+:\d+):/)[1]};this.ceil=function(time,unit){var date,floor,year;if(unit.name=="month"){date=new Date(time*1e3);floor=Date.UTC(date.getUTCFullYear(),date.getUTCMonth())/1e3;if(floor==time)return time;year=date.getUTCFullYear();var month=date.getUTCMonth();if(month==11){month=0;year=year+1}else{month+=1}return Date.UTC(year,month)/1e3}if(unit.name=="year"){date=new Date(time*1e3);floor=Date.UTC(date.getUTCFullYear(),0)/1e3;if(floor==time)return time;year=date.getUTCFullYear()+1;return Date.UTC(year,0)/1e3}return Math.ceil(time/unit.seconds)*unit.seconds}};Rickshaw.namespace("Rickshaw.Fixtures.Time.Local");Rickshaw.Fixtures.Time.Local=function(){var self=this;this.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this.units=[{name:"decade",seconds:86400*365.25*10,formatter:function(d){return parseInt(d.getFullYear()/10,10)*10}},{name:"year",seconds:86400*365.25,formatter:function(d){return d.getFullYear()}},{name:"month",seconds:86400*30.5,formatter:function(d){return self.months[d.getMonth()]}},{name:"week",seconds:86400*7,formatter:function(d){return self.formatDate(d)}},{name:"day",seconds:86400,formatter:function(d){return d.getDate()}},{name:"6 hour",seconds:3600*6,formatter:function(d){return self.formatTime(d)}},{name:"hour",seconds:3600,formatter:function(d){return self.formatTime(d)}},{name:"15 minute",seconds:60*15,formatter:function(d){return self.formatTime(d)}},{name:"minute",seconds:60,formatter:function(d){return d.getMinutes()}},{name:"15 second",seconds:15,formatter:function(d){return d.getSeconds()+"s"}},{name:"second",seconds:1,formatter:function(d){return d.getSeconds()+"s"}},{name:"decisecond",seconds:1/10,formatter:function(d){return d.getMilliseconds()+"ms"}},{name:"centisecond",seconds:1/100,formatter:function(d){return d.getMilliseconds()+"ms"}}];this.unit=function(unitName){return this.units.filter(function(unit){return unitName==unit.name}).shift()};this.formatDate=function(d){return d3.time.format("%b %e")(d)};this.formatTime=function(d){return d.toString().match(/(\d+:\d+):/)[1]};this.ceil=function(time,unit){var date,floor,year;if(unit.name=="day"){var nearFuture=new Date((time+unit.seconds-1)*1e3);var rounded=new Date(0);rounded.setMilliseconds(0);rounded.setSeconds(0);rounded.setMinutes(0);rounded.setHours(0);rounded.setDate(nearFuture.getDate());rounded.setMonth(nearFuture.getMonth());rounded.setFullYear(nearFuture.getFullYear());return rounded.getTime()/1e3}if(unit.name=="month"){date=new Date(time*1e3);floor=new Date(date.getFullYear(),date.getMonth()).getTime()/1e3;if(floor==time)return time;year=date.getFullYear();var month=date.getMonth();if(month==11){month=0;year=year+1}else{month+=1}return new Date(year,month).getTime()/1e3}if(unit.name=="year"){date=new Date(time*1e3);floor=new Date(date.getUTCFullYear(),0).getTime()/1e3;if(floor==time)return time;year=date.getFullYear()+1;return new Date(year,0).getTime()/1e3}return Math.ceil(time/unit.seconds)*unit.seconds}};Rickshaw.namespace("Rickshaw.Fixtures.Number");Rickshaw.Fixtures.Number.formatKMBT=function(y){var abs_y=Math.abs(y);if(abs_y>=1e12){return y/1e12+"T"}else if(abs_y>=1e9){return y/1e9+"B"}else if(abs_y>=1e6){return y/1e6+"M"}else if(abs_y>=1e3){return y/1e3+"K"}else if(abs_y<1&&y>0){return y.toFixed(2)}else if(abs_y===0){return""}else{return y}};Rickshaw.Fixtures.Number.formatBase1024KMGTP=function(y){var abs_y=Math.abs(y);if(abs_y>=0x4000000000000){return y/0x4000000000000+"P"}else if(abs_y>=1099511627776){return y/1099511627776+"T"}else if(abs_y>=1073741824){return y/1073741824+"G"}else if(abs_y>=1048576){return y/1048576+"M"}else if(abs_y>=1024){return y/1024+"K"}else if(abs_y<1&&y>0){return y.toFixed(2)}else if(abs_y===0){return""}else{return y}};Rickshaw.namespace("Rickshaw.Color.Palette");Rickshaw.Color.Palette=function(args){var color=new Rickshaw.Fixtures.Color;args=args||{};this.schemes={};this.scheme=color.schemes[args.scheme]||args.scheme||color.schemes.colorwheel;this.runningIndex=0;this.generatorIndex=0;if(args.interpolatedStopCount){var schemeCount=this.scheme.length-1;var i,j,scheme=[];for(i=0;i<schemeCount;i++){scheme.push(this.scheme[i]);var generator=d3.interpolateHsl(this.scheme[i],this.scheme[i+1]);for(j=1;j<args.interpolatedStopCount;j++){scheme.push(generator(1/args.interpolatedStopCount*j))}}scheme.push(this.scheme[this.scheme.length-1]);this.scheme=scheme}this.rotateCount=this.scheme.length;this.color=function(key){return this.scheme[key]||this.scheme[this.runningIndex++]||this.interpolateColor()||"#808080"};this.interpolateColor=function(){if(!Array.isArray(this.scheme))return;var color;if(this.generatorIndex==this.rotateCount*2-1){color=d3.interpolateHsl(this.scheme[this.generatorIndex],this.scheme[0])(.5);this.generatorIndex=0;this.rotateCount*=2}else{color=d3.interpolateHsl(this.scheme[this.generatorIndex],this.scheme[this.generatorIndex+1])(.5);this.generatorIndex++}this.scheme.push(color);return color}};Rickshaw.namespace("Rickshaw.Graph.Ajax");Rickshaw.Graph.Ajax=Rickshaw.Class.create({initialize:function(args){this.dataURL=args.dataURL;this.onData=args.onData||function(d){return d};this.onComplete=args.onComplete||function(){};this.onError=args.onError||function(){};this.args=args;this.request()},request:function(){jQuery.ajax({url:this.dataURL,dataType:"json",success:this.success.bind(this),error:this.error.bind(this)})},error:function(){console.log("error loading dataURL: "+this.dataURL);this.onError(this)},success:function(data,status){data=this.onData(data);this.args.series=this._splice({data:data,series:this.args.series});this.graph=this.graph||new Rickshaw.Graph(this.args);this.graph.render();this.onComplete(this)},_splice:function(args){var data=args.data;var series=args.series;if(!args.series)return data;series.forEach(function(s){var seriesKey=s.key||s.name;if(!seriesKey)throw"series needs a key or a name";data.forEach(function(d){var dataKey=d.key||d.name;if(!dataKey)throw"data needs a key or a name";if(seriesKey==dataKey){var properties=["color","name","data"];properties.forEach(function(p){if(d[p])s[p]=d[p]})}})});return series}});Rickshaw.namespace("Rickshaw.Graph.Annotate");Rickshaw.Graph.Annotate=function(args){var graph=this.graph=args.graph;this.elements={timeline:args.element};var self=this;this.data={};this.elements.timeline.classList.add("rickshaw_annotation_timeline");this.add=function(time,content,end_time){self.data[time]=self.data[time]||{boxes:[]};self.data[time].boxes.push({content:content,end:end_time})};this.update=function(){Rickshaw.keys(self.data).forEach(function(time){var annotation=self.data[time];var left=self.graph.x(time);if(left<0||left>self.graph.x.range()[1]){if(annotation.element){annotation.line.classList.add("offscreen");annotation.element.style.display="none"}annotation.boxes.forEach(function(box){if(box.rangeElement)box.rangeElement.classList.add("offscreen")});return}if(!annotation.element){var element=annotation.element=document.createElement("div");element.classList.add("annotation");this.elements.timeline.appendChild(element);element.addEventListener("click",function(e){element.classList.toggle("active");annotation.line.classList.toggle("active");annotation.boxes.forEach(function(box){if(box.rangeElement)box.rangeElement.classList.toggle("active")})},false)}annotation.element.style.left=left+"px";annotation.element.style.display="block";annotation.boxes.forEach(function(box){var element=box.element;if(!element){element=box.element=document.createElement("div");element.classList.add("content");element.innerHTML=box.content;annotation.element.appendChild(element);annotation.line=document.createElement("div");annotation.line.classList.add("annotation_line");self.graph.element.appendChild(annotation.line);if(box.end){box.rangeElement=document.createElement("div");box.rangeElement.classList.add("annotation_range");self.graph.element.appendChild(box.rangeElement)}}if(box.end){var annotationRangeStart=left;var annotationRangeEnd=Math.min(self.graph.x(box.end),self.graph.x.range()[1]);if(annotationRangeStart>annotationRangeEnd){annotationRangeEnd=left;annotationRangeStart=Math.max(self.graph.x(box.end),self.graph.x.range()[0])}var annotationRangeWidth=annotationRangeEnd-annotationRangeStart;box.rangeElement.style.left=annotationRangeStart+"px";box.rangeElement.style.width=annotationRangeWidth+"px";box.rangeElement.classList.remove("offscreen")}annotation.line.classList.remove("offscreen");annotation.line.style.left=left+"px"})},this)};this.graph.onUpdate(function(){self.update()})};Rickshaw.namespace("Rickshaw.Graph.Axis.Time");Rickshaw.Graph.Axis.Time=function(args){var self=this;this.graph=args.graph;this.elements=[];this.ticksTreatment=args.ticksTreatment||"plain";this.fixedTimeUnit=args.timeUnit;var time=args.timeFixture||new Rickshaw.Fixtures.Time;this.appropriateTimeUnit=function(){var unit;var units=time.units;var domain=this.graph.x.domain();var rangeSeconds=domain[1]-domain[0];units.forEach(function(u){if(Math.floor(rangeSeconds/u.seconds)>=2){unit=unit||u}});return unit||time.units[time.units.length-1]};this.tickOffsets=function(){var domain=this.graph.x.domain();var unit=this.fixedTimeUnit||this.appropriateTimeUnit();var count=Math.ceil((domain[1]-domain[0])/unit.seconds);var runningTick=domain[0];var offsets=[];for(var i=0;i<count;i++){var tickValue=time.ceil(runningTick,unit);runningTick=tickValue+unit.seconds/2;offsets.push({value:tickValue,unit:unit})}return offsets};this.render=function(){this.elements.forEach(function(e){e.parentNode.removeChild(e)});this.elements=[];var offsets=this.tickOffsets();offsets.forEach(function(o){if(self.graph.x(o.value)>self.graph.x.range()[1])return;var element=document.createElement("div");element.style.left=self.graph.x(o.value)+"px";element.classList.add("x_tick");element.classList.add(self.ticksTreatment);var title=document.createElement("div");title.classList.add("title");title.innerHTML=o.unit.formatter(new Date(o.value*1e3));element.appendChild(title);self.graph.element.appendChild(element);self.elements.push(element)})};this.graph.onUpdate(function(){self.render()})};Rickshaw.namespace("Rickshaw.Graph.Axis.X");Rickshaw.Graph.Axis.X=function(args){var self=this;var berthRate=.1;this.initialize=function(args){this.graph=args.graph;this.orientation=args.orientation||"top";this.pixelsPerTick=args.pixelsPerTick||75;if(args.ticks)this.staticTicks=args.ticks;if(args.tickValues)this.tickValues=args.tickValues;this.tickSize=args.tickSize||4;this.ticksTreatment=args.ticksTreatment||"plain";if(args.element){this.element=args.element;this._discoverSize(args.element,args);this.vis=d3.select(args.element).append("svg:svg").attr("height",this.height).attr("width",this.width).attr("class","rickshaw_graph x_axis_d3");this.element=this.vis[0][0];this.element.style.position="relative";this.setSize({width:args.width,height:args.height})}else{this.vis=this.graph.vis}this.graph.onUpdate(function(){self.render()})};this.setSize=function(args){args=args||{};if(!this.element)return;this._discoverSize(this.element.parentNode,args);this.vis.attr("height",this.height).attr("width",this.width*(1+berthRate));var berth=Math.floor(this.width*berthRate/2);this.element.style.left=-1*berth+"px"};this.render=function(){if(this._renderWidth!==undefined&&this.graph.width!==this._renderWidth)this.setSize({auto:true});var axis=d3.svg.axis().scale(this.graph.x).orient(this.orientation);axis.tickFormat(args.tickFormat||function(x){return x});if(this.tickValues)axis.tickValues(this.tickValues);this.ticks=this.staticTicks||Math.floor(this.graph.width/this.pixelsPerTick);var berth=Math.floor(this.width*berthRate/2)||0;var transform;if(this.orientation=="top"){var yOffset=this.height||this.graph.height;transform="translate("+berth+","+yOffset+")"}else{transform="translate("+berth+", 0)"}if(this.element){this.vis.selectAll("*").remove()}this.vis.append("svg:g").attr("class",["x_ticks_d3",this.ticksTreatment].join(" ")).attr("transform",transform).call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(this.tickSize));var gridSize=(this.orientation=="bottom"?1:-1)*this.graph.height;this.graph.vis.append("svg:g").attr("class","x_grid_d3").call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(gridSize)).selectAll("text").each(function(){this.parentNode.setAttribute("data-x-value",this.textContent)});this._renderHeight=this.graph.height};this._discoverSize=function(element,args){if(typeof window!=="undefined"){var style=window.getComputedStyle(element,null);var elementHeight=parseInt(style.getPropertyValue("height"),10);if(!args.auto){var elementWidth=parseInt(style.getPropertyValue("width"),10)}}this.width=(args.width||elementWidth||this.graph.width)*(1+berthRate);this.height=args.height||elementHeight||40};this.initialize(args)};Rickshaw.namespace("Rickshaw.Graph.Axis.Y");Rickshaw.Graph.Axis.Y=Rickshaw.Class.create({initialize:function(args){this.graph=args.graph;this.orientation=args.orientation||"right";this.pixelsPerTick=args.pixelsPerTick||75;if(args.ticks)this.staticTicks=args.ticks;if(args.tickValues)this.tickValues=args.tickValues;this.tickSize=args.tickSize||4;this.ticksTreatment=args.ticksTreatment||"plain";this.tickFormat=args.tickFormat||function(y){return y};this.berthRate=.1;if(args.element){this.element=args.element;this.vis=d3.select(args.element).append("svg:svg").attr("class","rickshaw_graph y_axis");this.element=this.vis[0][0];this.element.style.position="relative";this.setSize({width:args.width,height:args.height})}else{this.vis=this.graph.vis}var self=this;this.graph.onUpdate(function(){self.render()})},setSize:function(args){args=args||{};if(!this.element)return;if(typeof window!=="undefined"){var style=window.getComputedStyle(this.element.parentNode,null);var elementWidth=parseInt(style.getPropertyValue("width"),10);if(!args.auto){var elementHeight=parseInt(style.getPropertyValue("height"),10)}}this.width=args.width||elementWidth||this.graph.width*this.berthRate;this.height=args.height||elementHeight||this.graph.height;this.vis.attr("width",this.width).attr("height",this.height*(1+this.berthRate));var berth=this.height*this.berthRate;if(this.orientation=="left"){this.element.style.top=-1*berth+"px"}},render:function(){if(this._renderHeight!==undefined&&this.graph.height!==this._renderHeight)this.setSize({auto:true});this.ticks=this.staticTicks||Math.floor(this.graph.height/this.pixelsPerTick);var axis=this._drawAxis(this.graph.y);this._drawGrid(axis);this._renderHeight=this.graph.height},_drawAxis:function(scale){var axis=d3.svg.axis().scale(scale).orient(this.orientation);axis.tickFormat(this.tickFormat);if(this.tickValues)axis.tickValues(this.tickValues);if(this.orientation=="left"){var berth=this.height*this.berthRate;var transform="translate("+this.width+", "+berth+")"}if(this.element){this.vis.selectAll("*").remove()}this.vis.append("svg:g").attr("class",["y_ticks",this.ticksTreatment].join(" ")).attr("transform",transform).call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(this.tickSize));return axis},_drawGrid:function(axis){var gridSize=(this.orientation=="right"?1:-1)*this.graph.width;this.graph.vis.append("svg:g").attr("class","y_grid").call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(gridSize)).selectAll("text").each(function(){this.parentNode.setAttribute("data-y-value",this.textContent)})}});Rickshaw.namespace("Rickshaw.Graph.Axis.Y.Scaled");Rickshaw.Graph.Axis.Y.Scaled=Rickshaw.Class.create(Rickshaw.Graph.Axis.Y,{initialize:function($super,args){if(typeof args.scale==="undefined"){throw new Error("Scaled requires scale")}this.scale=args.scale;if(typeof args.grid==="undefined"){this.grid=true}else{this.grid=args.grid}$super(args)},_drawAxis:function($super,scale){var domain=this.scale.domain();var renderDomain=this.graph.renderer.domain().y;var extents=[Math.min.apply(Math,domain),Math.max.apply(Math,domain)];var extentMap=d3.scale.linear().domain([0,1]).range(extents);var adjExtents=[extentMap(renderDomain[0]),extentMap(renderDomain[1])];var adjustment=d3.scale.linear().domain(extents).range(adjExtents);var adjustedScale=this.scale.copy().domain(domain.map(adjustment)).range(scale.range());return $super(adjustedScale)},_drawGrid:function($super,axis){if(this.grid){$super(axis)}}});Rickshaw.namespace("Rickshaw.Graph.Behavior.Series.Highlight");Rickshaw.Graph.Behavior.Series.Highlight=function(args){this.graph=args.graph;this.legend=args.legend;var self=this;var colorSafe={};var activeLine=null;var disabledColor=args.disabledColor||function(seriesColor){return d3.interpolateRgb(seriesColor,d3.rgb("#d8d8d8"))(.8).toString()};this.addHighlightEvents=function(l){l.element.addEventListener("mouseover",function(e){if(activeLine)return;else activeLine=l;self.legend.lines.forEach(function(line){if(l===line){if(self.graph.renderer.unstack&&(line.series.renderer?line.series.renderer.unstack:true)){var seriesIndex=self.graph.series.indexOf(line.series);line.originalIndex=seriesIndex;var series=self.graph.series.splice(seriesIndex,1)[0];self.graph.series.push(series)}return}colorSafe[line.series.name]=colorSafe[line.series.name]||line.series.color;line.series.color=disabledColor(line.series.color)});self.graph.update()},false);l.element.addEventListener("mouseout",function(e){if(!activeLine)return;else activeLine=null;self.legend.lines.forEach(function(line){if(l===line&&line.hasOwnProperty("originalIndex")){var series=self.graph.series.pop();self.graph.series.splice(line.originalIndex,0,series);delete line.originalIndex}if(colorSafe[line.series.name]){line.series.color=colorSafe[line.series.name]}});self.graph.update()},false)};if(this.legend){this.legend.lines.forEach(function(l){self.addHighlightEvents(l)})}};Rickshaw.namespace("Rickshaw.Graph.Behavior.Series.Order");Rickshaw.Graph.Behavior.Series.Order=function(args){this.graph=args.graph;this.legend=args.legend;var self=this;if(typeof window.jQuery=="undefined"){throw"couldn't find jQuery at window.jQuery"}if(typeof window.jQuery.ui=="undefined"){throw"couldn't find jQuery UI at window.jQuery.ui"}jQuery(function(){jQuery(self.legend.list).sortable({containment:"parent",tolerance:"pointer",update:function(event,ui){var series=[];jQuery(self.legend.list).find("li").each(function(index,item){if(!item.series)return;series.push(item.series)});for(var i=self.graph.series.length-1;i>=0;i--){self.graph.series[i]=series.shift()}self.graph.update()}});jQuery(self.legend.list).disableSelection()});this.graph.onUpdate(function(){var h=window.getComputedStyle(self.legend.element).height;self.legend.element.style.height=h})};Rickshaw.namespace("Rickshaw.Graph.Behavior.Series.Toggle");Rickshaw.Graph.Behavior.Series.Toggle=function(args){this.graph=args.graph;this.legend=args.legend;var self=this;this.addAnchor=function(line){var anchor=document.createElement("a");anchor.innerHTML="&#10004;";anchor.classList.add("action");line.element.insertBefore(anchor,line.element.firstChild);anchor.onclick=function(e){if(line.series.disabled){line.series.enable();line.element.classList.remove("disabled")}else{if(this.graph.series.filter(function(s){return!s.disabled}).length<=1)return;line.series.disable();line.element.classList.add("disabled")}}.bind(this);var label=line.element.getElementsByTagName("span")[0];label.onclick=function(e){var disableAllOtherLines=line.series.disabled;if(!disableAllOtherLines){for(var i=0;i<self.legend.lines.length;i++){var l=self.legend.lines[i];if(line.series===l.series){}else if(l.series.disabled){}else{disableAllOtherLines=true;break}}}if(disableAllOtherLines){line.series.enable();line.element.classList.remove("disabled");self.legend.lines.forEach(function(l){if(line.series===l.series){}else{l.series.disable();l.element.classList.add("disabled")}})}else{self.legend.lines.forEach(function(l){l.series.enable();l.element.classList.remove("disabled")})}}};if(this.legend){var $=jQuery;if(typeof $!="undefined"&&$(this.legend.list).sortable){$(this.legend.list).sortable({start:function(event,ui){ui.item.bind("no.onclick",function(event){event.preventDefault()})},stop:function(event,ui){setTimeout(function(){ui.item.unbind("no.onclick")},250)}})}this.legend.lines.forEach(function(l){self.addAnchor(l)})}this._addBehavior=function(){this.graph.series.forEach(function(s){s.disable=function(){if(self.graph.series.length<=1){throw"only one series left"}s.disabled=true;self.graph.update()};s.enable=function(){s.disabled=false;self.graph.update()}})};this._addBehavior();this.updateBehaviour=function(){this._addBehavior()}};Rickshaw.namespace("Rickshaw.Graph.HoverDetail");Rickshaw.Graph.HoverDetail=Rickshaw.Class.create({initialize:function(args){var graph=this.graph=args.graph;this.xFormatter=args.xFormatter||function(x){return new Date(x*1e3).toUTCString()};this.yFormatter=args.yFormatter||function(y){return y===null?y:y.toFixed(2)};var element=this.element=document.createElement("div");element.className="detail";this.visible=true;graph.element.appendChild(element);this.lastEvent=null;this._addListeners();this.onShow=args.onShow;this.onHide=args.onHide;this.onRender=args.onRender;this.formatter=args.formatter||this.formatter},formatter:function(series,x,y,formattedX,formattedY,d){return series.name+":&nbsp;"+formattedY},update:function(e){e=e||this.lastEvent;if(!e)return;this.lastEvent=e;if(!e.target.nodeName.match(/^(path|svg|rect|circle)$/))return;var graph=this.graph;var eventX=e.offsetX||e.layerX;var eventY=e.offsetY||e.layerY;var j=0;var points=[];var nearestPoint;this.graph.series.active().forEach(function(series){var data=this.graph.stackedData[j++];if(!data.length)return;var domainX=graph.x.invert(eventX);var domainIndexScale=d3.scale.linear().domain([data[0].x,data.slice(-1)[0].x]).range([0,data.length-1]);var approximateIndex=Math.round(domainIndexScale(domainX));if(approximateIndex==data.length-1)approximateIndex--;var dataIndex=Math.min(approximateIndex||0,data.length-1);for(var i=approximateIndex;i<data.length-1;){if(!data[i]||!data[i+1])break;if(data[i].x<=domainX&&data[i+1].x>domainX){dataIndex=Math.abs(domainX-data[i].x)<Math.abs(domainX-data[i+1].x)?i:i+1;break}if(data[i+1].x<=domainX){i++}else{i--}}if(dataIndex<0)dataIndex=0;var value=data[dataIndex];var distance=Math.sqrt(Math.pow(Math.abs(graph.x(value.x)-eventX),2)+Math.pow(Math.abs(graph.y(value.y+value.y0)-eventY),2));var xFormatter=series.xFormatter||this.xFormatter;var yFormatter=series.yFormatter||this.yFormatter;var point={formattedXValue:xFormatter(value.x),formattedYValue:yFormatter(series.scale?series.scale.invert(value.y):value.y),series:series,value:value,distance:distance,order:j,name:series.name};if(!nearestPoint||distance<nearestPoint.distance){nearestPoint=point}points.push(point)},this);if(!nearestPoint)return;nearestPoint.active=true;var domainX=nearestPoint.value.x;var formattedXValue=nearestPoint.formattedXValue;this.element.innerHTML="";this.element.style.left=graph.x(domainX)+"px";this.visible&&this.render({points:points,detail:points,mouseX:eventX,mouseY:eventY,formattedXValue:formattedXValue,domainX:domainX})},hide:function(){this.visible=false;this.element.classList.add("inactive");if(typeof this.onHide=="function"){this.onHide()}},show:function(){this.visible=true;this.element.classList.remove("inactive");if(typeof this.onShow=="function"){this.onShow()}},render:function(args){var graph=this.graph;var points=args.points;var point=points.filter(function(p){return p.active}).shift();if(point.value.y===null)return;var formattedXValue=point.formattedXValue;var formattedYValue=point.formattedYValue;this.element.innerHTML="";this.element.style.left=graph.x(point.value.x)+"px";var xLabel=document.createElement("div");xLabel.className="x_label";xLabel.innerHTML=formattedXValue;this.element.appendChild(xLabel);var item=document.createElement("div");item.className="item";var series=point.series;var actualY=series.scale?series.scale.invert(point.value.y):point.value.y;item.innerHTML=this.formatter(series,point.value.x,actualY,formattedXValue,formattedYValue,point);item.style.top=this.graph.y(point.value.y0+point.value.y)+"px";this.element.appendChild(item);var dot=document.createElement("div");dot.className="dot";dot.style.top=item.style.top;dot.style.borderColor=series.color;this.element.appendChild(dot);if(point.active){item.classList.add("active");dot.classList.add("active")}var alignables=[xLabel,item];alignables.forEach(function(el){el.classList.add("left")});this.show();var leftAlignError=this._calcLayoutError(alignables);if(leftAlignError>0){alignables.forEach(function(el){el.classList.remove("left");el.classList.add("right")});var rightAlignError=this._calcLayoutError(alignables);if(rightAlignError>leftAlignError){alignables.forEach(function(el){el.classList.remove("right");el.classList.add("left")})}}if(typeof this.onRender=="function"){this.onRender(args)}},_calcLayoutError:function(alignables){var parentRect=this.element.parentNode.getBoundingClientRect();var error=0;var alignRight=alignables.forEach(function(el){var rect=el.getBoundingClientRect();if(!rect.width){return}if(rect.right>parentRect.right){error+=rect.right-parentRect.right}if(rect.left<parentRect.left){error+=parentRect.left-rect.left}});return error},_addListeners:function(){this.graph.element.addEventListener("mousemove",function(e){this.visible=true;this.update(e)}.bind(this),false);this.graph.onUpdate(function(){this.update()}.bind(this));this.graph.element.addEventListener("mouseout",function(e){if(e.relatedTarget&&!(e.relatedTarget.compareDocumentPosition(this.graph.element)&Node.DOCUMENT_POSITION_CONTAINS)){this.hide()}}.bind(this),false)}});Rickshaw.namespace("Rickshaw.Graph.JSONP");Rickshaw.Graph.JSONP=Rickshaw.Class.create(Rickshaw.Graph.Ajax,{request:function(){jQuery.ajax({url:this.dataURL,dataType:"jsonp",success:this.success.bind(this),error:this.error.bind(this)})}});Rickshaw.namespace("Rickshaw.Graph.Legend");Rickshaw.Graph.Legend=Rickshaw.Class.create({className:"rickshaw_legend",initialize:function(args){this.element=args.element;this.graph=args.graph;this.naturalOrder=args.naturalOrder;this.element.classList.add(this.className);this.list=document.createElement("ul");this.element.appendChild(this.list);this.render();this.graph.onUpdate(function(){})},render:function(){var self=this;while(this.list.firstChild){this.list.removeChild(this.list.firstChild)}this.lines=[];var series=this.graph.series.map(function(s){return s});if(!this.naturalOrder){series=series.reverse()}series.forEach(function(s){self.addLine(s)})},addLine:function(series){var line=document.createElement("li");line.className="line";if(series.disabled){line.className+=" disabled"}if(series.className){d3.select(line).classed(series.className,true)}var swatch=document.createElement("div");swatch.className="swatch";swatch.style.backgroundColor=series.color;line.appendChild(swatch);var label=document.createElement("span");label.className="label";label.innerHTML=series.name;line.appendChild(label);this.list.appendChild(line);line.series=series;if(series.noLegend){line.style.display="none"}var _line={element:line,series:series};if(this.shelving){this.shelving.addAnchor(_line);this.shelving.updateBehaviour()}if(this.highlighter){this.highlighter.addHighlightEvents(_line)}this.lines.push(_line);return line}});Rickshaw.namespace("Rickshaw.Graph.RangeSlider");Rickshaw.Graph.RangeSlider=Rickshaw.Class.create({initialize:function(args){var element=this.element=args.element;var graph=this.graph=args.graph;this.slideCallbacks=[];this.build();graph.onUpdate(function(){this.update()}.bind(this))},build:function(){var element=this.element;var graph=this.graph;var $=jQuery;var domain=graph.dataDomain();var self=this;$(function(){$(element).slider({range:true,min:domain[0],max:domain[1],values:[domain[0],domain[1]],slide:function(event,ui){if(ui.values[1]<=ui.values[0])return;graph.window.xMin=ui.values[0];graph.window.xMax=ui.values[1];graph.update();var domain=graph.dataDomain();if(domain[0]==ui.values[0]){graph.window.xMin=undefined}if(domain[1]==ui.values[1]){graph.window.xMax=undefined}self.slideCallbacks.forEach(function(callback){callback(graph,graph.window.xMin,graph.window.xMax)})}})});$(element)[0].style.width=graph.width+"px"},update:function(){var element=this.element;var graph=this.graph;var $=jQuery;var values=$(element).slider("option","values");var domain=graph.dataDomain();$(element).slider("option","min",domain[0]);$(element).slider("option","max",domain[1]);if(graph.window.xMin==null){values[0]=domain[0]}if(graph.window.xMax==null){values[1]=domain[1]}$(element).slider("option","values",values)},onSlide:function(callback){this.slideCallbacks.push(callback)}});Rickshaw.namespace("Rickshaw.Graph.RangeSlider.Preview");Rickshaw.Graph.RangeSlider.Preview=Rickshaw.Class.create({initialize:function(args){if(!args.element)throw"Rickshaw.Graph.RangeSlider.Preview needs a reference to an element";if(!args.graph&&!args.graphs)throw"Rickshaw.Graph.RangeSlider.Preview needs a reference to an graph or an array of graphs";this.element=args.element;this.element.style.position="relative";this.graphs=args.graph?[args.graph]:args.graphs;this.defaults={height:75,width:400,gripperColor:undefined,frameTopThickness:3,frameHandleThickness:10,frameColor:"#d4d4d4",frameOpacity:1,minimumFrameWidth:0,heightRatio:.2};this.heightRatio=args.heightRatio||this.defaults.heightRatio;this.defaults.gripperColor=d3.rgb(this.defaults.frameColor).darker().toString();this.configureCallbacks=[];this.slideCallbacks=[];this.previews=[];if(!args.width)this.widthFromGraph=true;if(!args.height)this.heightFromGraph=true;if(this.widthFromGraph||this.heightFromGraph){this.graphs[0].onConfigure(function(){this.configure(args);this.render()}.bind(this))}args.width=args.width||this.graphs[0].width||this.defaults.width;args.height=args.height||this.graphs[0].height*this.heightRatio||this.defaults.height;this.configure(args);this.render()},onSlide:function(callback){this.slideCallbacks.push(callback)},onConfigure:function(callback){this.configureCallbacks.push(callback)},configure:function(args){this.config=this.config||{};this.configureCallbacks.forEach(function(callback){callback(args)});Rickshaw.keys(this.defaults).forEach(function(k){this.config[k]=k in args?args[k]:k in this.config?this.config[k]:this.defaults[k]},this);if("width"in args||"height"in args){if(this.widthFromGraph){this.config.width=this.graphs[0].width}if(this.heightFromGraph){this.config.height=this.graphs[0].height*this.heightRatio;this.previewHeight=this.config.height}this.previews.forEach(function(preview){var height=this.previewHeight/this.graphs.length-this.config.frameTopThickness*2;var width=this.config.width-this.config.frameHandleThickness*2;preview.setSize({width:width,height:height});if(this.svg){var svgHeight=height+this.config.frameHandleThickness*2;var svgWidth=width+this.config.frameHandleThickness*2;this.svg.style("width",svgWidth+"px");this.svg.style("height",svgHeight+"px")}},this)}},render:function(){var self=this;this.svg=d3.select(this.element).selectAll("svg.rickshaw_range_slider_preview").data([null]);this.previewHeight=this.config.height-this.config.frameTopThickness*2;this.previewWidth=this.config.width-this.config.frameHandleThickness*2;this.currentFrame=[0,this.previewWidth];var buildGraph=function(parent,index){var graphArgs=Rickshaw.extend({},parent.config);var height=self.previewHeight/self.graphs.length;var renderer=parent.renderer.name;Rickshaw.extend(graphArgs,{element:this.appendChild(document.createElement("div")),height:height,width:self.previewWidth,series:parent.series,renderer:renderer});var graph=new Rickshaw.Graph(graphArgs);self.previews.push(graph);parent.onUpdate(function(){graph.render();self.render()});parent.onConfigure(function(args){delete args.height;args.width=args.width-self.config.frameHandleThickness*2;graph.configure(args);graph.render()});graph.render()};var graphContainer=d3.select(this.element).selectAll("div.rickshaw_range_slider_preview_container").data(this.graphs);var translateCommand="translate("+this.config.frameHandleThickness+"px, "+this.config.frameTopThickness+"px)";graphContainer.enter().append("div").classed("rickshaw_range_slider_preview_container",true).style("-webkit-transform",translateCommand).style("-moz-transform",translateCommand).style("-ms-transform",translateCommand).style("transform",translateCommand).each(buildGraph);graphContainer.exit().remove();var masterGraph=this.graphs[0];var domainScale=d3.scale.linear().domain([0,this.previewWidth]).range(masterGraph.dataDomain());var currentWindow=[masterGraph.window.xMin,masterGraph.window.xMax];this.currentFrame[0]=currentWindow[0]===undefined?0:Math.round(domainScale.invert(currentWindow[0]));if(this.currentFrame[0]<0)this.currentFrame[0]=0;this.currentFrame[1]=currentWindow[1]===undefined?this.previewWidth:domainScale.invert(currentWindow[1]);if(this.currentFrame[1]-this.currentFrame[0]<self.config.minimumFrameWidth){this.currentFrame[1]=(this.currentFrame[0]||0)+self.config.minimumFrameWidth}this.svg.enter().append("svg").classed("rickshaw_range_slider_preview",true).style("height",this.config.height+"px").style("width",this.config.width+"px").style("position","absolute").style("top",0);this._renderDimming();this._renderFrame();this._renderGrippers();this._renderHandles();this._renderMiddle();this._registerMouseEvents()},_renderDimming:function(){var element=this.svg.selectAll("path.dimming").data([null]);element.enter().append("path").attr("fill","white").attr("fill-opacity","0.7").attr("fill-rule","evenodd").classed("dimming",true);var path="";path+=" M "+this.config.frameHandleThickness+" "+this.config.frameTopThickness;path+=" h "+this.previewWidth;path+=" v "+this.previewHeight;path+=" h "+-this.previewWidth;path+=" z ";path+=" M "+Math.max(this.currentFrame[0],this.config.frameHandleThickness)+" "+this.config.frameTopThickness;path+=" H "+Math.min(this.currentFrame[1]+this.config.frameHandleThickness*2,this.previewWidth+this.config.frameHandleThickness);path+=" v "+this.previewHeight;path+=" H "+Math.max(this.currentFrame[0],this.config.frameHandleThickness);path+=" z";element.attr("d",path)},_renderFrame:function(){var element=this.svg.selectAll("path.frame").data([null]);element.enter().append("path").attr("stroke","white").attr("stroke-width","1px").attr("stroke-linejoin","round").attr("fill",this.config.frameColor).attr("fill-opacity",this.config.frameOpacity).attr("fill-rule","evenodd").classed("frame",true);var path="";path+=" M "+this.currentFrame[0]+" 0";path+=" H "+(this.currentFrame[1]+this.config.frameHandleThickness*2);path+=" V "+this.config.height;path+=" H "+this.currentFrame[0];path+=" z";path+=" M "+(this.currentFrame[0]+this.config.frameHandleThickness)+" "+this.config.frameTopThickness;path+=" H "+(this.currentFrame[1]+this.config.frameHandleThickness);path+=" v "+this.previewHeight;path+=" H "+(this.currentFrame[0]+this.config.frameHandleThickness);path+=" z";element.attr("d",path)},_renderGrippers:function(){var gripper=this.svg.selectAll("path.gripper").data([null]);gripper.enter().append("path").attr("stroke",this.config.gripperColor).classed("gripper",true);var path="";[.4,.6].forEach(function(spacing){path+=" M "+Math.round(this.currentFrame[0]+this.config.frameHandleThickness*spacing)+" "+Math.round(this.config.height*.3);path+=" V "+Math.round(this.config.height*.7);path+=" M "+Math.round(this.currentFrame[1]+this.config.frameHandleThickness*(1+spacing))+" "+Math.round(this.config.height*.3);path+=" V "+Math.round(this.config.height*.7)}.bind(this));gripper.attr("d",path)},_renderHandles:function(){var leftHandle=this.svg.selectAll("rect.left_handle").data([null]);leftHandle.enter().append("rect").attr("width",this.config.frameHandleThickness).style("cursor","ew-resize").style("fill-opacity","0").classed("left_handle",true);leftHandle.attr("x",this.currentFrame[0]).attr("height",this.config.height);var rightHandle=this.svg.selectAll("rect.right_handle").data([null]);rightHandle.enter().append("rect").attr("width",this.config.frameHandleThickness).style("cursor","ew-resize").style("fill-opacity","0").classed("right_handle",true);rightHandle.attr("x",this.currentFrame[1]+this.config.frameHandleThickness).attr("height",this.config.height)},_renderMiddle:function(){var middleHandle=this.svg.selectAll("rect.middle_handle").data([null]);middleHandle.enter().append("rect").style("cursor","move").style("fill-opacity","0").classed("middle_handle",true);middleHandle.attr("width",Math.max(0,this.currentFrame[1]-this.currentFrame[0])).attr("x",this.currentFrame[0]+this.config.frameHandleThickness).attr("height",this.config.height)},_registerMouseEvents:function(){var element=d3.select(this.element);var drag={target:null,start:null,stop:null,left:false,right:false,rigid:false};var self=this;function onMousemove(datum,index){drag.stop=self._getClientXFromEvent(d3.event,drag);var distanceTraveled=drag.stop-drag.start;var frameAfterDrag=self.frameBeforeDrag.slice(0);var minimumFrameWidth=self.config.minimumFrameWidth;if(drag.rigid){minimumFrameWidth=self.frameBeforeDrag[1]-self.frameBeforeDrag[0]}if(drag.left){frameAfterDrag[0]=Math.max(frameAfterDrag[0]+distanceTraveled,0)}if(drag.right){frameAfterDrag[1]=Math.min(frameAfterDrag[1]+distanceTraveled,self.previewWidth)}var currentFrameWidth=frameAfterDrag[1]-frameAfterDrag[0];if(currentFrameWidth<=minimumFrameWidth){if(drag.left){frameAfterDrag[0]=frameAfterDrag[1]-minimumFrameWidth}if(drag.right){frameAfterDrag[1]=frameAfterDrag[0]+minimumFrameWidth}if(frameAfterDrag[0]<=0){frameAfterDrag[1]-=frameAfterDrag[0];frameAfterDrag[0]=0}if(frameAfterDrag[1]>=self.previewWidth){frameAfterDrag[0]-=frameAfterDrag[1]-self.previewWidth;frameAfterDrag[1]=self.previewWidth}}self.graphs.forEach(function(graph){var domainScale=d3.scale.linear().interpolate(d3.interpolateNumber).domain([0,self.previewWidth]).range(graph.dataDomain());var windowAfterDrag=[domainScale(frameAfterDrag[0]),domainScale(frameAfterDrag[1])];self.slideCallbacks.forEach(function(callback){callback(graph,windowAfterDrag[0],windowAfterDrag[1])});if(frameAfterDrag[0]===0){windowAfterDrag[0]=undefined}if(frameAfterDrag[1]===self.previewWidth){windowAfterDrag[1]=undefined}graph.window.xMin=windowAfterDrag[0];graph.window.xMax=windowAfterDrag[1];graph.update()})}function onMousedown(){drag.target=d3.event.target;drag.start=self._getClientXFromEvent(d3.event,drag);self.frameBeforeDrag=self.currentFrame.slice();d3.event.preventDefault?d3.event.preventDefault():d3.event.returnValue=false;d3.select(document).on("mousemove.rickshaw_range_slider_preview",onMousemove);d3.select(document).on("mouseup.rickshaw_range_slider_preview",onMouseup);d3.select(document).on("touchmove.rickshaw_range_slider_preview",onMousemove);d3.select(document).on("touchend.rickshaw_range_slider_preview",onMouseup);d3.select(document).on("touchcancel.rickshaw_range_slider_preview",onMouseup)}function onMousedownLeftHandle(datum,index){drag.left=true;onMousedown()}function onMousedownRightHandle(datum,index){drag.right=true;onMousedown()}function onMousedownMiddleHandle(datum,index){drag.left=true;drag.right=true;drag.rigid=true;onMousedown()}function onMouseup(datum,index){d3.select(document).on("mousemove.rickshaw_range_slider_preview",null);d3.select(document).on("mouseup.rickshaw_range_slider_preview",null);d3.select(document).on("touchmove.rickshaw_range_slider_preview",null);d3.select(document).on("touchend.rickshaw_range_slider_preview",null);d3.select(document).on("touchcancel.rickshaw_range_slider_preview",null);delete self.frameBeforeDrag;drag.left=false;drag.right=false;drag.rigid=false}element.select("rect.left_handle").on("mousedown",onMousedownLeftHandle);element.select("rect.right_handle").on("mousedown",onMousedownRightHandle);element.select("rect.middle_handle").on("mousedown",onMousedownMiddleHandle);element.select("rect.left_handle").on("touchstart",onMousedownLeftHandle);element.select("rect.right_handle").on("touchstart",onMousedownRightHandle);element.select("rect.middle_handle").on("touchstart",onMousedownMiddleHandle)},_getClientXFromEvent:function(event,drag){switch(event.type){case"touchstart":case"touchmove":var touchList=event.changedTouches;var touch=null;for(var touchIndex=0;touchIndex<touchList.length;touchIndex++){if(touchList[touchIndex].target===drag.target){touch=touchList[touchIndex];break}}return touch!==null?touch.clientX:undefined;default:return event.clientX}}});Rickshaw.namespace("Rickshaw.Graph.Renderer");Rickshaw.Graph.Renderer=Rickshaw.Class.create({initialize:function(args){this.graph=args.graph;this.tension=args.tension||this.tension;this.configure(args)},seriesPathFactory:function(){},seriesStrokeFactory:function(){},defaults:function(){return{tension:.8,strokeWidth:2,unstack:true,padding:{top:.01,right:0,bottom:.01,left:0},stroke:false,fill:false}},domain:function(data){var stackedData=data||this.graph.stackedData||this.graph.stackData();var xMin=+Infinity;var xMax=-Infinity;var yMin=+Infinity;var yMax=-Infinity;stackedData.forEach(function(series){series.forEach(function(d){if(d.y==null)return;var y=d.y+d.y0;if(y<yMin)yMin=y;if(y>yMax)yMax=y});if(!series.length)return;if(series[0].x<xMin)xMin=series[0].x;if(series[series.length-1].x>xMax)xMax=series[series.length-1].x});xMin-=(xMax-xMin)*this.padding.left;xMax+=(xMax-xMin)*this.padding.right;yMin=this.graph.min==="auto"?yMin:this.graph.min||0;yMax=this.graph.max===undefined?yMax:this.graph.max;if(this.graph.min==="auto"||yMin<0){yMin-=(yMax-yMin)*this.padding.bottom}if(this.graph.max===undefined){yMax+=(yMax-yMin)*this.padding.top}return{x:[xMin,xMax],y:[yMin,yMax]}},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;vis.selectAll("*").remove();var data=series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});var pathNodes=vis.selectAll("path.path").data(data).enter().append("svg:path").classed("path",true).attr("d",this.seriesPathFactory());if(this.stroke){var strokeNodes=vis.selectAll("path.stroke").data(data).enter().append("svg:path").classed("stroke",true).attr("d",this.seriesStrokeFactory())}var i=0;series.forEach(function(series){if(series.disabled)return;series.path=pathNodes[0][i];if(this.stroke)series.stroke=strokeNodes[0][i];this._styleSeries(series);i++},this)},_styleSeries:function(series){var fill=this.fill?series.color:"none";var stroke=this.stroke?series.color:"none";series.path.setAttribute("fill",fill);series.path.setAttribute("stroke",stroke);series.path.setAttribute("stroke-width",this.strokeWidth);if(series.className){d3.select(series.path).classed(series.className,true)}if(series.className&&this.stroke){d3.select(series.stroke).classed(series.className,true)}},configure:function(args){args=args||{};Rickshaw.keys(this.defaults()).forEach(function(key){if(!args.hasOwnProperty(key)){this[key]=this[key]||this.graph[key]||this.defaults()[key];return}if(typeof this.defaults()[key]=="object"){Rickshaw.keys(this.defaults()[key]).forEach(function(k){this[key][k]=args[key][k]!==undefined?args[key][k]:this[key][k]!==undefined?this[key][k]:this.defaults()[key][k]},this)}else{this[key]=args[key]!==undefined?args[key]:this[key]!==undefined?this[key]:this.graph[key]!==undefined?this.graph[key]:this.defaults()[key]}},this)},setStrokeWidth:function(strokeWidth){if(strokeWidth!==undefined){this.strokeWidth=strokeWidth}},setTension:function(tension){if(tension!==undefined){this.tension=tension}}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Line");Rickshaw.Graph.Renderer.Line=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"line",defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:false,stroke:true})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.line().x(function(d){return graph.x(d.x)}).y(function(d){return graph.y(d.y)}).interpolate(this.graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Stack");Rickshaw.Graph.Renderer.Stack=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"stack",defaults:function($super){return Rickshaw.extend($super(),{fill:true,stroke:false,unstack:false})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.area().x(function(d){return graph.x(d.x)}).y0(function(d){return graph.y(d.y0)}).y1(function(d){return graph.y(d.y+d.y0)}).interpolate(this.graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Bar");Rickshaw.Graph.Renderer.Bar=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"bar",defaults:function($super){var defaults=Rickshaw.extend($super(),{gapSize:.05,unstack:false});delete defaults.tension;return defaults},initialize:function($super,args){args=args||{};this.gapSize=args.gapSize||this.gapSize;$super(args)},domain:function($super){var domain=$super();var frequentInterval=this._frequentInterval(this.graph.stackedData.slice(-1).shift());domain.x[1]+=Number(frequentInterval.magnitude);return domain},barWidth:function(series){var frequentInterval=this._frequentInterval(series.stack);var barWidth=this.graph.x.magnitude(frequentInterval.magnitude)*(1-this.gapSize);return barWidth},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;vis.selectAll("*").remove();var barWidth=this.barWidth(series.active()[0]);var barXOffset=0;var activeSeriesCount=series.filter(function(s){return!s.disabled}).length;var seriesBarWidth=this.unstack?barWidth/activeSeriesCount:barWidth;var transform=function(d){var matrix=[1,0,0,d.y<0?-1:1,0,d.y<0?graph.y.magnitude(Math.abs(d.y))*2:0];return"matrix("+matrix.join(",")+")"};series.forEach(function(series){if(series.disabled)return;var barWidth=this.barWidth(series);var nodes=vis.selectAll("path").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:rect").attr("x",function(d){return graph.x(d.x)+barXOffset}).attr("y",function(d){return graph.y(d.y0+Math.abs(d.y))*(d.y<0?-1:1)}).attr("width",seriesBarWidth).attr("height",function(d){return graph.y.magnitude(Math.abs(d.y))}).attr("transform",transform);Array.prototype.forEach.call(nodes[0],function(n){n.setAttribute("fill",series.color)});if(this.unstack)barXOffset+=seriesBarWidth},this)},_frequentInterval:function(data){var intervalCounts={};for(var i=0;i<data.length-1;i++){var interval=data[i+1].x-data[i].x;intervalCounts[interval]=intervalCounts[interval]||0;intervalCounts[interval]++}var frequentInterval={count:0,magnitude:1};Rickshaw.keys(intervalCounts).forEach(function(i){if(frequentInterval.count<intervalCounts[i]){frequentInterval={count:intervalCounts[i],magnitude:i}}});return frequentInterval}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Area");Rickshaw.Graph.Renderer.Area=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"area",defaults:function($super){return Rickshaw.extend($super(),{unstack:false,fill:false,stroke:false})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.area().x(function(d){return graph.x(d.x)}).y0(function(d){return graph.y(d.y0)}).y1(function(d){return graph.y(d.y+d.y0)}).interpolate(graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},seriesStrokeFactory:function(){var graph=this.graph;var factory=d3.svg.line().x(function(d){return graph.x(d.x)}).y(function(d){return graph.y(d.y+d.y0)}).interpolate(graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;vis.selectAll("*").remove();var method=this.unstack?"append":"insert";var data=series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});var nodes=vis.selectAll("path").data(data).enter()[method]("svg:g","g");nodes.append("svg:path").attr("d",this.seriesPathFactory()).attr("class","area");if(this.stroke){nodes.append("svg:path").attr("d",this.seriesStrokeFactory()).attr("class","line")}var i=0;series.forEach(function(series){if(series.disabled)return;series.path=nodes[0][i++];this._styleSeries(series)},this)},_styleSeries:function(series){if(!series.path)return;d3.select(series.path).select(".area").attr("fill",series.color);if(this.stroke){d3.select(series.path).select(".line").attr("fill","none").attr("stroke",series.stroke||d3.interpolateRgb(series.color,"black")(.125)).attr("stroke-width",this.strokeWidth)}if(series.className){series.path.setAttribute("class",series.className)}}});Rickshaw.namespace("Rickshaw.Graph.Renderer.ScatterPlot");Rickshaw.Graph.Renderer.ScatterPlot=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"scatterplot",defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:true,stroke:false,padding:{top:.01,right:.01,bottom:.01,left:.01},dotSize:4})},initialize:function($super,args){$super(args)},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;var dotSize=this.dotSize;vis.selectAll("*").remove();series.forEach(function(series){if(series.disabled)return;var nodes=vis.selectAll("path").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:circle").attr("cx",function(d){return graph.x(d.x)}).attr("cy",function(d){return graph.y(d.y)}).attr("r",function(d){return"r"in d?d.r:dotSize});if(series.className){nodes.classed(series.className,true)}Array.prototype.forEach.call(nodes[0],function(n){n.setAttribute("fill",series.color)})},this)}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Multi");Rickshaw.Graph.Renderer.Multi=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"multi",initialize:function($super,args){$super(args)},defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:false,stroke:true})},configure:function($super,args){args=args||{};this.config=args;$super(args)},domain:function($super){this.graph.stackData();var domains=[];var groups=this._groups();this._stack(groups);groups.forEach(function(group){var data=group.series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});if(!data.length)return;var domain=null;if(group.renderer&&group.renderer.domain){domain=group.renderer.domain(data)}else{domain=$super(data)}domains.push(domain)});var xMin=d3.min(domains.map(function(d){return d.x[0]}));var xMax=d3.max(domains.map(function(d){return d.x[1]}));var yMin=d3.min(domains.map(function(d){return d.y[0]}));var yMax=d3.max(domains.map(function(d){return d.y[1]}));return{x:[xMin,xMax],y:[yMin,yMax]}},_groups:function(){var graph=this.graph;var renderGroups={};graph.series.forEach(function(series){if(series.disabled)return;if(!renderGroups[series.renderer]){var ns="http://www.w3.org/2000/svg";var vis=document.createElementNS(ns,"g");graph.vis[0][0].appendChild(vis);var renderer=graph._renderers[series.renderer];var config={};var defaults=[this.defaults(),renderer.defaults(),this.config,this.graph];defaults.forEach(function(d){Rickshaw.extend(config,d)});renderer.configure(config);renderGroups[series.renderer]={renderer:renderer,series:[],vis:d3.select(vis)}}renderGroups[series.renderer].series.push(series)},this);var groups=[];Object.keys(renderGroups).forEach(function(key){var group=renderGroups[key];groups.push(group)});return groups},_stack:function(groups){groups.forEach(function(group){var series=group.series.filter(function(series){return!series.disabled});var data=series.map(function(series){return series.stack});if(!group.renderer.unstack){var layout=d3.layout.stack();var stackedData=Rickshaw.clone(layout(data));series.forEach(function(series,index){series._stack=Rickshaw.clone(stackedData[index])})}},this);return groups},render:function(){this.graph.series.forEach(function(series){if(!series.renderer){throw new Error("Each series needs a renderer for graph 'multi' renderer")}});this.graph.vis.selectAll("*").remove();var groups=this._groups();groups=this._stack(groups);groups.forEach(function(group){var series=group.series.filter(function(series){return!series.disabled});series.active=function(){return series};group.renderer.render({series:series,vis:group.vis});series.forEach(function(s){s.stack=s._stack||s.stack||s.data})})}});Rickshaw.namespace("Rickshaw.Graph.Renderer.LinePlot");Rickshaw.Graph.Renderer.LinePlot=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"lineplot",defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:false,stroke:true,padding:{top:.01,right:.01,bottom:.01,left:.01},dotSize:3,strokeWidth:2})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.line().x(function(d){return graph.x(d.x)}).y(function(d){return graph.y(d.y)}).interpolate(this.graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;var dotSize=this.dotSize;vis.selectAll("*").remove();var data=series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});var nodes=vis.selectAll("path").data(data).enter().append("svg:path").attr("d",this.seriesPathFactory());var i=0;series.forEach(function(series){if(series.disabled)return;series.path=nodes[0][i++];this._styleSeries(series)},this);series.forEach(function(series){if(series.disabled)return;var nodes=vis.selectAll("x").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:circle").attr("cx",function(d){return graph.x(d.x)}).attr("cy",function(d){return graph.y(d.y)}).attr("r",function(d){return"r"in d?d.r:dotSize});Array.prototype.forEach.call(nodes[0],function(n){if(!n)return;n.setAttribute("data-color",series.color);n.setAttribute("fill","white");n.setAttribute("stroke",series.color);n.setAttribute("stroke-width",this.strokeWidth)}.bind(this))},this)}});Rickshaw.namespace("Rickshaw.Graph.Smoother");Rickshaw.Graph.Smoother=Rickshaw.Class.create({initialize:function(args){this.graph=args.graph;this.element=args.element;this.aggregationScale=1;this.build();this.graph.stackData.hooks.data.push({name:"smoother",orderPosition:50,f:this.transformer.bind(this)})},build:function(){var self=this;var $=jQuery;if(this.element){$(function(){$(self.element).slider({min:1,max:100,slide:function(event,ui){self.setScale(ui.value);self.graph.update()}})})}},setScale:function(scale){if(scale<1){throw"scale out of range: "+scale}this.aggregationScale=scale;this.graph.update()},transformer:function(data){if(this.aggregationScale==1)return data;var aggregatedData=[];data.forEach(function(seriesData){var aggregatedSeriesData=[];while(seriesData.length){var avgX=0,avgY=0;var slice=seriesData.splice(0,this.aggregationScale);slice.forEach(function(d){avgX+=d.x/slice.length;avgY+=d.y/slice.length});aggregatedSeriesData.push({x:avgX,y:avgY})}aggregatedData.push(aggregatedSeriesData)}.bind(this));return aggregatedData}});Rickshaw.namespace("Rickshaw.Graph.Socketio");Rickshaw.Graph.Socketio=Rickshaw.Class.create(Rickshaw.Graph.Ajax,{request:function(){var socket=io.connect(this.dataURL);var self=this;socket.on("rickshaw",function(data){self.success(data)})}});Rickshaw.namespace("Rickshaw.Series");Rickshaw.Series=Rickshaw.Class.create(Array,{initialize:function(data,palette,options){options=options||{};this.palette=new Rickshaw.Color.Palette(palette);this.timeBase=typeof options.timeBase==="undefined"?Math.floor((new Date).getTime()/1e3):options.timeBase;var timeInterval=typeof options.timeInterval=="undefined"?1e3:options.timeInterval;this.setTimeInterval(timeInterval);if(data&&typeof data=="object"&&Array.isArray(data)){data.forEach(function(item){this.addItem(item)},this)}},addItem:function(item){if(typeof item.name==="undefined"){throw"addItem() needs a name"}item.color=item.color||this.palette.color(item.name);item.data=item.data||[];if(item.data.length===0&&this.length&&this.getIndex()>0){this[0].data.forEach(function(plot){item.data.push({x:plot.x,y:0})})}else if(item.data.length===0){item.data.push({x:this.timeBase-(this.timeInterval||0),y:0})}this.push(item);if(this.legend){this.legend.addLine(this.itemByName(item.name))}},addData:function(data,x){var index=this.getIndex();Rickshaw.keys(data).forEach(function(name){if(!this.itemByName(name)){this.addItem({name:name})}},this);this.forEach(function(item){item.data.push({x:x||(index*this.timeInterval||1)+this.timeBase,y:data[item.name]||0})},this)},getIndex:function(){return this[0]&&this[0].data&&this[0].data.length?this[0].data.length:0},itemByName:function(name){for(var i=0;i<this.length;i++){if(this[i].name==name)return this[i]}},setTimeInterval:function(iv){this.timeInterval=iv/1e3},setTimeBase:function(t){this.timeBase=t},dump:function(){var data={timeBase:this.timeBase,timeInterval:this.timeInterval,items:[]};this.forEach(function(item){var newItem={color:item.color,name:item.name,data:[]};item.data.forEach(function(plot){newItem.data.push({x:plot.x,y:plot.y})});data.items.push(newItem)});return data},load:function(data){if(data.timeInterval){this.timeInterval=data.timeInterval}if(data.timeBase){this.timeBase=data.timeBase}if(data.items){data.items.forEach(function(item){this.push(item);if(this.legend){this.legend.addLine(this.itemByName(item.name))}},this)}}});Rickshaw.Series.zeroFill=function(series){Rickshaw.Series.fill(series,0)};Rickshaw.Series.fill=function(series,fill){var x;var i=0;var data=series.map(function(s){return s.data});while(i<Math.max.apply(null,data.map(function(d){return d.length}))){x=Math.min.apply(null,data.filter(function(d){return d[i]}).map(function(d){return d[i].x}));data.forEach(function(d){if(!d[i]||d[i].x!=x){d.splice(i,0,{x:x,y:fill})}});i++}};Rickshaw.namespace("Rickshaw.Series.FixedDuration");Rickshaw.Series.FixedDuration=Rickshaw.Class.create(Rickshaw.Series,{initialize:function(data,palette,options){options=options||{};if(typeof options.timeInterval==="undefined"){throw new Error("FixedDuration series requires timeInterval")}if(typeof options.maxDataPoints==="undefined"){throw new Error("FixedDuration series requires maxDataPoints")}this.palette=new Rickshaw.Color.Palette(palette);this.timeBase=typeof options.timeBase==="undefined"?Math.floor((new Date).getTime()/1e3):options.timeBase;this.setTimeInterval(options.timeInterval);if(this[0]&&this[0].data&&this[0].data.length){this.currentSize=this[0].data.length;this.currentIndex=this[0].data.length}else{this.currentSize=0;this.currentIndex=0}this.maxDataPoints=options.maxDataPoints;if(data&&typeof data=="object"&&Array.isArray(data)){data.forEach(function(item){this.addItem(item)},this);this.currentSize+=1;this.currentIndex+=1}this.timeBase-=(this.maxDataPoints-this.currentSize)*this.timeInterval;if(typeof this.maxDataPoints!=="undefined"&&this.currentSize<this.maxDataPoints){for(var i=this.maxDataPoints-this.currentSize-1;i>1;i--){this.currentSize+=1;this.currentIndex+=1;this.forEach(function(item){item.data.unshift({x:((i-1)*this.timeInterval||1)+this.timeBase,y:0,i:i})},this)}}},addData:function($super,data,x){$super(data,x);this.currentSize+=1;this.currentIndex+=1;if(this.maxDataPoints!==undefined){while(this.currentSize>this.maxDataPoints){this.dropData()}}},dropData:function(){this.forEach(function(item){item.data.splice(0,1)});this.currentSize-=1},getIndex:function(){return this.currentIndex}});return Rickshaw});function do_pie(name,update_url,url_params,units,refresh){var pie=new PieChart(name,update_url,url_params,units,refresh);if(refresh)pie.setInterval(setInterval(function(){pie.update()},refresh));return pie}function PieChart(name,update_url,url_params,units,refresh){this.name=name;this.update_url=update_url;this.url_params=url_params;this.units=units;this.refresh=refresh;this.pieInterval;var pieData=[];var oldPieData=[];var filteredPieData=[];var rsp=create_pie_chart(name,units);var arc_group=rsp[0];var donut=rsp[1];var totalValue=rsp[2];var totalUnits=rsp[3];var color=rsp[4];var tweenDuration=rsp[5];var arc=rsp[6];var label_group=rsp[7];var center_group=rsp[8];var r=rsp[9];var textOffset=rsp[10];this.update=function(){$.ajax({type:"GET",url:this.update_url,data:this.url_params,success:function(content){update_pie_chart(jQuery.parseJSON(content))}})};this.update();this.update();function update_pie_chart(data){streakerDataAdded=data;oldPieData=filteredPieData;pieData=donut(streakerDataAdded);var totalOctets=0;filteredPieData=pieData.filter(filterData);function filterData(element,index,array){element.name=streakerDataAdded[index].label;element.value=streakerDataAdded[index].value;element.url=streakerDataAdded[index].url;totalOctets+=element.value;return element.value>0}if(filteredPieData.length>0&&oldPieData.length>0){arc_group.selectAll("circle").remove();if(totalValue){totalValue.text(function(){var kb=totalOctets/1024;return kb.toFixed(1)})}paths=arc_group.selectAll("path").data(filteredPieData);paths.enter().append("svg:path").attr("stroke","white").attr("stroke-width",.5).attr("fill",function(d,i){return color(i)}).transition().duration(tweenDuration).attrTween("d",pieTween);paths.transition().duration(tweenDuration).attrTween("d",pieTween);paths.exit().transition().duration(tweenDuration).attrTween("d",removePieTween).remove();lines=label_group.selectAll("line").data(filteredPieData);lines.enter().append("svg:line").attr("x1",0).attr("x2",0).attr("y1",-r-3).attr("y2",-r-8).attr("stroke","gray").attr("transform",function(d){return"rotate("+(d.startAngle+d.endAngle)/2*(180/Math.PI)+")"});lines.transition().duration(tweenDuration).attr("transform",function(d){return"rotate("+(d.startAngle+d.endAngle)/2*(180/Math.PI)+")"});lines.exit().remove();valueLabels=label_group.selectAll("text.value").data(filteredPieData).attr("dy",function(d){if((d.startAngle+d.endAngle)/2>Math.PI/2&&(d.startAngle+d.endAngle)/2<Math.PI*1.5){return 5}else{return-7}}).attr("text-anchor",function(d){if((d.startAngle+d.endAngle)/2<Math.PI){return"beginning"}else{return"end"}}).text(function(d){var percentage=d.value/totalOctets*100;return percentage.toFixed(1)+"%"});valueLabels.enter().append("svg:text").attr("class","value").attr("transform",function(d){return"translate("+Math.cos((d.startAngle+d.endAngle-Math.PI)/2)*(r+textOffset)+","+Math.sin((d.startAngle+d.endAngle-Math.PI)/2)*(r+textOffset)+")"}).attr("dy",function(d){if((d.startAngle+d.endAngle)/2>Math.PI/2&&(d.startAngle+d.endAngle)/2<Math.PI*1.5){return 5}else{return-7}}).attr("text-anchor",function(d){if((d.startAngle+d.endAngle)/2<Math.PI){return"beginning"}else{return"end"}}).text(function(d){var percentage=d.value/totalOctets*100;return percentage.toFixed(1)+"%"});valueLabels.transition().duration(tweenDuration).attrTween("transform",textTween);valueLabels.exit().remove();nameLabels=label_group.selectAll("text.units").data(filteredPieData).attr("dy",function(d){if((d.startAngle+d.endAngle)/2>Math.PI/2&&(d.startAngle+d.endAngle)/2<Math.PI*1.5){return 17}else{return 5}}).attr("text-anchor",function(d){if((d.startAngle+d.endAngle)/2<Math.PI){return"beginning"}else{return"end"}}).text(function(d){return d.name}).on("click",function(d){if(d.url)window.location.href=d.url});nameLabels.enter().append("svg:text").attr("class","units").attr("transform",function(d){return"translate("+Math.cos((d.startAngle+d.endAngle-Math.PI)/2)*(r+textOffset)+","+Math.sin((d.startAngle+d.endAngle-Math.PI)/2)*(r+textOffset)+")"}).attr("dy",function(d){if((d.startAngle+d.endAngle)/2>Math.PI/2&&(d.startAngle+d.endAngle)/2<Math.PI*1.5){return 17}else{return 5}}).attr("text-anchor",function(d){if((d.startAngle+d.endAngle)/2<Math.PI){return"beginning"}else{return"end"}}).text(function(d){return d.name}).on("click",function(d){if(d.url)window.location.href=d.url});nameLabels.transition().duration(tweenDuration).attrTween("transform",textTween);nameLabels.exit().remove()}}function pieTween(d,i){var s0;var e0;if(oldPieData[i]){s0=oldPieData[i].startAngle;e0=oldPieData[i].endAngle}else if(!oldPieData[i]&&oldPieData[i-1]){s0=oldPieData[i-1].endAngle;e0=oldPieData[i-1].endAngle}else if(!oldPieData[i-1]&&oldPieData.length>0){s0=oldPieData[oldPieData.length-1].endAngle;e0=oldPieData[oldPieData.length-1].endAngle}else{s0=0;e0=0}var i=d3.interpolate({startAngle:s0,endAngle:e0},{startAngle:d.startAngle,endAngle:d.endAngle});return function(t){var b=i(t);return arc(b)}}function removePieTween(d,i){s0=2*Math.PI;e0=2*Math.PI;var i=d3.interpolate({startAngle:d.startAngle,endAngle:d.endAngle},{startAngle:s0,endAngle:e0});return function(t){var b=i(t);return arc(b)}}function textTween(d,i){var a;if(oldPieData[i]){a=(oldPieData[i].startAngle+oldPieData[i].endAngle-Math.PI)/2}else if(!oldPieData[i]&&oldPieData[i-1]){a=(oldPieData[i-1].startAngle+oldPieData[i-1].endAngle-Math.PI)/2}else if(!oldPieData[i-1]&&oldPieData.length>0){a=(oldPieData[oldPieData.length-1].startAngle+oldPieData[oldPieData.length-1].endAngle-Math.PI)/2}else{a=0}var b=(d.startAngle+d.endAngle-Math.PI)/2;var fn=d3.interpolateNumber(a,b);return function(t){var val=fn(t);return"translate("+Math.cos(val)*(r+textOffset)+","+Math.sin(val)*(r+textOffset)+")"}}}PieChart.prototype.setUrlParams=function(url_params){this.url_params=url_params;this.forceUpdate()};PieChart.prototype.forceUpdate=function(url_params){this.stopInterval();this.update();this.startInterval()};PieChart.prototype.setInterval=function(p_pieInterval){this.pieInterval=p_pieInterval};PieChart.prototype.stopInterval=function(){clearInterval(this.pieInterval)};PieChart.prototype.startInterval=function(){this.pieInterval=setInterval(this.update(),this.refresh)};function create_pie_chart(name,units){var w=500;var h=325;var ir=52;var textOffset=14;var tweenDuration=250;var r=116;if($(name).hasClass("pie-chart-small")){w=330;h=250;r=w/5+15;ir=r/2}var lines,valueLabels,nameLabels;var donut=d3.layout.pie().value(function(d){if(d.value==0){d.value=1}return d.value});var color=d3.scale.category20();var arc=d3.svg.arc().startAngle(function(d){return d.startAngle}).endAngle(function(d){return d.endAngle}).innerRadius(ir).outerRadius(r);var vis=d3.select(name).append("svg:svg").attr("width",w).attr("height",h).attr("viewBox","0 0 "+w+" "+h).attr("preserveAspectRatio","xMidYMid");var arc_group=vis.append("svg:g").attr("class","arc").attr("transform","translate("+w/2+","+h/2+")");var label_group=vis.append("svg:g").attr("class","label_group").attr("transform","translate("+w/2+","+h/2+")");var center_group=vis.append("svg:g").attr("class","center_group").attr("transform","translate("+w/2+","+h/2+")");var paths=arc_group.append("svg:circle").attr("fill","#EFEFEF").attr("r",r);var whiteCircle=center_group.append("svg:circle").attr("fill","white").attr("r",ir);var totalUnits=null;var totalLabel=null;var totalValue=null;if(units){totalLabel=center_group.append("svg:text").attr("class","label").attr("dy",-15).attr("text-anchor","middle").text("TOTAL");totalValue=center_group.append("svg:text").attr("class","total").attr("dy",7).attr("text-anchor","middle").text("Waiting...");totalUnits=center_group.append("svg:text").attr("class","units").attr("dy",21).attr("text-anchor","middle").text(units)}return[arc_group,donut,totalValue,totalUnits,color,tweenDuration,arc,label_group,center_group,r,textOffset]}(function(){var AnimatedText,AnimatedTextFactory,Bar,BaseDonut,BaseGauge,Donut,Gauge,GaugePointer,TextRenderer,ValueUpdater,addCommas,cutHex,formatNumber,mergeObjects,secondsToString,updateObjectValues,_ref,_ref1,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child};(function(){var browserRequestAnimationFrame,isCancelled,lastId,vendor,vendors,_i,_len;vendors=["ms","moz","webkit","o"];for(_i=0,_len=vendors.length;_i<_len;_i++){vendor=vendors[_i];if(window.requestAnimationFrame){break}window.requestAnimationFrame=window[vendor+"RequestAnimationFrame"];window.cancelAnimationFrame=window[vendor+"CancelAnimationFrame"]||window[vendor+"CancelRequestAnimationFrame"]}browserRequestAnimationFrame=null;lastId=0;isCancelled={};if(!requestAnimationFrame){window.requestAnimationFrame=function(callback,element){var currTime,id,lastTime,timeToCall;currTime=(new Date).getTime();timeToCall=Math.max(0,16-(currTime-lastTime));id=window.setTimeout(function(){return callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id};return window.cancelAnimationFrame=function(id){return clearTimeout(id)}}else if(!window.cancelAnimationFrame){browserRequestAnimationFrame=window.requestAnimationFrame;window.requestAnimationFrame=function(callback,element){var myId;myId=++lastId;browserRequestAnimationFrame(function(){if(!isCancelled[myId]){return callback()}},element);return myId};return window.cancelAnimationFrame=function(id){return isCancelled[id]=true}}})();String.prototype.hashCode=function(){var char,hash,i,_i,_ref;hash=0;if(this.length===0){return hash}for(i=_i=0,_ref=this.length;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){char=this.charCodeAt(i);hash=(hash<<5)-hash+char;hash=hash&hash}return hash};secondsToString=function(sec){var hr,min;hr=Math.floor(sec/3600);min=Math.floor((sec-hr*3600)/60);sec-=hr*3600+min*60;sec+="";min+="";while(min.length<2){min="0"+min}while(sec.length<2){sec="0"+sec}hr=hr?hr+":":"";return hr+min+":"+sec};formatNumber=function(num){return addCommas(num.toFixed(0))};updateObjectValues=function(obj1,obj2){var key,val;for(key in obj2){if(!__hasProp.call(obj2,key))continue;val=obj2[key];obj1[key]=val}return obj1};mergeObjects=function(obj1,obj2){var key,out,val;out={};for(key in obj1){if(!__hasProp.call(obj1,key))continue;val=obj1[key];out[key]=val}for(key in obj2){if(!__hasProp.call(obj2,key))continue;val=obj2[key];out[key]=val}return out};addCommas=function(nStr){var rgx,x,x1,x2;nStr+="";x=nStr.split(".");x1=x[0];x2="";if(x.length>1){x2="."+x[1]}rgx=/(\d+)(\d{3})/;while(rgx.test(x1)){x1=x1.replace(rgx,"$1"+","+"$2")}return x1+x2};cutHex=function(nStr){if(nStr.charAt(0)==="#"){return nStr.substring(1,7)}return nStr};ValueUpdater=function(){ValueUpdater.prototype.animationSpeed=32;function ValueUpdater(addToAnimationQueue,clear){if(addToAnimationQueue==null){addToAnimationQueue=true}this.clear=clear!=null?clear:true;if(addToAnimationQueue){AnimationUpdater.add(this)}}ValueUpdater.prototype.update=function(force){var diff;if(force==null){force=false}if(force||this.displayedValue!==this.value){if(this.ctx&&this.clear){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}diff=this.value-this.displayedValue;if(Math.abs(diff/this.animationSpeed)<=.001){this.displayedValue=this.value}else{this.displayedValue=this.displayedValue+diff/this.animationSpeed}this.render();return true}return false};return ValueUpdater}();BaseGauge=function(_super){__extends(BaseGauge,_super);function BaseGauge(){_ref=BaseGauge.__super__.constructor.apply(this,arguments);return _ref}BaseGauge.prototype.displayScale=1;BaseGauge.prototype.setTextField=function(textField){return this.textField=textField instanceof TextRenderer?textField:new TextRenderer(textField)};BaseGauge.prototype.setMinValue=function(minValue,updateStartValue){var gauge,_i,_len,_ref1,_results;this.minValue=minValue;if(updateStartValue==null){updateStartValue=true}if(updateStartValue){this.displayedValue=this.minValue;_ref1=this.gp||[];_results=[];for(_i=0,_len=_ref1.length;_i<_len;_i++){gauge=_ref1[_i];_results.push(gauge.displayedValue=this.minValue)}return _results}};BaseGauge.prototype.setOptions=function(options){if(options==null){options=null}this.options=mergeObjects(this.options,options);if(this.textField){this.textField.el.style.fontSize=options.fontSize+"px"}if(this.options.angle>.5){this.gauge.options.angle=.5}this.configDisplayScale();return this};BaseGauge.prototype.configDisplayScale=function(){var backingStorePixelRatio,devicePixelRatio,height,prevDisplayScale,width;prevDisplayScale=this.displayScale;if(this.options.highDpiSupport===false){delete this.displayScale}else{devicePixelRatio=window.devicePixelRatio||1;backingStorePixelRatio=this.ctx.webkitBackingStorePixelRatio||this.ctx.mozBackingStorePixelRatio||this.ctx.msBackingStorePixelRatio||this.ctx.oBackingStorePixelRatio||this.ctx.backingStorePixelRatio||1;this.displayScale=devicePixelRatio/backingStorePixelRatio}if(this.displayScale!==prevDisplayScale){width=this.canvas.G__width||this.canvas.width;height=this.canvas.G__height||this.canvas.height;this.canvas.width=width*this.displayScale;this.canvas.height=height*this.displayScale;this.canvas.style.width=""+width+"px";this.canvas.style.height=""+height+"px";this.canvas.G__width=width;this.canvas.G__height=height}return this};return BaseGauge}(ValueUpdater);TextRenderer=function(){function TextRenderer(el){this.el=el}TextRenderer.prototype.render=function(gauge){return this.el.innerHTML=formatNumber(gauge.displayedValue)};return TextRenderer}();AnimatedText=function(_super){__extends(AnimatedText,_super);AnimatedText.prototype.displayedValue=0;AnimatedText.prototype.value=0;AnimatedText.prototype.setVal=function(value){return this.value=1*value};function AnimatedText(elem,text){this.elem=elem;this.text=text!=null?text:false;this.value=1*this.elem.innerHTML;if(this.text){this.value=0}}AnimatedText.prototype.render=function(){var textVal;if(this.text){textVal=secondsToString(this.displayedValue.toFixed(0))}else{textVal=addCommas(formatNumber(this.displayedValue))}return this.elem.innerHTML=textVal};return AnimatedText}(ValueUpdater);AnimatedTextFactory={create:function(objList){var elem,out,_i,_len;out=[];for(_i=0,_len=objList.length;_i<_len;_i++){elem=objList[_i];out.push(new AnimatedText(elem))}return out}};GaugePointer=function(_super){__extends(GaugePointer,_super);GaugePointer.prototype.displayedValue=0;GaugePointer.prototype.value=0;GaugePointer.prototype.options={strokeWidth:.035,length:.1,color:"#000000"};function GaugePointer(gauge){this.gauge=gauge;this.ctx=this.gauge.ctx;this.canvas=this.gauge.canvas;GaugePointer.__super__.constructor.call(this,false,false);this.setOptions()}GaugePointer.prototype.setOptions=function(options){if(options==null){options=null}updateObjectValues(this.options,options);this.length=this.canvas.height*this.options.length;this.strokeWidth=this.canvas.height*this.options.strokeWidth;this.maxValue=this.gauge.maxValue;this.minValue=this.gauge.minValue;this.animationSpeed=this.gauge.animationSpeed;return this.options.angle=this.gauge.options.angle};GaugePointer.prototype.render=function(){var angle,centerX,centerY,endX,endY,startX,startY,x,y;angle=this.gauge.getAngle.call(this,this.displayedValue);centerX=this.canvas.width/2;centerY=this.canvas.height*.9;x=Math.round(centerX+this.length*Math.cos(angle));y=Math.round(centerY+this.length*Math.sin(angle));startX=Math.round(centerX+this.strokeWidth*Math.cos(angle-Math.PI/2));startY=Math.round(centerY+this.strokeWidth*Math.sin(angle-Math.PI/2));endX=Math.round(centerX+this.strokeWidth*Math.cos(angle+Math.PI/2));endY=Math.round(centerY+this.strokeWidth*Math.sin(angle+Math.PI/2));this.ctx.fillStyle=this.options.color;this.ctx.beginPath();this.ctx.arc(centerX,centerY,this.strokeWidth,0,Math.PI*2,true);this.ctx.fill();this.ctx.beginPath();this.ctx.moveTo(startX,startY);this.ctx.lineTo(x,y);this.ctx.lineTo(endX,endY);return this.ctx.fill()};return GaugePointer}(ValueUpdater);Bar=function(){function Bar(elem){this.elem=elem}Bar.prototype.updateValues=function(arrValues){this.value=arrValues[0];this.maxValue=arrValues[1];this.avgValue=arrValues[2];return this.render()};Bar.prototype.render=function(){var avgPercent,valPercent;if(this.textField){this.textField.text(formatNumber(this.value))}if(this.maxValue===0){this.maxValue=this.avgValue*2}valPercent=this.value/this.maxValue*100;avgPercent=this.avgValue/this.maxValue*100;$(".bar-value",this.elem).css({width:valPercent+"%"});return $(".typical-value",this.elem).css({width:avgPercent+"%"})};return Bar}();Gauge=function(_super){__extends(Gauge,_super);Gauge.prototype.elem=null;Gauge.prototype.value=[20];Gauge.prototype.maxValue=80;Gauge.prototype.minValue=0;Gauge.prototype.displayedAngle=0;Gauge.prototype.displayedValue=0;Gauge.prototype.lineWidth=40;Gauge.prototype.paddingBottom=.1;Gauge.prototype.percentColors=null;Gauge.prototype.options={colorStart:"#6fadcf",colorStop:void 0,gradientType:0,strokeColor:"#e0e0e0",pointer:{length:.8,strokeWidth:.035},angle:.15,lineWidth:.44,fontSize:40,limitMax:false,percentColors:[[0,"#a9d70b"],[.5,"#f9c802"],[1,"#ff0000"]]};function Gauge(canvas){this.canvas=canvas;Gauge.__super__.constructor.call(this);this.percentColors=null;if(typeof G_vmlCanvasManager!=="undefined"){this.canvas=window.G_vmlCanvasManager.initElement(this.canvas)}this.ctx=this.canvas.getContext("2d");this.gp=[new GaugePointer(this)];this.setOptions();this.render()}Gauge.prototype.setOptions=function(options){var gauge,_i,_len,_ref1;if(options==null){options=null}Gauge.__super__.setOptions.call(this,options);this.configPercentColors();this.lineWidth=this.canvas.height*(1-this.paddingBottom)*this.options.lineWidth;this.radius=this.canvas.height*(1-this.paddingBottom)-this.lineWidth;this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.render();_ref1=this.gp;for(_i=0,_len=_ref1.length;_i<_len;_i++){gauge=_ref1[_i];gauge.setOptions(this.options.pointer);gauge.render()}return this};Gauge.prototype.configPercentColors=function(){var bval,gval,i,rval,_i,_ref1,_results;this.percentColors=null;if(this.options.percentColors!==void 0){this.percentColors=new Array;_results=[];for(i=_i=0,_ref1=this.options.percentColors.length-1;0<=_ref1?_i<=_ref1:_i>=_ref1;i=0<=_ref1?++_i:--_i){rval=parseInt(cutHex(this.options.percentColors[i][1]).substring(0,2),16);gval=parseInt(cutHex(this.options.percentColors[i][1]).substring(2,4),16);bval=parseInt(cutHex(this.options.percentColors[i][1]).substring(4,6),16);_results.push(this.percentColors[i]={pct:this.options.percentColors[i][0],color:{r:rval,g:gval,b:bval}})}return _results}};Gauge.prototype.set=function(value){var i,max_hit,val,_i,_j,_len,_ref1;if(!(value instanceof Array)){value=[value]}if(value.length>this.gp.length){for(i=_i=0,_ref1=value.length-this.gp.length;0<=_ref1?_i<_ref1:_i>_ref1;i=0<=_ref1?++_i:--_i){this.gp.push(new GaugePointer(this))}}i=0;max_hit=false;for(_j=0,_len=value.length;_j<_len;_j++){val=value[_j];if(val>this.maxValue){this.maxValue=this.value*1.1;max_hit=true}this.gp[i].value=val;this.gp[i++].setOptions({maxValue:this.maxValue,angle:this.options.angle})}this.value=value[value.length-1];if(max_hit){if(!this.options.limitMax){return AnimationUpdater.run()}}else{return AnimationUpdater.run()}};Gauge.prototype.getAngle=function(value){return(1+this.options.angle)*Math.PI+(value-this.minValue)/(this.maxValue-this.minValue)*(1-this.options.angle*2)*Math.PI};Gauge.prototype.getColorForPercentage=function(pct,grad){var color,endColor,i,rangePct,startColor,_i,_ref1;if(pct===0){color=this.percentColors[0].color}else{color=this.percentColors[this.percentColors.length-1].color;for(i=_i=0,_ref1=this.percentColors.length-1;0<=_ref1?_i<=_ref1:_i>=_ref1;i=0<=_ref1?++_i:--_i){if(pct<=this.percentColors[i].pct){if(grad===true){startColor=this.percentColors[i-1];endColor=this.percentColors[i];rangePct=(pct-startColor.pct)/(endColor.pct-startColor.pct);color={r:Math.floor(startColor.color.r*(1-rangePct)+endColor.color.r*rangePct),g:Math.floor(startColor.color.g*(1-rangePct)+endColor.color.g*rangePct),b:Math.floor(startColor.color.b*(1-rangePct)+endColor.color.b*rangePct)}}else{color=this.percentColors[i].color}break}}}return"rgb("+[color.r,color.g,color.b].join(",")+")"};Gauge.prototype.getColorForValue=function(val,grad){var pct;pct=(val-this.minValue)/(this.maxValue-this.minValue);return this.getColorForPercentage(pct,grad)};Gauge.prototype.render=function(){var displayedAngle,fillStyle,gauge,h,w,_i,_len,_ref1,_results;w=this.canvas.width/2;h=this.canvas.height*(1-this.paddingBottom);displayedAngle=this.getAngle(this.displayedValue);if(this.textField){this.textField.render(this)}this.ctx.lineCap="butt";if(this.options.customFillStyle!==void 0){fillStyle=this.options.customFillStyle(this)}else if(this.percentColors!==null){fillStyle=this.getColorForValue(this.displayedValue,true)}else if(this.options.colorStop!==void 0){if(this.options.gradientType===0){fillStyle=this.ctx.createRadialGradient(w,h,9,w,h,70)}else{fillStyle=this.ctx.createLinearGradient(0,0,w,0)}fillStyle.addColorStop(0,this.options.colorStart);fillStyle.addColorStop(1,this.options.colorStop)}else{fillStyle=this.options.colorStart}this.ctx.strokeStyle=fillStyle;this.ctx.beginPath();this.ctx.arc(w,h,this.radius,(1+this.options.angle)*Math.PI,displayedAngle,false);this.ctx.lineWidth=this.lineWidth;this.ctx.stroke();this.ctx.strokeStyle=this.options.strokeColor;this.ctx.beginPath();this.ctx.arc(w,h,this.radius,displayedAngle,(2-this.options.angle)*Math.PI,false);this.ctx.stroke();_ref1=this.gp;_results=[];for(_i=0,_len=_ref1.length;_i<_len;_i++){gauge=_ref1[_i];_results.push(gauge.update(true))}return _results};return Gauge}(BaseGauge);BaseDonut=function(_super){__extends(BaseDonut,_super);BaseDonut.prototype.lineWidth=15;BaseDonut.prototype.displayedValue=0;BaseDonut.prototype.value=33;BaseDonut.prototype.maxValue=80;BaseDonut.prototype.minValue=0;BaseDonut.prototype.options={lineWidth:.1,colorStart:"#6f6ea0",colorStop:"#c0c0db",strokeColor:"#eeeeee",shadowColor:"#d5d5d5",angle:.35};function BaseDonut(canvas){this.canvas=canvas;BaseDonut.__super__.constructor.call(this);if(typeof G_vmlCanvasManager!=="undefined"){this.canvas=window.G_vmlCanvasManager.initElement(this.canvas)}this.ctx=this.canvas.getContext("2d");this.setOptions();this.render()}BaseDonut.prototype.getAngle=function(value){return(1-this.options.angle)*Math.PI+(value-this.minValue)/(this.maxValue-this.minValue)*(2+this.options.angle-(1-this.options.angle))*Math.PI};BaseDonut.prototype.setOptions=function(options){if(options==null){options=null}BaseDonut.__super__.setOptions.call(this,options);this.lineWidth=this.canvas.height*this.options.lineWidth;this.radius=this.canvas.height/2-this.lineWidth/2;return this};BaseDonut.prototype.set=function(value){this.value=value;if(this.value>this.maxValue){this.maxValue=this.value*1.1}return AnimationUpdater.run()};BaseDonut.prototype.render=function(){var displayedAngle,grdFill,h,start,stop,w;displayedAngle=this.getAngle(this.displayedValue);w=this.canvas.width/2;h=this.canvas.height/2;if(this.textField){this.textField.render(this)}grdFill=this.ctx.createRadialGradient(w,h,39,w,h,70);grdFill.addColorStop(0,this.options.colorStart);grdFill.addColorStop(1,this.options.colorStop);start=this.radius-this.lineWidth/2;stop=this.radius+this.lineWidth/2;this.ctx.strokeStyle=this.options.strokeColor;this.ctx.beginPath();this.ctx.arc(w,h,this.radius,(1-this.options.angle)*Math.PI,(2+this.options.angle)*Math.PI,false);this.ctx.lineWidth=this.lineWidth;this.ctx.lineCap="round";this.ctx.stroke();this.ctx.strokeStyle=grdFill;this.ctx.beginPath();this.ctx.arc(w,h,this.radius,(1-this.options.angle)*Math.PI,displayedAngle,false);return this.ctx.stroke()};return BaseDonut}(BaseGauge);Donut=function(_super){__extends(Donut,_super);function Donut(){_ref1=Donut.__super__.constructor.apply(this,arguments);return _ref1}Donut.prototype.strokeGradient=function(w,h,start,stop){var grd;grd=this.ctx.createRadialGradient(w,h,start,w,h,stop);grd.addColorStop(0,this.options.shadowColor);grd.addColorStop(.12,this.options._orgStrokeColor);grd.addColorStop(.88,this.options._orgStrokeColor);grd.addColorStop(1,this.options.shadowColor);return grd};Donut.prototype.setOptions=function(options){var h,start,stop,w;if(options==null){options=null}Donut.__super__.setOptions.call(this,options);w=this.canvas.width/2;h=this.canvas.height/2;start=this.radius-this.lineWidth/2;stop=this.radius+this.lineWidth/2;this.options._orgStrokeColor=this.options.strokeColor;this.options.strokeColor=this.strokeGradient(w,h,start,stop);return this};return Donut}(BaseDonut);window.AnimationUpdater={elements:[],animId:null,addAll:function(list){var elem,_i,_len,_results;_results=[];for(_i=0,_len=list.length;_i<_len;_i++){elem=list[_i];_results.push(AnimationUpdater.elements.push(elem))}return _results},add:function(object){return AnimationUpdater.elements.push(object)},run:function(){var animationFinished,elem,_i,_len,_ref2;animationFinished=true;_ref2=AnimationUpdater.elements;for(_i=0,_len=_ref2.length;_i<_len;_i++){elem=_ref2[_i];if(elem.update()){animationFinished=false}}if(!animationFinished){return AnimationUpdater.animId=requestAnimationFrame(AnimationUpdater.run)}else{return cancelAnimationFrame(AnimationUpdater.animId)}}};window.Gauge=Gauge;window.Donut=Donut;window.BaseDonut=BaseDonut;window.TextRenderer=TextRenderer}).call(this);(function(exports){crossfilter.version="1.3.12";function crossfilter_identity(d){return d}crossfilter.permute=permute;function permute(array,index){for(var i=0,n=index.length,copy=new Array(n);i<n;++i){copy[i]=array[index[i]]}return copy}var bisect=crossfilter.bisect=bisect_by(crossfilter_identity);bisect.by=bisect_by;function bisect_by(f){function bisectLeft(a,x,lo,hi){while(lo<hi){var mid=lo+hi>>>1;if(f(a[mid])<x)lo=mid+1;else hi=mid}return lo}function bisectRight(a,x,lo,hi){while(lo<hi){var mid=lo+hi>>>1;if(x<f(a[mid]))hi=mid;else lo=mid+1}return lo}bisectRight.right=bisectRight;bisectRight.left=bisectLeft;return bisectRight}var heap=crossfilter.heap=heap_by(crossfilter_identity);heap.by=heap_by;function heap_by(f){function heap(a,lo,hi){var n=hi-lo,i=(n>>>1)+1;while(--i>0)sift(a,i,n,lo);return a}function sort(a,lo,hi){var n=hi-lo,t;while(--n>0)t=a[lo],a[lo]=a[lo+n],a[lo+n]=t,sift(a,1,n,lo);return a}function sift(a,i,n,lo){var d=a[--lo+i],x=f(d),child;while((child=i<<1)<=n){if(child<n&&f(a[lo+child])>f(a[lo+child+1]))child++;if(x<=f(a[lo+child]))break;a[lo+i]=a[lo+child];i=child}a[lo+i]=d}heap.sort=sort;return heap}var heapselect=crossfilter.heapselect=heapselect_by(crossfilter_identity);heapselect.by=heapselect_by;function heapselect_by(f){var heap=heap_by(f);function heapselect(a,lo,hi,k){var queue=new Array(k=Math.min(hi-lo,k)),min,i,x,d;for(i=0;i<k;++i)queue[i]=a[lo++];heap(queue,0,k);if(lo<hi){min=f(queue[0]);do{if(x=f(d=a[lo])>min){queue[0]=d;min=f(heap(queue,0,k)[0])}}while(++lo<hi)}return queue}return heapselect}var insertionsort=crossfilter.insertionsort=insertionsort_by(crossfilter_identity);insertionsort.by=insertionsort_by;function insertionsort_by(f){function insertionsort(a,lo,hi){for(var i=lo+1;i<hi;++i){for(var j=i,t=a[i],x=f(t);j>lo&&f(a[j-1])>x;--j){a[j]=a[j-1]}a[j]=t}return a}return insertionsort}var quicksort=crossfilter.quicksort=quicksort_by(crossfilter_identity);quicksort.by=quicksort_by;function quicksort_by(f){var insertionsort=insertionsort_by(f);function sort(a,lo,hi){return(hi-lo<quicksort_sizeThreshold?insertionsort:quicksort)(a,lo,hi)}function quicksort(a,lo,hi){var sixth=(hi-lo)/6|0,i1=lo+sixth,i5=hi-1-sixth,i3=lo+hi-1>>1,i2=i3-sixth,i4=i3+sixth;var e1=a[i1],x1=f(e1),e2=a[i2],x2=f(e2),e3=a[i3],x3=f(e3),e4=a[i4],x4=f(e4),e5=a[i5],x5=f(e5);var t;if(x1>x2)t=e1,e1=e2,e2=t,t=x1,x1=x2,x2=t;if(x4>x5)t=e4,e4=e5,e5=t,t=x4,x4=x5,x5=t;if(x1>x3)t=e1,e1=e3,e3=t,t=x1,x1=x3,x3=t;if(x2>x3)t=e2,e2=e3,e3=t,t=x2,x2=x3,x3=t;if(x1>x4)t=e1,e1=e4,e4=t,t=x1,x1=x4,x4=t;if(x3>x4)t=e3,e3=e4,e4=t,t=x3,x3=x4,x4=t;if(x2>x5)t=e2,e2=e5,e5=t,t=x2,x2=x5,x5=t;if(x2>x3)t=e2,e2=e3,e3=t,t=x2,x2=x3,x3=t;if(x4>x5)t=e4,e4=e5,e5=t,t=x4,x4=x5,x5=t;var pivot1=e2,pivotValue1=x2,pivot2=e4,pivotValue2=x4;a[i1]=e1;a[i2]=a[lo];a[i3]=e3;a[i4]=a[hi-1];a[i5]=e5;var less=lo+1,great=hi-2;var pivotsEqual=pivotValue1<=pivotValue2&&pivotValue1>=pivotValue2;if(pivotsEqual){for(var k=less;k<=great;++k){var ek=a[k],xk=f(ek);if(xk<pivotValue1){if(k!==less){a[k]=a[less];a[less]=ek}++less}else if(xk>pivotValue1){while(true){var greatValue=f(a[great]);if(greatValue>pivotValue1){great--;continue}else if(greatValue<pivotValue1){a[k]=a[less];a[less++]=a[great];a[great--]=ek;break}else{a[k]=a[great];a[great--]=ek;break}}}}}else{for(var k=less;k<=great;k++){var ek=a[k],xk=f(ek);if(xk<pivotValue1){if(k!==less){a[k]=a[less];a[less]=ek}++less}else{if(xk>pivotValue2){while(true){var greatValue=f(a[great]);if(greatValue>pivotValue2){great--;if(great<k)break;continue}else{if(greatValue<pivotValue1){a[k]=a[less];a[less++]=a[great];a[great--]=ek}else{a[k]=a[great];a[great--]=ek}break}}}}}}a[lo]=a[less-1];a[less-1]=pivot1;a[hi-1]=a[great+1];a[great+1]=pivot2;sort(a,lo,less-1);sort(a,great+2,hi);if(pivotsEqual){return a}if(less<i1&&great>i5){var lessValue,greatValue;while((lessValue=f(a[less]))<=pivotValue1&&lessValue>=pivotValue1)++less;while((greatValue=f(a[great]))<=pivotValue2&&greatValue>=pivotValue2)--great;for(var k=less;k<=great;k++){var ek=a[k],xk=f(ek);if(xk<=pivotValue1&&xk>=pivotValue1){if(k!==less){a[k]=a[less];a[less]=ek}less++}else{if(xk<=pivotValue2&&xk>=pivotValue2){while(true){var greatValue=f(a[great]);if(greatValue<=pivotValue2&&greatValue>=pivotValue2){great--;if(great<k)break;continue}else{if(greatValue<pivotValue1){a[k]=a[less];a[less++]=a[great];a[great--]=ek}else{a[k]=a[great];a[great--]=ek}break}}}}}}return sort(a,less,great+1)}return sort}var quicksort_sizeThreshold=32;var crossfilter_array8=crossfilter_arrayUntyped,crossfilter_array16=crossfilter_arrayUntyped,crossfilter_array32=crossfilter_arrayUntyped,crossfilter_arrayLengthen=crossfilter_arrayLengthenUntyped,crossfilter_arrayWiden=crossfilter_arrayWidenUntyped;if(typeof Uint8Array!=="undefined"){crossfilter_array8=function(n){return new Uint8Array(n)};crossfilter_array16=function(n){return new Uint16Array(n)};crossfilter_array32=function(n){return new Uint32Array(n)};crossfilter_arrayLengthen=function(array,length){if(array.length>=length)return array;var copy=new array.constructor(length);copy.set(array);return copy};crossfilter_arrayWiden=function(array,width){var copy;switch(width){case 16:copy=crossfilter_array16(array.length);break;case 32:copy=crossfilter_array32(array.length);break;default:throw new Error("invalid array width!")}copy.set(array);return copy}}function crossfilter_arrayUntyped(n){var array=new Array(n),i=-1;while(++i<n)array[i]=0;return array}function crossfilter_arrayLengthenUntyped(array,length){var n=array.length;while(n<length)array[n++]=0;return array}function crossfilter_arrayWidenUntyped(array,width){if(width>32)throw new Error("invalid array width!");return array}function crossfilter_filterExact(bisect,value){return function(values){var n=values.length;return[bisect.left(values,value,0,n),bisect.right(values,value,0,n)]}}function crossfilter_filterRange(bisect,range){var min=range[0],max=range[1];return function(values){var n=values.length;return[bisect.left(values,min,0,n),bisect.left(values,max,0,n)]}}function crossfilter_filterAll(values){return[0,values.length]}function crossfilter_null(){return null}function crossfilter_zero(){return 0}function crossfilter_reduceIncrement(p){return p+1}function crossfilter_reduceDecrement(p){return p-1}function crossfilter_reduceAdd(f){return function(p,v){return p+ +f(v)}}function crossfilter_reduceSubtract(f){return function(p,v){return p-f(v)}}exports.crossfilter=crossfilter;function crossfilter(){var crossfilter={add:add,remove:removeData,dimension:dimension,groupAll:groupAll,size:size};var data=[],n=0,m=0,M=8,filters=crossfilter_array8(0),filterListeners=[],dataListeners=[],removeDataListeners=[];function add(newData){var n0=n,n1=newData.length;if(n1){data=data.concat(newData);filters=crossfilter_arrayLengthen(filters,n+=n1);dataListeners.forEach(function(l){l(newData,n0,n1)})}return crossfilter}function removeData(){var newIndex=crossfilter_index(n,n),removed=[];for(var i=0,j=0;i<n;++i){if(filters[i])newIndex[i]=j++;else removed.push(i)}filterListeners.forEach(function(l){l(0,[],removed)});removeDataListeners.forEach(function(l){l(newIndex)});for(var i=0,j=0,k;i<n;++i){if(k=filters[i]){if(i!==j)filters[j]=k,data[j]=data[i];++j}}data.length=j;while(n>j)filters[--n]=0}function dimension(value){var dimension={filter:filter,filterExact:filterExact,filterRange:filterRange,filterFunction:filterFunction,filterAll:filterAll,top:top,bottom:bottom,group:group,groupAll:groupAll,dispose:dispose,remove:dispose};var one=~m&-~m,zero=~one,values,index,newValues,newIndex,sort=quicksort_by(function(i){return newValues[i]}),refilter=crossfilter_filterAll,refilterFunction,indexListeners=[],dimensionGroups=[],lo0=0,hi0=0;dataListeners.unshift(preAdd);dataListeners.push(postAdd);removeDataListeners.push(removeData);m|=one;if(M>=32?!one:m&-(1<<M)){filters=crossfilter_arrayWiden(filters,M<<=1)}preAdd(data,0,n);postAdd(data,0,n);function preAdd(newData,n0,n1){newValues=newData.map(value);newIndex=sort(crossfilter_range(n1),0,n1);newValues=permute(newValues,newIndex);var bounds=refilter(newValues),lo1=bounds[0],hi1=bounds[1],i;if(refilterFunction){for(i=0;i<n1;++i){if(!refilterFunction(newValues[i],i))filters[newIndex[i]+n0]|=one}}else{for(i=0;i<lo1;++i)filters[newIndex[i]+n0]|=one;for(i=hi1;i<n1;++i)filters[newIndex[i]+n0]|=one}if(!n0){values=newValues;index=newIndex;lo0=lo1;hi0=hi1;return}var oldValues=values,oldIndex=index,i0=0,i1=0;values=new Array(n);index=crossfilter_index(n,n);for(i=0;i0<n0&&i1<n1;++i){if(oldValues[i0]<newValues[i1]){values[i]=oldValues[i0];index[i]=oldIndex[i0++]}else{values[i]=newValues[i1];index[i]=newIndex[i1++]+n0}}for(;i0<n0;++i0,++i){values[i]=oldValues[i0];index[i]=oldIndex[i0]}for(;i1<n1;++i1,++i){values[i]=newValues[i1];index[i]=newIndex[i1]+n0}bounds=refilter(values),lo0=bounds[0],hi0=bounds[1]}function postAdd(newData,n0,n1){indexListeners.forEach(function(l){l(newValues,newIndex,n0,n1)});newValues=newIndex=null}function removeData(reIndex){for(var i=0,j=0,k;i<n;++i){if(filters[k=index[i]]){if(i!==j)values[j]=values[i];index[j]=reIndex[k];++j}}values.length=j;while(j<n)index[j++]=0;var bounds=refilter(values);lo0=bounds[0],hi0=bounds[1]}function filterIndexBounds(bounds){var lo1=bounds[0],hi1=bounds[1];if(refilterFunction){refilterFunction=null;filterIndexFunction(function(d,i){return lo1<=i&&i<hi1});lo0=lo1;hi0=hi1;return dimension}var i,j,k,added=[],removed=[];if(lo1<lo0){for(i=lo1,j=Math.min(lo0,hi1);i<j;++i){filters[k=index[i]]^=one;added.push(k)}}else if(lo1>lo0){for(i=lo0,j=Math.min(lo1,hi0);i<j;++i){filters[k=index[i]]^=one;removed.push(k)}}if(hi1>hi0){for(i=Math.max(lo1,hi0),j=hi1;i<j;++i){filters[k=index[i]]^=one;added.push(k)}}else if(hi1<hi0){for(i=Math.max(lo0,hi1),j=hi0;i<j;++i){filters[k=index[i]]^=one;removed.push(k)}}lo0=lo1;hi0=hi1;filterListeners.forEach(function(l){l(one,added,removed)});return dimension}function filter(range){return range==null?filterAll():Array.isArray(range)?filterRange(range):typeof range==="function"?filterFunction(range):filterExact(range)}function filterExact(value){return filterIndexBounds((refilter=crossfilter_filterExact(bisect,value))(values))}function filterRange(range){return filterIndexBounds((refilter=crossfilter_filterRange(bisect,range))(values))}function filterAll(){return filterIndexBounds((refilter=crossfilter_filterAll)(values))}function filterFunction(f){refilter=crossfilter_filterAll;filterIndexFunction(refilterFunction=f);lo0=0;hi0=n;return dimension}function filterIndexFunction(f){var i,k,x,added=[],removed=[];for(i=0;i<n;++i){if(!(filters[k=index[i]]&one)^!!(x=f(values[i],i))){if(x)filters[k]&=zero,added.push(k);else filters[k]|=one,removed.push(k)}}filterListeners.forEach(function(l){l(one,added,removed)})}function top(k){var array=[],i=hi0,j;while(--i>=lo0&&k>0){if(!filters[j=index[i]]){array.push(data[j]);--k}}return array}function bottom(k){var array=[],i=lo0,j;while(i<hi0&&k>0){if(!filters[j=index[i]]){array.push(data[j]);--k}i++}return array}function group(key){var group={top:top,all:all,reduce:reduce,reduceCount:reduceCount,reduceSum:reduceSum,order:order,orderNatural:orderNatural,size:size,dispose:dispose,remove:dispose};dimensionGroups.push(group);var groups,groupIndex,groupWidth=8,groupCapacity=crossfilter_capacity(groupWidth),k=0,select,heap,reduceAdd,reduceRemove,reduceInitial,update=crossfilter_null,reset=crossfilter_null,resetNeeded=true,groupAll=key===crossfilter_null;if(arguments.length<1)key=crossfilter_identity;filterListeners.push(update);indexListeners.push(add);removeDataListeners.push(removeData);add(values,index,0,n);function add(newValues,newIndex,n0,n1){var oldGroups=groups,reIndex=crossfilter_index(k,groupCapacity),add=reduceAdd,initial=reduceInitial,k0=k,i0=0,i1=0,j,g0,x0,x1,g,x;if(resetNeeded)add=initial=crossfilter_null;groups=new Array(k),k=0;groupIndex=k0>1?crossfilter_arrayLengthen(groupIndex,n):crossfilter_index(n,groupCapacity);if(k0)x0=(g0=oldGroups[0]).key;while(i1<n1&&!((x1=key(newValues[i1]))>=x1))++i1;while(i1<n1){if(g0&&x0<=x1){g=g0,x=x0;reIndex[i0]=k;if(g0=oldGroups[++i0])x0=g0.key}else{g={key:x1,value:initial()},x=x1}groups[k]=g;while(!(x1>x)){groupIndex[j=newIndex[i1]+n0]=k;if(!(filters[j]&zero))g.value=add(g.value,data[j]);if(++i1>=n1)break;x1=key(newValues[i1])}groupIncrement()}while(i0<k0){groups[reIndex[i0]=k]=oldGroups[i0++];groupIncrement()}if(k>i0)for(i0=0;i0<n0;++i0){groupIndex[i0]=reIndex[groupIndex[i0]]}j=filterListeners.indexOf(update);if(k>1){update=updateMany;reset=resetMany}else{if(!k&&groupAll){k=1;groups=[{key:null,value:initial()}]}if(k===1){update=updateOne;reset=resetOne}else{update=crossfilter_null;reset=crossfilter_null}groupIndex=null}filterListeners[j]=update;function groupIncrement(){if(++k===groupCapacity){reIndex=crossfilter_arrayWiden(reIndex,groupWidth<<=1);groupIndex=crossfilter_arrayWiden(groupIndex,groupWidth);groupCapacity=crossfilter_capacity(groupWidth)}}}function removeData(){if(k>1){var oldK=k,oldGroups=groups,seenGroups=crossfilter_index(oldK,oldK);for(var i=0,j=0;i<n;++i){if(filters[i]){seenGroups[groupIndex[j]=groupIndex[i]]=1;++j}}groups=[],k=0;for(i=0;i<oldK;++i){if(seenGroups[i]){seenGroups[i]=k++;groups.push(oldGroups[i])}}if(k>1){for(var i=0;i<j;++i)groupIndex[i]=seenGroups[groupIndex[i]]}else{groupIndex=null}filterListeners[filterListeners.indexOf(update)]=k>1?(reset=resetMany,update=updateMany):k===1?(reset=resetOne,update=updateOne):reset=update=crossfilter_null}else if(k===1){if(groupAll)return;for(var i=0;i<n;++i)if(filters[i])return;groups=[],k=0;filterListeners[filterListeners.indexOf(update)]=update=reset=crossfilter_null}}function updateMany(filterOne,added,removed){if(filterOne===one||resetNeeded)return;var i,k,n,g;for(i=0,n=added.length;i<n;++i){if(!(filters[k=added[i]]&zero)){g=groups[groupIndex[k]];g.value=reduceAdd(g.value,data[k])}}for(i=0,n=removed.length;i<n;++i){if((filters[k=removed[i]]&zero)===filterOne){g=groups[groupIndex[k]];g.value=reduceRemove(g.value,data[k])}}}function updateOne(filterOne,added,removed){if(filterOne===one||resetNeeded)return;var i,k,n,g=groups[0];for(i=0,n=added.length;i<n;++i){if(!(filters[k=added[i]]&zero)){g.value=reduceAdd(g.value,data[k])}}for(i=0,n=removed.length;i<n;++i){if((filters[k=removed[i]]&zero)===filterOne){g.value=reduceRemove(g.value,data[k])}}}function resetMany(){var i,g;for(i=0;i<k;++i){groups[i].value=reduceInitial()}for(i=0;i<n;++i){if(!(filters[i]&zero)){g=groups[groupIndex[i]];g.value=reduceAdd(g.value,data[i])}}}function resetOne(){var i,g=groups[0];g.value=reduceInitial();for(i=0;i<n;++i){if(!(filters[i]&zero)){g.value=reduceAdd(g.value,data[i])}}}function all(){if(resetNeeded)reset(),resetNeeded=false;return groups}function top(k){var top=select(all(),0,groups.length,k);return heap.sort(top,0,top.length)}function reduce(add,remove,initial){reduceAdd=add;reduceRemove=remove;reduceInitial=initial;resetNeeded=true;return group}function reduceCount(){return reduce(crossfilter_reduceIncrement,crossfilter_reduceDecrement,crossfilter_zero)}function reduceSum(value){return reduce(crossfilter_reduceAdd(value),crossfilter_reduceSubtract(value),crossfilter_zero)}function order(value){select=heapselect_by(valueOf);heap=heap_by(valueOf);function valueOf(d){return value(d.value)}return group}function orderNatural(){return order(crossfilter_identity)}function size(){return k}function dispose(){var i=filterListeners.indexOf(update);if(i>=0)filterListeners.splice(i,1);i=indexListeners.indexOf(add);if(i>=0)indexListeners.splice(i,1);i=removeDataListeners.indexOf(removeData);if(i>=0)removeDataListeners.splice(i,1);return group}return reduceCount().orderNatural()}function groupAll(){var g=group(crossfilter_null),all=g.all;delete g.all;delete g.top;delete g.order;delete g.orderNatural;delete g.size;g.value=function(){return all()[0].value};return g}function dispose(){dimensionGroups.forEach(function(group){group.dispose()});var i=dataListeners.indexOf(preAdd);if(i>=0)dataListeners.splice(i,1);i=dataListeners.indexOf(postAdd);if(i>=0)dataListeners.splice(i,1);i=removeDataListeners.indexOf(removeData);if(i>=0)removeDataListeners.splice(i,1);m&=zero;return filterAll()}return dimension}function groupAll(){var group={reduce:reduce,reduceCount:reduceCount,reduceSum:reduceSum,value:value,dispose:dispose,remove:dispose};var reduceValue,reduceAdd,reduceRemove,reduceInitial,resetNeeded=true;filterListeners.push(update);dataListeners.push(add);add(data,0,n);function add(newData,n0){var i;if(resetNeeded)return;for(i=n0;i<n;++i){if(!filters[i]){reduceValue=reduceAdd(reduceValue,data[i])}}}function update(filterOne,added,removed){var i,k,n;if(resetNeeded)return;for(i=0,n=added.length;i<n;++i){if(!filters[k=added[i]]){reduceValue=reduceAdd(reduceValue,data[k])}}for(i=0,n=removed.length;i<n;++i){if(filters[k=removed[i]]===filterOne){reduceValue=reduceRemove(reduceValue,data[k])}}}function reset(){var i;reduceValue=reduceInitial();for(i=0;i<n;++i){if(!filters[i]){reduceValue=reduceAdd(reduceValue,data[i])}}}function reduce(add,remove,initial){reduceAdd=add;reduceRemove=remove;reduceInitial=initial;resetNeeded=true;return group}function reduceCount(){return reduce(crossfilter_reduceIncrement,crossfilter_reduceDecrement,crossfilter_zero)}function reduceSum(value){return reduce(crossfilter_reduceAdd(value),crossfilter_reduceSubtract(value),crossfilter_zero)}function value(){if(resetNeeded)reset(),resetNeeded=false;return reduceValue}function dispose(){var i=filterListeners.indexOf(update);if(i>=0)filterListeners.splice(i);i=dataListeners.indexOf(add);if(i>=0)dataListeners.splice(i);return group}return reduceCount()}function size(){return n}return arguments.length?add(arguments[0]):crossfilter}function crossfilter_index(n,m){return(m<257?crossfilter_array8:m<65537?crossfilter_array16:crossfilter_array32)(n)}function crossfilter_range(n){var range=crossfilter_index(n,n);for(var i=-1;++i<n;)range[i]=i;return range}function crossfilter_capacity(w){return w===8?256:w===16?65536:4294967296}})(typeof exports!=="undefined"&&exports||this);+function($){"use strict";var Validator=function(element,options){this.$element=$(element);this.options=options;options.errors=$.extend({},Validator.DEFAULTS.errors,options.errors);for(var custom in options.custom){if(!options.errors[custom])throw new Error("Missing default error message for custom validator: "+custom)}$.extend(Validator.VALIDATORS,options.custom);this.$element.attr("novalidate",true);this.toggleSubmit();this.$element.on("input.bs.validator change.bs.validator focusout.bs.validator",$.proxy(this.validateInput,this));this.$element.on("submit.bs.validator",$.proxy(this.onSubmit,this));this.$element.find("[data-match]").each(function(){var $this=$(this);var target=$this.data("match");$(target).on("input.bs.validator",function(e){$this.val()&&$this.trigger("input.bs.validator")})})};Validator.INPUT_SELECTOR=':input:not([type="submit"], button):enabled:visible';Validator.DEFAULTS={delay:500,html:false,disable:true,custom:{},errors:{match:"Does not match",minlength:"Not long enough"},feedback:{success:"glyphicon-ok",error:"glyphicon-remove"}};Validator.VALIDATORS={native:function($el){var el=$el[0];return el.checkValidity?el.checkValidity():true},match:function($el){var target=$el.data("match");return!$el.val()||$el.val()===$(target).val()},minlength:function($el){var minlength=$el.data("minlength");return!$el.val()||$el.val().length>=minlength}};Validator.prototype.validateInput=function(e){var $el=$(e.target);var prevErrors=$el.data("bs.validator.errors");var errors;if($el.is('[type="radio"]'))$el=this.$element.find('input[name="'+$el.attr("name")+'"]');this.$element.trigger(e=$.Event("validate.bs.validator",{relatedTarget:$el[0]}));if(e.isDefaultPrevented())return;var self=this;this.runValidators($el).done(function(errors){$el.data("bs.validator.errors",errors);errors.length?self.showErrors($el):self.clearErrors($el);if(!prevErrors||errors.toString()!==prevErrors.toString()){e=errors.length?$.Event("invalid.bs.validator",{relatedTarget:$el[0],detail:errors}):$.Event("valid.bs.validator",{relatedTarget:$el[0],detail:prevErrors});self.$element.trigger(e)}self.toggleSubmit();self.$element.trigger($.Event("validated.bs.validator",{relatedTarget:$el[0]}))})};Validator.prototype.runValidators=function($el){var errors=[];var deferred=$.Deferred();var options=this.options;$el.data("bs.validator.deferred")&&$el.data("bs.validator.deferred").reject();$el.data("bs.validator.deferred",deferred);function getErrorMessage(key){return $el.data(key+"-error")||$el.data("error")||key=="native"&&$el[0].validationMessage||options.errors[key]}$.each(Validator.VALIDATORS,$.proxy(function(key,validator){if(($el.data(key)||key=="native")&&!validator.call(this,$el)){var error=getErrorMessage(key);!~errors.indexOf(error)&&errors.push(error)}},this));if(!errors.length&&$el.val()&&$el.data("remote")){this.defer($el,function(){var data={};data[$el.attr("name")]=$el.val();$.get($el.data("remote"),data).fail(function(jqXHR,textStatus,error){errors.push(getErrorMessage("remote")||error)}).always(function(){deferred.resolve(errors)})})}else deferred.resolve(errors);return deferred.promise()};Validator.prototype.validate=function(){var delay=this.options.delay;this.options.delay=0;this.$element.find(Validator.INPUT_SELECTOR).trigger("input.bs.validator");this.options.delay=delay;return this};Validator.prototype.showErrors=function($el){var method=this.options.html?"html":"text";var self=this;this.defer($el,function(){var $group=$el.closest(".form-group");var $block=$group.find(".help-block.with-errors");var $feedback=$group.find(".form-control-feedback");var errors=$el.data("bs.validator.errors");if(typeof errors==="undefined"){errors=[];self.clearErrors($el);self.toggleSubmit()}if(!errors.length)return;errors=$("<ul/>").addClass("list-unstyled").append($.map(errors,function(error){return $("<li/>")[method](error)}));$block.data("bs.validator.originalContent")===undefined&&$block.data("bs.validator.originalContent",$block.html());$block.empty().append(errors);$group.addClass("has-error");$feedback.length&&$feedback.removeClass(this.options.feedback.success)&&$feedback.addClass(this.options.feedback.error)&&$group.removeClass("has-success")})};Validator.prototype.clearErrors=function($el){var $group=$el.closest(".form-group");var $block=$group.find(".help-block.with-errors");var $feedback=$group.find(".form-control-feedback");$block.html($block.data("bs.validator.originalContent"));$group.removeClass("has-error");$feedback.length&&$feedback.removeClass(this.options.feedback.error)&&$feedback.addClass(this.options.feedback.success)&&$group.addClass("has-success")};Validator.prototype.hasErrors=function(){function fieldErrors(){return!!($(this).data("bs.validator.errors")||[]).length}return!!this.$element.find(Validator.INPUT_SELECTOR).filter(fieldErrors).length};Validator.prototype.isIncomplete=function(){function fieldIncomplete(){return this.type==="checkbox"?!this.checked:this.type==="radio"?!$('[name="'+this.name+'"]:checked').length:$.trim(this.value)===""}return!!this.$element.find(Validator.INPUT_SELECTOR).filter("[required]").filter(fieldIncomplete).length};Validator.prototype.onSubmit=function(e){this.validate();if(this.isIncomplete()||this.hasErrors())e.preventDefault()};Validator.prototype.toggleSubmit=function(){if(!this.options.disable)return;var $btn=$('button[type="submit"], input[type="submit"]').filter('[form="'+this.$element.attr("id")+'"]').add(this.$element.find('input[type="submit"], button[type="submit"]'));$btn.toggleClass("disabled",this.isIncomplete()||this.hasErrors())};Validator.prototype.defer=function($el,callback){callback=$.proxy(callback,this);if(!this.options.delay)return callback();window.clearTimeout($el.data("bs.validator.timeout"));$el.data("bs.validator.timeout",window.setTimeout(callback,this.options.delay))};Validator.prototype.destroy=function(){this.$element.removeAttr("novalidate").removeData("bs.validator").off(".bs.validator");this.$element.find(Validator.INPUT_SELECTOR).off(".bs.validator").removeData(["bs.validator.errors","bs.validator.deferred"]).each(function(){var $this=$(this);var timeout=$this.data("bs.validator.timeout");window.clearTimeout(timeout)&&$this.removeData("bs.validator.timeout")});this.$element.find(".help-block.with-errors").each(function(){var $this=$(this);var originalContent=$this.data("bs.validator.originalContent");$this.removeData("bs.validator.originalContent").html(originalContent)});this.$element.find('input[type="submit"], button[type="submit"]').removeClass("disabled");this.$element.find(".has-error").removeClass("has-error");return this};function Plugin(option){return this.each(function(){var $this=$(this);var options=$.extend({},Validator.DEFAULTS,$this.data(),typeof option=="object"&&option);var data=$this.data("bs.validator");if(!data&&option=="destroy")return;if(!data)$this.data("bs.validator",data=new Validator(this,options));if(typeof option=="string")data[option]()})}var old=$.fn.validator;$.fn.validator=Plugin;$.fn.validator.Constructor=Validator;$.fn.validator.noConflict=function(){$.fn.validator=old;return this};$(window).on("load",function(){$('form[data-toggle="validator"]').each(function(){var $form=$(this);Plugin.call($form,$form.data())})})}(jQuery);(function(){function _dc(d3,crossfilter){"use strict";var dc={version:"2.1.8",constants:{CHART_CLASS:"dc-chart",DEBUG_GROUP_CLASS:"debug",STACK_CLASS:"stack",DESELECTED_CLASS:"deselected",SELECTED_CLASS:"selected",NODE_INDEX_NAME:"__index__",GROUP_INDEX_NAME:"__group_index__",DEFAULT_CHART_GROUP:"__default_chart_group__",EVENT_DELAY:40,NEGLIGIBLE_NUMBER:1e-10},_renderlet:null};dc.chartRegistry=function(){var _chartMap={};function initializeChartGroup(group){if(!group){group=dc.constants.DEFAULT_CHART_GROUP}if(!_chartMap[group]){_chartMap[group]=[]}return group}return{has:function(chart){for(var e in _chartMap){if(_chartMap[e].indexOf(chart)>=0){return true}}return false},register:function(chart,group){group=initializeChartGroup(group);_chartMap[group].push(chart)},deregister:function(chart,group){group=initializeChartGroup(group);for(var i=0;i<_chartMap[group].length;i++){if(_chartMap[group][i].anchorName()===chart.anchorName()){_chartMap[group].splice(i,1);break}}},clear:function(group){if(group){delete _chartMap[group]}else{_chartMap={}}},list:function(group){group=initializeChartGroup(group);return _chartMap[group]}}}();dc.registerChart=function(chart,group){dc.chartRegistry.register(chart,group)};dc.deregisterChart=function(chart,group){dc.chartRegistry.deregister(chart,group)};dc.hasChart=function(chart){return dc.chartRegistry.has(chart)};dc.deregisterAllCharts=function(group){dc.chartRegistry.clear(group)};dc.filterAll=function(group){var charts=dc.chartRegistry.list(group);for(var i=0;i<charts.length;++i){charts[i].filterAll()}};dc.refocusAll=function(group){var charts=dc.chartRegistry.list(group);for(var i=0;i<charts.length;++i){if(charts[i].focus){charts[i].focus()}}};dc.renderAll=function(group){var charts=dc.chartRegistry.list(group);for(var i=0;i<charts.length;++i){charts[i].render()}if(dc._renderlet!==null){dc._renderlet(group)}};dc.redrawAll=function(group){var charts=dc.chartRegistry.list(group);for(var i=0;i<charts.length;++i){charts[i].redraw()}if(dc._renderlet!==null){dc._renderlet(group)}};dc.disableTransitions=false;dc.transition=function(selection,duration,delay,name){if(dc.disableTransitions||duration<=0){return selection}var s=selection.transition(name);if(duration>=0||duration!==undefined){s=s.duration(duration)}if(delay>=0||delay!==undefined){s=s.delay(delay)}return s};dc.optionalTransition=function(enable,duration,delay,name){if(enable){return function(selection){return dc.transition(selection,duration,delay,name)}}else{return function(selection){return selection}}};dc.afterTransition=function(transition,callback){if(transition.empty()||!transition.duration){callback.call(transition)}else{var n=0;transition.each(function(){++n}).each("end",function(){if(!--n){callback.call(transition)}})}};dc.units={};dc.units.integers=function(start,end){return Math.abs(end-start)};dc.units.ordinal=function(start,end,domain){return domain};dc.units.fp={};dc.units.fp.precision=function(precision){var _f=function(s,e){var d=Math.abs((e-s)/_f.resolution);if(dc.utils.isNegligible(d-Math.floor(d))){return Math.floor(d)}else{return Math.ceil(d)}};_f.resolution=precision;return _f};dc.round={};dc.round.floor=function(n){return Math.floor(n)};dc.round.ceil=function(n){return Math.ceil(n)};dc.round.round=function(n){return Math.round(n)};dc.override=function(obj,functionName,newFunction){var existingFunction=obj[functionName];obj["_"+functionName]=existingFunction;obj[functionName]=newFunction};dc.renderlet=function(_){if(!arguments.length){return dc._renderlet}dc._renderlet=_;return dc};dc.instanceOfChart=function(o){return o instanceof Object&&o.__dcFlag__&&true};dc.errors={};dc.errors.Exception=function(msg){var _msg=msg||"Unexpected internal error";this.message=_msg;this.toString=function(){return _msg};this.stack=(new Error).stack};dc.errors.Exception.prototype=Object.create(Error.prototype);dc.errors.Exception.prototype.constructor=dc.errors.Exception;dc.errors.InvalidStateException=function(){dc.errors.Exception.apply(this,arguments)};dc.errors.InvalidStateException.prototype=Object.create(dc.errors.Exception.prototype);dc.errors.InvalidStateException.prototype.constructor=dc.errors.InvalidStateException;dc.errors.BadArgumentException=function(){dc.errors.Exception.apply(this,arguments)};dc.errors.BadArgumentException.prototype=Object.create(dc.errors.Exception.prototype);dc.errors.BadArgumentException.prototype.constructor=dc.errors.BadArgumentException;dc.dateFormat=d3.time.format("%m/%d/%Y");dc.printers={};dc.printers.filters=function(filters){var s="";for(var i=0;i<filters.length;++i){if(i>0){s+=", "}s+=dc.printers.filter(filters[i])}return s};dc.printers.filter=function(filter){var s="";if(typeof filter!=="undefined"&&filter!==null){if(filter instanceof Array){if(filter.length>=2){s="["+dc.utils.printSingleValue(filter[0])+" -> "+dc.utils.printSingleValue(filter[1])+"]"}else if(filter.length>=1){s=dc.utils.printSingleValue(filter[0])}}else{s=dc.utils.printSingleValue(filter)}}return s};dc.pluck=function(n,f){if(!f){return function(d){return d[n]}}return function(d,i){return f.call(d,d[n],i)}};dc.utils={};dc.utils.printSingleValue=function(filter){var s=""+filter;if(filter instanceof Date){s=dc.dateFormat(filter)}else if(typeof filter==="string"){s=filter}else if(dc.utils.isFloat(filter)){s=dc.utils.printSingleValue.fformat(filter)}else if(dc.utils.isInteger(filter)){s=Math.round(filter)}return s};dc.utils.printSingleValue.fformat=d3.format(".2f");dc.utils.add=function(l,r,t){if(typeof r==="string"){r=r.replace("%","")}if(l instanceof Date){if(typeof r==="string"){r=+r}if(t==="millis"){return new Date(l.getTime()+r)}t=t||"day";return d3.time[t].offset(l,r)}else if(typeof r==="string"){var percentage=+r/100;return l>0?l*(1+percentage):l*(1-percentage)}else{return l+r}};dc.utils.subtract=function(l,r,t){if(typeof r==="string"){r=r.replace("%","")}if(l instanceof Date){if(typeof r==="string"){r=+r}if(t==="millis"){return new Date(l.getTime()-r)}t=t||"day";return d3.time[t].offset(l,-r)}else if(typeof r==="string"){var percentage=+r/100;return l<0?l*(1+percentage):l*(1-percentage)}else{return l-r}};dc.utils.isNumber=function(n){return n===+n};dc.utils.isFloat=function(n){return n===+n&&n!==(n|0)};dc.utils.isInteger=function(n){return n===+n&&n===(n|0)};dc.utils.isNegligible=function(n){return!dc.utils.isNumber(n)||n<dc.constants.NEGLIGIBLE_NUMBER&&n>-dc.constants.NEGLIGIBLE_NUMBER};dc.utils.clamp=function(val,min,max){return val<min?min:val>max?max:val};var _idCounter=0;dc.utils.uniqueId=function(){return++_idCounter};dc.utils.nameToId=function(name){return name.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")};dc.utils.appendOrSelect=function(parent,selector,tag){tag=tag||selector;var element=parent.select(selector);if(element.empty()){element=parent.append(tag)}return element};dc.utils.safeNumber=function(n){return dc.utils.isNumber(+n)?+n:0};dc.logger={};dc.logger.enableDebugLog=false;dc.logger.warn=function(msg){if(console){if(console.warn){console.warn(msg)}else if(console.log){console.log(msg)}}return dc.logger};dc.logger.debug=function(msg){if(dc.logger.enableDebugLog&&console){if(console.debug){console.debug(msg)}else if(console.log){console.log(msg)}}return dc.logger};dc.logger.deprecate=function(fn,msg){var warned=false;function deprecated(){if(!warned){dc.logger.warn(msg);warned=true}return fn.apply(this,arguments)}return deprecated};dc.events={current:null};dc.events.trigger=function(closure,delay){if(!delay){closure();return}dc.events.current=closure;setTimeout(function(){if(closure===dc.events.current){closure()}},delay)};dc.filters={};dc.filters.RangedFilter=function(low,high){var range=new Array(low,high);range.isFiltered=function(value){return value>=this[0]&&value<this[1]};range.filterType="RangedFilter";return range};dc.filters.TwoDimensionalFilter=function(filter){if(filter===null){return null}var f=filter;f.isFiltered=function(value){return value.length&&value.length===f.length&&value[0]===f[0]&&value[1]===f[1]};f.filterType="TwoDimensionalFilter";return f};dc.filters.RangedTwoDimensionalFilter=function(filter){if(filter===null){return null}var f=filter;var fromBottomLeft;if(f[0]instanceof Array){fromBottomLeft=[[Math.min(filter[0][0],filter[1][0]),Math.min(filter[0][1],filter[1][1])],[Math.max(filter[0][0],filter[1][0]),Math.max(filter[0][1],filter[1][1])]]}else{fromBottomLeft=[[filter[0],-Infinity],[filter[1],Infinity]]}f.isFiltered=function(value){var x,y;if(value instanceof Array){x=value[0];y=value[1]}else{x=value;y=fromBottomLeft[0][1]}return x>=fromBottomLeft[0][0]&&x<fromBottomLeft[1][0]&&y>=fromBottomLeft[0][1]&&y<fromBottomLeft[1][1]};f.filterType="RangedTwoDimensionalFilter";return f};dc.baseMixin=function(_chart){_chart.__dcFlag__=dc.utils.uniqueId();var _dimension;var _group;var _anchor;var _root;var _svg;var _isChild;var _minWidth=200;var _defaultWidthCalc=function(element){var width=element&&element.getBoundingClientRect&&element.getBoundingClientRect().width;return width&&width>_minWidth?width:_minWidth};var _widthCalc=_defaultWidthCalc;var _minHeight=200;var _defaultHeightCalc=function(element){var height=element&&element.getBoundingClientRect&&element.getBoundingClientRect().height;return height&&height>_minHeight?height:_minHeight};var _heightCalc=_defaultHeightCalc;var _width,_height;var _useViewBoxResizing=false;var _keyAccessor=dc.pluck("key");var _valueAccessor=dc.pluck("value");var _label=dc.pluck("key");var _ordering=dc.pluck("key");var _orderSort;var _renderLabel=false;var _title=function(d){return _chart.keyAccessor()(d)+": "+_chart.valueAccessor()(d)};var _renderTitle=true;var _controlsUseVisibility=false;var _transitionDuration=750;var _transitionDelay=0;var _filterPrinter=dc.printers.filters;var _mandatoryAttributes=["dimension","group"];var _chartGroup=dc.constants.DEFAULT_CHART_GROUP;var _listeners=d3.dispatch("preRender","postRender","preRedraw","postRedraw","filtered","zoomed","renderlet","pretransition");var _legend;var _commitHandler;var _filters=[];var _filterHandler=function(dimension,filters){if(filters.length===0){dimension.filter(null)}else if(filters.length===1&&!filters[0].isFiltered){dimension.filterExact(filters[0])}else if(filters.length===1&&filters[0].filterType==="RangedFilter"){dimension.filterRange(filters[0])}else{dimension.filterFunction(function(d){for(var i=0;i<filters.length;i++){var filter=filters[i];if(filter.isFiltered&&filter.isFiltered(d)){return true}else if(filter<=d&&filter>=d){return true}}return false})}return filters};var _data=function(group){return group.all()};_chart.height=function(height){if(!arguments.length){if(!dc.utils.isNumber(_height)){_height=_heightCalc(_root.node())}return _height}_heightCalc=d3.functor(height||_defaultHeightCalc);_height=undefined;return _chart};_chart.width=function(width){if(!arguments.length){if(!dc.utils.isNumber(_width)){_width=_widthCalc(_root.node())}return _width}_widthCalc=d3.functor(width||_defaultWidthCalc);_width=undefined;return _chart};_chart.minWidth=function(minWidth){if(!arguments.length){return _minWidth}_minWidth=minWidth;return _chart};_chart.minHeight=function(minHeight){if(!arguments.length){return _minHeight}_minHeight=minHeight;return _chart};_chart.useViewBoxResizing=function(useViewBoxResizing){if(!arguments.length){return _useViewBoxResizing}_useViewBoxResizing=useViewBoxResizing;return _chart};_chart.dimension=function(dimension){if(!arguments.length){return _dimension}_dimension=dimension;_chart.expireCache();return _chart};_chart.data=function(callback){if(!arguments.length){return _data.call(_chart,_group)}_data=d3.functor(callback);_chart.expireCache();return _chart};_chart.group=function(group,name){if(!arguments.length){return _group}_group=group;_chart._groupName=name;_chart.expireCache();return _chart};_chart.ordering=function(orderFunction){if(!arguments.length){return _ordering}_ordering=orderFunction;_orderSort=crossfilter.quicksort.by(_ordering);_chart.expireCache();return _chart};_chart._computeOrderedGroups=function(data){var dataCopy=data.slice(0);if(dataCopy.length<=1){return dataCopy}if(!_orderSort){_orderSort=crossfilter.quicksort.by(_ordering)}return _orderSort(dataCopy,0,dataCopy.length)};_chart.filterAll=function(){return _chart.filter(null)};_chart.select=function(s){return _root.select(s)};_chart.selectAll=function(s){return _root?_root.selectAll(s):null};_chart.anchor=function(parent,chartGroup){if(!arguments.length){return _anchor}if(dc.instanceOfChart(parent)){_anchor=parent.anchor();_root=parent.root();_isChild=true}else if(parent){if(parent.select&&parent.classed){_anchor=parent.node()}else{_anchor=parent}_root=d3.select(_anchor);_root.classed(dc.constants.CHART_CLASS,true);dc.registerChart(_chart,chartGroup);_isChild=false}else{throw new dc.errors.BadArgumentException("parent must be defined")}_chartGroup=chartGroup;return _chart};_chart.anchorName=function(){var a=_chart.anchor();if(a&&a.id){return a.id}if(a&&a.replace){return a.replace("#","")}return"dc-chart"+_chart.chartID()};_chart.root=function(rootElement){if(!arguments.length){return _root}_root=rootElement;return _chart};_chart.svg=function(svgElement){if(!arguments.length){return _svg}_svg=svgElement;return _chart};_chart.resetSvg=function(){_chart.select("svg").remove();return generateSvg()};function sizeSvg(){if(_svg){if(!_useViewBoxResizing){_svg.attr("width",_chart.width()).attr("height",_chart.height())}else if(!_svg.attr("viewBox")){_svg.attr("viewBox","0 0 "+_chart.width()+" "+_chart.height())}}}function generateSvg(){_svg=_chart.root().append("svg");sizeSvg();return _svg}_chart.filterPrinter=function(filterPrinterFunction){if(!arguments.length){return _filterPrinter}_filterPrinter=filterPrinterFunction;return _chart};_chart.controlsUseVisibility=function(useVisibility){if(!arguments.length){return _controlsUseVisibility}_controlsUseVisibility=useVisibility;return _chart};_chart.turnOnControls=function(){if(_root){var attribute=_chart.controlsUseVisibility()?"visibility":"display";_chart.selectAll(".reset").style(attribute,null);_chart.selectAll(".filter").text(_filterPrinter(_chart.filters())).style(attribute,null)}return _chart};_chart.turnOffControls=function(){if(_root){var attribute=_chart.controlsUseVisibility()?"visibility":"display";var value=_chart.controlsUseVisibility()?"hidden":"none";_chart.selectAll(".reset").style(attribute,value);_chart.selectAll(".filter").style(attribute,value).text(_chart.filter())}return _chart};_chart.transitionDuration=function(duration){if(!arguments.length){return _transitionDuration}_transitionDuration=duration;return _chart};_chart.transitionDelay=function(delay){if(!arguments.length){return _transitionDelay}_transitionDelay=delay;return _chart};_chart._mandatoryAttributes=function(_){if(!arguments.length){return _mandatoryAttributes}_mandatoryAttributes=_;return _chart};function checkForMandatoryAttributes(a){if(!_chart[a]||!_chart[a]()){throw new dc.errors.InvalidStateException("Mandatory attribute chart."+a+" is missing on chart[#"+_chart.anchorName()+"]")}}_chart.render=function(){_height=_width=undefined;_listeners.preRender(_chart);if(_mandatoryAttributes){_mandatoryAttributes.forEach(checkForMandatoryAttributes)}var result=_chart._doRender();if(_legend){_legend.render()}_chart._activateRenderlets("postRender");return result};_chart._activateRenderlets=function(event){_listeners.pretransition(_chart);if(_chart.transitionDuration()>0&&_svg){_svg.transition().duration(_chart.transitionDuration()).delay(_chart.transitionDelay()).each("end",function(){_listeners.renderlet(_chart);if(event){_listeners[event](_chart)}})}else{_listeners.renderlet(_chart);if(event){_listeners[event](_chart)}}};_chart.redraw=function(){sizeSvg();_listeners.preRedraw(_chart);var result=_chart._doRedraw();if(_legend){_legend.render()}_chart._activateRenderlets("postRedraw");return result};_chart.commitHandler=function(commitHandler){if(!arguments.length){return _commitHandler}_commitHandler=commitHandler;return _chart};_chart.redrawGroup=function(){if(_commitHandler){_commitHandler(false,function(error,result){if(error){console.log(error)}else{dc.redrawAll(_chart.chartGroup())}})}else{dc.redrawAll(_chart.chartGroup())}return _chart};_chart.renderGroup=function(){if(_commitHandler){_commitHandler(false,function(error,result){if(error){console.log(error)}else{dc.renderAll(_chart.chartGroup())}})}else{dc.renderAll(_chart.chartGroup())}return _chart};_chart._invokeFilteredListener=function(f){if(f!==undefined){_listeners.filtered(_chart,f)}};_chart._invokeZoomedListener=function(){_listeners.zoomed(_chart)};var _hasFilterHandler=function(filters,filter){if(filter===null||typeof filter==="undefined"){return filters.length>0}return filters.some(function(f){return filter<=f&&filter>=f})};_chart.hasFilterHandler=function(hasFilterHandler){if(!arguments.length){return _hasFilterHandler}_hasFilterHandler=hasFilterHandler;return _chart};_chart.hasFilter=function(filter){return _hasFilterHandler(_filters,filter)};var _removeFilterHandler=function(filters,filter){for(var i=0;i<filters.length;i++){if(filters[i]<=filter&&filters[i]>=filter){filters.splice(i,1);break}}return filters};_chart.removeFilterHandler=function(removeFilterHandler){if(!arguments.length){return _removeFilterHandler}_removeFilterHandler=removeFilterHandler;return _chart};var _addFilterHandler=function(filters,filter){filters.push(filter);return filters};_chart.addFilterHandler=function(addFilterHandler){if(!arguments.length){return _addFilterHandler}_addFilterHandler=addFilterHandler;return _chart};var _resetFilterHandler=function(filters){return[]};_chart.resetFilterHandler=function(resetFilterHandler){if(!arguments.length){return _resetFilterHandler}_resetFilterHandler=resetFilterHandler;return _chart};function applyFilters(filters){if(_chart.dimension()&&_chart.dimension().filter){var fs=_filterHandler(_chart.dimension(),filters);if(fs){filters=fs}}return filters}_chart.replaceFilter=function(filter){_filters=_resetFilterHandler(_filters);_chart.filter(filter);return _chart};_chart.filter=function(filter){if(!arguments.length){return _filters.length>0?_filters[0]:null}var filters=_filters;if(filter instanceof Array&&filter[0]instanceof Array&&!filter.isFiltered){filter[0].forEach(function(f){if(_hasFilterHandler(filters,f)){filters=_removeFilterHandler(filters,f)}else{filters=_addFilterHandler(filters,f)}})}else if(filter===null){filters=_resetFilterHandler(filters)}else{if(_hasFilterHandler(filters,filter)){filters=_removeFilterHandler(filters,filter)}else{filters=_addFilterHandler(filters,filter)}}_filters=applyFilters(filters);_chart._invokeFilteredListener(filter);if(_root!==null&&_chart.hasFilter()){_chart.turnOnControls()}else{_chart.turnOffControls()}return _chart};_chart.filters=function(){return _filters};_chart.highlightSelected=function(e){d3.select(e).classed(dc.constants.SELECTED_CLASS,true);d3.select(e).classed(dc.constants.DESELECTED_CLASS,false)};_chart.fadeDeselected=function(e){d3.select(e).classed(dc.constants.SELECTED_CLASS,false);d3.select(e).classed(dc.constants.DESELECTED_CLASS,true)};_chart.resetHighlight=function(e){d3.select(e).classed(dc.constants.SELECTED_CLASS,false);d3.select(e).classed(dc.constants.DESELECTED_CLASS,false)};_chart.onClick=function(datum){var filter=_chart.keyAccessor()(datum);dc.events.trigger(function(){_chart.filter(filter);_chart.redrawGroup()})};_chart.filterHandler=function(filterHandler){if(!arguments.length){return _filterHandler}_filterHandler=filterHandler;return _chart};_chart._doRender=function(){return _chart};_chart._doRedraw=function(){return _chart};_chart.legendables=function(){return[]};_chart.legendHighlight=function(){};_chart.legendReset=function(){};_chart.legendToggle=function(){};_chart.isLegendableHidden=function(){return false};_chart.keyAccessor=function(keyAccessor){if(!arguments.length){return _keyAccessor}_keyAccessor=keyAccessor;return _chart};_chart.valueAccessor=function(valueAccessor){if(!arguments.length){return _valueAccessor}_valueAccessor=valueAccessor;return _chart};_chart.label=function(labelFunction,enableLabels){if(!arguments.length){return _label}_label=labelFunction;if(enableLabels===undefined||enableLabels){_renderLabel=true}return _chart};_chart.renderLabel=function(renderLabel){if(!arguments.length){return _renderLabel}_renderLabel=renderLabel;return _chart};_chart.title=function(titleFunction){if(!arguments.length){return _title}_title=titleFunction;return _chart};_chart.renderTitle=function(renderTitle){if(!arguments.length){return _renderTitle}_renderTitle=renderTitle;return _chart};_chart.renderlet=dc.logger.deprecate(function(renderletFunction){_chart.on("renderlet."+dc.utils.uniqueId(),renderletFunction);return _chart},'chart.renderlet has been deprecated.  Please use chart.on("renderlet.<renderletKey>", renderletFunction)');_chart.chartGroup=function(chartGroup){if(!arguments.length){return _chartGroup}if(!_isChild){dc.deregisterChart(_chart,_chartGroup)}_chartGroup=chartGroup;if(!_isChild){dc.registerChart(_chart,_chartGroup)}return _chart};_chart.expireCache=function(){return _chart};_chart.legend=function(legend){if(!arguments.length){return _legend}_legend=legend;_legend.parent(_chart);return _chart};_chart.chartID=function(){return _chart.__dcFlag__};_chart.options=function(opts){var applyOptions=["anchor","group","xAxisLabel","yAxisLabel","stack","title","point","getColor","overlayGeoJson"];for(var o in opts){if(typeof _chart[o]==="function"){if(opts[o]instanceof Array&&applyOptions.indexOf(o)!==-1){_chart[o].apply(_chart,opts[o])}else{_chart[o].call(_chart,opts[o])}}else{dc.logger.debug("Not a valid option setter name: "+o)}}return _chart};_chart.on=function(event,listener){_listeners.on(event,listener);return _chart};return _chart};dc.marginMixin=function(_chart){var _margin={top:10,right:50,bottom:30,left:30};_chart.margins=function(margins){if(!arguments.length){return _margin}_margin=margins;return _chart};_chart.effectiveWidth=function(){return _chart.width()-_chart.margins().left-_chart.margins().right};_chart.effectiveHeight=function(){return _chart.height()-_chart.margins().top-_chart.margins().bottom};return _chart};dc.colorMixin=function(_chart){var _colors=d3.scale.category20c();var _defaultAccessor=true;var _colorAccessor=function(d){return _chart.keyAccessor()(d)};_chart.colors=function(colorScale){if(!arguments.length){return _colors}if(colorScale instanceof Array){_colors=d3.scale.quantize().range(colorScale)}else{_colors=d3.functor(colorScale)}return _chart};_chart.ordinalColors=function(r){return _chart.colors(d3.scale.ordinal().range(r))};_chart.linearColors=function(r){return _chart.colors(d3.scale.linear().range(r).interpolate(d3.interpolateHcl))};_chart.colorAccessor=function(colorAccessor){if(!arguments.length){return _colorAccessor}_colorAccessor=colorAccessor;_defaultAccessor=false;return _chart};_chart.defaultColorAccessor=function(){return _defaultAccessor};_chart.colorDomain=function(domain){if(!arguments.length){return _colors.domain()}_colors.domain(domain);return _chart};_chart.calculateColorDomain=function(){var newDomain=[d3.min(_chart.data(),_chart.colorAccessor()),d3.max(_chart.data(),_chart.colorAccessor())];_colors.domain(newDomain);return _chart};_chart.getColor=function(d,i){return _colors(_colorAccessor.call(this,d,i))};_chart.colorCalculator=dc.logger.deprecate(function(colorCalculator){if(!arguments.length){return _chart.getColor}_chart.getColor=colorCalculator;return _chart},"colorMixin.colorCalculator has been deprecated. Please colorMixin.colors and colorMixin.colorAccessor instead");return _chart};dc.coordinateGridMixin=function(_chart){var GRID_LINE_CLASS="grid-line";var HORIZONTAL_CLASS="horizontal";var VERTICAL_CLASS="vertical";var Y_AXIS_LABEL_CLASS="y-axis-label";var X_AXIS_LABEL_CLASS="x-axis-label";var DEFAULT_AXIS_LABEL_PADDING=12;_chart=dc.colorMixin(dc.marginMixin(dc.baseMixin(_chart)));_chart.colors(d3.scale.category10());_chart._mandatoryAttributes().push("x");var _parent;var _g;var _chartBodyG;var _x;var _xOriginalDomain;var _xAxis=d3.svg.axis().orient("bottom");var _xUnits=dc.units.integers;var _xAxisPadding=0;var _xAxisPaddingUnit="day";var _xElasticity=false;var _xAxisLabel;var _xAxisLabelPadding=0;var _lastXDomain;var _y;var _yAxis=d3.svg.axis().orient("left");var _yAxisPadding=0;var _yElasticity=false;var _yAxisLabel;var _yAxisLabelPadding=0;var _brush=d3.svg.brush();var _brushOn=true;var _round;var _renderHorizontalGridLine=false;var _renderVerticalGridLine=false;var _refocused=false,_resizing=false;var _unitCount;var _zoomScale=[1,Infinity];var _zoomOutRestrict=true;var _zoom=d3.behavior.zoom().on("zoom",zoomHandler);var _nullZoom=d3.behavior.zoom().on("zoom",null);var _hasBeenMouseZoomable=false;var _rangeChart;var _focusChart;var _mouseZoomable=false;var _clipPadding=0;var _outerRangeBandPadding=.5;var _rangeBandPadding=0;var _useRightYAxis=false;_chart.rescale=function(){_unitCount=undefined;_resizing=true;return _chart};_chart.resizing=function(){return _resizing};_chart.rangeChart=function(rangeChart){if(!arguments.length){return _rangeChart}_rangeChart=rangeChart;_rangeChart.focusChart(_chart);return _chart};_chart.zoomScale=function(extent){if(!arguments.length){return _zoomScale}_zoomScale=extent;return _chart};_chart.zoomOutRestrict=function(zoomOutRestrict){if(!arguments.length){return _zoomOutRestrict}_zoomScale[0]=zoomOutRestrict?1:0;_zoomOutRestrict=zoomOutRestrict;return _chart};_chart._generateG=function(parent){if(parent===undefined){_parent=_chart.svg()}else{_parent=parent}var href=window.location.href.split("#")[0];_g=_parent.append("g");_chartBodyG=_g.append("g").attr("class","chart-body").attr("transform","translate("+_chart.margins().left+", "+_chart.margins().top+")").attr("clip-path","url("+href+"#"+getClipPathId()+")");return _g};_chart.g=function(gElement){if(!arguments.length){return _g}_g=gElement;return _chart};_chart.mouseZoomable=function(mouseZoomable){if(!arguments.length){return _mouseZoomable}_mouseZoomable=mouseZoomable;return _chart};_chart.chartBodyG=function(chartBodyG){if(!arguments.length){return _chartBodyG}_chartBodyG=chartBodyG;return _chart};_chart.x=function(xScale){if(!arguments.length){return _x}_x=xScale;_xOriginalDomain=_x.domain();_chart.rescale();return _chart};_chart.xOriginalDomain=function(){return _xOriginalDomain};_chart.xUnits=function(xUnits){if(!arguments.length){return _xUnits}_xUnits=xUnits;return _chart};_chart.xAxis=function(xAxis){if(!arguments.length){return _xAxis}_xAxis=xAxis;return _chart};_chart.elasticX=function(elasticX){if(!arguments.length){return _xElasticity}_xElasticity=elasticX;return _chart};_chart.xAxisPadding=function(padding){if(!arguments.length){return _xAxisPadding}_xAxisPadding=padding;return _chart};_chart.xAxisPaddingUnit=function(unit){if(!arguments.length){return _xAxisPaddingUnit}_xAxisPaddingUnit=unit;return _chart};_chart.xUnitCount=function(){if(_unitCount===undefined){var units=_chart.xUnits()(_chart.x().domain()[0],_chart.x().domain()[1],_chart.x().domain());if(units instanceof Array){_unitCount=units.length}else{_unitCount=units}}return _unitCount};_chart.useRightYAxis=function(useRightYAxis){if(!arguments.length){return _useRightYAxis}_useRightYAxis=useRightYAxis;return _chart};_chart.isOrdinal=function(){return _chart.xUnits()===dc.units.ordinal};_chart._useOuterPadding=function(){return true};_chart._ordinalXDomain=function(){var groups=_chart._computeOrderedGroups(_chart.data());return groups.map(_chart.keyAccessor())};function compareDomains(d1,d2){return!d1||!d2||d1.length!==d2.length||d1.some(function(elem,i){return elem&&d2[i]?elem.toString()!==d2[i].toString():elem===d2[i]})}function prepareXAxis(g,render){if(!_chart.isOrdinal()){if(_chart.elasticX()){_x.domain([_chart.xAxisMin(),_chart.xAxisMax()])}}else{if(_chart.elasticX()||_x.domain().length===0){_x.domain(_chart._ordinalXDomain())}}var xdom=_x.domain();if(render||compareDomains(_lastXDomain,xdom)){_chart.rescale()}_lastXDomain=xdom;if(_chart.isOrdinal()){_x.rangeBands([0,_chart.xAxisLength()],_rangeBandPadding,_chart._useOuterPadding()?_outerRangeBandPadding:0)}else{_x.range([0,_chart.xAxisLength()])}_xAxis=_xAxis.scale(_chart.x());renderVerticalGridLines(g)}_chart.renderXAxis=function(g){var axisXG=g.select("g.x");if(axisXG.empty()){axisXG=g.append("g").attr("class","axis x").attr("transform","translate("+_chart.margins().left+","+_chart._xAxisY()+")")}var axisXLab=g.select("text."+X_AXIS_LABEL_CLASS);if(axisXLab.empty()&&_chart.xAxisLabel()){axisXLab=g.append("text").attr("class",X_AXIS_LABEL_CLASS).attr("transform","translate("+(_chart.margins().left+_chart.xAxisLength()/2)+","+(_chart.height()-_xAxisLabelPadding)+")").attr("text-anchor","middle")}if(_chart.xAxisLabel()&&axisXLab.text()!==_chart.xAxisLabel()){axisXLab.text(_chart.xAxisLabel())}dc.transition(axisXG,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform","translate("+_chart.margins().left+","+_chart._xAxisY()+")").call(_xAxis);dc.transition(axisXLab,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform","translate("+(_chart.margins().left+_chart.xAxisLength()/2)+","+(_chart.height()-_xAxisLabelPadding)+")")};function renderVerticalGridLines(g){var gridLineG=g.select("g."+VERTICAL_CLASS);if(_renderVerticalGridLine){if(gridLineG.empty()){gridLineG=g.insert("g",":first-child").attr("class",GRID_LINE_CLASS+" "+VERTICAL_CLASS).attr("transform","translate("+_chart.margins().left+","+_chart.margins().top+")")}var ticks=_xAxis.tickValues()?_xAxis.tickValues():typeof _x.ticks==="function"?_x.ticks(_xAxis.ticks()[0]):_x.domain();var lines=gridLineG.selectAll("line").data(ticks);var linesGEnter=lines.enter().append("line").attr("x1",function(d){return _x(d)}).attr("y1",_chart._xAxisY()-_chart.margins().top).attr("x2",function(d){return _x(d)}).attr("y2",0).attr("opacity",0);dc.transition(linesGEnter,_chart.transitionDuration(),_chart.transitionDelay()).attr("opacity",1);dc.transition(lines,_chart.transitionDuration(),_chart.transitionDelay()).attr("x1",function(d){return _x(d)}).attr("y1",_chart._xAxisY()-_chart.margins().top).attr("x2",function(d){return _x(d)}).attr("y2",0);lines.exit().remove()}else{gridLineG.selectAll("line").remove()}}_chart._xAxisY=function(){return _chart.height()-_chart.margins().bottom};_chart.xAxisLength=function(){return _chart.effectiveWidth()};_chart.xAxisLabel=function(labelText,padding){if(!arguments.length){return _xAxisLabel}_xAxisLabel=labelText;_chart.margins().bottom-=_xAxisLabelPadding;_xAxisLabelPadding=padding===undefined?DEFAULT_AXIS_LABEL_PADDING:padding;_chart.margins().bottom+=_xAxisLabelPadding;return _chart};_chart._prepareYAxis=function(g){if(_y===undefined||_chart.elasticY()){if(_y===undefined){_y=d3.scale.linear()}var min=_chart.yAxisMin()||0,max=_chart.yAxisMax()||0;_y.domain([min,max]).rangeRound([_chart.yAxisHeight(),0])}_y.range([_chart.yAxisHeight(),0]);_yAxis=_yAxis.scale(_y);if(_useRightYAxis){_yAxis.orient("right")}_chart._renderHorizontalGridLinesForAxis(g,_y,_yAxis)};_chart.renderYAxisLabel=function(axisClass,text,rotation,labelXPosition){labelXPosition=labelXPosition||_yAxisLabelPadding;var axisYLab=_chart.g().select("text."+Y_AXIS_LABEL_CLASS+"."+axisClass+"-label");var labelYPosition=_chart.margins().top+_chart.yAxisHeight()/2;if(axisYLab.empty()&&text){axisYLab=_chart.g().append("text").attr("transform","translate("+labelXPosition+","+labelYPosition+"),rotate("+rotation+")").attr("class",Y_AXIS_LABEL_CLASS+" "+axisClass+"-label").attr("text-anchor","middle").text(text)}if(text&&axisYLab.text()!==text){axisYLab.text(text)}dc.transition(axisYLab,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform","translate("+labelXPosition+","+labelYPosition+"),rotate("+rotation+")")};_chart.renderYAxisAt=function(axisClass,axis,position){var axisYG=_chart.g().select("g."+axisClass);if(axisYG.empty()){axisYG=_chart.g().append("g").attr("class","axis "+axisClass).attr("transform","translate("+position+","+_chart.margins().top+")")}dc.transition(axisYG,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform","translate("+position+","+_chart.margins().top+")").call(axis)};_chart.renderYAxis=function(){var axisPosition=_useRightYAxis?_chart.width()-_chart.margins().right:_chart._yAxisX();_chart.renderYAxisAt("y",_yAxis,axisPosition);var labelPosition=_useRightYAxis?_chart.width()-_yAxisLabelPadding:_yAxisLabelPadding;var rotation=_useRightYAxis?90:-90;_chart.renderYAxisLabel("y",_chart.yAxisLabel(),rotation,labelPosition)};_chart._renderHorizontalGridLinesForAxis=function(g,scale,axis){var gridLineG=g.select("g."+HORIZONTAL_CLASS);if(_renderHorizontalGridLine){var ticks=axis.tickValues()?axis.tickValues():scale.ticks(axis.ticks()[0]);if(gridLineG.empty()){gridLineG=g.insert("g",":first-child").attr("class",GRID_LINE_CLASS+" "+HORIZONTAL_CLASS).attr("transform","translate("+_chart.margins().left+","+_chart.margins().top+")")}var lines=gridLineG.selectAll("line").data(ticks);var linesGEnter=lines.enter().append("line").attr("x1",1).attr("y1",function(d){return scale(d)}).attr("x2",_chart.xAxisLength()).attr("y2",function(d){return scale(d)}).attr("opacity",0);dc.transition(linesGEnter,_chart.transitionDuration(),_chart.transitionDelay()).attr("opacity",1);dc.transition(lines,_chart.transitionDuration(),_chart.transitionDelay()).attr("x1",1).attr("y1",function(d){return scale(d)}).attr("x2",_chart.xAxisLength()).attr("y2",function(d){return scale(d)});lines.exit().remove()}else{gridLineG.selectAll("line").remove()}};_chart._yAxisX=function(){return _chart.useRightYAxis()?_chart.width()-_chart.margins().right:_chart.margins().left};_chart.yAxisLabel=function(labelText,padding){if(!arguments.length){return _yAxisLabel}_yAxisLabel=labelText;_chart.margins().left-=_yAxisLabelPadding;_yAxisLabelPadding=padding===undefined?DEFAULT_AXIS_LABEL_PADDING:padding;_chart.margins().left+=_yAxisLabelPadding;return _chart};_chart.y=function(yScale){if(!arguments.length){return _y}_y=yScale;_chart.rescale();return _chart};_chart.yAxis=function(yAxis){if(!arguments.length){return _yAxis}_yAxis=yAxis;return _chart};_chart.elasticY=function(elasticY){if(!arguments.length){return _yElasticity}_yElasticity=elasticY;return _chart};_chart.renderHorizontalGridLines=function(renderHorizontalGridLines){if(!arguments.length){return _renderHorizontalGridLine}_renderHorizontalGridLine=renderHorizontalGridLines;return _chart};_chart.renderVerticalGridLines=function(renderVerticalGridLines){if(!arguments.length){return _renderVerticalGridLine}_renderVerticalGridLine=renderVerticalGridLines;return _chart};_chart.xAxisMin=function(){var min=d3.min(_chart.data(),function(e){return _chart.keyAccessor()(e)});return dc.utils.subtract(min,_xAxisPadding,_xAxisPaddingUnit)};_chart.xAxisMax=function(){var max=d3.max(_chart.data(),function(e){return _chart.keyAccessor()(e)});return dc.utils.add(max,_xAxisPadding,_xAxisPaddingUnit)};_chart.yAxisMin=function(){var min=d3.min(_chart.data(),function(e){return _chart.valueAccessor()(e)});return dc.utils.subtract(min,_yAxisPadding)};_chart.yAxisMax=function(){var max=d3.max(_chart.data(),function(e){return _chart.valueAccessor()(e)});return dc.utils.add(max,_yAxisPadding)};_chart.yAxisPadding=function(padding){if(!arguments.length){return _yAxisPadding}_yAxisPadding=padding;return _chart};_chart.yAxisHeight=function(){return _chart.effectiveHeight()};_chart.round=function(round){if(!arguments.length){return _round}_round=round;return _chart};_chart._rangeBandPadding=function(_){if(!arguments.length){return _rangeBandPadding}_rangeBandPadding=_;return _chart};_chart._outerRangeBandPadding=function(_){if(!arguments.length){return _outerRangeBandPadding}_outerRangeBandPadding=_;return _chart};dc.override(_chart,"filter",function(_){if(!arguments.length){return _chart._filter()}_chart._filter(_);if(_){_chart.brush().extent(_)}else{_chart.brush().clear()}return _chart});_chart.brush=function(_){if(!arguments.length){return _brush}_brush=_;return _chart};function brushHeight(){return _chart._xAxisY()-_chart.margins().top}_chart.renderBrush=function(g){if(_brushOn){_brush.on("brush",_chart._brushing);_brush.on("brushstart",_chart._disableMouseZoom);_brush.on("brushend",configureMouseZoom);var gBrush=g.append("g").attr("class","brush").attr("transform","translate("+_chart.margins().left+","+_chart.margins().top+")").call(_brush.x(_chart.x()));_chart.setBrushY(gBrush,false);_chart.setHandlePaths(gBrush);if(_chart.hasFilter()){_chart.redrawBrush(g,false)}}};_chart.setHandlePaths=function(gBrush){gBrush.selectAll(".resize").append("path").attr("d",_chart.resizeHandlePath)};_chart.setBrushY=function(gBrush){gBrush.selectAll("rect").attr("height",brushHeight());gBrush.selectAll(".resize path").attr("d",_chart.resizeHandlePath)};_chart.extendBrush=function(){var extent=_brush.extent();if(_chart.round()){extent[0]=extent.map(_chart.round())[0];extent[1]=extent.map(_chart.round())[1];_g.select(".brush").call(_brush.extent(extent))}return extent};_chart.brushIsEmpty=function(extent){return _brush.empty()||!extent||extent[1]<=extent[0]};_chart._brushing=function(){var extent=_chart.extendBrush();_chart.redrawBrush(_g,false);if(_chart.brushIsEmpty(extent)){dc.events.trigger(function(){_chart.filter(null);_chart.redrawGroup()},dc.constants.EVENT_DELAY)}else{var rangedFilter=dc.filters.RangedFilter(extent[0],extent[1]);dc.events.trigger(function(){_chart.replaceFilter(rangedFilter);_chart.redrawGroup()},dc.constants.EVENT_DELAY)}};_chart.redrawBrush=function(g,doTransition){if(_brushOn){if(_chart.filter()&&_chart.brush().empty()){_chart.brush().extent(_chart.filter())}var gBrush=dc.optionalTransition(doTransition,_chart.transitionDuration(),_chart.transitionDelay())(g.select("g.brush"));_chart.setBrushY(gBrush);gBrush.call(_chart.brush().x(_chart.x()).extent(_chart.brush().extent()))}_chart.fadeDeselectedArea()};_chart.fadeDeselectedArea=function(){};_chart.resizeHandlePath=function(d){var e=+(d==="e"),x=e?1:-1,y=brushHeight()/3;return"M"+.5*x+","+y+"A6,6 0 0 "+e+" "+6.5*x+","+(y+6)+"V"+(2*y-6)+"A6,6 0 0 "+e+" "+.5*x+","+2*y+"Z"+"M"+2.5*x+","+(y+8)+"V"+(2*y-8)+"M"+4.5*x+","+(y+8)+"V"+(2*y-8)};function getClipPathId(){return _chart.anchorName().replace(/[ .#=\[\]"]/g,"-")+"-clip"}_chart.clipPadding=function(padding){if(!arguments.length){return _clipPadding}_clipPadding=padding;return _chart};function generateClipPath(){var defs=dc.utils.appendOrSelect(_parent,"defs");var id=getClipPathId();var chartBodyClip=dc.utils.appendOrSelect(defs,"#"+id,"clipPath").attr("id",id);var padding=_clipPadding*2;dc.utils.appendOrSelect(chartBodyClip,"rect").attr("width",_chart.xAxisLength()+padding).attr("height",_chart.yAxisHeight()+padding).attr("transform","translate(-"+_clipPadding+", -"+_clipPadding+")")}_chart._preprocessData=function(){};_chart._doRender=function(){_chart.resetSvg();_chart._preprocessData();_chart._generateG();generateClipPath();drawChart(true);configureMouseZoom();return _chart};_chart._doRedraw=function(){_chart._preprocessData();drawChart(false);generateClipPath();return _chart};function drawChart(render){if(_chart.isOrdinal()){_brushOn=false}prepareXAxis(_chart.g(),render);_chart._prepareYAxis(_chart.g());_chart.plotData();if(_chart.elasticX()||_resizing||render){_chart.renderXAxis(_chart.g())}if(_chart.elasticY()||_resizing||render){_chart.renderYAxis(_chart.g())}if(render){_chart.renderBrush(_chart.g(),false)}else{_chart.redrawBrush(_chart.g(),_resizing)}_chart.fadeDeselectedArea();_resizing=false}function configureMouseZoom(){if(_mouseZoomable){_chart._enableMouseZoom()}else if(_hasBeenMouseZoomable){_chart._disableMouseZoom()}}_chart._enableMouseZoom=function(){_hasBeenMouseZoomable=true;_zoom.x(_chart.x()).scaleExtent(_zoomScale).size([_chart.width(),_chart.height()]).duration(_chart.transitionDuration());_chart.root().call(_zoom)};_chart._disableMouseZoom=function(){_chart.root().call(_nullZoom)};function zoomHandler(){_refocused=true;if(_zoomOutRestrict){var constraint=_xOriginalDomain;if(_rangeChart){constraint=intersectExtents(constraint,_rangeChart.x().domain())}var constrained=constrainExtent(_chart.x().domain(),constraint);if(constrained){_chart.x().domain(constrained)}}var domain=_chart.x().domain();var domFilter=dc.filters.RangedFilter(domain[0],domain[1]);_chart.replaceFilter(domFilter);_chart.rescale();_chart.redraw();if(_rangeChart&&!rangesEqual(_chart.filter(),_rangeChart.filter())){dc.events.trigger(function(){_rangeChart.replaceFilter(domFilter);_rangeChart.redraw()})}_chart._invokeZoomedListener();dc.events.trigger(function(){_chart.redrawGroup()},dc.constants.EVENT_DELAY);_refocused=!rangesEqual(domain,_xOriginalDomain)}function intersectExtents(ext1,ext2){if(ext1[0]>ext2[1]||ext1[1]<ext2[0]){console.warn("could not intersect extents")}return[Math.max(ext1[0],ext2[0]),Math.min(ext1[1],ext2[1])]}function constrainExtent(extent,constraint){var size=extent[1]-extent[0];if(extent[0]<constraint[0]){return[constraint[0],Math.min(constraint[1],dc.utils.add(constraint[0],size,"millis"))]}else if(extent[1]>constraint[1]){return[Math.max(constraint[0],dc.utils.subtract(constraint[1],size,"millis")),constraint[1]]}else{return null}}_chart.focus=function(range){if(hasRangeSelected(range)){_chart.x().domain(range)}else{_chart.x().domain(_xOriginalDomain)}_zoom.x(_chart.x());zoomHandler()};_chart.refocused=function(){return _refocused};_chart.focusChart=function(c){if(!arguments.length){return _focusChart}_focusChart=c;_chart.on("filtered",function(chart){if(!chart.filter()){dc.events.trigger(function(){_focusChart.x().domain(_focusChart.xOriginalDomain())})}else if(!rangesEqual(chart.filter(),_focusChart.filter())){dc.events.trigger(function(){_focusChart.focus(chart.filter())})}});return _chart};function rangesEqual(range1,range2){if(!range1&&!range2){return true}else if(!range1||!range2){return false}else if(range1.length===0&&range2.length===0){return true}else if(range1[0].valueOf()===range2[0].valueOf()&&range1[1].valueOf()===range2[1].valueOf()){return true}return false}_chart.brushOn=function(brushOn){if(!arguments.length){return _brushOn}_brushOn=brushOn;return _chart};function hasRangeSelected(range){return range instanceof Array&&range.length>1}return _chart};dc.stackMixin=function(_chart){function prepareValues(layer,layerIdx){var valAccessor=layer.accessor||_chart.valueAccessor();layer.name=String(layer.name||layerIdx);layer.values=layer.group.all().map(function(d,i){return{x:_chart.keyAccessor()(d,i),y:layer.hidden?null:valAccessor(d,i),data:d,layer:layer.name,hidden:layer.hidden}});layer.values=layer.values.filter(domainFilter());return layer.values}var _stackLayout=d3.layout.stack().values(prepareValues);var _stack=[];var _titles={};var _hidableStacks=false;var _evadeDomainFilter=false;function domainFilter(){if(!_chart.x()||_evadeDomainFilter){return d3.functor(true)}var xDomain=_chart.x().domain();if(_chart.isOrdinal()){return function(){return true}}if(_chart.elasticX()){return function(){return true}}return function(p){return p.x>=xDomain[0]&&p.x<=xDomain[xDomain.length-1]}}_chart.stack=function(group,name,accessor){if(!arguments.length){return _stack}if(arguments.length<=2){accessor=name}var layer={group:group};if(typeof name==="string"){layer.name=name}if(typeof accessor==="function"){layer.accessor=accessor}_stack.push(layer);return _chart};dc.override(_chart,"group",function(g,n,f){if(!arguments.length){return _chart._group()}_stack=[];_titles={};_chart.stack(g,n);if(f){_chart.valueAccessor(f)}return _chart._group(g,n)});_chart.hidableStacks=function(hidableStacks){if(!arguments.length){return _hidableStacks}_hidableStacks=hidableStacks;return _chart};function findLayerByName(n){var i=_stack.map(dc.pluck("name")).indexOf(n);return _stack[i]}_chart.hideStack=function(stackName){var layer=findLayerByName(stackName);if(layer){layer.hidden=true}return _chart};_chart.showStack=function(stackName){var layer=findLayerByName(stackName);if(layer){layer.hidden=false}return _chart};_chart.getValueAccessorByIndex=function(index){return _stack[index].accessor||_chart.valueAccessor()};_chart.yAxisMin=function(){var min=d3.min(flattenStack(),function(p){return p.y<0?p.y+p.y0:p.y0});return dc.utils.subtract(min,_chart.yAxisPadding())};_chart.yAxisMax=function(){var max=d3.max(flattenStack(),function(p){return p.y>0?p.y+p.y0:p.y0});return dc.utils.add(max,_chart.yAxisPadding())};function flattenStack(){var valueses=_chart.data().map(function(layer){return layer.values});return Array.prototype.concat.apply([],valueses)}_chart.xAxisMin=function(){var min=d3.min(flattenStack(),dc.pluck("x"));return dc.utils.subtract(min,_chart.xAxisPadding(),_chart.xAxisPaddingUnit())};_chart.xAxisMax=function(){var max=d3.max(flattenStack(),dc.pluck("x"));return dc.utils.add(max,_chart.xAxisPadding(),_chart.xAxisPaddingUnit())};dc.override(_chart,"title",function(stackName,titleAccessor){if(!stackName){return _chart._title()}if(typeof stackName==="function"){return _chart._title(stackName)}if(stackName===_chart._groupName&&typeof titleAccessor==="function"){return _chart._title(titleAccessor)}if(typeof titleAccessor!=="function"){return _titles[stackName]||_chart._title()}_titles[stackName]=titleAccessor;return _chart});_chart.stackLayout=function(stack){if(!arguments.length){return _stackLayout}_stackLayout=stack;if(_stackLayout.values()===d3.layout.stack().values()){_stackLayout.values(prepareValues)}return _chart};_chart.evadeDomainFilter=function(evadeDomainFilter){if(!arguments.length){return _evadeDomainFilter}_evadeDomainFilter=evadeDomainFilter;return _chart};function visability(l){return!l.hidden}_chart.data(function(){var layers=_stack.filter(visability);return layers.length?_chart.stackLayout()(layers):[]});_chart._ordinalXDomain=function(){var flat=flattenStack().map(dc.pluck("data"));var ordered=_chart._computeOrderedGroups(flat);return ordered.map(_chart.keyAccessor())};_chart.colorAccessor(function(d){var layer=this.layer||this.name||d.name||d.layer;return layer});_chart.legendables=function(){return _stack.map(function(layer,i){return{chart:_chart,name:layer.name,hidden:layer.hidden||false,color:_chart.getColor.call(layer,layer.values,i)}})};_chart.isLegendableHidden=function(d){var layer=findLayerByName(d.name);return layer?layer.hidden:false};_chart.legendToggle=function(d){if(_hidableStacks){if(_chart.isLegendableHidden(d)){_chart.showStack(d.name)}else{_chart.hideStack(d.name)}_chart.renderGroup()}};return _chart};dc.capMixin=function(_chart){var _cap=Infinity,_takeFront=true;var _othersLabel="Others";_chart.ordering(function(kv){return-kv.value});var _othersGrouper=function(topItems,restItems){var restItemsSum=d3.sum(restItems,_chart.valueAccessor()),restKeys=restItems.map(_chart.keyAccessor());if(restItemsSum>0){return topItems.concat([{others:restKeys,key:_chart.othersLabel(),value:restItemsSum}])}return topItems};_chart.cappedKeyAccessor=function(d,i){if(d.others){return d.key}return _chart.keyAccessor()(d,i)};_chart.cappedValueAccessor=function(d,i){if(d.others){return d.value}return _chart.valueAccessor()(d,i)};_chart.data(function(group){if(_cap===Infinity){return _chart._computeOrderedGroups(group.all())}else{var items=group.all(),rest;items=_chart._computeOrderedGroups(items);if(_cap){if(_takeFront){rest=items.slice(_cap);items=items.slice(0,_cap)}else{var start=Math.max(0,items.length-_cap);rest=items.slice(0,start);items=items.slice(start)}}if(_othersGrouper){return _othersGrouper(items,rest)}return items}});_chart.cap=function(count){if(!arguments.length){return _cap}_cap=count;return _chart};_chart.takeFront=function(takeFront){if(!arguments.length){return _takeFront}_takeFront=takeFront;return _chart};_chart.othersLabel=function(label){if(!arguments.length){return _othersLabel}_othersLabel=label;return _chart};_chart.othersGrouper=function(grouperFunction){if(!arguments.length){return _othersGrouper}_othersGrouper=grouperFunction;return _chart};dc.override(_chart,"onClick",function(d){if(d.others){_chart.filter([d.others])}_chart._onClick(d)});return _chart};dc.bubbleMixin=function(_chart){var _maxBubbleRelativeSize=.3;var _minRadiusWithLabel=10;var _sortBubbleSize=false;var _elasticRadius=false;_chart.BUBBLE_NODE_CLASS="node";_chart.BUBBLE_CLASS="bubble";_chart.MIN_RADIUS=10;_chart=dc.colorMixin(_chart);_chart.renderLabel(true);_chart.data(function(group){var data=group.all();if(_sortBubbleSize){var radiusAccessor=_chart.radiusValueAccessor();data.sort(function(a,b){return d3.descending(radiusAccessor(a),radiusAccessor(b))})}return data});var _r=d3.scale.linear().domain([0,100]);var _rValueAccessor=function(d){return d.r};_chart.r=function(bubbleRadiusScale){if(!arguments.length){return _r}_r=bubbleRadiusScale;return _chart};_chart.elasticRadius=function(elasticRadius){if(!arguments.length){return _elasticRadius}_elasticRadius=elasticRadius;return _chart};_chart.calculateRadiusDomain=function(){if(_elasticRadius){_chart.r().domain([_chart.rMin(),_chart.rMax()])}};_chart.radiusValueAccessor=function(radiusValueAccessor){if(!arguments.length){return _rValueAccessor}_rValueAccessor=radiusValueAccessor;return _chart};_chart.rMin=function(){var min=d3.min(_chart.data(),function(e){return _chart.radiusValueAccessor()(e)});return min};_chart.rMax=function(){var max=d3.max(_chart.data(),function(e){return _chart.radiusValueAccessor()(e)});return max};_chart.bubbleR=function(d){var value=_chart.radiusValueAccessor()(d);var r=_chart.r()(value);if(isNaN(r)||value<=0){r=0}return r};var labelFunction=function(d){return _chart.label()(d)};var shouldLabel=function(d){return _chart.bubbleR(d)>_minRadiusWithLabel};var labelOpacity=function(d){return shouldLabel(d)?1:0};var labelPointerEvent=function(d){return shouldLabel(d)?"all":"none"};_chart._doRenderLabel=function(bubbleGEnter){if(_chart.renderLabel()){var label=bubbleGEnter.select("text");if(label.empty()){label=bubbleGEnter.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",_chart.onClick)}label.attr("opacity",0).attr("pointer-events",labelPointerEvent).text(labelFunction);dc.transition(label,_chart.transitionDuration(),_chart.transitionDelay()).attr("opacity",labelOpacity)}};_chart.doUpdateLabels=function(bubbleGEnter){if(_chart.renderLabel()){var labels=bubbleGEnter.select("text").attr("pointer-events",labelPointerEvent).text(labelFunction);dc.transition(labels,_chart.transitionDuration(),_chart.transitionDelay()).attr("opacity",labelOpacity)}};var titleFunction=function(d){return _chart.title()(d)};_chart._doRenderTitles=function(g){if(_chart.renderTitle()){var title=g.select("title");if(title.empty()){g.append("title").text(titleFunction)}}};_chart.doUpdateTitles=function(g){if(_chart.renderTitle()){g.select("title").text(titleFunction)}};_chart.sortBubbleSize=function(sortBubbleSize){if(!arguments.length){return _sortBubbleSize}_sortBubbleSize=sortBubbleSize;return _chart};_chart.minRadius=function(radius){if(!arguments.length){return _chart.MIN_RADIUS}_chart.MIN_RADIUS=radius;return _chart};_chart.minRadiusWithLabel=function(radius){if(!arguments.length){return _minRadiusWithLabel}_minRadiusWithLabel=radius;return _chart};_chart.maxBubbleRelativeSize=function(relativeSize){if(!arguments.length){return _maxBubbleRelativeSize}_maxBubbleRelativeSize=relativeSize;return _chart};_chart.fadeDeselectedArea=function(){if(_chart.hasFilter()){_chart.selectAll("g."+_chart.BUBBLE_NODE_CLASS).each(function(d){if(_chart.isSelectedNode(d)){_chart.highlightSelected(this)}else{_chart.fadeDeselected(this)}})}else{_chart.selectAll("g."+_chart.BUBBLE_NODE_CLASS).each(function(){_chart.resetHighlight(this)})}};_chart.isSelectedNode=function(d){return _chart.hasFilter(d.key)};_chart.onClick=function(d){var filter=d.key;dc.events.trigger(function(){_chart.filter(filter);_chart.redrawGroup()})};return _chart};dc.pieChart=function(parent,chartGroup){var DEFAULT_MIN_ANGLE_FOR_LABEL=.5;var _sliceCssClass="pie-slice";var _labelCssClass="pie-label";var _sliceGroupCssClass="pie-slice-group";var _labelGroupCssClass="pie-label-group";var _emptyCssClass="empty-chart";var _emptyTitle="empty";var _radius,_givenRadius,_innerRadius=0,_externalRadiusPadding=0;var _g;var _cx;var _cy;var _minAngleForLabel=DEFAULT_MIN_ANGLE_FOR_LABEL;var _externalLabelRadius;var _drawPaths=false;var _chart=dc.capMixin(dc.colorMixin(dc.baseMixin({})));_chart.colorAccessor(_chart.cappedKeyAccessor);_chart.title(function(d){return _chart.cappedKeyAccessor(d)+": "+_chart.cappedValueAccessor(d)});_chart.slicesCap=_chart.cap;_chart.label(_chart.cappedKeyAccessor);_chart.renderLabel(true);_chart.transitionDuration(350);_chart.transitionDelay(0);_chart._doRender=function(){_chart.resetSvg();_g=_chart.svg().append("g").attr("transform","translate("+_chart.cx()+","+_chart.cy()+")");_g.append("g").attr("class",_sliceGroupCssClass);_g.append("g").attr("class",_labelGroupCssClass);drawChart();return _chart};function drawChart(){var maxRadius=d3.min([_chart.width(),_chart.height()])/2;_radius=_givenRadius&&_givenRadius<maxRadius?_givenRadius:maxRadius;var arc=buildArcs();var pie=pieLayout();var pieData;if(d3.sum(_chart.data(),_chart.valueAccessor())){pieData=pie(_chart.data());_g.classed(_emptyCssClass,false)}else{pieData=pie([{key:_emptyTitle,value:1,others:[_emptyTitle]}]);_g.classed(_emptyCssClass,true)}if(_g){var slices=_g.select("g."+_sliceGroupCssClass).selectAll("g."+_sliceCssClass).data(pieData);var labels=_g.select("g."+_labelGroupCssClass).selectAll("text."+_labelCssClass).data(pieData);createElements(slices,labels,arc,pieData);updateElements(pieData,arc);removeElements(slices,labels);highlightFilter();dc.transition(_g,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform","translate("+_chart.cx()+","+_chart.cy()+")")}}function createElements(slices,labels,arc,pieData){var slicesEnter=createSliceNodes(slices);createSlicePath(slicesEnter,arc);createTitles(slicesEnter);createLabels(labels,pieData,arc)}function createSliceNodes(slices){var slicesEnter=slices.enter().append("g").attr("class",function(d,i){return _sliceCssClass+" _"+i});return slicesEnter}function createSlicePath(slicesEnter,arc){var slicePath=slicesEnter.append("path").attr("fill",fill).on("click",onClick).attr("d",function(d,i){return safeArc(d,i,arc)});var transition=dc.transition(slicePath,_chart.transitionDuration(),_chart.transitionDelay());if(transition.attrTween){transition.attrTween("d",tweenPie)}}function createTitles(slicesEnter){if(_chart.renderTitle()){slicesEnter.append("title").text(function(d){return _chart.title()(d.data)})}}_chart._applyLabelText=function(labels){labels.text(function(d){var data=d.data;if((sliceHasNoData(data)||sliceTooSmall(d))&&!isSelectedSlice(d)){return""}return _chart.label()(d.data)})};function positionLabels(labels,arc){_chart._applyLabelText(labels);dc.transition(labels,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform",function(d){return labelPosition(d,arc)}).attr("text-anchor","middle")}function highlightSlice(i,whether){_chart.select("g.pie-slice._"+i).classed("highlight",whether)}function createLabels(labels,pieData,arc){if(_chart.renderLabel()){var labelsEnter=labels.enter().append("text").attr("class",function(d,i){var classes=_sliceCssClass+" "+_labelCssClass+" _"+i;if(_externalLabelRadius){classes+=" external"}return classes}).on("click",onClick).on("mouseover",function(d,i){highlightSlice(i,true)}).on("mouseout",function(d,i){highlightSlice(i,false)});positionLabels(labelsEnter,arc);if(_externalLabelRadius&&_drawPaths){updateLabelPaths(pieData,arc)}}}function updateLabelPaths(pieData,arc){var polyline=_g.selectAll("polyline."+_sliceCssClass).data(pieData);polyline.enter().append("polyline").attr("class",function(d,i){return"pie-path _"+i+" "+_sliceCssClass}).on("click",onClick).on("mouseover",function(d,i){highlightSlice(i,true)}).on("mouseout",function(d,i){highlightSlice(i,false)});polyline.exit().remove();var arc2=d3.svg.arc().outerRadius(_radius-_externalRadiusPadding+_externalLabelRadius).innerRadius(_radius-_externalRadiusPadding);var transition=dc.transition(polyline,_chart.transitionDuration(),_chart.transitionDelay());if(transition.attrTween){transition.attrTween("points",function(d){var current=this._current||d;current={startAngle:current.startAngle,endAngle:current.endAngle};var interpolate=d3.interpolate(current,d);this._current=interpolate(0);return function(t){var d2=interpolate(t);return[arc.centroid(d2),arc2.centroid(d2)]}})}else{transition.attr("points",function(d){return[arc.centroid(d),arc2.centroid(d)]})}transition.style("visibility",function(d){return d.endAngle-d.startAngle<1e-4?"hidden":"visible"})}function updateElements(pieData,arc){updateSlicePaths(pieData,arc);updateLabels(pieData,arc);updateTitles(pieData)}function updateSlicePaths(pieData,arc){var slicePaths=_g.selectAll("g."+_sliceCssClass).data(pieData).select("path").attr("d",function(d,i){return safeArc(d,i,arc)});var transition=dc.transition(slicePaths,_chart.transitionDuration(),_chart.transitionDelay());if(transition.attrTween){transition.attrTween("d",tweenPie)}transition.attr("fill",fill)}function updateLabels(pieData,arc){if(_chart.renderLabel()){var labels=_g.selectAll("text."+_labelCssClass).data(pieData);positionLabels(labels,arc);if(_externalLabelRadius&&_drawPaths){updateLabelPaths(pieData,arc)}}}function updateTitles(pieData){if(_chart.renderTitle()){_g.selectAll("g."+_sliceCssClass).data(pieData).select("title").text(function(d){return _chart.title()(d.data)})}}function removeElements(slices,labels){slices.exit().remove();labels.exit().remove()}function highlightFilter(){if(_chart.hasFilter()){_chart.selectAll("g."+_sliceCssClass).each(function(d){if(isSelectedSlice(d)){_chart.highlightSelected(this)}else{_chart.fadeDeselected(this)}})}else{_chart.selectAll("g."+_sliceCssClass).each(function(){_chart.resetHighlight(this)})}}_chart.externalRadiusPadding=function(externalRadiusPadding){if(!arguments.length){return _externalRadiusPadding}_externalRadiusPadding=externalRadiusPadding;return _chart};_chart.innerRadius=function(innerRadius){if(!arguments.length){return _innerRadius}_innerRadius=innerRadius;return _chart};_chart.radius=function(radius){if(!arguments.length){return _givenRadius}_givenRadius=radius;return _chart};_chart.cx=function(cx){if(!arguments.length){return _cx||_chart.width()/2}_cx=cx;return _chart};_chart.cy=function(cy){if(!arguments.length){return _cy||_chart.height()/2}_cy=cy;return _chart};function buildArcs(){return d3.svg.arc().outerRadius(_radius-_externalRadiusPadding).innerRadius(_innerRadius)}function isSelectedSlice(d){return _chart.hasFilter(_chart.cappedKeyAccessor(d.data))}_chart._doRedraw=function(){drawChart();return _chart};_chart.minAngleForLabel=function(minAngleForLabel){if(!arguments.length){return _minAngleForLabel}_minAngleForLabel=minAngleForLabel;return _chart};function pieLayout(){return d3.layout.pie().sort(null).value(_chart.cappedValueAccessor)}function sliceTooSmall(d){var angle=d.endAngle-d.startAngle;return isNaN(angle)||angle<_minAngleForLabel}function sliceHasNoData(d){return _chart.cappedValueAccessor(d)===0}function tweenPie(b){b.innerRadius=_innerRadius;var current=this._current;if(isOffCanvas(current)){current={startAngle:0,endAngle:0}}else{current={startAngle:current.startAngle,endAngle:current.endAngle}}var i=d3.interpolate(current,b);this._current=i(0);return function(t){return safeArc(i(t),0,buildArcs())}}function isOffCanvas(current){return!current||isNaN(current.startAngle)||isNaN(current.endAngle)}function fill(d,i){return _chart.getColor(d.data,i)}function onClick(d,i){if(_g.attr("class")!==_emptyCssClass){_chart.onClick(d.data,i)}}function safeArc(d,i,arc){var path=arc(d,i);if(path.indexOf("NaN")>=0){path="M0,0"}return path}_chart.emptyTitle=function(title){if(arguments.length===0){return _emptyTitle}_emptyTitle=title;return _chart};_chart.externalLabels=function(externalLabelRadius){if(arguments.length===0){return _externalLabelRadius}else if(externalLabelRadius){_externalLabelRadius=externalLabelRadius}else{_externalLabelRadius=undefined}return _chart};_chart.drawPaths=function(drawPaths){if(arguments.length===0){return _drawPaths}_drawPaths=drawPaths;return _chart};function labelPosition(d,arc){var centroid;if(_externalLabelRadius){centroid=d3.svg.arc().outerRadius(_radius-_externalRadiusPadding+_externalLabelRadius).innerRadius(_radius-_externalRadiusPadding+_externalLabelRadius).centroid(d)}else{centroid=arc.centroid(d)}if(isNaN(centroid[0])||isNaN(centroid[1])){return"translate(0,0)"}else{return"translate("+centroid+")"}}_chart.legendables=function(){return _chart.data().map(function(d,i){var legendable={name:d.key,data:d.value,others:d.others,chart:_chart};legendable.color=_chart.getColor(d,i);return legendable})};_chart.legendHighlight=function(d){highlightSliceFromLegendable(d,true)};_chart.legendReset=function(d){highlightSliceFromLegendable(d,false)};_chart.legendToggle=function(d){_chart.onClick({key:d.name,others:d.others})};function highlightSliceFromLegendable(legendable,highlighted){_chart.selectAll("g.pie-slice").each(function(d){if(legendable.name===d.data.key){d3.select(this).classed("highlight",highlighted)}})}return _chart.anchor(parent,chartGroup)};dc.barChart=function(parent,chartGroup){var MIN_BAR_WIDTH=1;var DEFAULT_GAP_BETWEEN_BARS=2;var LABEL_PADDING=3;var _chart=dc.stackMixin(dc.coordinateGridMixin({}));var _gap=DEFAULT_GAP_BETWEEN_BARS;var _centerBar=false;var _alwaysUseRounding=false;var _barWidth;dc.override(_chart,"rescale",function(){_chart._rescale();_barWidth=undefined;return _chart});dc.override(_chart,"render",function(){if(_chart.round()&&_centerBar&&!_alwaysUseRounding){dc.logger.warn("By default, brush rounding is disabled if bars are centered. "+"See dc.js bar chart API documentation for details.")}return _chart._render()});_chart.label(function(d){return dc.utils.printSingleValue(d.y0+d.y)},false);_chart.plotData=function(){var layers=_chart.chartBodyG().selectAll("g.stack").data(_chart.data());calculateBarWidth();layers.enter().append("g").attr("class",function(d,i){return"stack "+"_"+i});var last=layers.size()-1;layers.each(function(d,i){var layer=d3.select(this);renderBars(layer,i,d);if(_chart.renderLabel()&&last===i){renderLabels(layer,i,d)}})};function barHeight(d){return dc.utils.safeNumber(Math.abs(_chart.y()(d.y+d.y0)-_chart.y()(d.y0)))}function renderLabels(layer,layerIndex,d){var labels=layer.selectAll("text.barLabel").data(d.values,dc.pluck("x"));labels.enter().append("text").attr("class","barLabel").attr("text-anchor","middle");if(_chart.isOrdinal()){labels.on("click",_chart.onClick);labels.attr("cursor","pointer")}dc.transition(labels,_chart.transitionDuration(),_chart.transitionDelay()).attr("x",function(d){var x=_chart.x()(d.x);if(!_centerBar){x+=_barWidth/2}return dc.utils.safeNumber(x)}).attr("y",function(d){var y=_chart.y()(d.y+d.y0);if(d.y<0){y-=barHeight(d)}return dc.utils.safeNumber(y-LABEL_PADDING)}).text(function(d){return _chart.label()(d)});dc.transition(labels.exit(),_chart.transitionDuration(),_chart.transitionDelay()).attr("height",0).remove()}function renderBars(layer,layerIndex,d){var bars=layer.selectAll("rect.bar").data(d.values,dc.pluck("x"));var enter=bars.enter().append("rect").attr("class","bar").attr("fill",dc.pluck("data",_chart.getColor)).attr("y",_chart.yAxisHeight()).attr("height",0);if(_chart.renderTitle()){enter.append("title").text(dc.pluck("data",_chart.title(d.name)))}if(_chart.isOrdinal()){bars.on("click",_chart.onClick)}dc.transition(bars,_chart.transitionDuration(),_chart.transitionDelay()).attr("x",function(d){var x=_chart.x()(d.x);if(_centerBar){x-=_barWidth/2}if(_chart.isOrdinal()&&_gap!==undefined){x+=_gap/2}return dc.utils.safeNumber(x)}).attr("y",function(d){var y=_chart.y()(d.y+d.y0);if(d.y<0){y-=barHeight(d)}return dc.utils.safeNumber(y)}).attr("width",_barWidth).attr("height",function(d){return barHeight(d)}).attr("fill",dc.pluck("data",_chart.getColor)).select("title").text(dc.pluck("data",_chart.title(d.name)));dc.transition(bars.exit(),_chart.transitionDuration(),_chart.transitionDelay()).attr("x",function(d){return _chart.x()(d.x)}).attr("width",_barWidth*.9).remove()}function calculateBarWidth(){if(_barWidth===undefined){var numberOfBars=_chart.xUnitCount();if(_chart.isOrdinal()&&_gap===undefined){_barWidth=Math.floor(_chart.x().rangeBand())}else if(_gap){_barWidth=Math.floor((_chart.xAxisLength()-(numberOfBars-1)*_gap)/numberOfBars)}else{_barWidth=Math.floor(_chart.xAxisLength()/(1+_chart.barPadding())/numberOfBars)}if(_barWidth===Infinity||isNaN(_barWidth)||_barWidth<MIN_BAR_WIDTH){_barWidth=MIN_BAR_WIDTH}}}_chart.fadeDeselectedArea=function(){var bars=_chart.chartBodyG().selectAll("rect.bar");var extent=_chart.brush().extent();if(_chart.isOrdinal()){if(_chart.hasFilter()){bars.classed(dc.constants.SELECTED_CLASS,function(d){return _chart.hasFilter(d.x)});bars.classed(dc.constants.DESELECTED_CLASS,function(d){return!_chart.hasFilter(d.x)})}else{bars.classed(dc.constants.SELECTED_CLASS,false);bars.classed(dc.constants.DESELECTED_CLASS,false)}}else{if(!_chart.brushIsEmpty(extent)){var start=extent[0];var end=extent[1];bars.classed(dc.constants.DESELECTED_CLASS,function(d){return d.x<start||d.x>=end})}else{bars.classed(dc.constants.DESELECTED_CLASS,false)}}};_chart.centerBar=function(centerBar){if(!arguments.length){return _centerBar}_centerBar=centerBar;return _chart};dc.override(_chart,"onClick",function(d){_chart._onClick(d.data)});_chart.barPadding=function(barPadding){if(!arguments.length){return _chart._rangeBandPadding()}_chart._rangeBandPadding(barPadding);_gap=undefined;return _chart};_chart._useOuterPadding=function(){return _gap===undefined};_chart.outerPadding=_chart._outerRangeBandPadding;_chart.gap=function(gap){if(!arguments.length){return _gap}_gap=gap;return _chart};_chart.extendBrush=function(){var extent=_chart.brush().extent();if(_chart.round()&&(!_centerBar||_alwaysUseRounding)){extent[0]=extent.map(_chart.round())[0];extent[1]=extent.map(_chart.round())[1];_chart.chartBodyG().select(".brush").call(_chart.brush().extent(extent))}return extent};_chart.alwaysUseRounding=function(alwaysUseRounding){if(!arguments.length){return _alwaysUseRounding}_alwaysUseRounding=alwaysUseRounding;return _chart};function colorFilter(color,inv){return function(){var item=d3.select(this);var match=item.attr("fill")===color;return inv?!match:match}}_chart.legendHighlight=function(d){if(!_chart.isLegendableHidden(d)){_chart.g().selectAll("rect.bar").classed("highlight",colorFilter(d.color)).classed("fadeout",colorFilter(d.color,true))}};_chart.legendReset=function(){_chart.g().selectAll("rect.bar").classed("highlight",false).classed("fadeout",false)};dc.override(_chart,"xAxisMax",function(){var max=this._xAxisMax();if("resolution"in _chart.xUnits()){var res=_chart.xUnits().resolution;max+=res}return max});return _chart.anchor(parent,chartGroup)};dc.lineChart=function(parent,chartGroup){var DEFAULT_DOT_RADIUS=5;var TOOLTIP_G_CLASS="dc-tooltip";var DOT_CIRCLE_CLASS="dot";var Y_AXIS_REF_LINE_CLASS="yRef";var X_AXIS_REF_LINE_CLASS="xRef";var DEFAULT_DOT_OPACITY=1e-6;var LABEL_PADDING=3;var _chart=dc.stackMixin(dc.coordinateGridMixin({}));var _renderArea=false;var _dotRadius=DEFAULT_DOT_RADIUS;var _dataPointRadius=null;var _dataPointFillOpacity=DEFAULT_DOT_OPACITY;var _dataPointStrokeOpacity=DEFAULT_DOT_OPACITY;var _interpolate="linear";var _tension=.7;var _defined;var _dashStyle;var _xyTipsOn=true;_chart.transitionDuration(500);_chart.transitionDelay(0);_chart._rangeBandPadding(1);_chart.plotData=function(){var chartBody=_chart.chartBodyG();var layersList=chartBody.select("g.stack-list");if(layersList.empty()){layersList=chartBody.append("g").attr("class","stack-list")}var layers=layersList.selectAll("g.stack").data(_chart.data());var layersEnter=layers.enter().append("g").attr("class",function(d,i){return"stack "+"_"+i});drawLine(layersEnter,layers);drawArea(layersEnter,layers);drawDots(chartBody,layers);if(_chart.renderLabel()){drawLabels(layers)}};_chart.interpolate=function(interpolate){if(!arguments.length){return _interpolate}_interpolate=interpolate;return _chart};_chart.tension=function(tension){if(!arguments.length){return _tension}_tension=tension;return _chart};_chart.defined=function(defined){if(!arguments.length){return _defined}_defined=defined;return _chart};_chart.dashStyle=function(dashStyle){if(!arguments.length){return _dashStyle}_dashStyle=dashStyle;return _chart};_chart.renderArea=function(renderArea){if(!arguments.length){return _renderArea}_renderArea=renderArea;return _chart};function colors(d,i){return _chart.getColor.call(d,d.values,i)}function drawLine(layersEnter,layers){var line=d3.svg.line().x(function(d){return _chart.x()(d.x)}).y(function(d){return _chart.y()(d.y+d.y0)}).interpolate(_interpolate).tension(_tension);if(_defined){line.defined(_defined)}var path=layersEnter.append("path").attr("class","line").attr("stroke",colors);if(_dashStyle){path.attr("stroke-dasharray",_dashStyle)}dc.transition(layers.select("path.line"),_chart.transitionDuration(),_chart.transitionDelay()).attr("stroke",colors).attr("d",function(d){return safeD(line(d.values))})}function drawArea(layersEnter,layers){if(_renderArea){var area=d3.svg.area().x(function(d){return _chart.x()(d.x)}).y(function(d){return _chart.y()(d.y+d.y0)}).y0(function(d){return _chart.y()(d.y0)}).interpolate(_interpolate).tension(_tension);if(_defined){area.defined(_defined)}layersEnter.append("path").attr("class","area").attr("fill",colors).attr("d",function(d){return safeD(area(d.values))});dc.transition(layers.select("path.area"),_chart.transitionDuration(),_chart.transitionDelay()).attr("fill",colors).attr("d",function(d){return safeD(area(d.values))})}}function safeD(d){return!d||d.indexOf("NaN")>=0?"M0,0":d}function drawDots(chartBody,layers){if(_chart.xyTipsOn()==="always"||!_chart.brushOn()&&_chart.xyTipsOn()){var tooltipListClass=TOOLTIP_G_CLASS+"-list";var tooltips=chartBody.select("g."+tooltipListClass);if(tooltips.empty()){tooltips=chartBody.append("g").attr("class",tooltipListClass)}layers.each(function(d,layerIndex){var points=d.values;if(_defined){points=points.filter(_defined)}var g=tooltips.select("g."+TOOLTIP_G_CLASS+"._"+layerIndex);if(g.empty()){g=tooltips.append("g").attr("class",TOOLTIP_G_CLASS+" _"+layerIndex)}createRefLines(g);var dots=g.selectAll("circle."+DOT_CIRCLE_CLASS).data(points,dc.pluck("x"));dots.enter().append("circle").attr("class",DOT_CIRCLE_CLASS).attr("r",getDotRadius()).style("fill-opacity",_dataPointFillOpacity).style("stroke-opacity",_dataPointStrokeOpacity).attr("fill",_chart.getColor).on("mousemove",function(){var dot=d3.select(this);showDot(dot);showRefLines(dot,g)}).on("mouseout",function(){var dot=d3.select(this);hideDot(dot);hideRefLines(g)});dots.call(renderTitle,d);dc.transition(dots,_chart.transitionDuration()).attr("cx",function(d){return dc.utils.safeNumber(_chart.x()(d.x))}).attr("cy",function(d){return dc.utils.safeNumber(_chart.y()(d.y+d.y0))}).attr("fill",_chart.getColor);dots.exit().remove()})}}_chart.label(function(d){return dc.utils.printSingleValue(d.y0+d.y)},false);function drawLabels(layers){layers.each(function(d,layerIndex){var layer=d3.select(this);var labels=layer.selectAll("text.lineLabel").data(d.values,dc.pluck("x"));labels.enter().append("text").attr("class","lineLabel").attr("text-anchor","middle");dc.transition(labels,_chart.transitionDuration()).attr("x",function(d){return dc.utils.safeNumber(_chart.x()(d.x))}).attr("y",function(d){var y=_chart.y()(d.y+d.y0)-LABEL_PADDING;return dc.utils.safeNumber(y)}).text(function(d){return _chart.label()(d)});dc.transition(labels.exit(),_chart.transitionDuration()).attr("height",0).remove()})}function createRefLines(g){var yRefLine=g.select("path."+Y_AXIS_REF_LINE_CLASS).empty()?g.append("path").attr("class",Y_AXIS_REF_LINE_CLASS):g.select("path."+Y_AXIS_REF_LINE_CLASS);yRefLine.style("display","none").attr("stroke-dasharray","5,5");var xRefLine=g.select("path."+X_AXIS_REF_LINE_CLASS).empty()?g.append("path").attr("class",X_AXIS_REF_LINE_CLASS):g.select("path."+X_AXIS_REF_LINE_CLASS);xRefLine.style("display","none").attr("stroke-dasharray","5,5")}function showDot(dot){dot.style("fill-opacity",.8);dot.style("stroke-opacity",.8);dot.attr("r",_dotRadius);return dot}function showRefLines(dot,g){var x=dot.attr("cx");var y=dot.attr("cy");var yAxisX=_chart._yAxisX()-_chart.margins().left;var yAxisRefPathD="M"+yAxisX+" "+y+"L"+x+" "+y;var xAxisRefPathD="M"+x+" "+_chart.yAxisHeight()+"L"+x+" "+y;g.select("path."+Y_AXIS_REF_LINE_CLASS).style("display","").attr("d",yAxisRefPathD);g.select("path."+X_AXIS_REF_LINE_CLASS).style("display","").attr("d",xAxisRefPathD)}function getDotRadius(){return _dataPointRadius||_dotRadius}function hideDot(dot){dot.style("fill-opacity",_dataPointFillOpacity).style("stroke-opacity",_dataPointStrokeOpacity).attr("r",getDotRadius())}function hideRefLines(g){g.select("path."+Y_AXIS_REF_LINE_CLASS).style("display","none");g.select("path."+X_AXIS_REF_LINE_CLASS).style("display","none")}function renderTitle(dot,d){if(_chart.renderTitle()){dot.select("title").remove();dot.append("title").text(dc.pluck("data",_chart.title(d.name)))}}_chart.xyTipsOn=function(xyTipsOn){if(!arguments.length){return _xyTipsOn}_xyTipsOn=xyTipsOn;return _chart};_chart.dotRadius=function(dotRadius){if(!arguments.length){return _dotRadius}_dotRadius=dotRadius;return _chart};_chart.renderDataPoints=function(options){if(!arguments.length){return{fillOpacity:_dataPointFillOpacity,strokeOpacity:_dataPointStrokeOpacity,radius:_dataPointRadius}}else if(!options){_dataPointFillOpacity=DEFAULT_DOT_OPACITY;_dataPointStrokeOpacity=DEFAULT_DOT_OPACITY;_dataPointRadius=null}else{_dataPointFillOpacity=options.fillOpacity||.8;_dataPointStrokeOpacity=options.strokeOpacity||.8;_dataPointRadius=options.radius||2}return _chart};function colorFilter(color,dashstyle,inv){return function(){var item=d3.select(this);var match=item.attr("stroke")===color&&item.attr("stroke-dasharray")===(dashstyle instanceof Array?dashstyle.join(","):null)||item.attr("fill")===color;return inv?!match:match}}_chart.legendHighlight=function(d){if(!_chart.isLegendableHidden(d)){_chart.g().selectAll("path.line, path.area").classed("highlight",colorFilter(d.color,d.dashstyle)).classed("fadeout",colorFilter(d.color,d.dashstyle,true))}};_chart.legendReset=function(){_chart.g().selectAll("path.line, path.area").classed("highlight",false).classed("fadeout",false)};dc.override(_chart,"legendables",function(){var legendables=_chart._legendables();if(!_dashStyle){return legendables}return legendables.map(function(l){l.dashstyle=_dashStyle;return l})});return _chart.anchor(parent,chartGroup)};dc.dataCount=function(parent,chartGroup){var _formatNumber=d3.format(",d");var _chart=dc.baseMixin({});var _html={some:"",all:""};_chart.html=function(options){if(!arguments.length){return _html}if(options.all){_html.all=options.all}if(options.some){_html.some=options.some}return _chart};_chart.formatNumber=function(formatter){if(!arguments.length){return _formatNumber}_formatNumber=formatter;return _chart};_chart._doRender=function(){var tot=_chart.dimension().size(),val=_chart.group().value();var all=_formatNumber(tot);var selected=_formatNumber(val);if(tot===val&&_html.all!==""){_chart.root().html(_html.all.replace("%total-count",all).replace("%filter-count",selected))}else if(_html.some!==""){_chart.root().html(_html.some.replace("%total-count",all).replace("%filter-count",selected))}else{_chart.selectAll(".total-count").text(all);_chart.selectAll(".filter-count").text(selected)}return _chart};_chart._doRedraw=function(){return _chart._doRender()};return _chart.anchor(parent,chartGroup)};dc.dataTable=function(parent,chartGroup){var LABEL_CSS_CLASS="dc-table-label";var ROW_CSS_CLASS="dc-table-row";var COLUMN_CSS_CLASS="dc-table-column";var GROUP_CSS_CLASS="dc-table-group";var HEAD_CSS_CLASS="dc-table-head";var _chart=dc.baseMixin({});var _size=25;var _columns=[];var _sortBy=function(d){return d};var _order=d3.ascending;var _beginSlice=0;var _endSlice;var _showGroups=true;_chart._doRender=function(){_chart.selectAll("tbody").remove();renderRows(renderGroups());return _chart};_chart._doColumnValueFormat=function(v,d){return typeof v==="function"?v(d):typeof v==="string"?d[v]:v.format(d)};_chart._doColumnHeaderFormat=function(d){return typeof d==="function"?_chart._doColumnHeaderFnToString(d):typeof d==="string"?_chart._doColumnHeaderCapitalize(d):String(d.label)};_chart._doColumnHeaderCapitalize=function(s){return s.charAt(0).toUpperCase()+s.slice(1)};_chart._doColumnHeaderFnToString=function(f){var s=String(f);var i1=s.indexOf("return ");if(i1>=0){var i2=s.lastIndexOf(";");if(i2>=0){s=s.substring(i1+7,i2);var i3=s.indexOf("numberFormat");if(i3>=0){s=s.replace("numberFormat","")}}}return s};function renderGroups(){var bAllFunctions=true;_columns.forEach(function(f){bAllFunctions=bAllFunctions&typeof f==="function"});if(!bAllFunctions){var thead=_chart.selectAll("thead").data([0]);thead.enter().append("thead");thead.exit().remove();var headrow=thead.selectAll("tr").data([0]);headrow.enter().append("tr");headrow.exit().remove();var headcols=headrow.selectAll("th").data(_columns);headcols.enter().append("th");headcols.exit().remove();headcols.attr("class",HEAD_CSS_CLASS).html(function(d){return _chart._doColumnHeaderFormat(d)})}var groups=_chart.root().selectAll("tbody").data(nestEntries(),function(d){return _chart.keyAccessor()(d)});var rowGroup=groups.enter().append("tbody");if(_showGroups===true){rowGroup.append("tr").attr("class",GROUP_CSS_CLASS).append("td").attr("class",LABEL_CSS_CLASS).attr("colspan",_columns.length).html(function(d){return _chart.keyAccessor()(d)})}groups.exit().remove();return rowGroup}function nestEntries(){var entries;if(_order===d3.ascending){entries=_chart.dimension().bottom(_size)}else{entries=_chart.dimension().top(_size)}return d3.nest().key(_chart.group()).sortKeys(_order).entries(entries.sort(function(a,b){return _order(_sortBy(a),_sortBy(b))}).slice(_beginSlice,_endSlice))}function renderRows(groups){var rows=groups.order().selectAll("tr."+ROW_CSS_CLASS).data(function(d){return d.values});var rowEnter=rows.enter().append("tr").attr("class",ROW_CSS_CLASS);_columns.forEach(function(v,i){rowEnter.append("td").attr("class",COLUMN_CSS_CLASS+" _"+i).html(function(d){return _chart._doColumnValueFormat(v,d)})});rows.exit().remove();return rows}_chart._doRedraw=function(){return _chart._doRender()};_chart.size=function(size){if(!arguments.length){return _size}_size=size;return _chart};_chart.beginSlice=function(beginSlice){if(!arguments.length){return _beginSlice}_beginSlice=beginSlice;return _chart};_chart.endSlice=function(endSlice){if(!arguments.length){return _endSlice}_endSlice=endSlice;return _chart};_chart.columns=function(columns){if(!arguments.length){return _columns}_columns=columns;return _chart};_chart.sortBy=function(sortBy){if(!arguments.length){return _sortBy}_sortBy=sortBy;return _chart};_chart.order=function(order){if(!arguments.length){return _order}_order=order;return _chart};_chart.showGroups=function(showGroups){if(!arguments.length){return _showGroups}_showGroups=showGroups;return _chart};return _chart.anchor(parent,chartGroup)};dc.dataGrid=function(parent,chartGroup){var LABEL_CSS_CLASS="dc-grid-label";var ITEM_CSS_CLASS="dc-grid-item";var GROUP_CSS_CLASS="dc-grid-group";var GRID_CSS_CLASS="dc-grid-top";var _chart=dc.baseMixin({});var _size=999;var _html=function(d){return"you need to provide an html() handling param:  "+JSON.stringify(d)};var _sortBy=function(d){return d};var _order=d3.ascending;var _beginSlice=0,_endSlice;var _htmlGroup=function(d){return"<div class='"+GROUP_CSS_CLASS+"'><h1 class='"+LABEL_CSS_CLASS+"'>"+_chart.keyAccessor()(d)+"</h1></div>"};_chart._doRender=function(){_chart.selectAll("div."+GRID_CSS_CLASS).remove();renderItems(renderGroups());return _chart};function renderGroups(){var groups=_chart.root().selectAll("div."+GRID_CSS_CLASS).data(nestEntries(),function(d){return _chart.keyAccessor()(d)});var itemGroup=groups.enter().append("div").attr("class",GRID_CSS_CLASS);if(_htmlGroup){itemGroup.html(function(d){return _htmlGroup(d)})}groups.exit().remove();return itemGroup}function nestEntries(){var entries=_chart.dimension().top(_size);return d3.nest().key(_chart.group()).sortKeys(_order).entries(entries.sort(function(a,b){return _order(_sortBy(a),_sortBy(b))}).slice(_beginSlice,_endSlice))}function renderItems(groups){var items=groups.order().selectAll("div."+ITEM_CSS_CLASS).data(function(d){return d.values});items.enter().append("div").attr("class",ITEM_CSS_CLASS).html(function(d){return _html(d)});items.exit().remove();return items}_chart._doRedraw=function(){return _chart._doRender()};_chart.beginSlice=function(beginSlice){if(!arguments.length){return _beginSlice}_beginSlice=beginSlice;return _chart};_chart.endSlice=function(endSlice){if(!arguments.length){return _endSlice}_endSlice=endSlice;return _chart};_chart.size=function(size){if(!arguments.length){return _size}_size=size;return _chart};_chart.html=function(html){if(!arguments.length){return _html}_html=html;return _chart};_chart.htmlGroup=function(htmlGroup){if(!arguments.length){return _htmlGroup}_htmlGroup=htmlGroup;return _chart};_chart.sortBy=function(sortByFunction){if(!arguments.length){return _sortBy}_sortBy=sortByFunction;return _chart};_chart.order=function(order){if(!arguments.length){return _order}_order=order;return _chart};return _chart.anchor(parent,chartGroup)};dc.bubbleChart=function(parent,chartGroup){var _chart=dc.bubbleMixin(dc.coordinateGridMixin({}));_chart.transitionDuration(750);_chart.transitionDelay(0);var bubbleLocator=function(d){return"translate("+bubbleX(d)+","+bubbleY(d)+")"};_chart.plotData=function(){_chart.calculateRadiusDomain();_chart.r().range([_chart.MIN_RADIUS,_chart.xAxisLength()*_chart.maxBubbleRelativeSize()]);var data=_chart.data();var bubbleG=_chart.chartBodyG().selectAll("g."+_chart.BUBBLE_NODE_CLASS).data(data,function(d){return d.key});if(_chart.sortBubbleSize()){bubbleG.order()}renderNodes(bubbleG);updateNodes(bubbleG);removeNodes(bubbleG);_chart.fadeDeselectedArea()};function renderNodes(bubbleG){var bubbleGEnter=bubbleG.enter().append("g");bubbleGEnter.attr("class",_chart.BUBBLE_NODE_CLASS).attr("transform",bubbleLocator).append("circle").attr("class",function(d,i){return _chart.BUBBLE_CLASS+" _"+i}).on("click",_chart.onClick).attr("fill",_chart.getColor).attr("r",0);dc.transition(bubbleG,_chart.transitionDuration(),_chart.transitionDelay()).select("circle."+_chart.BUBBLE_CLASS).attr("r",function(d){return _chart.bubbleR(d)}).attr("opacity",function(d){return _chart.bubbleR(d)>0?1:0});_chart._doRenderLabel(bubbleGEnter);_chart._doRenderTitles(bubbleGEnter)}function updateNodes(bubbleG){dc.transition(bubbleG,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform",bubbleLocator).select("circle."+_chart.BUBBLE_CLASS).attr("fill",_chart.getColor).attr("r",function(d){return _chart.bubbleR(d)}).attr("opacity",function(d){return _chart.bubbleR(d)>0?1:0});_chart.doUpdateLabels(bubbleG);_chart.doUpdateTitles(bubbleG)}function removeNodes(bubbleG){bubbleG.exit().remove()}function bubbleX(d){var x=_chart.x()(_chart.keyAccessor()(d));if(isNaN(x)){x=0}return x}function bubbleY(d){var y=_chart.y()(_chart.valueAccessor()(d));if(isNaN(y)){y=0}return y}_chart.renderBrush=function(){};_chart.redrawBrush=function(){_chart.fadeDeselectedArea()};return _chart.anchor(parent,chartGroup)};dc.compositeChart=function(parent,chartGroup){var SUB_CHART_CLASS="sub";var DEFAULT_RIGHT_Y_AXIS_LABEL_PADDING=12;var _chart=dc.coordinateGridMixin({});var _children=[];var _childOptions={};var _shareColors=false,_shareTitle=true,_alignYAxes=false;var _rightYAxis=d3.svg.axis(),_rightYAxisLabel=0,_rightYAxisLabelPadding=DEFAULT_RIGHT_Y_AXIS_LABEL_PADDING,_rightY,_rightAxisGridLines=false;_chart._mandatoryAttributes([]);_chart.transitionDuration(500);_chart.transitionDelay(0);dc.override(_chart,"_generateG",function(){var g=this.__generateG();for(var i=0;i<_children.length;++i){var child=_children[i];generateChildG(child,i);if(!child.dimension()){child.dimension(_chart.dimension())}if(!child.group()){child.group(_chart.group())}child.chartGroup(_chart.chartGroup());child.svg(_chart.svg());child.xUnits(_chart.xUnits());child.transitionDuration(_chart.transitionDuration(),_chart.transitionDelay());child.brushOn(_chart.brushOn());child.renderTitle(_chart.renderTitle());child.elasticX(_chart.elasticX())}return g});_chart._brushing=function(){var extent=_chart.extendBrush();var brushIsEmpty=_chart.brushIsEmpty(extent);for(var i=0;i<_children.length;++i){_children[i].replaceFilter(brushIsEmpty?null:extent)}};_chart._prepareYAxis=function(){var left=leftYAxisChildren().length!==0;var right=rightYAxisChildren().length!==0;var ranges=calculateYAxisRanges(left,right);if(left){prepareLeftYAxis(ranges)}if(right){prepareRightYAxis(ranges)}if(leftYAxisChildren().length>0&&!_rightAxisGridLines){_chart._renderHorizontalGridLinesForAxis(_chart.g(),_chart.y(),_chart.yAxis())}else if(rightYAxisChildren().length>0){_chart._renderHorizontalGridLinesForAxis(_chart.g(),_rightY,_rightYAxis)}};_chart.renderYAxis=function(){if(leftYAxisChildren().length!==0){_chart.renderYAxisAt("y",_chart.yAxis(),_chart.margins().left);_chart.renderYAxisLabel("y",_chart.yAxisLabel(),-90)}if(rightYAxisChildren().length!==0){_chart.renderYAxisAt("yr",_chart.rightYAxis(),_chart.width()-_chart.margins().right);_chart.renderYAxisLabel("yr",_chart.rightYAxisLabel(),90,_chart.width()-_rightYAxisLabelPadding)}};function calculateYAxisRanges(left,right){var lyAxisMin,lyAxisMax,ryAxisMin,ryAxisMax;var ranges;if(left){lyAxisMin=yAxisMin();lyAxisMax=yAxisMax()}if(right){ryAxisMin=rightYAxisMin();ryAxisMax=rightYAxisMax()}if(_chart.alignYAxes()&&left&&right){ranges=alignYAxisRanges(lyAxisMin,lyAxisMax,ryAxisMin,ryAxisMax)}return ranges||{lyAxisMin:lyAxisMin,lyAxisMax:lyAxisMax,ryAxisMin:ryAxisMin,ryAxisMax:ryAxisMax}}function alignYAxisRanges(lyAxisMin,lyAxisMax,ryAxisMin,ryAxisMax){var extentRatio=(ryAxisMax-ryAxisMin)/(lyAxisMax-lyAxisMin);return{lyAxisMin:Math.min(lyAxisMin,ryAxisMin/extentRatio),lyAxisMax:Math.max(lyAxisMax,ryAxisMax/extentRatio),ryAxisMin:Math.min(ryAxisMin,lyAxisMin*extentRatio),ryAxisMax:Math.max(ryAxisMax,lyAxisMax*extentRatio)}}function prepareRightYAxis(ranges){var needDomain=_chart.rightY()===undefined||_chart.elasticY(),needRange=needDomain||_chart.resizing();if(_chart.rightY()===undefined){_chart.rightY(d3.scale.linear())}if(needDomain){_chart.rightY().domain([ranges.ryAxisMin,ranges.ryAxisMax])}if(needRange){_chart.rightY().rangeRound([_chart.yAxisHeight(),0])}_chart.rightY().range([_chart.yAxisHeight(),0]);_chart.rightYAxis(_chart.rightYAxis().scale(_chart.rightY()));_chart.rightYAxis().orient("right")}function prepareLeftYAxis(ranges){var needDomain=_chart.y()===undefined||_chart.elasticY(),needRange=needDomain||_chart.resizing();if(_chart.y()===undefined){_chart.y(d3.scale.linear())}if(needDomain){_chart.y().domain([ranges.lyAxisMin,ranges.lyAxisMax])}if(needRange){_chart.y().rangeRound([_chart.yAxisHeight(),0])}_chart.y().range([_chart.yAxisHeight(),0]);_chart.yAxis(_chart.yAxis().scale(_chart.y()));_chart.yAxis().orient("left")}function generateChildG(child,i){child._generateG(_chart.g());child.g().attr("class",SUB_CHART_CLASS+" _"+i)}_chart.plotData=function(){for(var i=0;i<_children.length;++i){var child=_children[i];if(!child.g()){generateChildG(child,i)}if(_shareColors){child.colors(_chart.colors())}child.x(_chart.x());child.xAxis(_chart.xAxis());if(child.useRightYAxis()){child.y(_chart.rightY());child.yAxis(_chart.rightYAxis())}else{child.y(_chart.y());child.yAxis(_chart.yAxis())}child.plotData();child._activateRenderlets()}};_chart.useRightAxisGridLines=function(useRightAxisGridLines){if(!arguments){return _rightAxisGridLines}_rightAxisGridLines=useRightAxisGridLines;return _chart};_chart.childOptions=function(childOptions){if(!arguments.length){return _childOptions}_childOptions=childOptions;_children.forEach(function(child){child.options(_childOptions)});return _chart};_chart.fadeDeselectedArea=function(){for(var i=0;i<_children.length;++i){var child=_children[i];child.brush(_chart.brush());child.fadeDeselectedArea()}};_chart.rightYAxisLabel=function(rightYAxisLabel,padding){if(!arguments.length){return _rightYAxisLabel}_rightYAxisLabel=rightYAxisLabel;_chart.margins().right-=_rightYAxisLabelPadding;_rightYAxisLabelPadding=padding===undefined?DEFAULT_RIGHT_Y_AXIS_LABEL_PADDING:padding;_chart.margins().right+=_rightYAxisLabelPadding;return _chart};_chart.compose=function(subChartArray){_children=subChartArray;_children.forEach(function(child){child.height(_chart.height());child.width(_chart.width());child.margins(_chart.margins());if(_shareTitle){child.title(_chart.title())}child.options(_childOptions)});return _chart};_chart.children=function(){return _children};_chart.shareColors=function(shareColors){if(!arguments.length){return _shareColors}_shareColors=shareColors;return _chart};_chart.shareTitle=function(shareTitle){if(!arguments.length){return _shareTitle}_shareTitle=shareTitle;return _chart};_chart.rightY=function(yScale){if(!arguments.length){return _rightY}_rightY=yScale;_chart.rescale();return _chart};_chart.alignYAxes=function(alignYAxes){if(!arguments.length){return _alignYAxes}_alignYAxes=alignYAxes;_chart.rescale();return _chart};function leftYAxisChildren(){return _children.filter(function(child){return!child.useRightYAxis()})}function rightYAxisChildren(){return _children.filter(function(child){return child.useRightYAxis()})}function getYAxisMin(charts){return charts.map(function(c){return c.yAxisMin()})}delete _chart.yAxisMin;function yAxisMin(){return d3.min(getYAxisMin(leftYAxisChildren()))}function rightYAxisMin(){return d3.min(getYAxisMin(rightYAxisChildren()))}function getYAxisMax(charts){return charts.map(function(c){return c.yAxisMax()})}delete _chart.yAxisMax;function yAxisMax(){return dc.utils.add(d3.max(getYAxisMax(leftYAxisChildren())),_chart.yAxisPadding())}function rightYAxisMax(){return dc.utils.add(d3.max(getYAxisMax(rightYAxisChildren())),_chart.yAxisPadding())}function getAllXAxisMinFromChildCharts(){return _children.map(function(c){return c.xAxisMin()})}dc.override(_chart,"xAxisMin",function(){return dc.utils.subtract(d3.min(getAllXAxisMinFromChildCharts()),_chart.xAxisPadding())});function getAllXAxisMaxFromChildCharts(){return _children.map(function(c){return c.xAxisMax()})}dc.override(_chart,"xAxisMax",function(){return dc.utils.add(d3.max(getAllXAxisMaxFromChildCharts()),_chart.xAxisPadding())});_chart.legendables=function(){return _children.reduce(function(items,child){if(_shareColors){child.colors(_chart.colors())}items.push.apply(items,child.legendables());return items},[])};_chart.legendHighlight=function(d){for(var j=0;j<_children.length;++j){var child=_children[j];child.legendHighlight(d)}};_chart.legendReset=function(d){for(var j=0;j<_children.length;++j){var child=_children[j];child.legendReset(d)}};_chart.legendToggle=function(){console.log("composite should not be getting legendToggle itself")};_chart.rightYAxis=function(rightYAxis){if(!arguments.length){return _rightYAxis}_rightYAxis=rightYAxis;return _chart};return _chart.anchor(parent,chartGroup)};dc.seriesChart=function(parent,chartGroup){var _chart=dc.compositeChart(parent,chartGroup);function keySort(a,b){return d3.ascending(_chart.keyAccessor()(a),_chart.keyAccessor()(b))}var _charts={};var _chartFunction=dc.lineChart;var _seriesAccessor;var _seriesSort=d3.ascending;var _valueSort=keySort;_chart._mandatoryAttributes().push("seriesAccessor","chart");_chart.shareColors(true);_chart._preprocessData=function(){var keep=[];var childrenChanged;var nester=d3.nest().key(_seriesAccessor);if(_seriesSort){nester.sortKeys(_seriesSort)}if(_valueSort){nester.sortValues(_valueSort)}var nesting=nester.entries(_chart.data());var children=nesting.map(function(sub,i){var subChart=_charts[sub.key]||_chartFunction.call(_chart,_chart,chartGroup,sub.key,i);if(!_charts[sub.key]){childrenChanged=true}_charts[sub.key]=subChart;keep.push(sub.key);return subChart.dimension(_chart.dimension()).group({all:d3.functor(sub.values)},sub.key).keyAccessor(_chart.keyAccessor()).valueAccessor(_chart.valueAccessor()).brushOn(_chart.brushOn())});Object.keys(_charts).filter(function(c){return keep.indexOf(c)===-1}).forEach(function(c){clearChart(c);childrenChanged=true});_chart._compose(children);if(childrenChanged&&_chart.legend()){_chart.legend().render()}};function clearChart(c){if(_charts[c].g()){_charts[c].g().remove()}delete _charts[c]}function resetChildren(){Object.keys(_charts).map(clearChart);_charts={}}_chart.chart=function(chartFunction){if(!arguments.length){return _chartFunction}_chartFunction=chartFunction;resetChildren();return _chart};_chart.seriesAccessor=function(accessor){if(!arguments.length){return _seriesAccessor}_seriesAccessor=accessor;resetChildren();return _chart};_chart.seriesSort=function(sortFunction){if(!arguments.length){return _seriesSort}_seriesSort=sortFunction;resetChildren();return _chart};_chart.valueSort=function(sortFunction){if(!arguments.length){return _valueSort}_valueSort=sortFunction;resetChildren();return _chart};_chart._compose=_chart.compose;delete _chart.compose;return _chart};dc.geoChoroplethChart=function(parent,chartGroup){var _chart=dc.colorMixin(dc.baseMixin({}));_chart.colorAccessor(function(d){return d||0});var _geoPath=d3.geo.path();var _projectionFlag;var _geoJsons=[];_chart._doRender=function(){_chart.resetSvg();for(var layerIndex=0;layerIndex<_geoJsons.length;++layerIndex){var states=_chart.svg().append("g").attr("class","layer"+layerIndex);var regionG=states.selectAll("g."+geoJson(layerIndex).name).data(geoJson(layerIndex).data).enter().append("g").attr("class",geoJson(layerIndex).name);regionG.append("path").attr("fill","white").attr("d",_geoPath);regionG.append("title");plotData(layerIndex)}_projectionFlag=false};function plotData(layerIndex){var data=generateLayeredData();if(isDataLayer(layerIndex)){var regionG=renderRegionG(layerIndex);renderPaths(regionG,layerIndex,data);renderTitle(regionG,layerIndex,data)}}function generateLayeredData(){var data={};var groupAll=_chart.data();for(var i=0;i<groupAll.length;++i){data[_chart.keyAccessor()(groupAll[i])]=_chart.valueAccessor()(groupAll[i])}return data}function isDataLayer(layerIndex){return geoJson(layerIndex).keyAccessor}function renderRegionG(layerIndex){var regionG=_chart.svg().selectAll(layerSelector(layerIndex)).classed("selected",function(d){return isSelected(layerIndex,d)}).classed("deselected",function(d){return isDeselected(layerIndex,d)}).attr("class",function(d){var layerNameClass=geoJson(layerIndex).name;var regionClass=dc.utils.nameToId(geoJson(layerIndex).keyAccessor(d));var baseClasses=layerNameClass+" "+regionClass;if(isSelected(layerIndex,d)){baseClasses+=" selected"}if(isDeselected(layerIndex,d)){baseClasses+=" deselected"}return baseClasses});return regionG}function layerSelector(layerIndex){return"g.layer"+layerIndex+" g."+geoJson(layerIndex).name}function isSelected(layerIndex,d){return _chart.hasFilter()&&_chart.hasFilter(getKey(layerIndex,d))}function isDeselected(layerIndex,d){return _chart.hasFilter()&&!_chart.hasFilter(getKey(layerIndex,d))}function getKey(layerIndex,d){return geoJson(layerIndex).keyAccessor(d)}function geoJson(index){return _geoJsons[index]}function renderPaths(regionG,layerIndex,data){var paths=regionG.select("path").attr("fill",function(){var currentFill=d3.select(this).attr("fill");if(currentFill){return currentFill}return"none"}).on("click",function(d){return _chart.onClick(d,layerIndex)});dc.transition(paths,_chart.transitionDuration(),_chart.transitionDelay()).attr("fill",function(d,i){return _chart.getColor(data[geoJson(layerIndex).keyAccessor(d)],i)})}_chart.onClick=function(d,layerIndex){var selectedRegion=geoJson(layerIndex).keyAccessor(d);dc.events.trigger(function(){_chart.filter(selectedRegion);_chart.redrawGroup()})};function renderTitle(regionG,layerIndex,data){if(_chart.renderTitle()){regionG.selectAll("title").text(function(d){var key=getKey(layerIndex,d);var value=data[key];return _chart.title()({key:key,value:value})})}}_chart._doRedraw=function(){for(var layerIndex=0;layerIndex<_geoJsons.length;++layerIndex){plotData(layerIndex);if(_projectionFlag){_chart.svg().selectAll("g."+geoJson(layerIndex).name+" path").attr("d",_geoPath)}}_projectionFlag=false};_chart.overlayGeoJson=function(json,name,keyAccessor){for(var i=0;i<_geoJsons.length;++i){if(_geoJsons[i].name===name){_geoJsons[i].data=json;_geoJsons[i].keyAccessor=keyAccessor;return _chart}}_geoJsons.push({name:name,data:json,keyAccessor:keyAccessor});return _chart};_chart.projection=function(projection){_geoPath.projection(projection);_projectionFlag=true;return _chart};_chart.geoJsons=function(){return _geoJsons};_chart.geoPath=function(){return _geoPath};_chart.removeGeoJson=function(name){var geoJsons=[];for(var i=0;i<_geoJsons.length;++i){var layer=_geoJsons[i];if(layer.name!==name){geoJsons.push(layer)}}_geoJsons=geoJsons;return _chart};return _chart.anchor(parent,chartGroup)};dc.bubbleOverlay=function(parent,chartGroup){var BUBBLE_OVERLAY_CLASS="bubble-overlay";var BUBBLE_NODE_CLASS="node";var BUBBLE_CLASS="bubble";var _chart=dc.bubbleMixin(dc.baseMixin({}));var _g;var _points=[];_chart.transitionDuration(750);_chart.transitionDelay(0);_chart.radiusValueAccessor(function(d){return d.value});_chart.point=function(name,x,y){_points.push({name:name,x:x,y:y});return _chart};_chart._doRender=function(){_g=initOverlayG();_chart.r().range([_chart.MIN_RADIUS,_chart.width()*_chart.maxBubbleRelativeSize()]);initializeBubbles();_chart.fadeDeselectedArea();return _chart};function initOverlayG(){_g=_chart.select("g."+BUBBLE_OVERLAY_CLASS);if(_g.empty()){_g=_chart.svg().append("g").attr("class",BUBBLE_OVERLAY_CLASS)}return _g}function initializeBubbles(){var data=mapData();_chart.calculateRadiusDomain();_points.forEach(function(point){var nodeG=getNodeG(point,data);var circle=nodeG.select("circle."+BUBBLE_CLASS);if(circle.empty()){circle=nodeG.append("circle").attr("class",BUBBLE_CLASS).attr("r",0).attr("fill",_chart.getColor).on("click",_chart.onClick)}dc.transition(circle,_chart.transitionDuration(),_chart.transitionDelay()).attr("r",function(d){return _chart.bubbleR(d)});_chart._doRenderLabel(nodeG);_chart._doRenderTitles(nodeG)})}function mapData(){var data={};_chart.data().forEach(function(datum){data[_chart.keyAccessor()(datum)]=datum});return data}function getNodeG(point,data){var bubbleNodeClass=BUBBLE_NODE_CLASS+" "+dc.utils.nameToId(point.name);var nodeG=_g.select("g."+dc.utils.nameToId(point.name));if(nodeG.empty()){nodeG=_g.append("g").attr("class",bubbleNodeClass).attr("transform","translate("+point.x+","+point.y+")")}nodeG.datum(data[point.name]);return nodeG}_chart._doRedraw=function(){updateBubbles();_chart.fadeDeselectedArea();return _chart};function updateBubbles(){var data=mapData();_chart.calculateRadiusDomain();_points.forEach(function(point){var nodeG=getNodeG(point,data);var circle=nodeG.select("circle."+BUBBLE_CLASS);dc.transition(circle,_chart.transitionDuration(),_chart.transitionDelay()).attr("r",function(d){return _chart.bubbleR(d)}).attr("fill",_chart.getColor);_chart.doUpdateLabels(nodeG);_chart.doUpdateTitles(nodeG)})}_chart.debug=function(flag){if(flag){var debugG=_chart.select("g."+dc.constants.DEBUG_GROUP_CLASS);if(debugG.empty()){debugG=_chart.svg().append("g").attr("class",dc.constants.DEBUG_GROUP_CLASS)}var debugText=debugG.append("text").attr("x",10).attr("y",20);debugG.append("rect").attr("width",_chart.width()).attr("height",_chart.height()).on("mousemove",function(){var position=d3.mouse(debugG.node());var msg=position[0]+", "+position[1];debugText.text(msg)})}else{_chart.selectAll(".debug").remove()}return _chart};_chart.anchor(parent,chartGroup);return _chart};dc.rowChart=function(parent,chartGroup){var _g;var _labelOffsetX=10;var _labelOffsetY=15;var _hasLabelOffsetY=false;var _dyOffset="0.35em";var _titleLabelOffsetX=2;var _gap=5;var _fixedBarHeight=false;var _rowCssClass="row";var _titleRowCssClass="titlerow";var _renderTitleLabel=false;var _chart=dc.capMixin(dc.marginMixin(dc.colorMixin(dc.baseMixin({}))));var _x;var _elasticX;var _xAxis=d3.svg.axis().orient("bottom");var _rowData;_chart.rowsCap=_chart.cap;function calculateAxisScale(){if(!_x||_elasticX){var extent=d3.extent(_rowData,_chart.cappedValueAccessor);if(extent[0]>0){extent[0]=0}if(extent[1]<0){extent[1]=0}_x=d3.scale.linear().domain(extent).range([0,_chart.effectiveWidth()])}_xAxis.scale(_x)}function drawAxis(){var axisG=_g.select("g.axis");calculateAxisScale();if(axisG.empty()){axisG=_g.append("g").attr("class","axis")}axisG.attr("transform","translate(0, "+_chart.effectiveHeight()+")");dc.transition(axisG,_chart.transitionDuration(),_chart.transitionDelay()).call(_xAxis)}_chart._doRender=function(){_chart.resetSvg();_g=_chart.svg().append("g").attr("transform","translate("+_chart.margins().left+","+_chart.margins().top+")");drawChart();return _chart};_chart.title(function(d){return _chart.cappedKeyAccessor(d)+": "+_chart.cappedValueAccessor(d)});_chart.label(_chart.cappedKeyAccessor);_chart.x=function(scale){if(!arguments.length){return _x}_x=scale;return _chart};function drawGridLines(){_g.selectAll("g.tick").select("line.grid-line").remove();_g.selectAll("g.tick").append("line").attr("class","grid-line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",function(){return-_chart.effectiveHeight()})}function drawChart(){_rowData=_chart.data();drawAxis();drawGridLines();var rows=_g.selectAll("g."+_rowCssClass).data(_rowData);createElements(rows);removeElements(rows);updateElements(rows)}function createElements(rows){var rowEnter=rows.enter().append("g").attr("class",function(d,i){return _rowCssClass+" _"+i});rowEnter.append("rect").attr("width",0);createLabels(rowEnter)}function removeElements(rows){rows.exit().remove()}function rootValue(){var root=_x(0);return root===-Infinity||root!==root?_x(1):root}function updateElements(rows){var n=_rowData.length;var height;if(!_fixedBarHeight){height=(_chart.effectiveHeight()-(n+1)*_gap)/n}else{height=_fixedBarHeight}if(!_hasLabelOffsetY){_labelOffsetY=height/2}var rect=rows.attr("transform",function(d,i){return"translate(0,"+((i+1)*_gap+i*height)+")"}).select("rect").attr("height",height).attr("fill",_chart.getColor).on("click",onClick).classed("deselected",function(d){return _chart.hasFilter()?!isSelectedRow(d):false}).classed("selected",function(d){return _chart.hasFilter()?isSelectedRow(d):false});dc.transition(rect,_chart.transitionDuration(),_chart.transitionDelay()).attr("width",function(d){return Math.abs(rootValue()-_x(_chart.valueAccessor()(d)))}).attr("transform",translateX);createTitles(rows);updateLabels(rows)}function createTitles(rows){if(_chart.renderTitle()){rows.select("title").remove();rows.append("title").text(_chart.title())}}function createLabels(rowEnter){if(_chart.renderLabel()){rowEnter.append("text").on("click",onClick)}if(_chart.renderTitleLabel()){rowEnter.append("text").attr("class",_titleRowCssClass).on("click",onClick)}}function updateLabels(rows){if(_chart.renderLabel()){var lab=rows.select("text").attr("x",_labelOffsetX).attr("y",_labelOffsetY).attr("dy",_dyOffset).on("click",onClick).attr("class",function(d,i){return _rowCssClass+" _"+i}).text(function(d){return _chart.label()(d)});dc.transition(lab,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform",translateX)}if(_chart.renderTitleLabel()){var titlelab=rows.select("."+_titleRowCssClass).attr("x",_chart.effectiveWidth()-_titleLabelOffsetX).attr("y",_labelOffsetY).attr("dy",_dyOffset).attr("text-anchor","end").on("click",onClick).attr("class",function(d,i){return _titleRowCssClass+" _"+i}).text(function(d){return _chart.title()(d)});dc.transition(titlelab,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform",translateX)}}_chart.renderTitleLabel=function(renderTitleLabel){if(!arguments.length){return _renderTitleLabel}_renderTitleLabel=renderTitleLabel;return _chart};function onClick(d){_chart.onClick(d)}function translateX(d){var x=_x(_chart.cappedValueAccessor(d)),x0=rootValue(),s=x>x0?x0:x;return"translate("+s+",0)"}_chart._doRedraw=function(){drawChart();return _chart};_chart.xAxis=function(){return _xAxis};_chart.fixedBarHeight=function(fixedBarHeight){if(!arguments.length){return _fixedBarHeight}_fixedBarHeight=fixedBarHeight;return _chart};_chart.gap=function(gap){if(!arguments.length){return _gap}_gap=gap;return _chart};_chart.elasticX=function(elasticX){if(!arguments.length){return _elasticX}_elasticX=elasticX;return _chart};_chart.labelOffsetX=function(labelOffsetX){if(!arguments.length){return _labelOffsetX}_labelOffsetX=labelOffsetX;return _chart};_chart.labelOffsetY=function(labelOffsety){if(!arguments.length){return _labelOffsetY}_labelOffsetY=labelOffsety;_hasLabelOffsetY=true;return _chart};_chart.titleLabelOffsetX=function(titleLabelOffsetX){if(!arguments.length){return _titleLabelOffsetX}_titleLabelOffsetX=titleLabelOffsetX;return _chart};function isSelectedRow(d){return _chart.hasFilter(_chart.cappedKeyAccessor(d))}return _chart.anchor(parent,chartGroup)};dc.legend=function(){var LABEL_GAP=2;var _legend={},_parent,_x=0,_y=0,_itemHeight=12,_gap=5,_horizontal=false,_legendWidth=560,_itemWidth=70,_autoItemWidth=false,_legendText=dc.pluck("name"),_maxItems;var _g;_legend.parent=function(p){if(!arguments.length){return _parent}_parent=p;return _legend};_legend.render=function(){_parent.svg().select("g.dc-legend").remove();_g=_parent.svg().append("g").attr("class","dc-legend").attr("transform","translate("+_x+","+_y+")");var legendables=_parent.legendables();if(_maxItems!==undefined){legendables=legendables.slice(0,_maxItems)}var itemEnter=_g.selectAll("g.dc-legend-item").data(legendables).enter().append("g").attr("class","dc-legend-item").on("mouseover",function(d){_parent.legendHighlight(d)}).on("mouseout",function(d){_parent.legendReset(d)}).on("click",function(d){d.chart.legendToggle(d)});_g.selectAll("g.dc-legend-item").classed("fadeout",function(d){return d.chart.isLegendableHidden(d)});if(legendables.some(dc.pluck("dashstyle"))){itemEnter.append("line").attr("x1",0).attr("y1",_itemHeight/2).attr("x2",_itemHeight).attr("y2",_itemHeight/2).attr("stroke-width",2).attr("stroke-dasharray",dc.pluck("dashstyle")).attr("stroke",dc.pluck("color"))}else{itemEnter.append("rect").attr("width",_itemHeight).attr("height",_itemHeight).attr("fill",function(d){return d?d.color:"blue"})}itemEnter.append("text").text(_legendText).attr("x",_itemHeight+LABEL_GAP).attr("y",function(){return _itemHeight/2+(this.clientHeight?this.clientHeight:13)/2-2});var _cumulativeLegendTextWidth=0;var row=0;itemEnter.attr("transform",function(d,i){if(_horizontal){var itemWidth=_autoItemWidth===true?this.getBBox().width+_gap:_itemWidth;if(_cumulativeLegendTextWidth+itemWidth>_legendWidth&&_cumulativeLegendTextWidth>0){++row;_cumulativeLegendTextWidth=0}var translateBy="translate("+_cumulativeLegendTextWidth+","+row*legendItemHeight()+")";_cumulativeLegendTextWidth+=itemWidth;return translateBy}else{return"translate(0,"+i*legendItemHeight()+")"}})};function legendItemHeight(){return _gap+_itemHeight}_legend.x=function(x){if(!arguments.length){return _x}_x=x;return _legend};_legend.y=function(y){if(!arguments.length){return _y}_y=y;return _legend};_legend.gap=function(gap){if(!arguments.length){return _gap}_gap=gap;return _legend};_legend.itemHeight=function(itemHeight){if(!arguments.length){return _itemHeight}_itemHeight=itemHeight;return _legend};_legend.horizontal=function(horizontal){if(!arguments.length){return _horizontal}_horizontal=horizontal;return _legend};_legend.legendWidth=function(legendWidth){if(!arguments.length){return _legendWidth}_legendWidth=legendWidth;return _legend};_legend.itemWidth=function(itemWidth){if(!arguments.length){return _itemWidth}_itemWidth=itemWidth;return _legend};_legend.autoItemWidth=function(autoItemWidth){if(!arguments.length){return _autoItemWidth}_autoItemWidth=autoItemWidth;return _legend};_legend.legendText=function(legendText){if(!arguments.length){return _legendText}_legendText=legendText;return _legend};_legend.maxItems=function(maxItems){if(!arguments.length){return _maxItems}_maxItems=dc.utils.isNumber(maxItems)?maxItems:undefined;return _legend};return _legend};dc.scatterPlot=function(parent,chartGroup){var _chart=dc.coordinateGridMixin({});var _symbol=d3.svg.symbol();var _existenceAccessor=function(d){return d.value};var originalKeyAccessor=_chart.keyAccessor();_chart.keyAccessor(function(d){return originalKeyAccessor(d)[0]});_chart.valueAccessor(function(d){return originalKeyAccessor(d)[1]});_chart.colorAccessor(function(){return _chart._groupName});_chart.title(function(d){return _chart.keyAccessor()(d)+","+_chart.valueAccessor()(d)+": "+_chart.existenceAccessor()(d)});var _locator=function(d){return"translate("+_chart.x()(_chart.keyAccessor()(d))+","+_chart.y()(_chart.valueAccessor()(d))+")"};var _highlightedSize=7;var _symbolSize=5;var _excludedSize=3;var _excludedColor=null;var _excludedOpacity=1;var _emptySize=0;var _emptyOpacity=0;var _nonemptyOpacity=1;var _emptyColor=null;var _filtered=[];function elementSize(d,i){if(!_existenceAccessor(d)){return Math.pow(_emptySize,2)}else if(_filtered[i]){return Math.pow(_symbolSize,2)}else{return Math.pow(_excludedSize,2)}}_symbol.size(elementSize);dc.override(_chart,"_filter",function(filter){if(!arguments.length){return _chart.__filter()}return _chart.__filter(dc.filters.RangedTwoDimensionalFilter(filter))});_chart.plotData=function(){var symbols=_chart.chartBodyG().selectAll("path.symbol").data(_chart.data());symbols.enter().append("path").attr("class","symbol").attr("opacity",0).attr("fill",_chart.getColor).attr("transform",_locator);symbols.call(renderTitles,_chart.data());symbols.each(function(d,i){_filtered[i]=!_chart.filter()||_chart.filter().isFiltered([d.key[0],d.key[1]])});dc.transition(symbols,_chart.transitionDuration(),_chart.transitionDelay()).attr("opacity",function(d,i){if(!_existenceAccessor(d)){return _emptyOpacity}else if(_filtered[i]){return _nonemptyOpacity}else{return _chart.excludedOpacity()}}).attr("fill",function(d,i){if(_emptyColor&&!_existenceAccessor(d)){return _emptyColor}else if(_chart.excludedColor()&&!_filtered[i]){return _chart.excludedColor()}else{return _chart.getColor(d)}}).attr("transform",_locator).attr("d",_symbol);dc.transition(symbols.exit(),_chart.transitionDuration(),_chart.transitionDelay()).attr("opacity",0).remove()};function renderTitles(symbol,d){if(_chart.renderTitle()){symbol.selectAll("title").remove();symbol.append("title").text(function(d){return _chart.title()(d)})}}_chart.existenceAccessor=function(accessor){if(!arguments.length){return _existenceAccessor}_existenceAccessor=accessor;return this};_chart.symbol=function(type){if(!arguments.length){return _symbol.type()}_symbol.type(type);return _chart};_chart.customSymbol=function(customSymbol){if(!arguments.length){return _symbol}_symbol=customSymbol;_symbol.size(elementSize);return _chart};_chart.symbolSize=function(symbolSize){if(!arguments.length){return _symbolSize}_symbolSize=symbolSize;return _chart};_chart.highlightedSize=function(highlightedSize){if(!arguments.length){return _highlightedSize}_highlightedSize=highlightedSize;return _chart};_chart.excludedSize=function(excludedSize){if(!arguments.length){return _excludedSize}_excludedSize=excludedSize;return _chart};_chart.excludedColor=function(excludedColor){if(!arguments.length){return _excludedColor}_excludedColor=excludedColor;return _chart};_chart.excludedOpacity=function(excludedOpacity){if(!arguments.length){return _excludedOpacity}_excludedOpacity=excludedOpacity;return _chart};_chart.hiddenSize=_chart.emptySize=function(emptySize){if(!arguments.length){return _emptySize}_emptySize=emptySize;return _chart};_chart.emptyColor=function(emptyColor){if(!arguments.length){return _emptyColor}_emptyColor=emptyColor;return _chart};_chart.emptyOpacity=function(emptyOpacity){if(!arguments.length){return _emptyOpacity}_emptyOpacity=emptyOpacity;return _chart};_chart.nonemptyOpacity=function(nonemptyOpacity){if(!arguments.length){return _emptyOpacity}_nonemptyOpacity=nonemptyOpacity;return _chart};_chart.legendables=function(){return[{chart:_chart,name:_chart._groupName,color:_chart.getColor()}]};_chart.legendHighlight=function(d){resizeSymbolsWhere(function(symbol){return symbol.attr("fill")===d.color},_highlightedSize);_chart.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return d3.select(this).attr("fill")!==d.color}).classed("fadeout",true)};_chart.legendReset=function(d){resizeSymbolsWhere(function(symbol){return symbol.attr("fill")===d.color},_symbolSize);_chart.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return d3.select(this).attr("fill")!==d.color}).classed("fadeout",false)};function resizeSymbolsWhere(condition,size){var symbols=_chart.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return condition(d3.select(this))});var oldSize=_symbol.size();_symbol.size(Math.pow(size,2));dc.transition(symbols,_chart.transitionDuration(),_chart.transitionDelay()).attr("d",_symbol);_symbol.size(oldSize)}_chart.setHandlePaths=function(){};_chart.extendBrush=function(){var extent=_chart.brush().extent();if(_chart.round()){extent[0]=extent[0].map(_chart.round());extent[1]=extent[1].map(_chart.round());_chart.g().select(".brush").call(_chart.brush().extent(extent))}return extent};_chart.brushIsEmpty=function(extent){return _chart.brush().empty()||!extent||extent[0][0]>=extent[1][0]||extent[0][1]>=extent[1][1]};_chart._brushing=function(){var extent=_chart.extendBrush();_chart.redrawBrush(_chart.g());if(_chart.brushIsEmpty(extent)){dc.events.trigger(function(){_chart.filter(null);_chart.redrawGroup()})}else{var ranged2DFilter=dc.filters.RangedTwoDimensionalFilter(extent);dc.events.trigger(function(){_chart.filter(null);_chart.filter(ranged2DFilter);_chart.redrawGroup()},dc.constants.EVENT_DELAY)}};_chart.setBrushY=function(gBrush){gBrush.call(_chart.brush().y(_chart.y()))};return _chart.anchor(parent,chartGroup)};dc.numberDisplay=function(parent,chartGroup){var SPAN_CLASS="number-display";var _formatNumber=d3.format(".2s");var _chart=dc.baseMixin({});var _html={one:"",some:"",none:""};var _lastValue;_chart._mandatoryAttributes(["group"]);_chart.ordering(function(kv){return kv.value});_chart.html=function(html){if(!arguments.length){return _html}if(html.none){_html.none=html.none}else if(html.one){_html.none=html.one}else if(html.some){_html.none=html.some}if(html.one){_html.one=html.one}else if(html.some){_html.one=html.some}if(html.some){_html.some=html.some}else if(html.one){_html.some=html.one}return _chart};_chart.value=function(){return _chart.data()};function maxBin(all){if(!all.length){return null}var sorted=_chart._computeOrderedGroups(all);return sorted[sorted.length-1]}_chart.data(function(group){var valObj=group.value?group.value():maxBin(group.all());return _chart.valueAccessor()(valObj)});_chart.transitionDuration(250);_chart.transitionDelay(0);_chart._doRender=function(){var newValue=_chart.value(),span=_chart.selectAll("."+SPAN_CLASS);if(span.empty()){span=span.data([0]).enter().append("span").attr("class",SPAN_CLASS)}span.transition().duration(_chart.transitionDuration()).delay(_chart.transitionDelay()).ease("quad-out-in").tween("text",function(){var interpStart=isFinite(_lastValue)?_lastValue:0;var interp=d3.interpolateNumber(interpStart||0,newValue);_lastValue=newValue;return function(t){var html=null,num=_chart.formatNumber()(interp(t));if(newValue===0&&_html.none!==""){html=_html.none}else if(newValue===1&&_html.one!==""){html=_html.one}else if(_html.some!==""){html=_html.some}this.innerHTML=html?html.replace("%number",num):num}})};_chart._doRedraw=function(){return _chart._doRender()};_chart.formatNumber=function(formatter){if(!arguments.length){return _formatNumber}_formatNumber=formatter;return _chart};return _chart.anchor(parent,chartGroup)};dc.heatMap=function(parent,chartGroup){var DEFAULT_BORDER_RADIUS=6.75;var _chartBody;var _cols;var _rows;var _colOrdering=d3.ascending;var _rowOrdering=d3.ascending;var _colScale=d3.scale.ordinal();var _rowScale=d3.scale.ordinal();var _xBorderRadius=DEFAULT_BORDER_RADIUS;var _yBorderRadius=DEFAULT_BORDER_RADIUS;var _chart=dc.colorMixin(dc.marginMixin(dc.baseMixin({})));_chart._mandatoryAttributes(["group"]);_chart.title(_chart.colorAccessor());var _colsLabel=function(d){return d};var _rowsLabel=function(d){return d};_chart.colsLabel=function(labelFunction){if(!arguments.length){return _colsLabel}_colsLabel=labelFunction;return _chart};_chart.rowsLabel=function(labelFunction){if(!arguments.length){return _rowsLabel}_rowsLabel=labelFunction;return _chart};var _xAxisOnClick=function(d){filterAxis(0,d)};var _yAxisOnClick=function(d){filterAxis(1,d)};var _boxOnClick=function(d){var filter=d.key;dc.events.trigger(function(){_chart.filter(filter);_chart.redrawGroup()})};function filterAxis(axis,value){var cellsOnAxis=_chart.selectAll(".box-group").filter(function(d){return d.key[axis]===value});var unfilteredCellsOnAxis=cellsOnAxis.filter(function(d){return!_chart.hasFilter(d.key)});dc.events.trigger(function(){var selection=unfilteredCellsOnAxis.empty()?cellsOnAxis:unfilteredCellsOnAxis;var filters=selection.data().map(function(kv){return dc.filters.TwoDimensionalFilter(kv.key)});_chart._filter([filters]);_chart.redrawGroup()})}dc.override(_chart,"filter",function(filter){if(!arguments.length){return _chart._filter()}return _chart._filter(dc.filters.TwoDimensionalFilter(filter))});_chart.rows=function(rows){if(!arguments.length){return _rows}_rows=rows;return _chart};_chart.rowOrdering=function(_){if(!arguments.length){return _rowOrdering}_rowOrdering=_;return _chart};_chart.cols=function(cols){if(!arguments.length){return _cols}_cols=cols;return _chart};_chart.colOrdering=function(_){if(!arguments.length){return _colOrdering}_colOrdering=_;return _chart};_chart._doRender=function(){_chart.resetSvg();_chartBody=_chart.svg().append("g").attr("class","heatmap").attr("transform","translate("+_chart.margins().left+","+_chart.margins().top+")");return _chart._doRedraw()};_chart._doRedraw=function(){var data=_chart.data(),rows=_chart.rows()||data.map(_chart.valueAccessor()),cols=_chart.cols()||data.map(_chart.keyAccessor());if(_rowOrdering){rows=rows.sort(_rowOrdering)}if(_colOrdering){cols=cols.sort(_colOrdering)}rows=_rowScale.domain(rows);cols=_colScale.domain(cols);var rowCount=rows.domain().length,colCount=cols.domain().length,boxWidth=Math.floor(_chart.effectiveWidth()/colCount),boxHeight=Math.floor(_chart.effectiveHeight()/rowCount);cols.rangeRoundBands([0,_chart.effectiveWidth()]);rows.rangeRoundBands([_chart.effectiveHeight(),0]);var boxes=_chartBody.selectAll("g.box-group").data(_chart.data(),function(d,i){return _chart.keyAccessor()(d,i)+"\0"+_chart.valueAccessor()(d,i)});var gEnter=boxes.enter().append("g").attr("class","box-group");gEnter.append("rect").attr("class","heat-box").attr("fill","white").on("click",_chart.boxOnClick());if(_chart.renderTitle()){gEnter.append("title");boxes.select("title").text(_chart.title())}dc.transition(boxes.select("rect"),_chart.transitionDuration(),_chart.transitionDelay()).attr("x",function(d,i){return cols(_chart.keyAccessor()(d,i))}).attr("y",function(d,i){return rows(_chart.valueAccessor()(d,i))}).attr("rx",_xBorderRadius).attr("ry",_yBorderRadius).attr("fill",_chart.getColor).attr("width",boxWidth).attr("height",boxHeight);boxes.exit().remove();var gCols=_chartBody.select("g.cols");if(gCols.empty()){gCols=_chartBody.append("g").attr("class","cols axis")}var gColsText=gCols.selectAll("text").data(cols.domain());gColsText.enter().append("text").attr("x",function(d){return cols(d)+boxWidth/2}).style("text-anchor","middle").attr("y",_chart.effectiveHeight()).attr("dy",12).on("click",_chart.xAxisOnClick()).text(_chart.colsLabel());dc.transition(gColsText,_chart.transitionDuration(),_chart.transitionDelay()).text(_chart.colsLabel()).attr("x",function(d){return cols(d)+boxWidth/2}).attr("y",_chart.effectiveHeight());gColsText.exit().remove();var gRows=_chartBody.select("g.rows");if(gRows.empty()){gRows=_chartBody.append("g").attr("class","rows axis")}var gRowsText=gRows.selectAll("text").data(rows.domain());gRowsText.enter().append("text").attr("dy",6).style("text-anchor","end").attr("x",0).attr("dx",-2).on("click",_chart.yAxisOnClick()).text(_chart.rowsLabel());dc.transition(gRowsText,_chart.transitionDuration(),_chart.transitionDelay()).text(_chart.rowsLabel()).attr("y",function(d){return rows(d)+boxHeight/2});gRowsText.exit().remove();if(_chart.hasFilter()){_chart.selectAll("g.box-group").each(function(d){if(_chart.isSelectedNode(d)){_chart.highlightSelected(this)}else{_chart.fadeDeselected(this)}})}else{_chart.selectAll("g.box-group").each(function(){_chart.resetHighlight(this)})}return _chart};_chart.boxOnClick=function(handler){if(!arguments.length){return _boxOnClick}_boxOnClick=handler;return _chart};_chart.xAxisOnClick=function(handler){if(!arguments.length){return _xAxisOnClick}_xAxisOnClick=handler;return _chart};_chart.yAxisOnClick=function(handler){if(!arguments.length){return _yAxisOnClick}_yAxisOnClick=handler;return _chart};_chart.xBorderRadius=function(xBorderRadius){if(!arguments.length){return _xBorderRadius}_xBorderRadius=xBorderRadius;return _chart};_chart.yBorderRadius=function(yBorderRadius){if(!arguments.length){return _yBorderRadius}_yBorderRadius=yBorderRadius;return _chart};_chart.isSelectedNode=function(d){return _chart.hasFilter(d.key)};return _chart.anchor(parent,chartGroup)};(function(){d3.box=function(){var width=1,height=1,duration=0,delay=0,domain=null,value=Number,whiskers=boxWhiskers,quartiles=boxQuartiles,tickFormat=null;function box(g){g.each(function(d,i){d=d.map(value).sort(d3.ascending);var g=d3.select(this),n=d.length,min=d[0],max=d[n-1];var quartileData=d.quartiles=quartiles(d);var whiskerIndices=whiskers&&whiskers.call(this,d,i),whiskerData=whiskerIndices&&whiskerIndices.map(function(i){return d[i]});var outlierIndices=whiskerIndices?d3.range(0,whiskerIndices[0]).concat(d3.range(whiskerIndices[1]+1,n)):d3.range(n);var x1=d3.scale.linear().domain(domain&&domain.call(this,d,i)||[min,max]).range([height,0]);var x0=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(x1.range());this.__chart__=x1;var center=g.selectAll("line.center").data(whiskerData?[whiskerData]:[]);center.enter().insert("line","rect").attr("class","center").attr("x1",width/2).attr("y1",function(d){return x0(d[0])}).attr("x2",width/2).attr("y2",function(d){return x0(d[1])}).style("opacity",1e-6).transition().duration(duration).delay(delay).style("opacity",1).attr("y1",function(d){return x1(d[0])}).attr("y2",function(d){return x1(d[1])});center.transition().duration(duration).delay(delay).style("opacity",1).attr("x1",width/2).attr("x2",width/2).attr("y1",function(d){return x1(d[0])}).attr("y2",function(d){return x1(d[1])});center.exit().transition().duration(duration).delay(delay).style("opacity",1e-6).attr("y1",function(d){return x1(d[0])}).attr("y2",function(d){return x1(d[1])}).remove();var box=g.selectAll("rect.box").data([quartileData]);box.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(d){return x0(d[2])}).attr("width",width).attr("height",function(d){return x0(d[0])-x0(d[2])}).transition().duration(duration).delay(delay).attr("y",function(d){return x1(d[2])}).attr("height",function(d){return x1(d[0])-x1(d[2])});box.transition().duration(duration).delay(delay).attr("width",width).attr("y",function(d){return x1(d[2])}).attr("height",function(d){return x1(d[0])-x1(d[2])});var medianLine=g.selectAll("line.median").data([quartileData[1]]);medianLine.enter().append("line").attr("class","median").attr("x1",0).attr("y1",x0).attr("x2",width).attr("y2",x0).transition().duration(duration).delay(delay).attr("y1",x1).attr("y2",x1);medianLine.transition().duration(duration).delay(delay).attr("x1",0).attr("x2",width).attr("y1",x1).attr("y2",x1);var whisker=g.selectAll("line.whisker").data(whiskerData||[]);whisker.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",x0).attr("x2",width).attr("y2",x0).style("opacity",1e-6).transition().duration(duration).delay(delay).attr("y1",x1).attr("y2",x1).style("opacity",1);whisker.transition().duration(duration).delay(delay).attr("x1",0).attr("x2",width).attr("y1",x1).attr("y2",x1).style("opacity",1);whisker.exit().transition().duration(duration).delay(delay).attr("y1",x1).attr("y2",x1).style("opacity",1e-6).remove();var outlier=g.selectAll("circle.outlier").data(outlierIndices,Number);outlier.enter().insert("circle","text").attr("class","outlier").attr("r",5).attr("cx",width/2).attr("cy",function(i){return x0(d[i])}).style("opacity",1e-6).transition().duration(duration).delay(delay).attr("cy",function(i){return x1(d[i])}).style("opacity",1);outlier.transition().duration(duration).delay(delay).attr("cx",width/2).attr("cy",function(i){return x1(d[i])}).style("opacity",1);outlier.exit().transition().duration(duration).delay(delay).attr("cy",function(i){return x1(d[i])}).style("opacity",1e-6).remove();var format=tickFormat||x1.tickFormat(8);var boxTick=g.selectAll("text.box").data(quartileData);boxTick.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(d,i){return i&1?6:-6}).attr("x",function(d,i){return i&1?width:0}).attr("y",x0).attr("text-anchor",function(d,i){return i&1?"start":"end"}).text(format).transition().duration(duration).delay(delay).attr("y",x1);boxTick.transition().duration(duration).delay(delay).text(format).attr("x",function(d,i){return i&1?width:0}).attr("y",x1);var whiskerTick=g.selectAll("text.whisker").data(whiskerData||[]);whiskerTick.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",width).attr("y",x0).text(format).style("opacity",1e-6).transition().duration(duration).delay(delay).attr("y",x1).style("opacity",1);whiskerTick.transition().duration(duration).delay(delay).text(format).attr("x",width).attr("y",x1).style("opacity",1);whiskerTick.exit().transition().duration(duration).delay(delay).attr("y",x1).style("opacity",1e-6).remove()});d3.timer.flush()}box.width=function(x){if(!arguments.length){return width}width=x;return box};box.height=function(x){if(!arguments.length){return height}height=x;return box};box.tickFormat=function(x){if(!arguments.length){return tickFormat}tickFormat=x;return box};box.duration=function(x){if(!arguments.length){return duration}duration=x;return box};box.domain=function(x){if(!arguments.length){return domain}domain=x===null?x:d3.functor(x);return box};box.value=function(x){if(!arguments.length){return value}value=x;return box};box.whiskers=function(x){if(!arguments.length){return whiskers}whiskers=x;return box};box.quartiles=function(x){if(!arguments.length){return quartiles}quartiles=x;return box};return box};function boxWhiskers(d){return[0,d.length-1]}function boxQuartiles(d){return[d3.quantile(d,.25),d3.quantile(d,.5),d3.quantile(d,.75)]}})();dc.boxPlot=function(parent,chartGroup){var _chart=dc.coordinateGridMixin({});function DEFAULT_WHISKERS_IQR(k){return function(d){var q1=d.quartiles[0],q3=d.quartiles[2],iqr=(q3-q1)*k,i=-1,j=d.length;do{++i}while(d[i]<q1-iqr);do{--j}while(d[j]>q3+iqr);return[i,j]}}var _whiskerIqrFactor=1.5;var _whiskersIqr=DEFAULT_WHISKERS_IQR;var _whiskers=_whiskersIqr(_whiskerIqrFactor);var _box=d3.box();var _tickFormat=null;var _boxWidth=function(innerChartWidth,xUnits){if(_chart.isOrdinal()){return _chart.x().rangeBand()}else{return innerChartWidth/(1+_chart.boxPadding())/xUnits}};_chart.yAxisPadding(12);_chart.x(d3.scale.ordinal());_chart.xUnits(dc.units.ordinal);_chart.data(function(group){return group.all().map(function(d){d.map=function(accessor){return accessor.call(d,d)};return d}).filter(function(d){var values=_chart.valueAccessor()(d);return values.length!==0})});_chart.boxPadding=_chart._rangeBandPadding;_chart.boxPadding(.8);_chart.outerPadding=_chart._outerRangeBandPadding;_chart.outerPadding(.5);_chart.boxWidth=function(boxWidth){if(!arguments.length){return _boxWidth}_boxWidth=d3.functor(boxWidth);return _chart};var boxTransform=function(d,i){var xOffset=_chart.x()(_chart.keyAccessor()(d,i));return"translate("+xOffset+", 0)"};_chart._preprocessData=function(){if(_chart.elasticX()){_chart.x().domain([])}};_chart.plotData=function(){var _calculatedBoxWidth=_boxWidth(_chart.effectiveWidth(),_chart.xUnitCount());_box.whiskers(_whiskers).width(_calculatedBoxWidth).height(_chart.effectiveHeight()).value(_chart.valueAccessor()).domain(_chart.y().domain()).duration(_chart.transitionDuration()).tickFormat(_tickFormat);var boxesG=_chart.chartBodyG().selectAll("g.box").data(_chart.data(),_chart.keyAccessor());renderBoxes(boxesG);updateBoxes(boxesG);removeBoxes(boxesG);_chart.fadeDeselectedArea()};function renderBoxes(boxesG){var boxesGEnter=boxesG.enter().append("g");boxesGEnter.attr("class","box").attr("transform",boxTransform).call(_box).on("click",function(d){_chart.filter(_chart.keyAccessor()(d));_chart.redrawGroup()})}function updateBoxes(boxesG){dc.transition(boxesG,_chart.transitionDuration(),_chart.transitionDelay()).attr("transform",boxTransform).call(_box).each(function(){d3.select(this).select("rect.box").attr("fill",_chart.getColor)})}function removeBoxes(boxesG){boxesG.exit().remove().call(_box)}_chart.fadeDeselectedArea=function(){if(_chart.hasFilter()){if(_chart.isOrdinal()){_chart.g().selectAll("g.box").each(function(d){if(_chart.isSelectedNode(d)){_chart.highlightSelected(this)}else{_chart.fadeDeselected(this)}})}else{var extent=_chart.brush().extent();var start=extent[0];var end=extent[1];var keyAccessor=_chart.keyAccessor();_chart.g().selectAll("g.box").each(function(d){var key=keyAccessor(d);if(key<start||key>=end){_chart.fadeDeselected(this)}else{_chart.highlightSelected(this)}})}}else{_chart.g().selectAll("g.box").each(function(){_chart.resetHighlight(this)})}};_chart.isSelectedNode=function(d){return _chart.hasFilter(_chart.keyAccessor()(d))};_chart.yAxisMin=function(){var min=d3.min(_chart.data(),function(e){return d3.min(_chart.valueAccessor()(e))});return dc.utils.subtract(min,_chart.yAxisPadding())};_chart.yAxisMax=function(){var max=d3.max(_chart.data(),function(e){return d3.max(_chart.valueAccessor()(e))});return dc.utils.add(max,_chart.yAxisPadding())};_chart.tickFormat=function(tickFormat){if(!arguments.length){return _tickFormat}_tickFormat=tickFormat;return _chart};return _chart.anchor(parent,chartGroup)};dc.selectMenu=function(parent,chartGroup){var SELECT_CSS_CLASS="dc-select-menu";var OPTION_CSS_CLASS="dc-select-option";var _chart=dc.baseMixin({});var _select;var _promptText="Select all";var _multiple=false;var _promptValue=null;var _numberVisible=null;var _order=function(a,b){return _chart.keyAccessor()(a)>_chart.keyAccessor()(b)?1:_chart.keyAccessor()(b)>_chart.keyAccessor()(a)?-1:0};var _filterDisplayed=function(d){return _chart.valueAccessor()(d)>0};_chart.data(function(group){return group.all().filter(_filterDisplayed)});_chart._doRender=function(){_chart.select("select").remove();_select=_chart.root().append("select").classed(SELECT_CSS_CLASS,true);_select.append("option").text(_promptText).attr("value","");_chart._doRedraw();return _chart};_chart._doRedraw=function(){setAttributes();renderOptions();if(_chart.hasFilter()&&_multiple){_select.selectAll("option").property("selected",function(d){return d&&_chart.filters().indexOf(String(_chart.keyAccessor()(d)))>=0})}else if(_chart.hasFilter()){_select.property("value",_chart.filter())}else{_select.property("value","")}return _chart};function renderOptions(){var options=_select.selectAll("option."+OPTION_CSS_CLASS).data(_chart.data(),function(d){return _chart.keyAccessor()(d)});options.enter().append("option").classed(OPTION_CSS_CLASS,true).attr("value",function(d){return _chart.keyAccessor()(d)});options.text(_chart.title());options.exit().remove();_select.selectAll("option."+OPTION_CSS_CLASS).sort(_order);_select.on("change",onChange);return options}function onChange(d,i){var values;var target=d3.event.target;if(target.selectedOptions){var selectedOptions=Array.prototype.slice.call(target.selectedOptions);values=selectedOptions.map(function(d){return d.value})}else{var options=[].slice.call(d3.event.target.options);values=options.filter(function(option){return option.selected}).map(function(option){return option.value})}if(values.length===1&&values[0]===""){values=_promptValue||null}else if(!_multiple&&values.length===1){values=values[0]}_chart.onChange(values)}_chart.onChange=function(val){if(val&&_multiple){_chart.replaceFilter([val])}else if(val){_chart.replaceFilter(val)}else{_chart.filterAll()}dc.events.trigger(function(){_chart.redrawGroup()})};function setAttributes(){if(_multiple){_select.attr("multiple",true)}else{_select.attr("multiple",null)}if(_numberVisible!==null){_select.attr("size",_numberVisible)}else{_select.attr("size",null)}}_chart.order=function(order){if(!arguments.length){return _order}_order=order;return _chart};_chart.promptText=function(_){if(!arguments.length){return _promptText}_promptText=_;return _chart};_chart.filterDisplayed=function(filterDisplayed){if(!arguments.length){return _filterDisplayed}_filterDisplayed=filterDisplayed;return _chart};_chart.multiple=function(multiple){if(!arguments.length){return _multiple}_multiple=multiple;return _chart};_chart.promptValue=function(promptValue){if(!arguments.length){return _promptValue}_promptValue=promptValue;return _chart};_chart.numberVisible=function(numberVisible){if(!arguments.length){return _numberVisible}_numberVisible=numberVisible;return _chart};_chart.size=dc.logger.deprecate(_chart.numberVisible,"selectMenu.size is ambiguous - use numberVisible instead");return _chart.anchor(parent,chartGroup)};dc.abstractBubbleChart=dc.bubbleMixin;dc.baseChart=dc.baseMixin;dc.capped=dc.capMixin;dc.colorChart=dc.colorMixin;dc.coordinateGridChart=dc.coordinateGridMixin;dc.marginable=dc.marginMixin;dc.stackableChart=dc.stackMixin;dc.d3=d3;dc.crossfilter=crossfilter;return dc}if(typeof define==="function"&&define.amd){define(["d3","crossfilter2"],_dc)}else if(typeof module==="object"&&module.exports){var _d3=require("d3");var _crossfilter=require("crossfilter2");if(typeof _crossfilter!=="function"){_crossfilter=_crossfilter.crossfilter}module.exports=_dc(_d3,_crossfilter)}else{this.dc=_dc(d3,crossfilter)}})();var CalHeatMap=function(){"use strict";var self=this;this.allowedDataType=["json","csv","tsv","txt"];this.options={itemSelector:"#cal-heatmap",paintOnLoad:true,range:12,cellSize:10,cellPadding:2,cellRadius:0,domainGutter:2,domainMargin:[0,0,0,0],domain:"hour",subDomain:"min",colLimit:null,rowLimit:null,weekStartOnMonday:true,start:new Date,minDate:null,maxDate:null,data:"",dataType:this.allowedDataType[0],considerMissingDataAsZero:false,loadOnInit:true,verticalOrientation:false,domainDynamicDimension:true,label:{position:"bottom",align:"center",offset:{x:0,y:0},rotate:null,width:100,height:null},legend:[10,20,30,40],displayLegend:true,legendCellSize:10,legendCellPadding:2,legendMargin:[0,0,0,0],legendVerticalPosition:"bottom",legendHorizontalPosition:"left",legendOrientation:"horizontal",legendColors:null,highlight:[],itemName:["item","items"],domainLabelFormat:null,subDomainTitleFormat:{empty:"{date}",filled:"{count} {name} {connector} {date}"},subDomainDateFormat:null,subDomainTextFormat:null,legendTitleFormat:{lower:"less than {min} {name}",inner:"between {down} and {up} {name}",upper:"more than {max} {name}"},animationDuration:500,nextSelector:false,previousSelector:false,itemNamespace:"cal-heatmap",tooltip:false,onClick:null,afterLoad:null,afterLoadNextDomain:null,afterLoadPreviousDomain:null,onComplete:null,afterLoadData:function(data){return data},onMaxDomainReached:null,onMinDomainReached:null};this._domainType={min:{name:"minute",level:10,maxItemNumber:60,defaultRowNumber:10,defaultColumnNumber:6,row:function(d){return self.getSubDomainRowNumber(d)},column:function(d){return self.getSubDomainColumnNumber(d)},position:{x:function(d){return Math.floor(d.getMinutes()/self._domainType.min.row(d))},y:function(d){return d.getMinutes()%self._domainType.min.row(d)}},format:{date:"%H:%M, %A %B %-e, %Y",legend:"",connector:"at"},extractUnit:function(d){return new Date(d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes()).getTime()}},hour:{name:"hour",level:20,maxItemNumber:function(d){switch(self.options.domain){case"day":return 24;case"week":return 24*7;case"month":return 24*(self.options.domainDynamicDimension?self.getDayCountInMonth(d):31)}},defaultRowNumber:6,defaultColumnNumber:function(d){switch(self.options.domain){case"day":return 4;case"week":return 28;case"month":return self.options.domainDynamicDimension?self.getDayCountInMonth(d):31}},row:function(d){return self.getSubDomainRowNumber(d)},column:function(d){return self.getSubDomainColumnNumber(d)},position:{x:function(d){if(self.options.domain==="month"){if(self.options.colLimit>0||self.options.rowLimit>0){return Math.floor((d.getHours()+(d.getDate()-1)*24)/self._domainType.hour.row(d))}return Math.floor(d.getHours()/self._domainType.hour.row(d))+(d.getDate()-1)*4}else if(self.options.domain==="week"){if(self.options.colLimit>0||self.options.rowLimit>0){return Math.floor((d.getHours()+self.getWeekDay(d)*24)/self._domainType.hour.row(d))}return Math.floor(d.getHours()/self._domainType.hour.row(d))+self.getWeekDay(d)*4}return Math.floor(d.getHours()/self._domainType.hour.row(d))},y:function(d){var p=d.getHours();if(self.options.colLimit>0||self.options.rowLimit>0){switch(self.options.domain){case"month":p+=(d.getDate()-1)*24;break;case"week":p+=self.getWeekDay(d)*24;break}}return Math.floor(p%self._domainType.hour.row(d))}},format:{date:"%Hh, %A %B %-e, %Y",legend:"%H:00",connector:"at"},extractUnit:function(d){return new Date(d.getFullYear(),d.getMonth(),d.getDate(),d.getHours()).getTime()}},day:{name:"day",level:30,maxItemNumber:function(d){switch(self.options.domain){case"week":return 7;case"month":return self.options.domainDynamicDimension?self.getDayCountInMonth(d):31;case"year":return self.options.domainDynamicDimension?self.getDayCountInYear(d):366}},defaultColumnNumber:function(d){d=new Date(d);switch(self.options.domain){case"week":return 1;case"month":return self.options.domainDynamicDimension&&!self.options.verticalOrientation?self.getWeekNumber(new Date(d.getFullYear(),d.getMonth()+1,0))-self.getWeekNumber(d)+1:6;case"year":return self.options.domainDynamicDimension?self.getWeekNumber(new Date(d.getFullYear(),11,31))-self.getWeekNumber(new Date(d.getFullYear(),0))+1:54}},defaultRowNumber:7,row:function(d){return self.getSubDomainRowNumber(d)},column:function(d){return self.getSubDomainColumnNumber(d)},position:{x:function(d){switch(self.options.domain){case"week":return Math.floor(self.getWeekDay(d)/self._domainType.day.row(d));case"month":if(self.options.colLimit>0||self.options.rowLimit>0){return Math.floor((d.getDate()-1)/self._domainType.day.row(d))}return self.getWeekNumber(d)-self.getWeekNumber(new Date(d.getFullYear(),d.getMonth()));case"year":if(self.options.colLimit>0||self.options.rowLimit>0){return Math.floor((self.getDayOfYear(d)-1)/self._domainType.day.row(d))}return self.getWeekNumber(d)}},y:function(d){var p=self.getWeekDay(d);if(self.options.colLimit>0||self.options.rowLimit>0){switch(self.options.domain){case"year":p=self.getDayOfYear(d)-1;break;case"week":p=self.getWeekDay(d);break;case"month":p=d.getDate()-1;break}}return Math.floor(p%self._domainType.day.row(d))}},format:{date:"%A %B %-e, %Y",legend:"%e %b",connector:"on"},extractUnit:function(d){return new Date(d.getFullYear(),d.getMonth(),d.getDate()).getTime()}},week:{name:"week",level:40,maxItemNumber:54,defaultColumnNumber:function(d){d=new Date(d);switch(self.options.domain){case"year":return self._domainType.week.maxItemNumber;case"month":return self.getWeekNumber(new Date(d.getFullYear(),d.getMonth()+1,0))-self.getWeekNumber(d)}},defaultRowNumber:1,row:function(d){return self.getSubDomainRowNumber(d)},column:function(d){return self.getSubDomainColumnNumber(d)},position:{x:function(d){switch(self.options.domain){case"year":return Math.floor(self.getWeekNumber(d)/self._domainType.week.row(d));case"month":return Math.floor(self.getMonthWeekNumber(d)/self._domainType.week.row(d))}},y:function(d){return self.getWeekNumber(d)%self._domainType.week.row(d)}},format:{date:"%B Week #%W",legend:"%B Week #%W",connector:"on"},extractUnit:function(d){var dt=new Date(d.getFullYear(),d.getMonth(),d.getDate());var weekDay=dt.getDay()-1;if(weekDay<0){weekDay=6}dt.setDate(dt.getDate()-weekDay);return dt.getTime()}},month:{name:"month",level:50,maxItemNumber:12,defaultColumnNumber:12,defaultRowNumber:1,row:function(){return self.getSubDomainRowNumber()},column:function(){return self.getSubDomainColumnNumber()},position:{x:function(d){return Math.floor(d.getMonth()/self._domainType.month.row(d))},y:function(d){return d.getMonth()%self._domainType.month.row(d)}},format:{date:"%B %Y",legend:"%B",connector:"on"},extractUnit:function(d){return new Date(d.getFullYear(),d.getMonth()).getTime()}},year:{name:"year",level:60,row:function(){return self.options.rowLimit||1},column:function(){return self.options.colLimit||1},position:{x:function(){return 1},y:function(){return 1}},format:{date:"%Y",legend:"%Y",connector:"on"},extractUnit:function(d){return new Date(d.getFullYear()).getTime()}}};for(var type in this._domainType){if(this._domainType.hasOwnProperty(type)){var d=this._domainType[type];this._domainType["x_"+type]={name:"x_"+type,level:d.type,maxItemNumber:d.maxItemNumber,defaultRowNumber:d.defaultRowNumber,defaultColumnNumber:d.defaultColumnNumber,row:d.column,column:d.row,position:{x:d.position.y,y:d.position.x},format:d.format,extractUnit:d.extractUnit}}}this.lastInsertedSvg=null;this._completed=false;this._domains=d3.map();this.graphDim={width:0,height:0};this.legendDim={width:0,height:0};this.NAVIGATE_LEFT=1;this.NAVIGATE_RIGHT=2;this.RESET_ALL_ON_UPDATE=0;this.RESET_SINGLE_ON_UPDATE=1;this.APPEND_ON_UPDATE=2;this.DEFAULT_LEGEND_MARGIN=10;this.root=null;this.tooltip=null;this._maxDomainReached=false;this._minDomainReached=false;this.domainPosition=new DomainPosition;this.Legend=null;this.legendScale=null;this.DSTDomain=[];this._init=function(){self.getDomain(self.options.start).map(function(d){return d.getTime()}).map(function(d){self._domains.set(d,self.getSubDomain(d).map(function(d){return{t:self._domainType[self.options.subDomain].extractUnit(d),v:null}}))});self.root=d3.select(self.options.itemSelector).append("svg").attr("class","cal-heatmap-container");self.tooltip=d3.select(self.options.itemSelector).attr("style",function(){var current=d3.select(self.options.itemSelector).attr("style");return(current!==null?current:"")+"position:relative;"}).append("div").attr("class","ch-tooltip");self.root.attr("x",0).attr("y",0).append("svg").attr("class","graph");self.Legend=new Legend(self);if(self.options.paintOnLoad){_initCalendar()}return true};function _initCalendar(){self.verticalDomainLabel=self.options.label.position==="top"||self.options.label.position==="bottom";self.domainVerticalLabelHeight=self.options.label.height===null?Math.max(25,self.options.cellSize*2):self.options.label.height;self.domainHorizontalLabelWidth=0;if(self.options.domainLabelFormat===""&&self.options.label.height===null){self.domainVerticalLabelHeight=0}if(!self.verticalDomainLabel){self.domainVerticalLabelHeight=0;self.domainHorizontalLabelWidth=self.options.label.width}self.paint();if(self.options.nextSelector!==false){d3.select(self.options.nextSelector).on("click."+self.options.itemNamespace,function(){d3.event.preventDefault();return self.loadNextDomain(1)})}if(self.options.previousSelector!==false){d3.select(self.options.previousSelector).on("click."+self.options.itemNamespace,function(){d3.event.preventDefault();return self.loadPreviousDomain(1)})}self.Legend.redraw(self.graphDim.width-self.options.domainGutter-self.options.cellPadding);self.afterLoad();var domains=self.getDomainKeys();if(self.options.loadOnInit){self.getDatas(self.options.data,new Date(domains[0]),self.getSubDomain(domains[domains.length-1]).pop(),function(){self.fill();self.onComplete()})}else{self.onComplete()}self.checkIfMinDomainIsReached(domains[0]);self.checkIfMaxDomainIsReached(self.getNextDomain().getTime())}function w(d,outer){var width=self.options.cellSize*self._domainType[self.options.subDomain].column(d)+self.options.cellPadding*self._domainType[self.options.subDomain].column(d);if(arguments.length===2&&outer===true){return width+=self.domainHorizontalLabelWidth+self.options.domainGutter+self.options.domainMargin[1]+self.options.domainMargin[3]}return width}function h(d,outer){var height=self.options.cellSize*self._domainType[self.options.subDomain].row(d)+self.options.cellPadding*self._domainType[self.options.subDomain].row(d);if(arguments.length===2&&outer===true){height+=self.options.domainGutter+self.domainVerticalLabelHeight+self.options.domainMargin[0]+self.options.domainMargin[2]}return height}this.paint=function(navigationDir){var options=self.options;if(arguments.length===0){navigationDir=false}var domainSvg=self.root.select(".graph").selectAll(".graph-domain").data(function(){var data=self.getDomainKeys();return navigationDir===self.NAVIGATE_LEFT?data.reverse():data},function(d){return d});var enteringDomainDim=0;var exitingDomainDim=0;var svg=domainSvg.enter().append("svg").attr("width",function(d){return w(d,true)}).attr("height",function(d){return h(d,true)}).attr("x",function(d){if(options.verticalOrientation){self.graphDim.width=Math.max(self.graphDim.width,w(d,true));return 0}else{return getDomainPosition(d,self.graphDim,"width",w(d,true))}}).attr("y",function(d){if(options.verticalOrientation){return getDomainPosition(d,self.graphDim,"height",h(d,true))}else{self.graphDim.height=Math.max(self.graphDim.height,h(d,true));return 0}}).attr("class",function(d){var classname="graph-domain";var date=new Date(d);switch(options.domain){case"hour":classname+=" h_"+date.getHours();case"day":classname+=" d_"+date.getDate()+" dy_"+date.getDay();case"week":classname+=" w_"+self.getWeekNumber(date);case"month":classname+=" m_"+(date.getMonth()+1);case"year":classname+=" y_"+date.getFullYear()}return classname});self.lastInsertedSvg=svg;function getDomainPosition(domainIndex,graphDim,axis,domainDim){var tmp=0;switch(navigationDir){case false:tmp=graphDim[axis];graphDim[axis]+=domainDim;self.domainPosition.setPosition(domainIndex,tmp);return tmp;case self.NAVIGATE_RIGHT:self.domainPosition.setPosition(domainIndex,graphDim[axis]);enteringDomainDim=domainDim;exitingDomainDim=self.domainPosition.getPositionFromIndex(1);self.domainPosition.shiftRightBy(exitingDomainDim);return graphDim[axis];case self.NAVIGATE_LEFT:tmp=-domainDim;enteringDomainDim=-tmp;exitingDomainDim=graphDim[axis]-self.domainPosition.getLast();self.domainPosition.setPosition(domainIndex,tmp);self.domainPosition.shiftLeftBy(enteringDomainDim);return tmp}}svg.append("rect").attr("width",function(d){return w(d,true)-options.domainGutter-options.cellPadding}).attr("height",function(d){return h(d,true)-options.domainGutter-options.cellPadding}).attr("class","domain-background");var subDomainSvgGroup=svg.append("svg").attr("x",function(){if(options.label.position==="left"){return self.domainHorizontalLabelWidth+options.domainMargin[3]}else{return options.domainMargin[3]}}).attr("y",function(){if(options.label.position==="top"){return self.domainVerticalLabelHeight+options.domainMargin[0]}else{return options.domainMargin[0]}}).attr("class","graph-subdomain-group");var rect=subDomainSvgGroup.selectAll("g").data(function(d){return self._domains.get(d)}).enter().append("g");rect.append("rect").attr("class",function(d){return"graph-rect"+self.getHighlightClassName(d.t)+(options.onClick!==null?" hover_cursor":"")}).attr("width",options.cellSize).attr("height",options.cellSize).attr("x",function(d){return self.positionSubDomainX(d.t)}).attr("y",function(d){return self.positionSubDomainY(d.t)}).on("click",function(d){if(options.onClick!==null){return self.onClick(new Date(d.t),d.v)}}).call(function(selection){if(options.cellRadius>0){selection.attr("rx",options.cellRadius).attr("ry",options.cellRadius)}if(self.legendScale!==null&&options.legendColors!==null&&options.legendColors.hasOwnProperty("base")){selection.attr("fill",options.legendColors.base)}if(options.tooltip){selection.on("mouseover",function(d){var domainNode=this.parentNode.parentNode.parentNode;self.tooltip.html(self.getSubDomainTitle(d)).attr("style","display: block;");self.tooltip.attr("style","display: block; "+"left: "+(self.positionSubDomainX(d.t)-self.tooltip[0][0].offsetWidth/2+options.cellSize/2+parseInt(domainNode.getAttribute("x"),10))+"px; "+"top: "+(self.positionSubDomainY(d.t)-self.tooltip[0][0].offsetHeight-options.cellSize/2+parseInt(domainNode.getAttribute("y"),10))+"px;")});selection.on("mouseout",function(){self.tooltip.attr("style","display:none").html("")})}});if(!options.tooltip){rect.append("title").text(function(d){return self.formatDate(new Date(d.t),options.subDomainDateFormat)})}if(options.domainLabelFormat!==""){svg.append("text").attr("class","graph-label").attr("y",function(d){var y=options.domainMargin[0];switch(options.label.position){case"top":y+=self.domainVerticalLabelHeight/2;break;case"bottom":y+=h(d)+self.domainVerticalLabelHeight/2}return y+options.label.offset.y*(options.label.rotate==="right"&&options.label.position==="right"||options.label.rotate==="left"&&options.label.position==="left"?-1:1)}).attr("x",function(d){var x=options.domainMargin[3];switch(options.label.position){case"right":x+=w(d);break;case"bottom":case"top":x+=w(d)/2}if(options.label.align==="right"){return x+self.domainHorizontalLabelWidth-options.label.offset.x*(options.label.rotate==="right"?-1:1)}return x+options.label.offset.x}).attr("text-anchor",function(){switch(options.label.align){case"start":case"left":return"start";case"end":case"right":return"end";default:return"middle"}}).attr("dominant-baseline",function(){return self.verticalDomainLabel?"middle":"top"}).text(function(d){return self.formatDate(new Date(d),options.domainLabelFormat)}).call(domainRotate)}function domainRotate(selection){switch(options.label.rotate){case"right":selection.attr("transform",function(d){var s="rotate(90), ";switch(options.label.position){case"right":s+="translate(-"+w(d)+" , -"+w(d)+")";break;case"left":s+="translate(0, -"+self.domainHorizontalLabelWidth+")";break}return s});break;case"left":selection.attr("transform",function(d){var s="rotate(270), ";switch(options.label.position){case"right":s+="translate(-"+(w(d)+self.domainHorizontalLabelWidth)+" , "+w(d)+")";break;case"left":s+="translate(-"+self.domainHorizontalLabelWidth+" , "+self.domainHorizontalLabelWidth+")";break}return s});break}}if(options.subDomainTextFormat!==null){rect.append("text").attr("class",function(d){return"subdomain-text"+self.getHighlightClassName(d.t)}).attr("x",function(d){return self.positionSubDomainX(d.t)+options.cellSize/2}).attr("y",function(d){return self.positionSubDomainY(d.t)+options.cellSize/2}).attr("text-anchor","middle").attr("dominant-baseline","central").text(function(d){return self.formatDate(new Date(d.t),options.subDomainTextFormat)})}if(navigationDir!==false){domainSvg.transition().duration(options.animationDuration).attr("x",function(d){return options.verticalOrientation?0:self.domainPosition.getPosition(d)}).attr("y",function(d){return options.verticalOrientation?self.domainPosition.getPosition(d):0})}var tempWidth=self.graphDim.width;var tempHeight=self.graphDim.height;if(options.verticalOrientation){self.graphDim.height+=enteringDomainDim-exitingDomainDim}else{self.graphDim.width+=enteringDomainDim-exitingDomainDim}domainSvg.exit().transition().duration(options.animationDuration).attr("x",function(d){if(options.verticalOrientation){return 0}else{switch(navigationDir){case self.NAVIGATE_LEFT:return Math.min(self.graphDim.width,tempWidth);case self.NAVIGATE_RIGHT:return-w(d,true)}}}).attr("y",function(d){if(options.verticalOrientation){switch(navigationDir){case self.NAVIGATE_LEFT:return Math.min(self.graphDim.height,tempHeight);case self.NAVIGATE_RIGHT:return-h(d,true)}}else{return 0}}).remove();self.resize()}};CalHeatMap.prototype={init:function(settings){"use strict";var parent=this;var options=parent.options=mergeRecursive(parent.options,settings);validateDomainType();validateSelector(options.itemSelector,false,"itemSelector");if(parent.allowedDataType.indexOf(options.dataType)===-1){throw new Error("The data type '"+options.dataType+"' is not valid data type")}if(d3.select(options.itemSelector)[0][0]===null){throw new Error("The node '"+options.itemSelector+"' specified in itemSelector does not exists")}try{validateSelector(options.nextSelector,true,"nextSelector");validateSelector(options.previousSelector,true,"previousSelector")}catch(error){console.log(error.message);return false}if(!settings.hasOwnProperty("subDomain")){this.options.subDomain=getOptimalSubDomain(settings.domain)}if(typeof options.itemNamespace!=="string"||options.itemNamespace===""){console.log("itemNamespace can not be empty, falling back to cal-heatmap");options.itemNamespace="cal-heatmap"}var s=["data","onComplete","onClick","afterLoad","afterLoadData","afterLoadPreviousDomain","afterLoadNextDomain"];for(var k in s){if(settings.hasOwnProperty(s[k])){options[s[k]]=settings[s[k]]}}options.subDomainDateFormat=typeof options.subDomainDateFormat==="string"||typeof options.subDomainDateFormat==="function"?options.subDomainDateFormat:this._domainType[options.subDomain].format.date;options.domainLabelFormat=typeof options.domainLabelFormat==="string"||typeof options.domainLabelFormat==="function"?options.domainLabelFormat:this._domainType[options.domain].format.legend;options.subDomainTextFormat=typeof options.subDomainTextFormat==="string"&&options.subDomainTextFormat!==""||typeof options.subDomainTextFormat==="function"?options.subDomainTextFormat:null;options.domainMargin=expandMarginSetting(options.domainMargin);options.legendMargin=expandMarginSetting(options.legendMargin);options.highlight=parent.expandDateSetting(options.highlight);options.itemName=expandItemName(options.itemName);options.colLimit=parseColLimit(options.colLimit);options.rowLimit=parseRowLimit(options.rowLimit);if(!settings.hasOwnProperty("legendMargin")){autoAddLegendMargin()}autoAlignLabel();function validateSelector(selector,canBeFalse,name){if((canBeFalse&&selector===false||selector instanceof Element||typeof selector==="string")&&selector!==""){return true}throw new Error("The "+name+" is not valid")}function getOptimalSubDomain(domain){switch(domain){case"year":return"month";case"month":return"day";case"week":return"day";case"day":return"hour";default:return"min"}}function validateDomainType(){if(!parent._domainType.hasOwnProperty(options.domain)||options.domain==="min"||options.domain.substring(0,2)==="x_"){throw new Error("The domain '"+options.domain+"' is not valid")}if(!parent._domainType.hasOwnProperty(options.subDomain)||options.subDomain==="year"){throw new Error("The subDomain '"+options.subDomain+"' is not valid")}if(parent._domainType[options.domain].level<=parent._domainType[options.subDomain].level){throw new Error("'"+options.subDomain+"' is not a valid subDomain to '"+options.domain+"'")}return true}function autoAlignLabel(){if(!settings.hasOwnProperty("label")||settings.hasOwnProperty("label")&&!settings.label.hasOwnProperty("align")){switch(options.label.position){case"left":options.label.align="right";break;case"right":options.label.align="left";break;default:options.label.align="center"}if(options.label.rotate==="left"){options.label.align="right"}else if(options.label.rotate==="right"){options.label.align="left"}}if(!settings.hasOwnProperty("label")||settings.hasOwnProperty("label")&&!settings.label.hasOwnProperty("offset")){if(options.label.position==="left"||options.label.position==="right"){options.label.offset={x:10,y:15}}}}function autoAddLegendMargin(){switch(options.legendVerticalPosition){case"top":options.legendMargin[2]=parent.DEFAULT_LEGEND_MARGIN;break;case"bottom":options.legendMargin[0]=parent.DEFAULT_LEGEND_MARGIN;break;case"middle":case"center":options.legendMargin[options.legendHorizontalPosition==="right"?3:1]=parent.DEFAULT_LEGEND_MARGIN}}function expandMarginSetting(value){if(typeof value==="number"){value=[value]}if(!Array.isArray(value)){console.log("Margin only takes an integer or an array of integers");value=[0]}switch(value.length){case 1:return[value[0],value[0],value[0],value[0]];case 2:return[value[0],value[1],value[0],value[1]];case 3:return[value[0],value[1],value[2],value[1]];case 4:return value;default:return value.slice(0,4)}}function expandItemName(value){if(typeof value==="string"){return[value,value+(value!==""?"s":"")]}if(Array.isArray(value)){if(value.length===1){return[value[0],value[0]+"s"]}else if(value.length>2){return value.slice(0,2)}return value}return["item","items"]}function parseColLimit(value){return value>0?value:null}function parseRowLimit(value){if(value>0&&options.colLimit>0){console.log("colLimit and rowLimit are mutually exclusive, rowLimit will be ignored");return null}return value>0?value:null}return this._init()},expandDateSetting:function(value){"use strict";if(!Array.isArray(value)){value=[value]}return value.map(function(data){if(data==="now"){return new Date}if(data instanceof Date){return data}return false}).filter(function(d){return d!==false})},fill:function(svg){"use strict";var parent=this;var options=parent.options;if(arguments.length===0){svg=parent.root.selectAll(".graph-domain")}var rect=svg.selectAll("svg").selectAll("g").data(function(d){return parent._domains.get(d)});function addStyle(element){if(parent.legendScale===null){return false}element.attr("fill",function(d){if(d.v===0&&options.legendColors!==null&&options.legendColors.hasOwnProperty("empty")){return options.legendColors.empty}if(d.v<0&&options.legend[0]>0&&options.legendColors!==null&&options.legendColors.hasOwnProperty("overflow")){return options.legendColors.overflow}return parent.legendScale(Math.min(d.v,options.legend[options.legend.length-1]))})}rect.transition().duration(options.animationDuration).select("rect").attr("class",function(d){var htmlClass=parent.getHighlightClassName(d.t);if(parent.legendScale===null){htmlClass+=" graph-rect"}if(d.v!==null){htmlClass+=" "+parent.Legend.getClass(d.v,parent.legendScale===null)}else if(options.considerMissingDataAsZero&&parent.dateIsLessThan(d.t,new Date)){htmlClass+=" "+parent.Legend.getClass(0,parent.legendScale===null)}if(options.onClick!==null){htmlClass+=" hover_cursor"}return htmlClass}).call(addStyle);rect.transition().duration(options.animationDuration).select("title").text(function(d){return parent.getSubDomainTitle(d)})},triggerEvent:function(eventName,successArgs,skip){"use strict";if(arguments.length===3&&skip||this.options[eventName]===null){return true}if(typeof this.options[eventName]==="function"){if(typeof successArgs==="function"){successArgs=successArgs()}return this.options[eventName].apply(this,successArgs)}else{console.log("Provided callback for "+eventName+" is not a function.");return false}},onClick:function(d,itemNb){"use strict";return this.triggerEvent("onClick",[d,itemNb])},afterLoad:function(){"use strict";return this.triggerEvent("afterLoad")},onComplete:function(){"use strict";var response=this.triggerEvent("onComplete",[],this._completed);this._completed=true;return response},afterLoadPreviousDomain:function(start){"use strict";var parent=this;return this.triggerEvent("afterLoadPreviousDomain",function(){var subDomain=parent.getSubDomain(start);return[subDomain.shift(),subDomain.pop()]})},afterLoadNextDomain:function(start){"use strict";var parent=this;return this.triggerEvent("afterLoadNextDomain",function(){var subDomain=parent.getSubDomain(start);return[subDomain.shift(),subDomain.pop()]})},onMinDomainReached:function(reached){"use strict";this._minDomainReached=reached;return this.triggerEvent("onMinDomainReached",[reached])},onMaxDomainReached:function(reached){"use strict";this._maxDomainReached=reached;return this.triggerEvent("onMaxDomainReached",[reached])},checkIfMinDomainIsReached:function(date,upperBound){"use strict";if(this.minDomainIsReached(date)){this.onMinDomainReached(true)}if(arguments.length===2){if(this._maxDomainReached&&!this.maxDomainIsReached(upperBound)){this.onMaxDomainReached(false)}}},checkIfMaxDomainIsReached:function(date,lowerBound){"use strict";if(this.maxDomainIsReached(date)){this.onMaxDomainReached(true)}if(arguments.length===2){if(this._minDomainReached&&!this.minDomainIsReached(lowerBound)){this.onMinDomainReached(false)}}},formatNumber:d3.format(",g"),formatDate:function(d,format){"use strict";if(arguments.length<2){format="title"}if(typeof format==="function"){return format(d)}else{var f=d3.time.format(format);return f(d)}},getSubDomainTitle:function(d){"use strict";if(d.v===null&&!this.options.considerMissingDataAsZero){return this.options.subDomainTitleFormat.empty.format({date:this.formatDate(new Date(d.t),this.options.subDomainDateFormat)})}else{var value=d.v;if(value===null&&this.options.considerMissingDataAsZero){value=0}return this.options.subDomainTitleFormat.filled.format({count:this.formatNumber(value),name:this.options.itemName[value!==1?1:0],connector:this._domainType[this.options.subDomain].format.connector,date:this.formatDate(new Date(d.t),this.options.subDomainDateFormat)})}},loadNextDomain:function(n){"use strict";if(this._maxDomainReached||n===0){return false}var bound=this.loadNewDomains(this.NAVIGATE_RIGHT,this.getDomain(this.getNextDomain(),n));this.afterLoadNextDomain(bound.end);this.checkIfMaxDomainIsReached(this.getNextDomain().getTime(),bound.start);return true},loadPreviousDomain:function(n){"use strict";if(this._minDomainReached||n===0){return false}var bound=this.loadNewDomains(this.NAVIGATE_LEFT,this.getDomain(this.getDomainKeys()[0],-n).reverse());this.afterLoadPreviousDomain(bound.start);this.checkIfMinDomainIsReached(bound.start,bound.end);return true},loadNewDomains:function(direction,newDomains){"use strict";var parent=this;var backward=direction===this.NAVIGATE_LEFT;var i=-1;var total=newDomains.length;var domains=this.getDomainKeys();function buildSubDomain(d){return{t:parent._domainType[parent.options.subDomain].extractUnit(d),v:null}}while(++i<total){if(backward&&this.minDomainIsReached(newDomains[i])){newDomains=newDomains.slice(0,i+1);break}if(!backward&&this.maxDomainIsReached(newDomains[i])){newDomains=newDomains.slice(0,i);break}}newDomains=newDomains.slice(-this.options.range);for(i=0,total=newDomains.length;i<total;i++){this._domains.set(newDomains[i].getTime(),this.getSubDomain(newDomains[i]).map(buildSubDomain));this._domains.remove(backward?domains.pop():domains.shift())}domains=this.getDomainKeys();if(backward){newDomains=newDomains.reverse()}this.paint(direction);this.getDatas(this.options.data,newDomains[0],this.getSubDomain(newDomains[newDomains.length-1]).pop(),function(){parent.fill(parent.lastInsertedSvg)});return{start:newDomains[backward?0:1],end:domains[domains.length-1]}},maxDomainIsReached:function(datetimestamp){"use strict";return this.options.maxDate!==null&&this.options.maxDate.getTime()<datetimestamp},minDomainIsReached:function(datetimestamp){"use strict";return this.options.minDate!==null&&this.options.minDate.getTime()>=datetimestamp},getDomainKeys:function(){"use strict";return this._domains.keys().map(function(d){return parseInt(d,10)}).sort(function(a,b){return a-b})},positionSubDomainX:function(d){"use strict";var index=this._domainType[this.options.subDomain].position.x(new Date(d));return index*this.options.cellSize+index*this.options.cellPadding},positionSubDomainY:function(d){"use strict";var index=this._domainType[this.options.subDomain].position.y(new Date(d));return index*this.options.cellSize+index*this.options.cellPadding},getSubDomainColumnNumber:function(d){"use strict";if(this.options.rowLimit>0){var i=this._domainType[this.options.subDomain].maxItemNumber;if(typeof i==="function"){i=i(d)}return Math.ceil(i/this.options.rowLimit)}var j=this._domainType[this.options.subDomain].defaultColumnNumber;if(typeof j==="function"){j=j(d)}return this.options.colLimit||j},getSubDomainRowNumber:function(d){"use strict";if(this.options.colLimit>0){var i=this._domainType[this.options.subDomain].maxItemNumber;if(typeof i==="function"){i=i(d)}return Math.ceil(i/this.options.colLimit)}var j=this._domainType[this.options.subDomain].defaultRowNumber;if(typeof j==="function"){j=j(d)}return this.options.rowLimit||j},getHighlightClassName:function(d){"use strict";d=new Date(d);if(this.options.highlight.length>0){for(var i in this.options.highlight){if(this.options.highlight[i]instanceof Date&&this.dateIsEqual(this.options.highlight[i],d)){return" highlight"+(this.isNow(this.options.highlight[i])?" now":"")}}}return""},isNow:function(d){"use strict";return this.dateIsEqual(d,new Date)},dateIsEqual:function(dateA,dateB){"use strict";switch(this.options.subDomain){case"x_min":case"min":return dateA.getFullYear()===dateB.getFullYear()&&dateA.getMonth()===dateB.getMonth()&&dateA.getDate()===dateB.getDate()&&dateA.getHours()===dateB.getHours()&&dateA.getMinutes()===dateB.getMinutes();case"x_hour":case"hour":return dateA.getFullYear()===dateB.getFullYear()&&dateA.getMonth()===dateB.getMonth()&&dateA.getDate()===dateB.getDate()&&dateA.getHours()===dateB.getHours();case"x_day":case"day":return dateA.getFullYear()===dateB.getFullYear()&&dateA.getMonth()===dateB.getMonth()&&dateA.getDate()===dateB.getDate();case"x_week":case"week":case"x_month":case"month":return dateA.getFullYear()===dateB.getFullYear()&&dateA.getMonth()===dateB.getMonth();default:return false}},dateIsLessThan:function(dateA,dateB){"use strict";if(!(dateA instanceof Date)){dateA=new Date(dateA)}if(!(dateB instanceof Date)){dateB=new Date(dateB)}function normalizedMillis(date,subdomain){switch(subdomain){case"x_min":case"min":return new Date(date.getFullYear(),date.getMonth(),date.getDate(),date.getHours(),date.getMinutes()).getTime();case"x_hour":case"hour":return new Date(date.getFullYear(),date.getMonth(),date.getDate(),date.getHours()).getTime();case"x_day":case"day":return new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime();case"x_week":case"week":case"x_month":case"month":return new Date(date.getFullYear(),date.getMonth()).getTime();default:return date.getTime()}}return normalizedMillis(dateA,this.options.subDomain)<normalizedMillis(dateB,this.options.subDomain)},getDayOfYear:d3.time.format("%j"),getWeekNumber:function(d){"use strict";var f=this.options.weekStartOnMonday===true?d3.time.format("%W"):d3.time.format("%U");return f(d)},getMonthWeekNumber:function(d){"use strict";if(typeof d==="number"){d=new Date(d)}var monthFirstWeekNumber=this.getWeekNumber(new Date(d.getFullYear(),d.getMonth()));return this.getWeekNumber(d)-monthFirstWeekNumber-1},getWeekNumberInYear:function(d){"use strict";if(typeof d==="number"){d=new Date(d)}},getDayCountInMonth:function(d){"use strict";return this.getEndOfMonth(d).getDate()},getDayCountInYear:function(d){"use strict";if(typeof d==="number"){d=new Date(d)}return new Date(d.getFullYear(),1,29).getMonth()===1?366:365},getWeekDay:function(d){"use strict";if(this.options.weekStartOnMonday===false){return d.getDay()}return d.getDay()===0?6:d.getDay()-1},getEndOfMonth:function(d){"use strict";if(typeof d==="number"){d=new Date(d)}return new Date(d.getFullYear(),d.getMonth()+1,0)},jumpDate:function(date,count,step){"use strict";var d=new Date(date);switch(step){case"hour":d.setHours(d.getHours()+count);break;case"day":d.setHours(d.getHours()+count*24);break;case"week":d.setHours(d.getHours()+count*24*7);break;case"month":d.setMonth(d.getMonth()+count);break;case"year":d.setFullYear(d.getFullYear()+count)}return new Date(d)},getMinuteDomain:function(d,range){"use strict";var start=new Date(d.getFullYear(),d.getMonth(),d.getDate(),d.getHours());var stop=null;if(range instanceof Date){stop=new Date(range.getFullYear(),range.getMonth(),range.getDate(),range.getHours())}else{stop=new Date(+start+range*1e3*60)}return d3.time.minutes(Math.min(start,stop),Math.max(start,stop))},getHourDomain:function(d,range){"use strict";var start=new Date(d.getFullYear(),d.getMonth(),d.getDate(),d.getHours());var stop=null;if(range instanceof Date){stop=new Date(range.getFullYear(),range.getMonth(),range.getDate(),range.getHours())}else{stop=new Date(start);stop.setHours(stop.getHours()+range)}var domains=d3.time.hours(Math.min(start,stop),Math.max(start,stop));var i=0;var total=domains.length;for(i=0;i<total;i++){if(i>0&&domains[i].getHours()===domains[i-1].getHours()){this.DSTDomain.push(domains[i].getTime());domains.splice(i,1);break}}if(typeof range==="number"&&domains.length>Math.abs(range)){domains.splice(domains.length-1,1)}return domains},getDayDomain:function(d,range){"use strict";var start=new Date(d.getFullYear(),d.getMonth(),d.getDate());var stop=null;if(range instanceof Date){stop=new Date(range.getFullYear(),range.getMonth(),range.getDate())}else{stop=new Date(start);stop=new Date(stop.setDate(stop.getDate()+parseInt(range,10)))}return d3.time.days(Math.min(start,stop),Math.max(start,stop))},getWeekDomain:function(d,range){"use strict";var weekStart;if(this.options.weekStartOnMonday===false){weekStart=new Date(d.getFullYear(),d.getMonth(),d.getDate()-d.getDay())}else{if(d.getDay()===1){weekStart=new Date(d.getFullYear(),d.getMonth(),d.getDate())}else if(d.getDay()===0){weekStart=new Date(d.getFullYear(),d.getMonth(),d.getDate());weekStart.setDate(weekStart.getDate()-6)}else{weekStart=new Date(d.getFullYear(),d.getMonth(),d.getDate()-d.getDay()+1)}}var endDate=new Date(weekStart);var stop=range;if(typeof range!=="object"){stop=new Date(endDate.setDate(endDate.getDate()+range*7))}return this.options.weekStartOnMonday===true?d3.time.mondays(Math.min(weekStart,stop),Math.max(weekStart,stop)):d3.time.sundays(Math.min(weekStart,stop),Math.max(weekStart,stop))},getMonthDomain:function(d,range){"use strict";var start=new Date(d.getFullYear(),d.getMonth());var stop=null;if(range instanceof Date){stop=new Date(range.getFullYear(),range.getMonth())}else{stop=new Date(start);stop=stop.setMonth(stop.getMonth()+range)}return d3.time.months(Math.min(start,stop),Math.max(start,stop))},getYearDomain:function(d,range){"use strict";var start=new Date(d.getFullYear(),0);var stop=null;if(range instanceof Date){stop=new Date(range.getFullYear(),0)}else{stop=new Date(d.getFullYear()+range,0)}return d3.time.years(Math.min(start,stop),Math.max(start,stop))},getDomain:function(date,range){"use strict";if(typeof date==="number"){date=new Date(date)}if(arguments.length<2){range=this.options.range}switch(this.options.domain){case"hour":var domains=this.getHourDomain(date,range);if(typeof range==="number"&&domains.length<range){if(range>0){domains.push(this.getHourDomain(domains[domains.length-1],2)[1])}else{domains.shift(this.getHourDomain(domains[0],-2)[0])}}return domains;case"day":return this.getDayDomain(date,range);case"week":return this.getWeekDomain(date,range);case"month":return this.getMonthDomain(date,range);case"year":return this.getYearDomain(date,range)}},getSubDomain:function(date){"use strict";if(typeof date==="number"){date=new Date(date)}var parent=this;var computeDaySubDomainSize=function(date,domain){switch(domain){case"year":return parent.getDayCountInYear(date);case"month":return parent.getDayCountInMonth(date);case"week":return 7}};var computeMinSubDomainSize=function(date,domain){switch(domain){case"hour":return 60;case"day":return 60*24;case"week":return 60*24*7}};var computeHourSubDomainSize=function(date,domain){switch(domain){case"day":return 24;case"week":return 168;case"month":return parent.getDayCountInMonth(date)*24}};var computeWeekSubDomainSize=function(date,domain){if(domain==="month"){var endOfMonth=new Date(date.getFullYear(),date.getMonth()+1,0);var endWeekNb=parent.getWeekNumber(endOfMonth);var startWeekNb=parent.getWeekNumber(new Date(date.getFullYear(),date.getMonth()));if(startWeekNb>endWeekNb){startWeekNb=0;endWeekNb++}return endWeekNb-startWeekNb+1}else if(domain==="year"){return parent.getWeekNumber(new Date(date.getFullYear(),11,31))}};switch(this.options.subDomain){case"x_min":case"min":return this.getMinuteDomain(date,computeMinSubDomainSize(date,this.options.domain));case"x_hour":case"hour":return this.getHourDomain(date,computeHourSubDomainSize(date,this.options.domain));case"x_day":case"day":return this.getDayDomain(date,computeDaySubDomainSize(date,this.options.domain));case"x_week":case"week":return this.getWeekDomain(date,computeWeekSubDomainSize(date,this.options.domain));case"x_month":case"month":return this.getMonthDomain(date,12)}},getNextDomain:function(n){"use strict";if(arguments.length===0){n=1}return this.getDomain(this.jumpDate(this.getDomainKeys().pop(),n,this.options.domain),1)[0]},getPreviousDomain:function(n){"use strict";if(arguments.length===0){n=1}return this.getDomain(this.jumpDate(this.getDomainKeys().shift(),-n,this.options.domain),1)[0]},getDatas:function(source,startDate,endDate,callback,afterLoad,updateMode){"use strict";var self=this;if(arguments.length<5){afterLoad=true}if(arguments.length<6){updateMode=this.APPEND_ON_UPDATE}var _callback=function(data){if(afterLoad!==false){if(typeof afterLoad==="function"){data=afterLoad(data)}else if(typeof self.options.afterLoadData==="function"){data=self.options.afterLoadData(data)}else{console.log("Provided callback for afterLoadData is not a function.")}}else if(self.options.dataType==="csv"||self.options.dataType==="tsv"){data=this.interpretCSV(data)}self.parseDatas(data,updateMode,startDate,endDate);if(typeof callback==="function"){callback()}};switch(typeof source){case"string":if(source===""){_callback({});return true}else{switch(this.options.dataType){case"json":d3.json(this.parseURI(source,startDate,endDate),_callback);break;case"csv":d3.csv(this.parseURI(source,startDate,endDate),_callback);break;case"tsv":d3.tsv(this.parseURI(source,startDate,endDate),_callback);break;case"txt":d3.text(this.parseURI(source,startDate,endDate),"text/plain",_callback);break}}return false;case"object":if(source===Object(source)){_callback(source);return false}default:_callback({});return true}},parseDatas:function(data,updateMode,startDate,endDate){"use strict";if(updateMode===this.RESET_ALL_ON_UPDATE){this._domains.forEach(function(key,value){value.forEach(function(element,index,array){array[index].v=null})})}var temp={};var extractTime=function(d){return d.t};for(var d in data){var date=new Date(d*1e3);var domainUnit=this.getDomain(date)[0].getTime();if(this.DSTDomain.indexOf(domainUnit)>=0){if(this._domains.has(domainUnit-3600*1e3)){domainUnit-=3600*1e3}}if(isNaN(d)||!data.hasOwnProperty(d)||!this._domains.has(domainUnit)||!(domainUnit>=+startDate&&domainUnit<+endDate)){continue}var subDomainsData=this._domains.get(domainUnit);if(!temp.hasOwnProperty(domainUnit)){temp[domainUnit]=subDomainsData.map(extractTime)}var index=temp[domainUnit].indexOf(this._domainType[this.options.subDomain].extractUnit(date));if(updateMode===this.RESET_SINGLE_ON_UPDATE){subDomainsData[index].v=data[d]}else{if(!isNaN(subDomainsData[index].v)){subDomainsData[index].v+=data[d]}else{subDomainsData[index].v=data[d]}}}},parseURI:function(str,startDate,endDate){"use strict";str=str.replace(/\{\{t:start\}\}/g,startDate.getTime()/1e3);str=str.replace(/\{\{t:end\}\}/g,endDate.getTime()/1e3);str=str.replace(/\{\{d:start\}\}/g,startDate.toISOString());str=str.replace(/\{\{d:end\}\}/g,endDate.toISOString());return str},interpretCSV:function(data){"use strict";var d={};var keys=Object.keys(data[0]);var i,total;for(i=0,total=data.length;i<total;i++){d[data[i][keys[0]]]=+data[i][keys[1]]}return d},resize:function(){"use strict";var parent=this;var options=parent.options;var legendWidth=options.displayLegend?parent.Legend.getDim("width")+options.legendMargin[1]+options.legendMargin[3]:0;var legendHeight=options.displayLegend?parent.Legend.getDim("height")+options.legendMargin[0]+options.legendMargin[2]:0;var graphWidth=parent.graphDim.width-options.domainGutter-options.cellPadding;var graphHeight=parent.graphDim.height-options.domainGutter-options.cellPadding;this.root.transition().duration(options.animationDuration).attr("width",function(){if(options.legendVerticalPosition==="middle"||options.legendVerticalPosition==="center"){return graphWidth+legendWidth}return Math.max(graphWidth,legendWidth)}).attr("height",function(){if(options.legendVerticalPosition==="middle"||options.legendVerticalPosition==="center"){return Math.max(graphHeight,legendHeight)}return graphHeight+legendHeight});this.root.select(".graph").transition().duration(options.animationDuration).attr("y",function(){if(options.legendVerticalPosition==="top"){return legendHeight}return 0}).attr("x",function(){if((options.legendVerticalPosition==="middle"||options.legendVerticalPosition==="center")&&options.legendHorizontalPosition==="left"){return legendWidth}return 0})},next:function(n){"use strict";if(arguments.length===0){n=1}return this.loadNextDomain(n)},previous:function(n){"use strict";if(arguments.length===0){n=1}return this.loadPreviousDomain(n)},jumpTo:function(date,reset){"use strict";if(arguments.length<2){reset=false}var domains=this.getDomainKeys();var firstDomain=domains[0];var lastDomain=domains[domains.length-1];if(date<firstDomain){return this.loadPreviousDomain(this.getDomain(firstDomain,date).length)}else{if(reset){return this.loadNextDomain(this.getDomain(firstDomain,date).length)}if(date>lastDomain){return this.loadNextDomain(this.getDomain(lastDomain,date).length)}}return false},rewind:function(){"use strict";this.jumpTo(this.options.start,true)},update:function(dataSource,afterLoad,updateMode){"use strict";if(arguments.length<2){afterLoad=true}if(arguments.length<3){updateMode=this.RESET_ALL_ON_UPDATE}var domains=this.getDomainKeys();var self=this;this.getDatas(dataSource,new Date(domains[0]),this.getSubDomain(domains[domains.length-1]).pop(),function(){self.fill()},afterLoad,updateMode)},setLegend:function(){"use strict";var oldLegend=this.options.legend.slice(0);if(arguments.length>=1&&Array.isArray(arguments[0])){this.options.legend=arguments[0]}if(arguments.length>=2){if(Array.isArray(arguments[1])&&arguments[1].length>=2){this.options.legendColors=[arguments[1][0],arguments[1][1]]}else{this.options.legendColors=arguments[1]}}if(arguments.length>0&&!arrayEquals(oldLegend,this.options.legend)||arguments.length>=2){this.Legend.buildColors();this.fill()}this.Legend.redraw(this.graphDim.width-this.options.domainGutter-this.options.cellPadding)},removeLegend:function(){"use strict";if(!this.options.displayLegend){return false}this.options.displayLegend=false;this.Legend.remove();return true},showLegend:function(){"use strict";if(this.options.displayLegend){return false}this.options.displayLegend=true;this.Legend.redraw(this.graphDim.width-this.options.domainGutter-this.options.cellPadding);return true},highlight:function(args){"use strict";if((this.options.highlight=this.expandDateSetting(args)).length>0){this.fill();return true}return false},destroy:function(callback){"use strict";this.root.transition().duration(this.options.animationDuration).attr("width",0).attr("height",0).remove().each("end",function(){if(typeof callback==="function"){callback()}else if(arguments.length>0){console.log("Provided callback for destroy() is not a function.")}});return null},getSVG:function(){"use strict";var styles={".cal-heatmap-container":{},".graph":{},".graph-rect":{},"rect.highlight":{},"rect.now":{},"text.highlight":{},"text.now":{},".domain-background":{},".graph-label":{},".subdomain-text":{},".q0":{},".qi":{}};for(var j=1,total=this.options.legend.length+1;j<=total;j++){styles[".q"+j]={}}var root=this.root;var whitelistStyles=["stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-miterlimit","fill","fill-opacity","fill-rule","marker","marker-start","marker-mid","marker-end","alignement-baseline","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","shape-rendering","text-transform","font-family","font","font-size","font-weight"];var filterStyles=function(attribute,property,value){if(whitelistStyles.indexOf(property)!==-1){styles[attribute][property]=value}};var getElement=function(e){return root.select(e)[0][0]};for(var element in styles){if(!styles.hasOwnProperty(element)){continue}var dom=getElement(element);if(dom===null){continue}if("getComputedStyle"in window){var cs=getComputedStyle(dom,null);if(cs.length!==0){for(var i=0;i<cs.length;i++){filterStyles(element,cs.item(i),cs.getPropertyValue(cs.item(i)))}}else{for(var k in cs){if(cs.hasOwnProperty(k)){filterStyles(element,k,cs[k])}}}}else if("currentStyle"in dom){var css=dom.currentStyle;for(var p in css){filterStyles(element,p,css[p])}}}var string='<svg xmlns="http://www.w3.org/2000/svg" '+'xmlns:xlink="http://www.w3.org/1999/xlink"><style type="text/css"><![CDATA[ ';for(var style in styles){string+=style+" {\n";for(var l in styles[style]){string+="\t"+l+":"+styles[style][l]+";\n"}string+="}\n"}string+="]]></style>";string+=(new XMLSerializer).serializeToString(this.root[0][0]);string+="</svg>";return string}};var DomainPosition=function(){"use strict";this.positions=d3.map()};DomainPosition.prototype.getPosition=function(d){"use strict";return this.positions.get(d)};DomainPosition.prototype.getPositionFromIndex=function(i){"use strict";var domains=this.getKeys();return this.positions.get(domains[i])};DomainPosition.prototype.getLast=function(){"use strict";var domains=this.getKeys();return this.positions.get(domains[domains.length-1])};DomainPosition.prototype.setPosition=function(d,dim){"use strict";this.positions.set(d,dim)};DomainPosition.prototype.shiftRightBy=function(exitingDomainDim){"use strict";this.positions.forEach(function(key,value){this.set(key,value-exitingDomainDim)});var domains=this.getKeys();this.positions.remove(domains[0])};DomainPosition.prototype.shiftLeftBy=function(enteringDomainDim){"use strict";this.positions.forEach(function(key,value){this.set(key,value+enteringDomainDim)});var domains=this.getKeys();this.positions.remove(domains[domains.length-1])};DomainPosition.prototype.getKeys=function(){"use strict";return this.positions.keys().sort(function(a,b){return parseInt(a,10)-parseInt(b,10)})};var Legend=function(calendar){"use strict";this.calendar=calendar;this.computeDim();if(calendar.options.legendColors!==null){this.buildColors()}};Legend.prototype.computeDim=function(){"use strict";var options=this.calendar.options;this.dim={width:options.legendCellSize*(options.legend.length+1)+options.legendCellPadding*options.legend.length,height:options.legendCellSize}};Legend.prototype.remove=function(){"use strict";this.calendar.root.select(".graph-legend").remove();this.calendar.resize()};Legend.prototype.redraw=function(width){"use strict";if(!this.calendar.options.displayLegend){return false}var parent=this;var calendar=this.calendar;var legend=calendar.root;var legendItem;var options=calendar.options;this.computeDim();var _legend=options.legend.slice(0);_legend.push(_legend[_legend.length-1]+1);var legendElement=calendar.root.select(".graph-legend");if(legendElement[0][0]!==null){legend=legendElement;legendItem=legend.select("g").selectAll("rect").data(_legend)}else{legend=options.legendVerticalPosition==="top"?legend.insert("svg",".graph"):legend.append("svg");legend.attr("x",getLegendXPosition()).attr("y",getLegendYPosition());legendItem=legend.attr("class","graph-legend").attr("height",parent.getDim("height")).attr("width",parent.getDim("width")).append("g").selectAll().data(_legend)}legendItem.enter().append("rect").call(legendCellLayout).attr("class",function(d){return calendar.Legend.getClass(d,calendar.legendScale===null)}).attr("fill-opacity",0).call(function(selection){if(calendar.legendScale!==null&&options.legendColors!==null&&options.legendColors.hasOwnProperty("base")){selection.attr("fill",options.legendColors.base)}}).append("title");legendItem.exit().transition().duration(options.animationDuration).attr("fill-opacity",0).remove();legendItem.transition().delay(function(d,i){return options.animationDuration*i/10}).call(legendCellLayout).attr("fill-opacity",1).call(function(element){element.attr("fill",function(d,i){if(calendar.legendScale===null){return""}if(i===0){return calendar.legendScale(d-1)}return calendar.legendScale(options.legend[i-1])});element.attr("class",function(d){return calendar.Legend.getClass(d,calendar.legendScale===null)})});function legendCellLayout(selection){selection.attr("width",options.legendCellSize).attr("height",options.legendCellSize).attr("x",function(d,i){return i*(options.legendCellSize+options.legendCellPadding)})}legendItem.select("title").text(function(d,i){if(i===0){return options.legendTitleFormat.lower.format({min:options.legend[i],name:options.itemName[1]})}else if(i===_legend.length-1){return options.legendTitleFormat.upper.format({max:options.legend[i-1],name:options.itemName[1]})}else{return options.legendTitleFormat.inner.format({down:options.legend[i-1],up:options.legend[i],name:options.itemName[1]})}});legend.transition().duration(options.animationDuration).attr("x",getLegendXPosition()).attr("y",getLegendYPosition()).attr("width",parent.getDim("width")).attr("height",parent.getDim("height"));legend.select("g").transition().duration(options.animationDuration).attr("transform",function(){if(options.legendOrientation==="vertical"){return"rotate(90 "+options.legendCellSize/2+" "+options.legendCellSize/2+")"}return""});function getLegendXPosition(){switch(options.legendHorizontalPosition){case"right":if(options.legendVerticalPosition==="center"||options.legendVerticalPosition==="middle"){return width+options.legendMargin[3]}return width-parent.getDim("width")-options.legendMargin[1];case"middle":case"center":return Math.round(width/2-parent.getDim("width")/2);default:return options.legendMargin[3]}}function getLegendYPosition(){if(options.legendVerticalPosition==="bottom"){return calendar.graphDim.height+options.legendMargin[0]-options.domainGutter-options.cellPadding}return options.legendMargin[0]}calendar.resize()};Legend.prototype.getDim=function(axis){"use strict";var isHorizontal=this.calendar.options.legendOrientation==="horizontal";switch(axis){case"width":return this.dim[isHorizontal?"width":"height"];case"height":return this.dim[isHorizontal?"height":"width"]}};Legend.prototype.buildColors=function(){"use strict";var options=this.calendar.options;if(options.legendColors===null){this.calendar.legendScale=null;return false}var _colorRange=[];if(Array.isArray(options.legendColors)){_colorRange=options.legendColors}else if(options.legendColors.hasOwnProperty("min")&&options.legendColors.hasOwnProperty("max")){_colorRange=[options.legendColors.min,options.legendColors.max]}else{options.legendColors=null;return false}var _legend=options.legend.slice(0);if(_legend[0]>0){_legend.unshift(0)}else if(_legend[0]<0){_legend.unshift(_legend[0]-(_legend[_legend.length-1]-_legend[0])/_legend.length)}var colorScale=d3.scale.linear().range(_colorRange).interpolate(d3.interpolateHcl).domain([d3.min(_legend),d3.max(_legend)]);var legendColors=_legend.map(function(element){return colorScale(element)});this.calendar.legendScale=d3.scale.threshold().domain(options.legend).range(legendColors);return true};Legend.prototype.getClass=function(n,withCssClass){"use strict";if(n===null||isNaN(n)){return""}var index=[this.calendar.options.legend.length+1];for(var i=0,total=this.calendar.options.legend.length-1;i<=total;i++){if(this.calendar.options.legend[0]>0&&n<0){index=["1","i"];break}if(n<=this.calendar.options.legend[i]){index=[i+1];break}}if(n===0){index.push(0)}index.unshift("");return(index.join(" r")+(withCssClass?index.join(" q"):"")).trim()};String.prototype.format=function(){"use strict";var formatted=this;for(var prop in arguments[0]){if(arguments[0].hasOwnProperty(prop)){var regexp=new RegExp("\\{"+prop+"\\}","gi");formatted=formatted.replace(regexp,arguments[0][prop])}}return formatted};function mergeRecursive(obj1,obj2){"use strict";for(var p in obj2){try{if(obj2[p].constructor===Object){obj1[p]=mergeRecursive(obj1[p],obj2[p])}else{obj1[p]=obj2[p]}}catch(e){obj1[p]=obj2[p]}}return obj1}function arrayEquals(arrayA,arrayB){"use strict";if(!arrayB||!arrayA){return false}if(arrayA.length!==arrayB.length){return false}for(var i=0;i<arrayA.length;i++){if(arrayA[i]instanceof Array&&arrayB[i]instanceof Array){if(!arrayEquals(arrayA[i],arrayB[i])){return false}}else if(arrayA[i]!==arrayB[i]){return false}}return true}if(typeof define==="function"&&define.amd){define(["d3"],function(){"use strict";return CalHeatMap})}(function(){var nv={};nv.dev=false;nv.tooltip=nv.tooltip||{};nv.utils=nv.utils||{};nv.models=nv.models||{};nv.charts={};nv.logs={};nv.dom={};if(typeof module!=="undefined"&&typeof exports!=="undefined"&&typeof d3=="undefined"){d3=require("d3")}nv.dispatch=d3.dispatch("render_start","render_end");if(!Function.prototype.bind){Function.prototype.bind=function(oThis){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")}var aArgs=Array.prototype.slice.call(arguments,1),fToBind=this,fNOP=function(){},fBound=function(){return fToBind.apply(this instanceof fNOP&&oThis?this:oThis,aArgs.concat(Array.prototype.slice.call(arguments)))};fNOP.prototype=this.prototype;fBound.prototype=new fNOP;return fBound}}if(nv.dev){nv.dispatch.on("render_start",function(e){nv.logs.startTime=+new Date});nv.dispatch.on("render_end",function(e){nv.logs.endTime=+new Date;nv.logs.totalTime=nv.logs.endTime-nv.logs.startTime;nv.log("total",nv.logs.totalTime)})}nv.log=function(){if(nv.dev&&window.console&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(nv.dev&&window.console&&typeof console.log=="function"&&Function.prototype.bind){var log=Function.prototype.bind.call(console.log,console);log.apply(console,arguments)}return arguments[arguments.length-1]};nv.deprecated=function(name,info){if(console&&console.warn){console.warn("nvd3 warning: `"+name+"` has been deprecated. ",info||"")}};nv.render=function render(step){step=step||1;nv.render.active=true;nv.dispatch.render_start();var renderLoop=function(){var chart,graph;for(var i=0;i<step&&(graph=nv.render.queue[i]);i++){chart=graph.generate();if(typeof graph.callback==typeof Function)graph.callback(chart)}nv.render.queue.splice(0,i);if(nv.render.queue.length){setTimeout(renderLoop)}else{nv.dispatch.render_end();nv.render.active=false}};setTimeout(renderLoop)};nv.render.active=false;nv.render.queue=[];nv.addGraph=function(obj){if(typeof arguments[0]===typeof Function){obj={generate:arguments[0],callback:arguments[1]}}nv.render.queue.push(obj);if(!nv.render.active){nv.render()}};if(typeof module!=="undefined"&&typeof exports!=="undefined"){module.exports=nv}if(typeof window!=="undefined"){window.nv=nv}nv.dom.write=function(callback){if(window.fastdom!==undefined){return fastdom.mutate(callback)}return callback()};nv.dom.read=function(callback){if(window.fastdom!==undefined){return fastdom.measure(callback)}return callback()};nv.interactiveGuideline=function(){"use strict";var margin={left:0,top:0},width=null,height=null,xScale=d3.scale.linear(),dispatch=d3.dispatch("elementMousemove","elementMouseout","elementClick","elementDblclick","elementMouseDown","elementMouseUp"),showGuideLine=true,svgContainer=null,tooltip=nv.models.tooltip(),isMSIE=window.ActiveXObject;tooltip.duration(0).hideDelay(0).hidden(false);function layer(selection){selection.each(function(data){var container=d3.select(this);var availableWidth=width||960,availableHeight=height||400;var wrap=container.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([data]);var wrapEnter=wrap.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");wrapEnter.append("g").attr("class","nv-interactiveGuideLine");if(!svgContainer){return}function mouseHandler(){var mouseX=d3.event.clientX-this.getBoundingClientRect().left;var mouseY=d3.event.clientY-this.getBoundingClientRect().top;var subtractMargin=true;var mouseOutAnyReason=false;if(isMSIE){mouseX=d3.event.offsetX;mouseY=d3.event.offsetY;if(d3.event.target.tagName!=="svg"){subtractMargin=false}if(d3.event.target.className.baseVal.match("nv-legend")){mouseOutAnyReason=true}}if(subtractMargin){mouseX-=margin.left;mouseY-=margin.top}if(d3.event.type==="mouseout"||mouseX<0||mouseY<0||mouseX>availableWidth||mouseY>availableHeight||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||mouseOutAnyReason){if(isMSIE){if(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&(d3.event.relatedTarget.className===undefined||d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass))){return}}dispatch.elementMouseout({mouseX:mouseX,mouseY:mouseY});layer.renderGuideLine(null);tooltip.hidden(true);return}else{tooltip.hidden(false)}var scaleIsOrdinal=typeof xScale.rangeBands==="function";var pointXValue=undefined;if(scaleIsOrdinal){var elementIndex=d3.bisect(xScale.range(),mouseX)-1;if(xScale.range()[elementIndex]+xScale.rangeBand()>=mouseX){pointXValue=xScale.domain()[d3.bisect(xScale.range(),mouseX)-1]}else{dispatch.elementMouseout({mouseX:mouseX,mouseY:mouseY});layer.renderGuideLine(null);tooltip.hidden(true);return}}else{pointXValue=xScale.invert(Math.min(mouseX,availableWidth))}dispatch.elementMousemove({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue});if(d3.event.type==="dblclick"){dispatch.elementDblclick({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue})}if(d3.event.type==="click"){dispatch.elementClick({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue})}if(d3.event.type==="mousedown"){dispatch.elementMouseDown({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue})}if(d3.event.type==="mouseup"){dispatch.elementMouseUp({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue})}}svgContainer.on("touchmove",mouseHandler).on("mousemove",mouseHandler,true).on("mouseout",mouseHandler,true).on("mousedown",mouseHandler,true).on("mouseup",mouseHandler,true).on("dblclick",mouseHandler).on("click",mouseHandler);layer.guideLine=null;layer.renderGuideLine=function(x){if(!showGuideLine)return;if(layer.guideLine&&layer.guideLine.attr("x1")===x)return;nv.dom.write(function(){var line=wrap.select(".nv-interactiveGuideLine").selectAll("line").data(x!=null?[nv.utils.NaNtoZero(x)]:[],String);line.enter().append("line").attr("class","nv-guideline").attr("x1",function(d){return d}).attr("x2",function(d){return d}).attr("y1",availableHeight).attr("y2",0);line.exit().remove()})}})}layer.dispatch=dispatch;layer.tooltip=tooltip;layer.margin=function(_){if(!arguments.length)return margin;margin.top=typeof _.top!="undefined"?_.top:margin.top;margin.left=typeof _.left!="undefined"?_.left:margin.left;return layer};layer.width=function(_){if(!arguments.length)return width;width=_;return layer};layer.height=function(_){if(!arguments.length)return height;height=_;return layer};layer.xScale=function(_){if(!arguments.length)return xScale;xScale=_;return layer};layer.showGuideLine=function(_){if(!arguments.length)return showGuideLine;showGuideLine=_;return layer};layer.svgContainer=function(_){if(!arguments.length)return svgContainer;svgContainer=_;return layer};return layer};nv.zoomLayer=function(){"use strict";var margin={left:0,top:0},width=null,height=null,xScale=d3.scale.linear(),dispatch=d3.dispatch("elementMousemove","elementMouseout","elementClick","elementDblclick","elementMouseDown","elementMouseUp","elementDragStart","elementDragEnd","elementDragAbort"),showGuideLine=true,svgContainer=null,tooltip=nv.models.tooltip(),isMSIE="ActiveXObject"in window;function layer(selection){selection.each(function(data){var container=d3.select(this);var availableWidth=width||960,availableHeight=height||400;var wrap=container.selectAll("g.nv-wrap.nv-zoomLayer").data([data]);var wrapEnter=wrap.enter().append("g").attr("class"," nv-wrap nv-zoomLayer");wrapEnter.append("g").attr("class","nv-zoomGuideArea");if(!svgContainer){return}function mouseHandler(){var d3mouse=d3.mouse(this);var mouseX=d3mouse[0];var mouseY=d3mouse[1];var subtractMargin=true;var mouseOutAnyReason=false;if(isMSIE){mouseX=d3.event.offsetX;mouseY=d3.event.offsetY;if(d3.event.target.tagName!=="svg"){subtractMargin=false}if(d3.event.target.className.baseVal.match("nv-legend")){mouseOutAnyReason=true}}if(subtractMargin){mouseX-=margin.left;mouseY-=margin.top}if(d3.event.type==="mouseout"||mouseX<0||mouseY<0||mouseX>availableWidth||mouseY>availableHeight||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||mouseOutAnyReason){if(isMSIE){if(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&(d3.event.relatedTarget.className===undefined||d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass))){return}}dispatch.elementMouseout({mouseX:mouseX,mouseY:mouseY});tooltip.hidden(true);if(d3.event.target.tagName!=="svg"){dispatch.elementDragAbort({mouseX:mouseX,mouseY:mouseY});layer.removeSelectArea(null);return}}else{tooltip.hidden(false)}var scaleIsOrdinal=typeof xScale.rangeBands==="function";var pointXValue=undefined;if(scaleIsOrdinal){var elementIndex=d3.bisect(xScale.range(),mouseX)-1;if(xScale.range()[elementIndex]+xScale.rangeBand()>=mouseX){pointXValue=xScale.domain()[d3.bisect(xScale.range(),mouseX)-1]}else{dispatch.elementMouseout({mouseX:mouseX,mouseY:mouseY});layer.removeSelectArea(null);tooltip.hidden(true);return}}else{pointXValue=xScale.invert(Math.min(mouseX,availableWidth))}dispatch.elementMousemove({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue});if(d3.event.type==="mousedown"){dispatch.elementDragStart({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue})}if(d3.event.type==="mousemove"){dispatch.elementMousemove({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue})}if(d3.event.type==="mouseup"){dispatch.elementDragEnd({mouseX:mouseX,mouseY:mouseY,pointXValue:pointXValue})}}svgContainer.on("mousedown.drag",mouseHandler).on("mousemove.drag",mouseHandler).on("mouseup.drag",mouseHandler);layer.guideLine=null;layer.renderSelectArea=function(x){if(!showGuideLine)return;if(layer.guideLine&&layer.guideLine.attr("x1")===x)return;nv.dom.write(function(){var selectArea=wrap.select(".nv-zoomGuideArea");selectArea.append("rect").attr("fill-opacity",.4).attr("fill","#C8D3E2").attr("x",x).attr("y",0).attr("width",1).attr("height",availableHeight)})};layer.updateSelectArea=function(startX,currentX){wrap.select(".nv-zoomGuideArea").selectAll("rect").attr("x",d3.min([startX,currentX])).attr("width",Math.abs(currentX-startX))};layer.removeSelectArea=function(){wrap.select(".nv-zoomGuideArea").selectAll("rect").remove()}})}layer.dispatch=dispatch;layer.margin=function(_){if(!arguments.length)return margin;margin.top=typeof _.top!="undefined"?_.top:margin.top;margin.left=typeof _.left!="undefined"?_.left:margin.left;return layer};layer.width=function(_){if(!arguments.length)return width;width=_;return layer};layer.height=function(_){if(!arguments.length)return height;height=_;return layer};layer.xScale=function(_){if(!arguments.length)return xScale;xScale=_;return layer};layer.svgContainer=function(_){if(!arguments.length)return svgContainer;svgContainer=_;return layer};return layer};nv.interactiveBisect=function(values,searchVal,xAccessor){"use strict";if(!(values instanceof Array)){return null}var _xAccessor;if(typeof xAccessor!=="function"){_xAccessor=function(d){return d.x}}else{_xAccessor=xAccessor}var _cmp=function(d,v){return _xAccessor(d)-v};var bisect=d3.bisector(_cmp).left;var index=d3.max([0,bisect(values,searchVal)-1]);var currentValue=_xAccessor(values[index]);if(typeof currentValue==="undefined"){currentValue=index}if(currentValue===searchVal){return index}var nextIndex=d3.min([index+1,values.length-1]);var nextValue=_xAccessor(values[nextIndex]);if(typeof nextValue==="undefined"){nextValue=nextIndex}if(Math.abs(nextValue-searchVal)>=Math.abs(currentValue-searchVal)){return index}else{return nextIndex}};nv.nearestValueIndex=function(values,searchVal,threshold){"use strict";var yDistMax=Infinity,indexToHighlight=null;values.forEach(function(d,i){var delta=Math.abs(searchVal-d);if(d!=null&&delta<=yDistMax&&delta<threshold){yDistMax=delta;indexToHighlight=i}});return indexToHighlight};nv.models.tooltip=function(){"use strict";var id="nvtooltip-"+Math.floor(Math.random()*1e5),data=null,gravity="w",distance=25,snapDistance=0,classes=null,hidden=true,hideDelay=200,tooltip=null,lastPosition={left:null,top:null},enabled=true,duration=100,headerEnabled=true,nvPointerEventsClass="nv-pointer-events-none";var valueFormatter=function(d,i,p){return d};var headerFormatter=function(d){return d};var keyFormatter=function(d,i){return d};var contentGenerator=function(d,elem){if(d===null){return""}var table=d3.select(document.createElement("table"));if(headerEnabled){var theadEnter=table.selectAll("thead").data([d]).enter().append("thead");theadEnter.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",true).html(headerFormatter(d.value))}var tbodyEnter=table.selectAll("tbody").data([d]).enter().append("tbody");var trowEnter=tbodyEnter.selectAll("tr").data(function(p){return p.series}).enter().append("tr").classed("highlight",function(p){return p.highlight});trowEnter.append("td").classed("legend-color-guide",true).append("div").style("background-color",function(p){return p.color});trowEnter.append("td").classed("key",true).classed("total",function(p){return!!p.total}).html(function(p,i){return keyFormatter(p.key,i)});trowEnter.append("td").classed("value",true).html(function(p,i){return valueFormatter(p.value,i,p)});trowEnter.filter(function(p,i){return p.percent!==undefined}).append("td").classed("percent",true).html(function(p,i){return"("+d3.format("%")(p.percent)+")"});trowEnter.selectAll("td").each(function(p){if(p.highlight){var opacityScale=d3.scale.linear().domain([0,1]).range(["#fff",p.color]);var opacity=.6;d3.select(this).style("border-bottom-color",opacityScale(opacity)).style("border-top-color",opacityScale(opacity))}});var html=table.node().outerHTML;if(d.footer!==undefined)html+="<div class='footer'>"+d.footer+"</div>";return html};var position=function(){var pos={left:d3.event!==null?d3.event.clientX:0,top:d3.event!==null?d3.event.clientY:0};if(getComputedStyle(document.body).transform!="none"){var client=document.body.getBoundingClientRect();pos.left-=client.left;pos.top-=client.top}return pos};var dataSeriesExists=function(d){if(d&&d.series){if(nv.utils.isArray(d.series)){return true}if(nv.utils.isObject(d.series)){d.series=[d.series];return true}}return false};var calcGravityOffset=function(pos){var height=tooltip.node().offsetHeight,width=tooltip.node().offsetWidth,clientWidth=document.documentElement.clientWidth,clientHeight=document.documentElement.clientHeight,left,top,tmp;switch(gravity){case"e":left=-width-distance;top=-(height/2);if(pos.left+left<0)left=distance;if((tmp=pos.top+top)<0)top-=tmp;if((tmp=pos.top+top+height)>clientHeight)top-=tmp-clientHeight;break;case"w":left=distance;top=-(height/2);if(pos.left+left+width>clientWidth)left=-width-distance;if((tmp=pos.top+top)<0)top-=tmp;if((tmp=pos.top+top+height)>clientHeight)top-=tmp-clientHeight;break;case"n":left=-(width/2)-5;top=distance;if(pos.top+top+height>clientHeight)top=-height-distance;if((tmp=pos.left+left)<0)left-=tmp;if((tmp=pos.left+left+width)>clientWidth)left-=tmp-clientWidth;break;case"s":left=-(width/2);top=-height-distance;if(pos.top+top<0)top=distance;if((tmp=pos.left+left)<0)left-=tmp;if((tmp=pos.left+left+width)>clientWidth)left-=tmp-clientWidth;break;case"center":left=-(width/2);top=-(height/2);break;default:left=0;top=0;break}return{left:left,top:top}};var positionTooltip=function(){nv.dom.read(function(){var pos=position(),gravityOffset=calcGravityOffset(pos),left=pos.left+gravityOffset.left,top=pos.top+gravityOffset.top+window.scrollY;if(hidden){tooltip.interrupt().transition().delay(hideDelay).duration(0).style("opacity",0)}else{var old_translate="translate("+lastPosition.left+"px, "+lastPosition.top+"px)";var new_translate="translate("+Math.round(left)+"px, "+Math.round(top)+"px)";var translateInterpolator=d3.interpolateString(old_translate,new_translate);var is_hidden=tooltip.style("opacity")<.1;tooltip.interrupt().transition().duration(is_hidden?0:duration).styleTween("transform",function(d){return translateInterpolator},"important").styleTween("-webkit-transform",function(d){return translateInterpolator}).style("-ms-transform",new_translate).style("opacity",1)}lastPosition.left=left;lastPosition.top=top})};function initTooltip(){if(!tooltip||!tooltip.node()){var data=[1];tooltip=d3.select(document.body).selectAll("#"+id).data(data);tooltip.enter().append("div").attr("class","nvtooltip "+(classes?classes:"xy-tooltip")).attr("id",id).style("top",0).style("left",0).style("opacity",0).style("position","absolute").selectAll("div, table, td, tr").classed(nvPointerEventsClass,true).classed(nvPointerEventsClass,true);tooltip.exit().remove()}}function nvtooltip(){if(!enabled)return;if(!dataSeriesExists(data))return;nv.dom.write(function(){initTooltip();var newContent=contentGenerator(data,tooltip.node());if(newContent){tooltip.node().innerHTML=newContent}positionTooltip()});return nvtooltip}nvtooltip.nvPointerEventsClass=nvPointerEventsClass;nvtooltip.options=nv.utils.optionsFunc.bind(nvtooltip);nvtooltip._options=Object.create({},{duration:{get:function(){return duration},set:function(_){duration=_}},gravity:{get:function(){return gravity},set:function(_){gravity=_}},distance:{get:function(){return distance},set:function(_){distance=_}},snapDistance:{get:function(){return snapDistance},set:function(_){snapDistance=_}},classes:{get:function(){return classes},set:function(_){classes=_}},enabled:{get:function(){return enabled},set:function(_){enabled=_}},hideDelay:{get:function(){return hideDelay},set:function(_){hideDelay=_}},contentGenerator:{get:function(){return contentGenerator},set:function(_){contentGenerator=_}},valueFormatter:{get:function(){return valueFormatter},set:function(_){valueFormatter=_}},headerFormatter:{get:function(){return headerFormatter},set:function(_){headerFormatter=_}},keyFormatter:{get:function(){return keyFormatter},set:function(_){keyFormatter=_}},headerEnabled:{get:function(){return headerEnabled},set:function(_){headerEnabled=_}},position:{get:function(){return position},set:function(_){position=_}},chartContainer:{get:function(){return document.body},set:function(_){nv.deprecated("chartContainer","feature removed after 1.8.3")}},fixedTop:{get:function(){return null},set:function(_){nv.deprecated("fixedTop","feature removed after 1.8.1")}},offset:{get:function(){return{left:0,top:0}},set:function(_){nv.deprecated("offset","use chart.tooltip.distance() instead")}},hidden:{get:function(){return hidden},set:function(_){if(hidden!=_){hidden=!!_;nvtooltip()}}},data:{get:function(){return data},set:function(_){if(_.point){_.value=_.point.x;_.series=_.series||{};_.series.value=_.point.y;_.series.color=_.point.color||_.series.color}data=_}},node:{get:function(){return tooltip.node()},set:function(_){}},id:{get:function(){return id},set:function(_){}}});nv.utils.initOptions(nvtooltip);return nvtooltip};nv.utils.windowSize=function(){var size={width:640,height:480};if(window.innerWidth&&window.innerHeight){size.width=window.innerWidth;size.height=window.innerHeight;return size}if(document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth){size.width=document.documentElement.offsetWidth;size.height=document.documentElement.offsetHeight;return size}if(document.body&&document.body.offsetWidth){size.width=document.body.offsetWidth;size.height=document.body.offsetHeight;return size}return size};nv.utils.isArray=Array.isArray;nv.utils.isObject=function(a){return a!==null&&typeof a==="object"};nv.utils.isFunction=function(a){return typeof a==="function"};nv.utils.isDate=function(a){return toString.call(a)==="[object Date]"};nv.utils.isNumber=function(a){return!isNaN(a)&&typeof a==="number"};nv.utils.windowResize=function(handler){if(window.addEventListener){window.addEventListener("resize",handler)}else{nv.log("ERROR: Failed to bind to window.resize with: ",handler)}return{callback:handler,clear:function(){window.removeEventListener("resize",handler)}}};nv.utils.getColor=function(color){if(color===undefined){return nv.utils.defaultColor()}else if(nv.utils.isArray(color)){var color_scale=d3.scale.ordinal().range(color);return function(d,i){var key=i===undefined?d:i;return d.color||color_scale(key)}}else{return color}};nv.utils.defaultColor=function(){return nv.utils.getColor(d3.scale.category20().range())};nv.utils.customTheme=function(dictionary,getKey,defaultColors){getKey=getKey||function(series){return series.key};defaultColors=defaultColors||d3.scale.category20().range();var defIndex=defaultColors.length;return function(series,index){var key=getKey(series);if(nv.utils.isFunction(dictionary[key])){return dictionary[key]()}else if(dictionary[key]!==undefined){return dictionary[key]}else{if(!defIndex){defIndex=defaultColors.length}defIndex=defIndex-1;return defaultColors[defIndex]}}};nv.utils.pjax=function(links,content){var load=function(href){d3.html(href,function(fragment){var target=d3.select(content).node();target.parentNode.replaceChild(d3.select(fragment).select(content).node(),target);nv.utils.pjax(links,content)})};d3.selectAll(links).on("click",function(){history.pushState(this.href,this.textContent,this.href);load(this.href);d3.event.preventDefault()});d3.select(window).on("popstate",function(){if(d3.event.state){load(d3.event.state)}})};nv.utils.calcApproxTextWidth=function(svgTextElem){if(nv.utils.isFunction(svgTextElem.style)&&nv.utils.isFunction(svgTextElem.text)){var fontSize=parseInt(svgTextElem.style("font-size").replace("px",""),10);var textLength=svgTextElem.text().length;return nv.utils.NaNtoZero(textLength*fontSize*.5)}return 0};nv.utils.NaNtoZero=function(n){if(!nv.utils.isNumber(n)||isNaN(n)||n===null||n===Infinity||n===-Infinity){return 0}return n};d3.selection.prototype.watchTransition=function(renderWatch){var args=[this].concat([].slice.call(arguments,1));return renderWatch.transition.apply(renderWatch,args)};nv.utils.renderWatch=function(dispatch,duration){if(!(this instanceof nv.utils.renderWatch)){return new nv.utils.renderWatch(dispatch,duration)}var _duration=duration!==undefined?duration:250;var renderStack=[];var self=this;this.models=function(models){models=[].slice.call(arguments,0);models.forEach(function(model){model.__rendered=false;(function(m){m.dispatch.on("renderEnd",function(arg){m.__rendered=true;self.renderEnd("model")})})(model);if(renderStack.indexOf(model)<0){renderStack.push(model)}});return this};this.reset=function(duration){if(duration!==undefined){_duration=duration}renderStack=[]};this.transition=function(selection,args,duration){args=arguments.length>1?[].slice.call(arguments,1):[];if(args.length>1){duration=args.pop()}else{duration=_duration!==undefined?_duration:250}selection.__rendered=false;if(renderStack.indexOf(selection)<0){renderStack.push(selection)}if(duration===0){selection.__rendered=true;selection.delay=function(){return this};selection.duration=function(){return this};return selection}else{if(selection.length===0){selection.__rendered=true}else if(selection.every(function(d){return!d.length})){selection.__rendered=true}else{selection.__rendered=false}var n=0;return selection.transition().duration(duration).each(function(){++n}).each("end",function(d,i){if(--n===0){selection.__rendered=true;self.renderEnd.apply(this,args)}})}};this.renderEnd=function(){if(renderStack.every(function(d){return d.__rendered})){renderStack.forEach(function(d){d.__rendered=false});dispatch.renderEnd.apply(this,arguments)}}};nv.utils.deepExtend=function(dst){var sources=arguments.length>1?[].slice.call(arguments,1):[];sources.forEach(function(source){for(var key in source){var isArray=nv.utils.isArray(dst[key]);var isObject=nv.utils.isObject(dst[key]);var srcObj=nv.utils.isObject(source[key]);if(isObject&&!isArray&&srcObj){nv.utils.deepExtend(dst[key],source[key])}else{dst[key]=source[key]}}})};nv.utils.state=function(){if(!(this instanceof nv.utils.state)){return new nv.utils.state}var state={};var _self=this;var _setState=function(){};var _getState=function(){return{}};var init=null;var changed=null;this.dispatch=d3.dispatch("change","set");this.dispatch.on("set",function(state){_setState(state,true)});this.getter=function(fn){_getState=fn;return this};this.setter=function(fn,callback){if(!callback){callback=function(){}}_setState=function(state,update){fn(state);if(update){callback()}};return this};this.init=function(state){init=init||{};nv.utils.deepExtend(init,state)};var _set=function(){var settings=_getState();if(JSON.stringify(settings)===JSON.stringify(state)){return false}for(var key in settings){if(state[key]===undefined){state[key]={}}state[key]=settings[key];changed=true}return true};this.update=function(){if(init){_setState(init,false);init=null}if(_set.call(this)){this.dispatch.change(state)}}};nv.utils.optionsFunc=function(args){if(args){d3.map(args).forEach(function(key,value){if(nv.utils.isFunction(this[key])){this[key](value)}}.bind(this))}return this};nv.utils.calcTicksX=function(numTicks,data){var numValues=1;var i=0;for(i;i<data.length;i+=1){var stream_len=data[i]&&data[i].values?data[i].values.length:0;numValues=stream_len>numValues?stream_len:numValues}nv.log("Requested number of ticks: ",numTicks);nv.log("Calculated max values to be: ",numValues);numTicks=numTicks>numValues?numTicks=numValues-1:numTicks;numTicks=numTicks<1?1:numTicks;numTicks=Math.floor(numTicks);nv.log("Calculating tick count as: ",numTicks);return numTicks};nv.utils.calcTicksY=function(numTicks,data,getY){if(getY){var numValues=1;for(var i=0;i<data.length;i+=1){var values=data[i]&&data[i].values?data[i].values:[];var maxValue;for(var j=0;j<values.length;j+=1){maxValue=values[j]&&getY(values[j])?getY(values[j]):0;numValues=maxValue>numValues?maxValue:numValues}}nv.log("Requested number of ticks: ",numTicks);nv.log("Calculated max values to be: ",numValues);numTicks=numTicks>numValues?numValues-1:numTicks;numTicks=numTicks<1?1:numTicks;numTicks=Math.floor(numTicks);nv.log("Calculating tick count as: ",numTicks);return numTicks}else{return nv.utils.calcTicksX(numTicks,data)}};nv.utils.initOption=function(chart,name){if(chart._calls&&chart._calls[name]){chart[name]=chart._calls[name]}else{chart[name]=function(_){if(!arguments.length)return chart._options[name];chart._overrides[name]=true;chart._options[name]=_;return chart};chart["_"+name]=function(_){if(!arguments.length)return chart._options[name];if(!chart._overrides[name]){chart._options[name]=_}return chart}}};nv.utils.initOptions=function(chart){chart._overrides=chart._overrides||{};var ops=Object.getOwnPropertyNames(chart._options||{});var calls=Object.getOwnPropertyNames(chart._calls||{});ops=ops.concat(calls);for(var i in ops){nv.utils.initOption(chart,ops[i])}};nv.utils.inheritOptionsD3=function(target,d3_source,oplist){target._d3options=oplist.concat(target._d3options||[]);target._d3options=(target._d3options||[]).filter(function(item,i,ar){return ar.indexOf(item)===i});oplist.unshift(d3_source);oplist.unshift(target);d3.rebind.apply(this,oplist)};nv.utils.arrayUnique=function(a){return a.sort().filter(function(item,pos){return!pos||item!=a[pos-1]})};nv.utils.symbolMap=d3.map();nv.utils.symbol=function(){var type,size=64;function symbol(d,i){var t=type.call(this,d,i);var s=size.call(this,d,i);if(d3.svg.symbolTypes.indexOf(t)!==-1){return d3.svg.symbol().type(t).size(s)()}else{return nv.utils.symbolMap.get(t)(s)}}symbol.type=function(_){if(!arguments.length)return type;type=d3.functor(_);return symbol};symbol.size=function(_){if(!arguments.length)return size;size=d3.functor(_);return symbol};return symbol};nv.utils.inheritOptions=function(target,source){var ops=Object.getOwnPropertyNames(source._options||{});var calls=Object.getOwnPropertyNames(source._calls||{});var inherited=source._inherited||[];var d3ops=source._d3options||[];var args=ops.concat(calls).concat(inherited).concat(d3ops);args.unshift(source);args.unshift(target);d3.rebind.apply(this,args);target._inherited=nv.utils.arrayUnique(ops.concat(calls).concat(inherited).concat(ops).concat(target._inherited||[]));target._d3options=nv.utils.arrayUnique(d3ops.concat(target._d3options||[]))};nv.utils.initSVG=function(svg){svg.classed({"nvd3-svg":true})};nv.utils.sanitizeHeight=function(height,container){return height||parseInt(container.style("height"),10)||400};nv.utils.sanitizeWidth=function(width,container){return width||parseInt(container.style("width"),10)||960};nv.utils.availableHeight=function(height,container,margin){return Math.max(0,nv.utils.sanitizeHeight(height,container)-margin.top-margin.bottom)};nv.utils.availableWidth=function(width,container,margin){return Math.max(0,nv.utils.sanitizeWidth(width,container)-margin.left-margin.right)};nv.utils.noData=function(chart,container){var opt=chart.options(),margin=opt.margin(),noData=opt.noData(),data=noData==null?["No Data Available."]:[noData],height=nv.utils.availableHeight(null,container,margin),width=nv.utils.availableWidth(null,container,margin),x=margin.left+width/2,y=margin.top+height/2;container.selectAll("g").remove();var noDataText=container.selectAll(".nv-noData").data(data);noDataText.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");noDataText.attr("x",x).attr("y",y).text(function(t){return t})};nv.utils.wrapTicks=function(text,width){text.each(function(){var text=d3.select(this),words=text.text().split(/\s+/).reverse(),word,line=[],lineNumber=0,lineHeight=1.1,y=text.attr("y"),dy=parseFloat(text.attr("dy")),tspan=text.text(null).append("tspan").attr("x",0).attr("y",y).attr("dy",dy+"em");while(word=words.pop()){line.push(word);tspan.text(line.join(" "));if(tspan.node().getComputedTextLength()>width){line.pop();tspan.text(line.join(" "));line=[word];tspan=text.append("tspan").attr("x",0).attr("y",y).attr("dy",++lineNumber*lineHeight+dy+"em").text(word)}}})};nv.utils.arrayEquals=function(array1,array2){if(array1===array2)return true;if(!array1||!array2)return false;if(array1.length!=array2.length)return false;for(var i=0,l=array1.length;i<l;i++){if(array1[i]instanceof Array&&array2[i]instanceof Array){if(!nv.arrayEquals(array1[i],array2[i]))return false}else if(array1[i]!=array2[i]){return false}}return true};nv.utils.pointIsInArc=function(pt,ptData,d3Arc){var r1=d3Arc.innerRadius()(ptData),r2=d3Arc.outerRadius()(ptData),theta1=d3Arc.startAngle()(ptData),theta2=d3Arc.endAngle()(ptData);var dist=pt.x*pt.x+pt.y*pt.y,angle=Math.atan2(pt.x,-pt.y);angle=angle<0?angle+Math.PI*2:angle;return r1*r1<=dist&&dist<=r2*r2&&theta1<=angle&&angle<=theta2};nv.models.axis=function(){"use strict";var axis=d3.svg.axis();var scale=d3.scale.linear();var margin={top:0,right:0,bottom:0,left:0},width=75,height=60,axisLabelText=null,showMaxMin=true,rotateLabels=0,rotateYLabel=true,staggerLabels=false,isOrdinal=false,ticks=null,axisLabelDistance=0,fontSize=undefined,duration=250,dispatch=d3.dispatch("renderEnd"),tickFormatMaxMin;axis.scale(scale).orient("bottom").tickFormat(function(d){return d});var scale0;var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();selection.each(function(data){var container=d3.select(this);nv.utils.initSVG(container);var wrap=container.selectAll("g.nv-wrap.nv-axis").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var gEnter=wrapEnter.append("g");var g=wrap.select("g");if(ticks!==null)axis.ticks(ticks);else if(axis.orient()=="top"||axis.orient()=="bottom")axis.ticks(Math.abs(scale.range()[1]-scale.range()[0])/100);g.watchTransition(renderWatch,"axis").call(axis);scale0=scale0||axis.scale();var fmt=axis.tickFormat();if(fmt==null){fmt=scale0.tickFormat()}var axisLabel=g.selectAll("text.nv-axislabel").data([axisLabelText||null]);axisLabel.exit().remove();if(fontSize!==undefined){g.selectAll("g").select("text").style("font-size",fontSize)}var xLabelMargin;var axisMaxMin;var w;switch(axis.orient()){case"top":xLabelMargin=axisLabelDistance+36;axisLabel.enter().append("text").attr("class","nv-axislabel");w=0;if(scale.range().length===1){w=isOrdinal?scale.range()[0]*2+scale.rangeBand():0}else if(scale.range().length===2){w=isOrdinal?scale.range()[0]+scale.range()[1]+scale.rangeBand():scale.range()[1]}else if(scale.range().length>2){w=scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])};axisLabel.attr("text-anchor","middle").attr("y",-xLabelMargin).attr("x",w/2);if(showMaxMin){axisMaxMin=wrap.selectAll("g.nv-axisMaxMin").data(scale.domain());axisMaxMin.enter().append("g").attr("class",function(d,i){return["nv-axisMaxMin","nv-axisMaxMin-x",i==0?"nv-axisMin-x":"nv-axisMax-x"].join(" ")}).append("text");axisMaxMin.exit().remove();axisMaxMin.attr("transform",function(d,i){return"translate("+nv.utils.NaNtoZero(scale(d))+",0)"}).select("text").attr("dy","-0.5em").attr("y",-axis.tickPadding()).attr("text-anchor","middle").text(function(d,i){var formatter=tickFormatMaxMin||fmt;var v=formatter(d);return(""+v).match("NaN")?"":v});axisMaxMin.watchTransition(renderWatch,"min-max top").attr("transform",function(d,i){return"translate("+nv.utils.NaNtoZero(scale.range()[i])+",0)"})}break;case"bottom":xLabelMargin=axisLabelDistance+36;var maxTextWidth=30;var textHeight=0;var xTicks=g.selectAll("g").select("text");var rotateLabelsRule="";if(rotateLabels%360){xTicks.attr("transform","");xTicks.each(function(d,i){var box=this.getBoundingClientRect();var width=box.width;textHeight=box.height;if(width>maxTextWidth)maxTextWidth=width});rotateLabelsRule="rotate("+rotateLabels+" 0,"+(textHeight/2+axis.tickPadding())+")";var sin=Math.abs(Math.sin(rotateLabels*Math.PI/180));xLabelMargin=(sin?sin*maxTextWidth:maxTextWidth)+30;xTicks.attr("transform",rotateLabelsRule).style("text-anchor",rotateLabels%360>0?"start":"end")}else{if(staggerLabels){xTicks.attr("transform",function(d,i){return"translate(0,"+(i%2==0?"0":"12")+")"})}else{xTicks.attr("transform","translate(0,0)")}}axisLabel.enter().append("text").attr("class","nv-axislabel");w=0;if(scale.range().length===1){w=isOrdinal?scale.range()[0]*2+scale.rangeBand():0}else if(scale.range().length===2){w=isOrdinal?scale.range()[0]+scale.range()[1]+scale.rangeBand():scale.range()[1]}else if(scale.range().length>2){w=scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])};axisLabel.attr("text-anchor","middle").attr("y",xLabelMargin).attr("x",w/2);if(showMaxMin){axisMaxMin=wrap.selectAll("g.nv-axisMaxMin").data([scale.domain()[0],scale.domain()[scale.domain().length-1]]);axisMaxMin.enter().append("g").attr("class",function(d,i){return["nv-axisMaxMin","nv-axisMaxMin-x",i==0?"nv-axisMin-x":"nv-axisMax-x"].join(" ")}).append("text");axisMaxMin.exit().remove();axisMaxMin.attr("transform",function(d,i){return"translate("+nv.utils.NaNtoZero(scale(d)+(isOrdinal?scale.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",axis.tickPadding()).attr("transform",rotateLabelsRule).style("text-anchor",rotateLabels?rotateLabels%360>0?"start":"end":"middle").text(function(d,i){var formatter=tickFormatMaxMin||fmt;var v=formatter(d);return(""+v).match("NaN")?"":v});axisMaxMin.watchTransition(renderWatch,"min-max bottom").attr("transform",function(d,i){return"translate("+nv.utils.NaNtoZero(scale(d)+(isOrdinal?scale.rangeBand()/2:0))+",0)"})}break;case"right":axisLabel.enter().append("text").attr("class","nv-axislabel");axisLabel.style("text-anchor",rotateYLabel?"middle":"begin").attr("transform",rotateYLabel?"rotate(90)":"").attr("y",rotateYLabel?-Math.max(margin.right,width)+12-(axisLabelDistance||0):-10).attr("x",rotateYLabel?d3.max(scale.range())/2:axis.tickPadding());if(showMaxMin){axisMaxMin=wrap.selectAll("g.nv-axisMaxMin").data(scale.domain());axisMaxMin.enter().append("g").attr("class",function(d,i){return["nv-axisMaxMin","nv-axisMaxMin-y",i==0?"nv-axisMin-y":"nv-axisMax-y"].join(" ")}).append("text").style("opacity",0);axisMaxMin.exit().remove();axisMaxMin.attr("transform",function(d,i){return"translate(0,"+nv.utils.NaNtoZero(scale(d))+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",axis.tickPadding()).style("text-anchor","start").text(function(d,i){var formatter=tickFormatMaxMin||fmt;var v=formatter(d);return(""+v).match("NaN")?"":v});axisMaxMin.watchTransition(renderWatch,"min-max right").attr("transform",function(d,i){return"translate(0,"+nv.utils.NaNtoZero(scale.range()[i])+")"}).select("text").style("opacity",1)}break;case"left":axisLabel.enter().append("text").attr("class","nv-axislabel");axisLabel.style("text-anchor",rotateYLabel?"middle":"end").attr("transform",rotateYLabel?"rotate(-90)":"").attr("y",rotateYLabel?-Math.max(margin.left,width)+25-(axisLabelDistance||0):-10).attr("x",rotateYLabel?-d3.max(scale.range())/2:-axis.tickPadding());if(showMaxMin){axisMaxMin=wrap.selectAll("g.nv-axisMaxMin").data(scale.domain());axisMaxMin.enter().append("g").attr("class",function(d,i){return["nv-axisMaxMin","nv-axisMaxMin-y",i==0?"nv-axisMin-y":"nv-axisMax-y"].join(" ")}).append("text").style("opacity",0);axisMaxMin.exit().remove();axisMaxMin.attr("transform",function(d,i){return"translate(0,"+nv.utils.NaNtoZero(scale0(d))+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-axis.tickPadding()).attr("text-anchor","end").text(function(d,i){var formatter=tickFormatMaxMin||fmt;var v=formatter(d);return(""+v).match("NaN")?"":v});axisMaxMin.watchTransition(renderWatch,"min-max right").attr("transform",function(d,i){return"translate(0,"+nv.utils.NaNtoZero(scale.range()[i])+")"}).select("text").style("opacity",1)}break}axisLabel.text(function(d){return d});if(showMaxMin&&(axis.orient()==="left"||axis.orient()==="right")){g.selectAll("g").each(function(d,i){d3.select(this).select("text").attr("opacity",1);if(scale(d)<scale.range()[1]+10||scale(d)>scale.range()[0]-10){if(d>1e-10||d<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(scale.domain()[0]==scale.domain()[1]&&scale.domain()[0]==0){wrap.selectAll("g.nv-axisMaxMin").style("opacity",function(d,i){return!i?1:0})}}if(showMaxMin&&(axis.orient()==="top"||axis.orient()==="bottom")){var maxMinRange=[];wrap.selectAll("g.nv-axisMaxMin").each(function(d,i){try{if(i)maxMinRange.push(scale(d)-this.getBoundingClientRect().width-4);else maxMinRange.push(scale(d)+this.getBoundingClientRect().width+4)}catch(err){if(i)maxMinRange.push(scale(d)-4);else maxMinRange.push(scale(d)+4)}});g.selectAll("g").each(function(d,i){if(scale(d)<maxMinRange[0]||scale(d)>maxMinRange[1]){if(d>1e-10||d<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}g.selectAll(".tick").filter(function(d){return!parseFloat(Math.round(d*1e5)/1e6)&&d!==undefined}).classed("zero",true);scale0=scale.copy()});renderWatch.renderEnd("axis immediate");return chart}chart.axis=axis;chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{axisLabelDistance:{get:function(){return axisLabelDistance},set:function(_){axisLabelDistance=_}},staggerLabels:{get:function(){return staggerLabels},set:function(_){staggerLabels=_}},rotateLabels:{get:function(){return rotateLabels},set:function(_){rotateLabels=_}},rotateYLabel:{get:function(){return rotateYLabel},set:function(_){rotateYLabel=_}},showMaxMin:{get:function(){return showMaxMin},set:function(_){showMaxMin=_}},axisLabel:{get:function(){return axisLabelText},set:function(_){axisLabelText=_}},height:{get:function(){return height},set:function(_){height=_}},ticks:{get:function(){return ticks},set:function(_){ticks=_}},width:{get:function(){return width},set:function(_){width=_}},fontSize:{get:function(){return fontSize},set:function(_){fontSize=_}},tickFormatMaxMin:{get:function(){return tickFormatMaxMin},set:function(_){tickFormatMaxMin=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}},scale:{get:function(){return scale},set:function(_){scale=_;axis.scale(scale);isOrdinal=typeof scale.rangeBands==="function";nv.utils.inheritOptionsD3(chart,scale,["domain","range","rangeBand","rangeBands"])}}});nv.utils.initOptions(chart);nv.utils.inheritOptionsD3(chart,axis,["orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"]);nv.utils.inheritOptionsD3(chart,scale,["domain","range","rangeBand","rangeBands"]);return chart};nv.models.boxPlot=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,id=Math.floor(Math.random()*1e4),xScale=d3.scale.ordinal(),yScale=d3.scale.linear(),getX=function(d){return d.label},getQ1=function(d){return d.values.Q1},getQ2=function(d){return d.values.Q2},getQ3=function(d){return d.values.Q3},getWl=function(d){return d.values.whisker_low},getWh=function(d){return d.values.whisker_high},getColor=function(d){return d.color},getOlItems=function(d){return d.values.outliers},getOlValue=function(d,i,j){return d},getOlLabel=function(d,i,j){return d},getOlColor=function(d,i,j){return undefined},color=nv.utils.defaultColor(),container=null,xDomain,xRange,yDomain,yRange,dispatch=d3.dispatch("elementMouseover","elementMouseout","elementMousemove","renderEnd"),duration=250,maxBoxWidth=null;var xScale0,yScale0;var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);xScale.domain(xDomain||data.map(function(d,i){return getX(d,i)})).rangeBands(xRange||[0,availableWidth],.1);var yData=[];if(!yDomain){var values=[],yMin,yMax;data.forEach(function(d,i){var q1=getQ1(d),q3=getQ3(d),wl=getWl(d),wh=getWh(d);var olItems=getOlItems(d);if(olItems){olItems.forEach(function(e,i){values.push(getOlValue(e,i,undefined))})}if(wl){values.push(wl)}if(q1){values.push(q1)}if(q3){values.push(q3)}if(wh){values.push(wh)}});yMin=d3.min(values);yMax=d3.max(values);yData=[yMin,yMax]}yScale.domain(yDomain||yData);yScale.range(yRange||[availableHeight,0]);xScale0=xScale0||xScale;yScale0=yScale0||yScale.copy().range([yScale(0),yScale(0)]);var wrap=container.selectAll("g.nv-wrap").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var boxplots=wrap.selectAll(".nv-boxplot").data(function(d){return d});var boxEnter=boxplots.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);boxplots.attr("class","nv-boxplot").attr("transform",function(d,i,j){return"translate("+(xScale(getX(d,i))+xScale.rangeBand()*.05)+", 0)"}).classed("hover",function(d){return d.hover});boxplots.watchTransition(renderWatch,"nv-boxplot: boxplots").style("stroke-opacity",1).style("fill-opacity",.75).delay(function(d,i){return i*duration/data.length}).attr("transform",function(d,i){return"translate("+(xScale(getX(d,i))+xScale.rangeBand()*.05)+", 0)"});boxplots.exit().remove();boxEnter.each(function(d,i){var box=d3.select(this);[getWl,getWh].forEach(function(f){if(f(d)!==undefined&&f(d)!==null){var key=f===getWl?"low":"high";box.append("line").style("stroke",getColor(d)||color(d,i)).attr("class","nv-boxplot-whisker nv-boxplot-"+key);box.append("line").style("stroke",getColor(d)||color(d,i)).attr("class","nv-boxplot-tick nv-boxplot-"+key)}})});var box_width=function(){return maxBoxWidth===null?xScale.rangeBand()*.9:Math.min(75,xScale.rangeBand()*.9)};var box_left=function(){return xScale.rangeBand()*.45-box_width()/2};var box_right=function(){return xScale.rangeBand()*.45+box_width()/2};[getWl,getWh].forEach(function(f){var key=f===getWl?"low":"high";var endpoint=f===getWl?getQ1:getQ3;boxplots.select("line.nv-boxplot-whisker.nv-boxplot-"+key).watchTransition(renderWatch,"nv-boxplot: boxplots").attr("x1",xScale.rangeBand()*.45).attr("y1",function(d,i){return yScale(f(d))}).attr("x2",xScale.rangeBand()*.45).attr("y2",function(d,i){return yScale(endpoint(d))});boxplots.select("line.nv-boxplot-tick.nv-boxplot-"+key).watchTransition(renderWatch,"nv-boxplot: boxplots").attr("x1",box_left).attr("y1",function(d,i){return yScale(f(d))}).attr("x2",box_right).attr("y2",function(d,i){return yScale(f(d))})});[getWl,getWh].forEach(function(f){var key=f===getWl?"low":"high";boxEnter.selectAll(".nv-boxplot-"+key).on("mouseover",function(d,i,j){d3.select(this).classed("hover",true);dispatch.elementMouseover({series:{key:f(d),color:getColor(d)||color(d,j)},e:d3.event})}).on("mouseout",function(d,i,j){d3.select(this).classed("hover",false);dispatch.elementMouseout({series:{key:f(d),color:getColor(d)||color(d,j)},e:d3.event})}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})})});boxEnter.append("rect").attr("class","nv-boxplot-box").on("mouseover",function(d,i){d3.select(this).classed("hover",true);dispatch.elementMouseover({key:getX(d),value:getX(d),series:[{key:"Q3",value:getQ3(d),color:getColor(d)||color(d,i)},{key:"Q2",value:getQ2(d),color:getColor(d)||color(d,i)},{key:"Q1",value:getQ1(d),color:getColor(d)||color(d,i)}],data:d,index:i,e:d3.event})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false);dispatch.elementMouseout({key:getX(d),value:getX(d),series:[{key:"Q3",value:getQ3(d),color:getColor(d)||color(d,i)},{key:"Q2",value:getQ2(d),color:getColor(d)||color(d,i)},{key:"Q1",value:getQ1(d),color:getColor(d)||color(d,i)}],data:d,index:i,e:d3.event})}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})});boxplots.select("rect.nv-boxplot-box").watchTransition(renderWatch,"nv-boxplot: boxes").attr("y",function(d,i){return yScale(getQ3(d))}).attr("width",box_width).attr("x",box_left).attr("height",function(d,i){return Math.abs(yScale(getQ3(d))-yScale(getQ1(d)))||1}).style("fill",function(d,i){return getColor(d)||color(d,i)}).style("stroke",function(d,i){return getColor(d)||color(d,i)});boxEnter.append("line").attr("class","nv-boxplot-median");boxplots.select("line.nv-boxplot-median").watchTransition(renderWatch,"nv-boxplot: boxplots line").attr("x1",box_left).attr("y1",function(d,i){return yScale(getQ2(d))}).attr("x2",box_right).attr("y2",function(d,i){return yScale(getQ2(d))});var outliers=boxplots.selectAll(".nv-boxplot-outlier").data(function(d){return getOlItems(d)||[]});outliers.enter().append("circle").style("fill",function(d,i,j){return getOlColor(d,i,j)||color(d,j)}).style("stroke",function(d,i,j){return getOlColor(d,i,j)||color(d,j)}).style("z-index",9e3).on("mouseover",function(d,i,j){d3.select(this).classed("hover",true);dispatch.elementMouseover({series:{key:getOlLabel(d,i,j),color:getOlColor(d,i,j)||color(d,j)},e:d3.event})}).on("mouseout",function(d,i,j){d3.select(this).classed("hover",false);dispatch.elementMouseout({series:{key:getOlLabel(d,i,j),color:getOlColor(d,i,j)||color(d,j)},e:d3.event})}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})});outliers.attr("class","nv-boxplot-outlier");outliers.watchTransition(renderWatch,"nv-boxplot: nv-boxplot-outlier").attr("cx",xScale.rangeBand()*.45).attr("cy",function(d,i,j){return yScale(getOlValue(d,i,j))}).attr("r","3");outliers.exit().remove();xScale0=xScale.copy();yScale0=yScale.copy()});renderWatch.renderEnd("nv-boxplot immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},maxBoxWidth:{get:function(){return maxBoxWidth},set:function(_){maxBoxWidth=_}},x:{get:function(){return getX},set:function(_){getX=_}},q1:{get:function(){return getQ1},set:function(_){getQ1=_}},q2:{get:function(){return getQ2},set:function(_){getQ2=_}},q3:{get:function(){return getQ3},set:function(_){getQ3=_}},wl:{get:function(){return getWl},set:function(_){getWl=_}},wh:{get:function(){return getWh},set:function(_){getWh=_}},itemColor:{get:function(){return getColor},set:function(_){getColor=_}},outliers:{get:function(){return getOlItems},set:function(_){getOlItems=_}},outlierValue:{get:function(){return getOlValue},set:function(_){getOlValue=_}},outlierLabel:{get:function(){return getOlLabel},set:function(_){getOlLabel=_}},outlierColor:{get:function(){return getOlColor},set:function(_){getOlColor=_}},xScale:{get:function(){return xScale},set:function(_){xScale=_}},yScale:{get:function(){return yScale},set:function(_){yScale=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},id:{get:function(){return id},set:function(_){id=_}},y:{get:function(){console.warn("BoxPlot 'y' chart option is deprecated. Please use model overrides instead.");return{}},set:function(_){console.warn("BoxPlot 'y' chart option is deprecated. Please use model overrides instead.")}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}}});nv.utils.initOptions(chart);return chart};nv.models.boxPlotChart=function(){"use strict";var boxplot=nv.models.boxPlot(),xAxis=nv.models.axis(),yAxis=nv.models.axis();var margin={top:15,right:10,bottom:50,left:60},width=null,height=null,color=nv.utils.getColor(),showXAxis=true,showYAxis=true,rightAlignYAxis=false,staggerLabels=false,tooltip=nv.models.tooltip(),x,y,noData="No Data Available.",dispatch=d3.dispatch("beforeUpdate","renderEnd"),duration=250;xAxis.orient("bottom").showMaxMin(false).tickFormat(function(d){return d});yAxis.orient(rightAlignYAxis?"right":"left").tickFormat(d3.format(",.1f"));tooltip.duration(0);var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();renderWatch.models(boxplot);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=(width||parseInt(container.style("width"))||960)-margin.left-margin.right;var availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom;chart.update=function(){dispatch.beforeUpdate();container.transition().duration(duration).call(chart)};chart.container=this;if(!data||!data.length){var noDataText=container.selectAll(".nv-noData").data([noData]);noDataText.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");noDataText.attr("x",margin.left+availableWidth/2).attr("y",margin.top+availableHeight/2).text(function(d){return d});return chart}else{container.selectAll(".nv-noData").remove()}x=boxplot.xScale();y=boxplot.yScale().clamp(true);var wrap=container.selectAll("g.nv-wrap.nv-boxPlotWithAxes").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-boxPlotWithAxes").append("g");var defsEnter=gEnter.append("defs");var g=wrap.select("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line");gEnter.append("g").attr("class","nv-barsWrap");g.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}boxplot.width(availableWidth).height(availableHeight);var barsWrap=g.select(".nv-barsWrap").datum(data.filter(function(d){return!d.disabled}));barsWrap.transition().call(boxplot);defsEnter.append("clipPath").attr("id","nv-x-label-clip-"+boxplot.id()).append("rect");g.select("#nv-x-label-clip-"+boxplot.id()+" rect").attr("width",x.rangeBand()*(staggerLabels?2:1)).attr("height",16).attr("x",-x.rangeBand()/(staggerLabels?1:2));if(showXAxis){xAxis.scale(x).ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");g.select(".nv-x.nv-axis").call(xAxis);var xTicks=g.select(".nv-x.nv-axis").selectAll("g");if(staggerLabels){xTicks.selectAll("text").attr("transform",function(d,i,j){return"translate(0,"+(j%2===0?"5":"17")+")"})}}if(showYAxis){yAxis.scale(y).ticks(Math.floor(availableHeight/36)).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").call(yAxis)}g.select(".nv-zeroLine line").attr("x1",0).attr("x2",availableWidth).attr("y1",y(0)).attr("y2",y(0))});renderWatch.renderEnd("nv-boxplot chart immediate");return chart}boxplot.dispatch.on("elementMouseover.tooltip",function(evt){tooltip.data(evt).hidden(false)});boxplot.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.data(evt).hidden(true)});boxplot.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.dispatch=dispatch;chart.boxplot=boxplot;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},staggerLabels:{get:function(){return staggerLabels},set:function(_){staggerLabels=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},tooltipContent:{get:function(){return tooltip},set:function(_){tooltip=_}},noData:{get:function(){return noData},set:function(_){noData=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);boxplot.duration(duration);xAxis.duration(duration);yAxis.duration(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);boxplot.color(color)}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(_?"right":"left")}}});nv.utils.inheritOptions(chart,boxplot);nv.utils.initOptions(chart);return chart};nv.models.bullet=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},orient="left",reverse=false,ranges=function(d){return d.ranges},markers=function(d){return d.markers?d.markers:[]},markerLines=function(d){return d.markerLines?d.markerLines:[0]},measures=function(d){return d.measures},rangeLabels=function(d){return d.rangeLabels?d.rangeLabels:[]},markerLabels=function(d){return d.markerLabels?d.markerLabels:[]},markerLineLabels=function(d){return d.markerLineLabels?d.markerLineLabels:[]},measureLabels=function(d){return d.measureLabels?d.measureLabels:[]},forceX=[0],width=380,height=30,container=null,tickFormat=null,color=nv.utils.getColor(["#1f77b4"]),dispatch=d3.dispatch("elementMouseover","elementMouseout","elementMousemove"),defaultRangeLabels=["Maximum","Mean","Minimum"],legacyRangeClassNames=["Max","Avg","Min"],duration=1e3;function sortLabels(labels,values){var lz=labels.slice();labels.sort(function(a,b){var iA=lz.indexOf(a);var iB=lz.indexOf(b);return d3.descending(values[iA],values[iB])})}function chart(selection){selection.each(function(d,i){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);var rangez=ranges.call(this,d,i).slice(),markerz=markers.call(this,d,i).slice(),markerLinez=markerLines.call(this,d,i).slice(),measurez=measures.call(this,d,i).slice(),rangeLabelz=rangeLabels.call(this,d,i).slice(),markerLabelz=markerLabels.call(this,d,i).slice(),markerLineLabelz=markerLineLabels.call(this,d,i).slice(),measureLabelz=measureLabels.call(this,d,i).slice();sortLabels(rangeLabelz,rangez);sortLabels(markerLabelz,markerz);sortLabels(markerLineLabelz,markerLinez);sortLabels(measureLabelz,measurez);rangez.sort(d3.descending);markerz.sort(d3.descending);markerLinez.sort(d3.descending);measurez.sort(d3.descending);var x1=d3.scale.linear().domain(d3.extent(d3.merge([forceX,rangez]))).range(reverse?[availableWidth,0]:[0,availableWidth]);var x0=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(x1.range());this.__chart__=x1;var rangeMin=d3.min(rangez),rangeMax=d3.max(rangez),rangeAvg=rangez[1];var wrap=container.selectAll("g.nv-wrap.nv-bullet").data([d]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet");var gEnter=wrapEnter.append("g");var g=wrap.select("g");for(var i=0,il=rangez.length;i<il;i++){var rangeClassNames="nv-range nv-range"+i;if(i<=2){rangeClassNames=rangeClassNames+" nv-range"+legacyRangeClassNames[i]}gEnter.append("rect").attr("class",rangeClassNames)}gEnter.append("rect").attr("class","nv-measure");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var w0=function(d){return Math.abs(x0(d)-x0(0))},w1=function(d){return Math.abs(x1(d)-x1(0))};var xp0=function(d){return d<0?x0(d):x0(0)},xp1=function(d){return d<0?x1(d):x1(0)};for(var i=0,il=rangez.length;i<il;i++){var range=rangez[i];g.select("rect.nv-range"+i).datum(range).attr("height",availableHeight).transition().duration(duration).attr("width",w1(range)).attr("x",xp1(range))}g.select("rect.nv-measure").style("fill",color).attr("height",availableHeight/3).attr("y",availableHeight/3).on("mouseover",function(){dispatch.elementMouseover({value:measurez[0],label:measureLabelz[0]||"Current",color:d3.select(this).style("fill")})}).on("mousemove",function(){dispatch.elementMousemove({value:measurez[0],label:measureLabelz[0]||"Current",color:d3.select(this).style("fill")})}).on("mouseout",function(){dispatch.elementMouseout({value:measurez[0],label:measureLabelz[0]||"Current",color:d3.select(this).style("fill")})}).transition().duration(duration).attr("width",measurez<0?x1(0)-x1(measurez[0]):x1(measurez[0])-x1(0)).attr("x",xp1(measurez));var h3=availableHeight/6;var markerData=markerz.map(function(marker,index){return{value:marker,label:markerLabelz[index]}});gEnter.selectAll("path.nv-markerTriangle").data(markerData).enter().append("path").attr("class","nv-markerTriangle").attr("d","M0,"+h3+"L"+h3+","+-h3+" "+-h3+","+-h3+"Z").on("mouseover",function(d){dispatch.elementMouseover({value:d.value,label:d.label||"Previous",color:d3.select(this).style("fill"),pos:[x1(d.value),availableHeight/2]})}).on("mousemove",function(d){dispatch.elementMousemove({value:d.value,label:d.label||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(d,i){dispatch.elementMouseout({value:d.value,label:d.label||"Previous",color:d3.select(this).style("fill")})});g.selectAll("path.nv-markerTriangle").data(markerData).transition().duration(duration).attr("transform",function(d){return"translate("+x1(d.value)+","+availableHeight/2+")"});var markerLinesData=markerLinez.map(function(marker,index){return{value:marker,label:markerLineLabelz[index]}});gEnter.selectAll("line.nv-markerLine").data(markerLinesData).enter().append("line").attr("cursor","").attr("class","nv-markerLine").attr("x1",function(d){return x1(d.value)}).attr("y1","2").attr("x2",function(d){return x1(d.value)}).attr("y2",availableHeight-2).on("mouseover",function(d){dispatch.elementMouseover({value:d.value,label:d.label||"Previous",color:d3.select(this).style("fill"),pos:[x1(d.value),availableHeight/2]})}).on("mousemove",function(d){dispatch.elementMousemove({value:d.value,label:d.label||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(d,i){dispatch.elementMouseout({value:d.value,label:d.label||"Previous",color:d3.select(this).style("fill")})});g.selectAll("line.nv-markerLine").data(markerLinesData).transition().duration(duration).attr("x1",function(d){return x1(d.value)}).attr("x2",function(d){return x1(d.value)});wrap.selectAll(".nv-range").on("mouseover",function(d,i){var label=rangeLabelz[i]||defaultRangeLabels[i];dispatch.elementMouseover({value:d,label:label,color:d3.select(this).style("fill")})}).on("mousemove",function(){dispatch.elementMousemove({value:measurez[0],label:measureLabelz[0]||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(d,i){var label=rangeLabelz[i]||defaultRangeLabels[i];dispatch.elementMouseout({value:d,label:label,color:d3.select(this).style("fill")})})});return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{ranges:{get:function(){return ranges},set:function(_){ranges=_}},markers:{get:function(){return markers},set:function(_){markers=_}},measures:{get:function(){return measures},set:function(_){measures=_}},forceX:{get:function(){return forceX},set:function(_){forceX=_}},width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},tickFormat:{get:function(){return tickFormat},set:function(_){tickFormat=_}},duration:{get:function(){return duration},set:function(_){duration=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},orient:{get:function(){return orient},set:function(_){orient=_;reverse=orient=="right"||orient=="bottom"}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});nv.utils.initOptions(chart);return chart};nv.models.bulletChart=function(){"use strict";var bullet=nv.models.bullet();var tooltip=nv.models.tooltip();var orient="left",reverse=false,margin={top:5,right:40,bottom:20,left:120},ranges=function(d){return d.ranges},markers=function(d){return d.markers?d.markers:[]},measures=function(d){return d.measures},width=null,height=55,tickFormat=null,ticks=null,noData=null,dispatch=d3.dispatch();tooltip.duration(0).headerEnabled(false);function chart(selection){selection.each(function(d,i){var container=d3.select(this);nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=height-margin.top-margin.bottom,that=this;chart.update=function(){chart(selection)};chart.container=this;if(!d||!ranges.call(this,d,i)){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}var rangez=ranges.call(this,d,i).slice().sort(d3.descending),markerz=markers.call(this,d,i).slice().sort(d3.descending),measurez=measures.call(this,d,i).slice().sort(d3.descending);var wrap=container.selectAll("g.nv-wrap.nv-bulletChart").data([d]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-bulletWrap");gEnter.append("g").attr("class","nv-titles");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var x1=d3.scale.linear().domain([0,Math.max(rangez[0],markerz[0]||0,measurez[0])]).range(reverse?[availableWidth,0]:[0,availableWidth]);var x0=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(x1.range());this.__chart__=x1;var w0=function(d){return Math.abs(x0(d)-x0(0))},w1=function(d){return Math.abs(x1(d)-x1(0))};var title=gEnter.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(height-margin.top-margin.bottom)/2+")");title.append("text").attr("class","nv-title").text(function(d){return d.title});title.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(d){return d.subtitle});bullet.width(availableWidth).height(availableHeight);var bulletWrap=g.select(".nv-bulletWrap");d3.transition(bulletWrap).call(bullet);var format=tickFormat||x1.tickFormat(availableWidth/100);var tick=g.selectAll("g.nv-tick").data(x1.ticks(ticks?ticks:availableWidth/50),function(d){return this.textContent||format(d)});var tickEnter=tick.enter().append("g").attr("class","nv-tick").attr("transform",function(d){return"translate("+x0(d)+",0)"}).style("opacity",1e-6);tickEnter.append("line").attr("y1",availableHeight).attr("y2",availableHeight*7/6);tickEnter.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",availableHeight*7/6).text(format);var tickUpdate=d3.transition(tick).transition().duration(bullet.duration()).attr("transform",function(d){return"translate("+x1(d)+",0)"}).style("opacity",1);tickUpdate.select("line").attr("y1",availableHeight).attr("y2",availableHeight*7/6);tickUpdate.select("text").attr("y",availableHeight*7/6);d3.transition(tick.exit()).transition().duration(bullet.duration()).attr("transform",function(d){return"translate("+x1(d)+",0)"}).style("opacity",1e-6).remove()});d3.timer.flush();return chart}bullet.dispatch.on("elementMouseover.tooltip",function(evt){evt["series"]={key:evt.label,value:evt.value,color:evt.color};tooltip.data(evt).hidden(false)});bullet.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});bullet.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.bullet=bullet;chart.dispatch=dispatch;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{ranges:{get:function(){return ranges},set:function(_){ranges=_}},markers:{get:function(){return markers},set:function(_){markers=_}},measures:{get:function(){return measures},set:function(_){measures=_}},width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},tickFormat:{get:function(){return tickFormat},set:function(_){tickFormat=_}},ticks:{get:function(){return ticks},set:function(_){ticks=_}},noData:{get:function(){return noData},set:function(_){noData=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},orient:{get:function(){return orient},set:function(_){orient=_;reverse=orient=="right"||orient=="bottom"}}});nv.utils.inheritOptions(chart,bullet);nv.utils.initOptions(chart);return chart};nv.models.candlestickBar=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=null,height=null,id=Math.floor(Math.random()*1e4),container,x=d3.scale.linear(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},getOpen=function(d){return d.open},getClose=function(d){return d.close},getHigh=function(d){return d.high},getLow=function(d){return d.low},forceX=[],forceY=[],padData=false,clipEdge=true,color=nv.utils.defaultColor(),interactive=false,xDomain,yDomain,xRange,yRange,dispatch=d3.dispatch("stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");function chart(selection){selection.each(function(data){container=d3.select(this);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);nv.utils.initSVG(container);var barWidth=availableWidth/data[0].values.length*.45;x.domain(xDomain||d3.extent(data[0].values.map(getX).concat(forceX)));if(padData)x.range(xRange||[availableWidth*.5/data[0].values.length,availableWidth*(data[0].values.length-.5)/data[0].values.length]);else x.range(xRange||[5+barWidth/2,availableWidth-barWidth/2-5]);y.domain(yDomain||[d3.min(data[0].values.map(getLow).concat(forceY)),d3.max(data[0].values.map(getHigh).concat(forceY))]).range(yRange||[availableHeight,0]);if(x.domain()[0]===x.domain()[1])x.domain()[0]?x.domain([x.domain()[0]-x.domain()[0]*.01,x.domain()[1]+x.domain()[1]*.01]):x.domain([-1,1]);if(y.domain()[0]===y.domain()[1])y.domain()[0]?y.domain([y.domain()[0]+y.domain()[0]*.01,y.domain()[1]-y.domain()[1]*.01]):y.domain([-1,1]);var wrap=d3.select(this).selectAll("g.nv-wrap.nv-candlestickBar").data([data[0].values]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-candlestickBar");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-ticks");wrap.attr("transform","translate("+margin.left+","+margin.top+")");container.on("click",function(d,i){dispatch.chartClick({data:d,index:i,pos:d3.event,id:id})});defsEnter.append("clipPath").attr("id","nv-chart-clip-path-"+id).append("rect");wrap.select("#nv-chart-clip-path-"+id+" rect").attr("width",availableWidth).attr("height",availableHeight);g.attr("clip-path",clipEdge?"url(#nv-chart-clip-path-"+id+")":"");var ticks=wrap.select(".nv-ticks").selectAll(".nv-tick").data(function(d){return d});ticks.exit().remove();var tickGroups=ticks.enter().append("g");ticks.attr("class",function(d,i,j){return(getOpen(d,i)>getClose(d,i)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+j+"-"+i});var lines=tickGroups.append("line").attr("class","nv-candlestick-lines").attr("transform",function(d,i){return"translate("+x(getX(d,i))+",0)"}).attr("x1",0).attr("y1",function(d,i){return y(getHigh(d,i))}).attr("x2",0).attr("y2",function(d,i){return y(getLow(d,i))});var rects=tickGroups.append("rect").attr("class","nv-candlestick-rects nv-bars").attr("transform",function(d,i){return"translate("+(x(getX(d,i))-barWidth/2)+","+(y(getY(d,i))-(getOpen(d,i)>getClose(d,i)?y(getClose(d,i))-y(getOpen(d,i)):0))+")"}).attr("x",0).attr("y",0).attr("width",barWidth).attr("height",function(d,i){var open=getOpen(d,i);var close=getClose(d,i);return open>close?y(close)-y(open):y(open)-y(close)});ticks.select(".nv-candlestick-lines").transition().attr("transform",function(d,i){return"translate("+x(getX(d,i))+",0)"}).attr("x1",0).attr("y1",function(d,i){return y(getHigh(d,i))}).attr("x2",0).attr("y2",function(d,i){return y(getLow(d,i))});ticks.select(".nv-candlestick-rects").transition().attr("transform",function(d,i){return"translate("+(x(getX(d,i))-barWidth/2)+","+(y(getY(d,i))-(getOpen(d,i)>getClose(d,i)?y(getClose(d,i))-y(getOpen(d,i)):0))+")"}).attr("x",0).attr("y",0).attr("width",barWidth).attr("height",function(d,i){var open=getOpen(d,i);var close=getClose(d,i);return open>close?y(close)-y(open):y(open)-y(close)})});return chart}chart.highlightPoint=function(pointIndex,isHoverOver){chart.clearHighlights();container.select(".nv-candlestickBar .nv-tick-0-"+pointIndex).classed("hover",isHoverOver)};chart.clearHighlights=function(){container.select(".nv-candlestickBar .nv-tick.hover").classed("hover",false)};chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},xScale:{get:function(){return x},set:function(_){x=_}},yScale:{get:function(){return y},set:function(_){y=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},forceX:{get:function(){return forceX},set:function(_){forceX=_}},forceY:{get:function(){return forceY},set:function(_){forceY=_}},padData:{get:function(){return padData},set:function(_){padData=_}},clipEdge:{get:function(){return clipEdge},set:function(_){clipEdge=_}},id:{get:function(){return id},set:function(_){id=_}},interactive:{get:function(){return interactive},set:function(_){interactive=_}},x:{get:function(){return getX},set:function(_){getX=_}},y:{get:function(){return getY},set:function(_){getY=_}},open:{get:function(){return getOpen()},set:function(_){getOpen=_}},close:{get:function(){return getClose()},set:function(_){getClose=_}},high:{get:function(){return getHigh},set:function(_){getHigh=_}},low:{get:function(){return getLow},set:function(_){getLow=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!=undefined?_.top:margin.top;margin.right=_.right!=undefined?_.right:margin.right;margin.bottom=_.bottom!=undefined?_.bottom:margin.bottom;margin.left=_.left!=undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});nv.utils.initOptions(chart);return chart};nv.models.cumulativeLineChart=function(){"use strict";var lines=nv.models.line(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),controls=nv.models.legend(),interactiveLayer=nv.interactiveGuideline(),tooltip=nv.models.tooltip();var margin={top:30,right:30,bottom:50,left:60},marginTop=null,color=nv.utils.defaultColor(),width=null,height=null,showLegend=true,showXAxis=true,showYAxis=true,rightAlignYAxis=false,showControls=true,useInteractiveGuideline=false,rescaleY=true,x,y,id=lines.id(),state=nv.utils.state(),defaultState=null,noData=null,average=function(d){return d.average},dispatch=d3.dispatch("stateChange","changeState","renderEnd"),transitionDuration=250,duration=250,noErrorCheck=false;state.index=0;state.rescaleY=rescaleY;xAxis.orient("bottom").tickPadding(7);yAxis.orient(rightAlignYAxis?"right":"left");tooltip.valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});controls.updateState(false);var dx=d3.scale.linear(),index={i:0,x:0},renderWatch=nv.utils.renderWatch(dispatch,duration),currentYDomain;var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled}),index:index.i,rescaleY:rescaleY}}};var stateSetter=function(data){return function(state){if(state.index!==undefined)index.i=state.index;if(state.rescaleY!==undefined)rescaleY=state.rescaleY;if(state.active!==undefined)data.forEach(function(series,i){series.disabled=!state.active[i]})}};function chart(selection){renderWatch.reset();renderWatch.models(lines);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this);nv.utils.initSVG(container);container.classed("nv-chart-"+id,true);var that=this;var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){if(duration===0)container.call(chart);else container.transition().duration(duration).call(chart)};chart.container=this;state.setter(stateSetter(data),chart.update).getter(stateGetter(data)).update();state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}var indexDrag=d3.behavior.drag().on("dragstart",dragStart).on("drag",dragMove).on("dragend",dragEnd);function dragStart(d,i){d3.select(chart.container).style("cursor","ew-resize")}function dragMove(d,i){index.x=d3.event.x;index.i=Math.round(dx.invert(index.x));updateZero()}function dragEnd(d,i){d3.select(chart.container).style("cursor","auto");state.index=index.i;dispatch.stateChange(state)}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}x=lines.xScale();y=lines.yScale();dx.domain([0,data[0].values.length-1]).range([0,availableWidth]).clamp(true);var data=indexify(index.i,data);if(typeof currentYDomain==="undefined"){currentYDomain=getCurrentYDomain(data)}if(!rescaleY){lines.yDomain(currentYDomain);lines.clipEdge(true)}else{lines.yDomain(null)}var interactivePointerEvents=useInteractiveGuideline?"none":"all";var wrap=container.selectAll("g.nv-wrap.nv-cumulativeLine").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-interactive");gEnter.append("g").attr("class","nv-x nv-axis").style("pointer-events","none");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-background");gEnter.append("g").attr("class","nv-linesWrap").style("pointer-events",interactivePointerEvents);gEnter.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{legend.width(availableWidth);g.select(".nv-legendWrap").datum(data).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}g.select(".nv-legendWrap").attr("transform","translate(0,"+-margin.top+")")}if(!showControls){g.select(".nv-controlsWrap").selectAll("*").remove()}else{var controlsData=[{key:"Re-scale y-axis",disabled:!rescaleY}];controls.width(140).color(["#444","#444","#444"]).rightAlign(false).margin({top:5,right:0,bottom:5,left:20});g.select(".nv-controlsWrap").datum(controlsData).attr("transform","translate(0,"+-margin.top+")").call(controls)}wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}var tempDisabled=data.filter(function(d){return d.tempDisabled});wrap.select(".tempDisabled").remove();if(tempDisabled.length){wrap.append("text").attr("class","tempDisabled").attr("x",availableWidth/2).attr("y","-.71em").style("text-anchor","end").text(tempDisabled.map(function(d){return d.key}).join(", ")+" values cannot be calculated for this time period.")}if(useInteractiveGuideline){interactiveLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-interactive").call(interactiveLayer)}gEnter.select(".nv-background").append("rect");g.select(".nv-background rect").attr("width",availableWidth).attr("height",availableHeight);lines.y(function(d){return d.display.y}).width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled&&!data[i].tempDisabled}));var linesWrap=g.select(".nv-linesWrap").datum(data.filter(function(d){return!d.disabled&&!d.tempDisabled}));linesWrap.call(lines);data.forEach(function(d,i){d.seriesIndex=i});var avgLineData=data.filter(function(d){return!d.disabled&&!!average(d)});var avgLines=g.select(".nv-avgLinesWrap").selectAll("line").data(avgLineData,function(d){return d.key});var getAvgLineY=function(d){var yVal=y(average(d));if(yVal<0)return 0;if(yVal>availableHeight)return availableHeight;return yVal};avgLines.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(d,i){return lines.color()(d,d.seriesIndex)}).attr("x1",0).attr("x2",availableWidth).attr("y1",getAvgLineY).attr("y2",getAvgLineY);avgLines.style("stroke-opacity",function(d){var yVal=y(average(d));if(yVal<0||yVal>availableHeight)return 0;return 1}).attr("x1",0).attr("x2",availableWidth).attr("y1",getAvgLineY).attr("y2",getAvgLineY);avgLines.exit().remove();var indexLine=linesWrap.selectAll(".nv-indexLine").data([index]);indexLine.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(indexDrag);indexLine.attr("transform",function(d){return"translate("+dx(d.i)+",0)"}).attr("height",availableHeight);if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/70,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");g.select(".nv-x.nv-axis").call(xAxis)}if(showYAxis){yAxis.scale(y)._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").call(yAxis)}function updateZero(){indexLine.data([index]);var oldDuration=chart.duration();chart.duration(0);chart.update();chart.duration(oldDuration)}g.select(".nv-background rect").on("click",function(){index.x=d3.mouse(this)[0];index.i=Math.round(dx.invert(index.x));state.index=index.i;dispatch.stateChange(state);updateZero()});lines.dispatch.on("elementClick",function(e){index.i=e.pointIndex;index.x=dx(index.i);state.index=index.i;dispatch.stateChange(state);updateZero()});controls.dispatch.on("legendClick",function(d,i){d.disabled=!d.disabled;rescaleY=!d.disabled;state.rescaleY=rescaleY;if(!rescaleY){currentYDomain=getCurrentYDomain(data)}dispatch.stateChange(state);chart.update()});legend.dispatch.on("stateChange",function(newState){for(var key in newState)state[key]=newState[key];dispatch.stateChange(state);chart.update()});interactiveLayer.dispatch.on("elementMousemove",function(e){lines.clearHighlights();var singlePoint,pointIndex,pointXLocation,allData=[];data.filter(function(series,i){series.seriesIndex=i;return!(series.disabled||series.tempDisabled)}).forEach(function(series,i){pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());lines.highlightPoint(i,pointIndex,true);var point=series.values[pointIndex];if(typeof point==="undefined")return;if(typeof singlePoint==="undefined")singlePoint=point;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex));allData.push({key:series.key,value:chart.y()(point,pointIndex),color:color(series,series.seriesIndex)})});if(allData.length>2){var yValue=chart.yScale().invert(e.mouseY);var domainExtent=Math.abs(chart.yScale().domain()[0]-chart.yScale().domain()[1]);var threshold=.03*domainExtent;var indexToHighlight=nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);if(indexToHighlight!==null)allData[indexToHighlight].highlight=true}var xValue=xAxis.tickFormat()(chart.x()(singlePoint,pointIndex),pointIndex);interactiveLayer.tooltip.valueFormatter(function(d,i){return yAxis.tickFormat()(d)}).data({value:xValue,series:allData})();interactiveLayer.renderGuideLine(pointXLocation)});interactiveLayer.dispatch.on("elementMouseout",function(e){lines.clearHighlights()});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}if(typeof e.index!=="undefined"){index.i=e.index;index.x=dx(index.i);state.index=e.index;indexLine.data([index])}if(typeof e.rescaleY!=="undefined"){rescaleY=e.rescaleY}chart.update()})});renderWatch.renderEnd("cumulativeLineChart immediate");return chart}lines.dispatch.on("elementMouseover.tooltip",function(evt){var point={x:chart.x()(evt.point),y:chart.y()(evt.point),color:evt.point.color};evt.point=point;tooltip.data(evt).hidden(false)});lines.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});var indexifyYGetter=null;function indexify(idx,data){if(!indexifyYGetter)indexifyYGetter=lines.y();return data.map(function(line,i){if(!line.values){return line}var indexValue=line.values[idx];if(indexValue==null){return line}var v=indexifyYGetter(indexValue,idx);if(Math.abs(v)<1e-5&&!noErrorCheck){line.tempDisabled=true;return line}line.tempDisabled=false;line.values=line.values.map(function(point,pointIndex){point.display={y:(indexifyYGetter(point,pointIndex)-v)/v};return point});return line})}function getCurrentYDomain(data){var seriesDomains=data.filter(function(series){return!(series.disabled||series.tempDisabled)}).map(function(series,i){return d3.extent(series.values,function(d){return d.display.y})});return[d3.min(seriesDomains,function(d){return d[0]}),d3.max(seriesDomains,function(d){return d[1]})]}chart.dispatch=dispatch;chart.lines=lines;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.interactiveLayer=interactiveLayer;chart.state=state;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showControls:{get:function(){return showControls},set:function(_){showControls=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},average:{get:function(){return average},set:function(_){average=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},noData:{get:function(){return noData},set:function(_){noData=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},noErrorCheck:{get:function(){return noErrorCheck},set:function(_){noErrorCheck=_}},rescaleY:{get:function(){return rescaleY},set:function(_){rescaleY=_;chart.state.rescaleY=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color)}},useInteractiveGuideline:{get:function(){return useInteractiveGuideline},set:function(_){useInteractiveGuideline=_;if(_===true){chart.interactive(false);chart.useVoronoi(false)}}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(_?"right":"left")}},duration:{get:function(){return duration},set:function(_){duration=_;lines.duration(duration);xAxis.duration(duration);yAxis.duration(duration);renderWatch.reset(duration)}}});nv.utils.inheritOptions(chart,lines);nv.utils.initOptions(chart);return chart};"use strict";nv.models.differenceChart=function(){"use strict";var container=void 0;var multiChart=nv.models.multiChart();var focus=nv.models.focus(nv.models.line());var yForMultiChart=function yForMultiChart(d){if(isDefined(d.y0)){return d.y0}return d.y};var xForMultiChart=function xForMultiChart(d){return d.x};var xAccessor=function xAccessor(d){return d.x};var keyForXValue="x";var yAccessor=function yAccessor(d){return d.y};var duration=300;var keyForActualLessThanPredicted=null;var keyForActualGreaterThanPredicted=null;var height=null;var width=null;var margin={top:30,right:50,bottom:20,left:70};var focusMargin={top:0,right:0,bottom:0,left:0};var showPredictedLine=true;var interpolate="linear";var strokeWidth=1;var xScale=d3.time.scale();var tickFormat=d3.time.format.multi([["%I:%M",function(d){return d.getMinutes()}],["%I %p",function(d){return d.getHours()}],["%a %d",function(d){return d.getDay()&&d.getDate()!=1}],["%b %d",function(d){return d.getDate()!=1}],["%B",function(d){return d.getMonth()}],["%Y",function(){return true}]]);function chart(selection){selection.each(function(data){container=d3.select(this);var dataWithoutDisabledSeries=(data||[]).filter(function(dataset){return!dataset.disabled});if(!data||!dataWithoutDisabledSeries.length){nv.utils.noData(chart,container);return chart}var processedData=processData(data);var availableHeight=nv.utils.availableHeight(height,container,margin)-focus.height();var availableWidth=nv.utils.availableWidth(width,container,margin);container.attr("class","nv-differenceChart");nv.utils.initSVG(container);chart.container=this;multiChart.margin(margin).color(d3.scale.category10().range()).y(yForMultiChart).width(width).height(availableHeight).interpolate(interpolate).useInteractiveGuideline(true);multiChart.interactiveLayer.tooltip.valueFormatter(function(value,i,datum){if(datum.key===keyForActualGreaterThanPredicted||datum.key===keyForActualLessThanPredicted){var diff=Math.abs(datum.data.y0-datum.data.y1);if(diff===0){return"-"}return diff}return value});multiChart.stack1.areaY1(function(d){return multiChart.stack1.scatter.yScale()(d.display.y)});multiChart.stack1.transformData(function(d){d.display={y:d.y1,y0:d.y0}});multiChart.xAxis.scale(xScale);multiChart.xAxis.tickFormat(tickFormat);var allValues=processedData.filter(function(dataset){return!dataset.disabled}).map(function(dataset){return dataset.values});var dateExtent=d3.extent(d3.merge(allValues),function(d){return xForMultiChart(d)});multiChart.xAxis.domain(dateExtent).range([0,availableWidth]);var yExtent=d3.extent(d3.merge(allValues),function(d){return yForMultiChart(d)});multiChart.yDomain1(yExtent);multiChart.yAxis1.tickFormat(d3.format(",.1f"));multiChart.yAxis2.tickFormat(d3.format(",.1f"));focus.width(availableWidth);focus.margin(focusMargin);focus.xScale(xScale.copy());focus.xAxis.tickFormat(tickFormat);focus.xAxis.rotateLabels(0);container.append("g").attr("class","nv-focusWrap").style("display","initial").attr("transform","translate("+margin.left+", "+(availableHeight+focus.margin().top)+")").datum(processedData.filter(function(dataset){return dataset.type==="line"})).call(focus);container.datum(processedData).call(multiChart);focus.dispatch.on("onBrush",function(extent){var filteredData=processedData.map(function(datum){var leftIndex=-1;var rightIndex=-1;datum.values.some(function(val,index){if(leftIndex===-1&&val.x>=extent[0]){leftIndex=index}if(rightIndex===-1&&val.x>=extent[1]){rightIndex=index;return true}return false});var filteredValues=datum.values.slice(leftIndex,rightIndex);var iterations=0;while(filteredValues.length<2&&iterations<5){leftIndex-=1;rightIndex+=1;filteredValues=datum.values.slice(leftIndex,rightIndex);iterations++}return Object.assign({},datum,{values:filteredValues})});container.datum(filteredData);multiChart.xAxis.domain(extent);multiChart.update()});chart.update=function(){container.selectAll("*").remove();if(duration===0){container.call(chart)}else{container.transition().duration(duration).call(chart)}};return chart})}chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function get(){return width},set:function set(_){width=_}},height:{get:function get(){return height},set:function set(_){height=_}},strokeWidth:{get:function get(){return strokeWidth},set:function set(_){strokeWidth=_}},x:{get:function get(){return xAccessor},set:function set(_){xAccessor=_}},keyForXValue:{get:function get(){return keyForXValue},set:function set(_){keyForXValue=_}},y:{get:function get(){return yAccessor},set:function set(_){yAccessor=_}},xScale:{get:function get(){return xScale},set:function set(_){xScale=_}},keyForActualLessThanPredicted:{get:function get(){return keyForActualLessThanPredicted},set:function set(_){keyForActualLessThanPredicted=_}},keyForActualGreaterThanPredicted:{get:function get(){return keyForActualGreaterThanPredicted},set:function set(_){keyForActualGreaterThanPredicted=_}},showPredictedLine:{get:function get(){return showPredictedLine},set:function set(_){showPredictedLine=_}},tickFormat:{get:function get(){return tickFormat},set:function set(_){tickFormat=_}},interpolate:{get:function get(){return interpolate},set:function set(_){interpolate=_}},focusMargin:{get:function get(){return focusMargin},set:function set(_){focusMargin.top=_.top!==undefined?_.top:focusMargin.top;focusMargin.right=_.right!==undefined?_.right:focusMargin.right;focusMargin.bottom=_.bottom!==undefined?_.bottom:focusMargin.bottom;focusMargin.left=_.left!==undefined?_.left:focusMargin.left}},margin:{get:function get(){return margin},set:function set(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}}});function processData(data){var clonedData=data.slice(0);var allProcessed=clonedData.every(function(dataset){return dataset.processed});var actualData=clonedData.filter(function(dataSet){return dataSet.type==="actual"});var predictedData=clonedData.filter(function(dataSet){return dataSet.type==="expected"});if(allProcessed){return clonedData}else if(!actualData.length||!predictedData.length){return[]}var defaultKeyForActualLessThanPredicted=predictedData[0].key+" minus "+actualData[0].key+" (Predicted > Actual)";var defaultKeyForActualGreaterThanPredicted=predictedData[0].key+" minus "+actualData[0].key+" (Predicted < Actual)";var processedData=[{key:keyForActualLessThanPredicted||defaultKeyForActualLessThanPredicted,type:"area",values:[],yAxis:1,color:"rgba(44,160,44,.9)",processed:true,noHighlightSeries:true},{key:keyForActualGreaterThanPredicted||defaultKeyForActualGreaterThanPredicted,type:"area",values:[],yAxis:1,color:"rgba(234,39,40,.9)",processed:true,noHighlightSeries:true},{key:actualData[0].key,type:"line",values:[],yAxis:1,color:"#666666",processed:true,strokeWidth:strokeWidth}];if(showPredictedLine){processedData[3]={key:predictedData[0].key,type:"line",values:[],yAxis:1,color:"#aec7e8",processed:true,strokeWidth:strokeWidth}}var actualDataAsMap=actualData[0].values.reduce(function(result,datum,idx){result[xAccessor(datum)]=yAccessor(datum);return result},{});var predictedDataAsMap=predictedData[0].values.reduce(function(result,datum,idx){result[xAccessor(datum)]=yAccessor(datum);return result},{});Object.keys(actualDataAsMap).forEach(function(stringifiedXValue,idx){var actualUsage=actualDataAsMap[stringifiedXValue];var predictedUsage=predictedDataAsMap[stringifiedXValue];var fakeDatumToGetProperXValue={};fakeDatumToGetProperXValue[keyForXValue]=stringifiedXValue;var correctlyFormattedXValue=xAccessor(fakeDatumToGetProperXValue);var predictedActualDelta=predictedUsage-actualUsage;if(isNaN(predictedActualDelta)){processedData[1].values[idx]={x:correctlyFormattedXValue,y0:actualUsage,y1:actualUsage};processedData[0].values[idx]={x:correctlyFormattedXValue,y0:actualUsage,y1:actualUsage}}else if(predictedActualDelta<0){processedData[1].values[idx]={x:correctlyFormattedXValue,y0:actualUsage,y1:predictedUsage};processedData[0].values[idx]={x:correctlyFormattedXValue,y0:actualUsage,y1:actualUsage}}else{processedData[0].values[idx]={x:correctlyFormattedXValue,y0:actualUsage,y1:predictedUsage};processedData[1].values[idx]={x:correctlyFormattedXValue,y0:actualUsage,y1:actualUsage}}processedData[2].values[idx]={x:correctlyFormattedXValue,y:actualUsage};if(showPredictedLine){processedData[3].values[idx]={x:correctlyFormattedXValue,y:predictedUsage}}});return processedData}function isDefined(thingToCheck){return thingToCheck!==void 0}chart.xAxis=multiChart.xAxis;chart.yAxis=multiChart.yAxis1;chart.multiChart=multiChart;chart.focus=focus;chart.processData=processData;nv.utils.inheritOptions(chart,multiChart);nv.utils.initOptions(chart);return chart};nv.models.discreteBar=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,id=Math.floor(Math.random()*1e4),container,x=d3.scale.ordinal(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},forceY=[0],color=nv.utils.defaultColor(),cornerRadius=0,showValues=false,valueFormat=d3.format(",.2f"),xDomain,yDomain,xRange,yRange,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),rectClass="discreteBar",duration=250;var x0,y0;var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);data.forEach(function(series,i){series.values.forEach(function(point){point.series=i})});var seriesData=xDomain&&yDomain?[]:data.map(function(d){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i),y0:d.y0}})});x.domain(xDomain||d3.merge(seriesData).map(function(d){return d.x})).rangeBands(xRange||[0,availableWidth],.1);y.domain(yDomain||d3.extent(d3.merge(seriesData).map(function(d){return d.y}).concat(forceY)));if(showValues)y.range(yRange||[availableHeight-(y.domain()[0]<0?12:0),y.domain()[1]>0?12:0]);else y.range(yRange||[availableHeight,0]);x0=x0||x;y0=y0||y.copy().range([y(0),y(0)]);var wrap=container.selectAll("g.nv-wrap.nv-discretebar").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-groups");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var groups=wrap.select(".nv-groups").selectAll(".nv-group").data(function(d){return d},function(d){return d.key});groups.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);groups.exit().watchTransition(renderWatch,"discreteBar: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();groups.attr("class",function(d,i){return"nv-group nv-series-"+i}).classed("hover",function(d){return d.hover});groups.watchTransition(renderWatch,"discreteBar: groups").style("stroke-opacity",1).style("fill-opacity",.75);var bars=groups.selectAll("g.nv-bar").data(function(d){return d.values});bars.exit().remove();var barsEnter=bars.enter().append("g").attr("transform",function(d,i,j){return"translate("+(x(getX(d,i))+x.rangeBand()*.05)+", "+y(0)+")"}).on("mouseover",function(d,i){d3.select(this).classed("hover",true);dispatch.elementMouseover({data:d,index:i,color:d3.select(this).style("fill")})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false);dispatch.elementMouseout({data:d,index:i,color:d3.select(this).style("fill")})}).on("mousemove",function(d,i){dispatch.elementMousemove({data:d,index:i,color:d3.select(this).style("fill")})}).on("click",function(d,i){var element=this;dispatch.elementClick({data:d,index:i,color:d3.select(this).style("fill"),event:d3.event,element:element});d3.event.stopPropagation()}).on("dblclick",function(d,i){dispatch.elementDblClick({data:d,index:i,color:d3.select(this).style("fill")});d3.event.stopPropagation()});barsEnter.append("rect").attr("height",0).attr("width",x.rangeBand()*.9/data.length);if(showValues){barsEnter.append("text").attr("text-anchor","middle");bars.select("text").text(function(d,i){return valueFormat(getY(d,i))}).watchTransition(renderWatch,"discreteBar: bars text").attr("x",x.rangeBand()*.9/2).attr("y",function(d,i){return getY(d,i)<0?y(getY(d,i))-y(0)+12:-4})}else{bars.selectAll("text").remove()}bars.attr("class",function(d,i){return getY(d,i)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(d,i){return d.color||color(d,i)}).style("stroke",function(d,i){return d.color||color(d,i)}).select("rect").attr("rx",cornerRadius).attr("class",rectClass).watchTransition(renderWatch,"discreteBar: bars rect").attr("width",x.rangeBand()*.9/data.length);bars.watchTransition(renderWatch,"discreteBar: bars").attr("transform",function(d,i){var left=x(getX(d,i))+x.rangeBand()*.05,top=getY(d,i)<0?y(0):y(0)-y(getY(d,i))<1?y(0)-1:y(getY(d,i));return"translate("+left+", "+top+")"}).select("rect").attr("height",function(d,i){return Math.max(Math.abs(y(getY(d,i))-y(0)),1)});x0=x.copy();y0=y.copy()});renderWatch.renderEnd("discreteBar immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},forceY:{get:function(){return forceY},set:function(_){forceY=_}},showValues:{get:function(){return showValues},set:function(_){showValues=_}},cornerRadius:{get:function(){return cornerRadius},set:function(_){cornerRadius=_}},x:{get:function(){return getX},set:function(_){getX=_}},y:{get:function(){return getY},set:function(_){getY=_}},xScale:{get:function(){return x},set:function(_){x=_}},yScale:{get:function(){return y},set:function(_){y=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},valueFormat:{get:function(){return valueFormat},set:function(_){valueFormat=_}},id:{get:function(){return id},set:function(_){id=_}},rectClass:{get:function(){return rectClass},set:function(_){rectClass=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}}});nv.utils.initOptions(chart);return chart};nv.models.discreteBarChart=function(){"use strict";var discretebar=nv.models.discreteBar(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),tooltip=nv.models.tooltip();var margin={top:15,right:10,bottom:50,left:60},marginTop=null,width=null,height=null,color=nv.utils.getColor(),showLegend=false,showXAxis=true,showYAxis=true,rightAlignYAxis=false,staggerLabels=false,wrapLabels=false,rotateLabels=0,x,y,noData=null,dispatch=d3.dispatch("beforeUpdate","renderEnd"),duration=250;xAxis.orient("bottom").showMaxMin(false).tickFormat(function(d){return d});yAxis.orient(rightAlignYAxis?"right":"left").tickFormat(d3.format(",.1f"));tooltip.duration(0).headerEnabled(false).valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)}).keyFormatter(function(d,i){return xAxis.tickFormat()(d,i)});var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();renderWatch.models(discretebar);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){dispatch.beforeUpdate();container.transition().duration(duration).call(chart)};chart.container=this;if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}x=discretebar.xScale();y=discretebar.yScale().clamp(true);var wrap=container.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g");var defsEnter=gEnter.append("defs");var g=wrap.select("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line");gEnter.append("g").attr("class","nv-barsWrap");gEnter.append("g").attr("class","nv-legendWrap");g.attr("transform","translate("+margin.left+","+margin.top+")");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{legend.width(availableWidth);g.select(".nv-legendWrap").datum(data).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}wrap.select(".nv-legendWrap").attr("transform","translate(0,"+-margin.top+")")}if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}discretebar.width(availableWidth).height(availableHeight);var barsWrap=g.select(".nv-barsWrap").datum(data.filter(function(d){return!d.disabled}));barsWrap.transition().call(discretebar);defsEnter.append("clipPath").attr("id","nv-x-label-clip-"+discretebar.id()).append("rect");g.select("#nv-x-label-clip-"+discretebar.id()+" rect").attr("width",x.rangeBand()*(staggerLabels?2:1)).attr("height",16).attr("x",-x.rangeBand()/(staggerLabels?1:2));if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+(y.range()[0]+(discretebar.showValues()&&y.domain()[0]<0?16:0))+")");g.select(".nv-x.nv-axis").call(xAxis);var xTicks=g.select(".nv-x.nv-axis").selectAll("g");if(staggerLabels){xTicks.selectAll("text").attr("transform",function(d,i,j){return"translate(0,"+(j%2==0?"5":"17")+")"})}if(rotateLabels){xTicks.selectAll(".tick text").attr("transform","rotate("+rotateLabels+" 0,0)").style("text-anchor",rotateLabels>0?"start":"end")}if(wrapLabels){g.selectAll(".tick text").call(nv.utils.wrapTicks,chart.xAxis.rangeBand())}}if(showYAxis){yAxis.scale(y)._ticks(nv.utils.calcTicksY(availableHeight/36,data,discretebar.y())).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").call(yAxis)}g.select(".nv-zeroLine line").attr("x1",0).attr("x2",rightAlignYAxis?-availableWidth:availableWidth).attr("y1",y(0)).attr("y2",y(0))});renderWatch.renderEnd("discreteBar chart immediate");return chart}discretebar.dispatch.on("elementMouseover.tooltip",function(evt){evt["series"]={key:chart.x()(evt.data),value:chart.y()(evt.data),color:evt.color};tooltip.data(evt).hidden(false)});discretebar.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});discretebar.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.dispatch=dispatch;chart.discretebar=discretebar;chart.legend=legend;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},staggerLabels:{get:function(){return staggerLabels},set:function(_){staggerLabels=_}},rotateLabels:{get:function(){return rotateLabels},set:function(_){rotateLabels=_}},wrapLabels:{get:function(){return wrapLabels},set:function(_){wrapLabels=!!_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},noData:{get:function(){return noData},set:function(_){noData=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);discretebar.duration(duration);xAxis.duration(duration);yAxis.duration(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);discretebar.color(color);legend.color(color)}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(_?"right":"left")}}});nv.utils.inheritOptions(chart,discretebar);nv.utils.initOptions(chart);return chart};nv.models.distribution=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=400,size=8,axis="x",getData=function(d){return d[axis]},color=nv.utils.defaultColor(),scale=d3.scale.linear(),domain,duration=250,dispatch=d3.dispatch("renderEnd");var scale0;var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();selection.each(function(data){var availableLength=width-(axis==="x"?margin.left+margin.right:margin.top+margin.bottom),naxis=axis=="x"?"y":"x",container=d3.select(this);nv.utils.initSVG(container);scale0=scale0||scale;var wrap=container.selectAll("g.nv-distribution").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-distribution");var gEnter=wrapEnter.append("g");var g=wrap.select("g");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var distWrap=g.selectAll("g.nv-dist").data(function(d){return d},function(d){return d.key});distWrap.enter().append("g");distWrap.attr("class",function(d,i){return"nv-dist nv-series-"+i}).style("stroke",function(d,i){return color(d,i)});var dist=distWrap.selectAll("line.nv-dist"+axis).data(function(d){return d.values});dist.enter().append("line").attr(axis+"1",function(d,i){return scale0(getData(d,i))}).attr(axis+"2",function(d,i){return scale0(getData(d,i))});renderWatch.transition(distWrap.exit().selectAll("line.nv-dist"+axis),"dist exit").attr(axis+"1",function(d,i){return scale(getData(d,i))}).attr(axis+"2",function(d,i){return scale(getData(d,i))}).style("stroke-opacity",0).remove();dist.attr("class",function(d,i){return"nv-dist"+axis+" nv-dist"+axis+"-"+i}).attr(naxis+"1",0).attr(naxis+"2",size);renderWatch.transition(dist,"dist").attr(axis+"1",function(d,i){return scale(getData(d,i))}).attr(axis+"2",function(d,i){return scale(getData(d,i))});scale0=scale.copy()});renderWatch.renderEnd("distribution immediate");return chart}chart.options=nv.utils.optionsFunc.bind(chart);chart.dispatch=dispatch;chart.margin=function(_){if(!arguments.length)return margin;margin.top=typeof _.top!="undefined"?_.top:margin.top;margin.right=typeof _.right!="undefined"?_.right:margin.right;margin.bottom=typeof _.bottom!="undefined"?_.bottom:margin.bottom;margin.left=typeof _.left!="undefined"?_.left:margin.left;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.axis=function(_){if(!arguments.length)return axis;axis=_;return chart};chart.size=function(_){if(!arguments.length)return size;size=_;return chart};chart.getData=function(_){if(!arguments.length)return getData;getData=d3.functor(_);return chart};chart.scale=function(_){if(!arguments.length)return scale;scale=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);return chart};chart.duration=function(_){if(!arguments.length)return duration;duration=_;renderWatch.reset(duration);return chart};return chart};nv.models.distroPlot=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,id=Math.floor(Math.random()*1e4),xScale=d3.scale.ordinal(),yScale=d3.scale.linear(),getX=function(d){return d.label},getY=function(d){return d.value},getColor=function(d){return d.color},getQ1=function(d){return d.values.q1},getQ2=function(d){return d.values.q2},getQ3=function(d){return d.values.q3},getNl=function(d){return(centralTendency=="mean"?getMean(d):getQ2(d))-d.values.notch},getNu=function(d){return(centralTendency=="mean"?getMean(d):getQ2(d))+d.values.notch},getMean=function(d){return d.values.mean},getWl=function(d){return d.values.wl[whiskerDef]},getWh=function(d){return d.values.wu[whiskerDef]},getMin=function(d){return d.values.min},getMax=function(d){return d.values.max},getDev=function(d){return d.values.dev},getValsObj=function(d){return d.values.observations},getValsArr=function(d){return d.values.observations.map(function(e){return e.y})},plotType,observationType=false,whiskerDef="iqr",hideWhiskers=false,notchBox=false,colorGroup=false,centralTendency=false,showOnlyOutliers=true,jitter=.7,squash=true,bandwidth="scott",clampViolin=true,resolution=50,pointSize=3,color=nv.utils.defaultColor(),container=null,xDomain,xRange,yDomain,yRange,dispatch=d3.dispatch("elementMouseover","elementMouseout","elementMousemove","renderEnd"),duration=250,maxBoxWidth=null;function select_sigma(x){var sorted=x.sort(d3.ascending);var normalize=1.349;var IQR=(d3.quantile(sorted,.75)-d3.quantile(sorted,.25))/normalize;return d3.min([d3.deviation(sorted),IQR])}function calcBandwidth(x,type){if(typeof type==="undefined")type="scott";var A=select_sigma(x);var n=x.length;return type==="scott"?Math.pow(1.059*A*n,-.2):Math.pow(.9*A*n,-.2)}function prepData(dat){function calcStats(g,xGroup){var v=g.map(function(d){if(colorGroup)allColorGroups.add(colorGroup(d));return getY(d)}).sort(d3.ascending);var q1=d3.quantile(v,.25);var q3=d3.quantile(v,.75);var iqr=q3-q1;var upper=q3+1.5*iqr;var lower=q1-1.5*iqr;var wl={iqr:d3.max([d3.min(v),d3.min(v.filter(function(d){return d>lower}))]),minmax:d3.min(v),stddev:d3.mean(v)-d3.deviation(v)};var wu={iqr:d3.min([d3.max(v),d3.max(v.filter(function(d){return d<upper}))]),minmax:d3.max(v),stddev:d3.mean(v)+d3.deviation(v)};var median=d3.median(v);var mean=d3.mean(v);var observations=[];if(typeof d3.beeswarm!=="undefined"){observations=d3.beeswarm().data(g.map(function(e){return getY(e)})).radius(pointSize+1).orientation("vertical").side("symmetric").distributeOn(function(e){return yScale(e)}).arrange();observations.map(function(e,i){e.key=xGroup;e.object_constancy=g[i].object_constancy;e.isOutlier=e.datum<wl.iqr||e.datum>wu.iqr;e.isOutlierStdDev=e.datum<wl.stddev||e.datum>wu.stddev;e.randX=Math.random()*jitter*(Math.floor(Math.random()*2)==1?1:-1)})}else{v.forEach(function(e,i){observations.push({object_constancy:e.object_constancy,datum:e,key:xGroup,isOutlier:e<wl.iqr||e>wu.iqr,isOutlierStdDev:e<wl.stddev||e>wu.stddev,randX:Math.random()*jitter*(Math.floor(Math.random()*2)==1?1:-1)})})}if(isNaN(parseFloat(bandwidth))){var bandwidthCalc;if(["scott","silverman"].indexOf(bandwidth)!=-1){bandwidthCalc=calcBandwidth(v,bandwidth)}else{bandwidthCalc=calcBandwidth(v)}}var kde=kernelDensityEstimator(eKernel(bandwidthCalc),yScale.ticks(resolution));var kdeDat=clampViolin?clampViolinKDE(kde(v),d3.extent(v)):kde(v);var tmpScale=d3.scale.linear().domain([0,d3.max(kdeDat,function(e){return e.y})]).clamp(true);yVScale.push(tmpScale);var reformat={count:v.length,num_outlier:observations.filter(function(e){return e.isOutlier}).length,sum:d3.sum(v),mean:mean,q1:q1,q2:median,q3:q3,wl:wl,wu:wu,iqr:iqr,min:d3.min(v),max:d3.max(v),dev:d3.deviation(v),observations:observations,key:xGroup,kde:kdeDat,notch:1.57*iqr/Math.sqrt(v.length)};if(colorGroup){reformatDatFlat.push({key:xGroup,values:reformat})}return reformat}dat.forEach(function(d,i){d.object_constancy=i+"_"+getY(d)+"_"+getX(d)});var formatted;if(!colorGroup){formatted=d3.nest().key(function(d){return getX(d)}).rollup(function(v,i){return calcStats(v)}).entries(dat)}else{allColorGroups=d3.set();var tmp=d3.nest().key(function(d){return getX(d)}).key(function(d){return colorGroup(d)}).rollup(function(v){return calcStats(v,getX(v[0]))}).entries(dat);allColorGroups=allColorGroups.values();var xGroups=tmp.map(function(d){return d.key});var allGroups=[];for(var i=0;i<xGroups.length;i++){for(var j=0;j<allColorGroups.length;j++){allGroups.push(xGroups[i]+"_"+allColorGroups[j])}}allColorGroups=allGroups;formatted=[];tmp.forEach(function(d){d.values.forEach(function(e){e.key=d.key+"_"+e.key});formatted.push.apply(formatted,d.values)})}return formatted}function kernelDensityEstimator(kernel,X){return function(sample){return X.map(function(x){var y=d3.mean(sample,function(v){return kernel(x-v)});return{x:x,y:y}})}}function clampViolinKDE(kde,extent){if(extent[0]===extent[1])return kde;var clamped=kde.reduce(function(res,d){if(d.x>=extent[0]&&d.x<=extent[1])res.push(d);return res},[]);if(extent[0]<clamped[0].x)clamped.unshift({x:extent[0],y:clamped[0].y});if(extent[1]>clamped[clamped.length-1].x)clamped.push({x:extent[1],y:clamped[clamped.length-1].y});return clamped}function eKernel(scale){return function(u){return Math.abs(u/=scale)<=1?.75*(1-u*u)/scale:0}}function makeNotchBox(boxLeft,notchLeft,boxCenter,dat){var boxPoints;var y=centralTendency=="mean"?getMean(dat):getQ2(dat);if(notchBox){boxPoints=[{x:boxCenter,y:yScale(getQ1(dat))},{x:boxLeft,y:yScale(getQ1(dat))},{x:boxLeft,y:yScale(getNl(dat))},{x:notchLeft,y:yScale(y)},{x:boxLeft,y:yScale(getNu(dat))},{x:boxLeft,y:yScale(getQ3(dat))},{x:boxCenter,y:yScale(getQ3(dat))}]}else{boxPoints=[{x:boxCenter,y:yScale(getQ1(dat))},{x:boxLeft,y:yScale(getQ1(dat))},{x:boxLeft,y:yScale(y)},{x:boxLeft,y:yScale(y)},{x:boxLeft,y:yScale(y)},{x:boxLeft,y:yScale(getQ3(dat))},{x:boxCenter,y:yScale(getQ3(dat))}]}return boxPoints}function getAvailableColorGroups(x){if(!colorGroup)return x;var tmp=reformatDat.find(function(d){return d.key==x});return tmp.values.map(function(d){return d.key}).sort(d3.ascending)}function isOutlier(d){return whiskerDef=="iqr"&&d.isOutlier||whiskerDef=="stddev"&&d.isOutlierStdDev}var allColorGroups=d3.set();var yVScale=[],reformatDat,reformatDatFlat=[];var renderWatch=nv.utils.renderWatch(dispatch,duration);var availableWidth,availableHeight;function chart(selection){renderWatch.reset();selection.each(function(data){availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);yScale.domain(yDomain||d3.extent(data.map(function(d){return getY(d)}))).nice().range(yRange||[availableHeight,0]);if(typeof reformatDat==="undefined")reformatDat=prepData(data);xScale.rangeBands(xRange||[0,availableWidth],.1).domain(xDomain||colorGroup&&!squash?allColorGroups:reformatDat.map(function(d){return d.key}));var wrap=container.selectAll("g.nv-wrap").data([reformatDat]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap");wrap.watchTransition(renderWatch,"nv-wrap: wrap").attr("transform","translate("+margin.left+","+margin.top+")");var areaEnter,distroplots=wrap.selectAll(".nv-distroplot-x-group").data(function(d){return d});distroplots.each(function(d,i){d3.select(this).selectAll("line.nv-distroplot-middle").datum(d)});areaEnter=distroplots.enter().append("g").attr("class","nv-distroplot-x-group").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).style("fill",function(d,i){return getColor(d)||color(d,i)}).style("stroke",function(d,i){return getColor(d)||color(d,i)});distroplots.exit().remove();var rangeBand=function(){return xScale.rangeBand()};var areaWidth=function(){return d3.min([maxBoxWidth,rangeBand()*.9])};var areaCenter=function(){return areaWidth()/2};var areaLeft=function(){return areaCenter()-areaWidth()/2};var areaRight=function(){return areaCenter()+areaWidth()/2};var tickLeft=function(){return areaCenter()-areaWidth()/5};var tickRight=function(){return areaCenter()+areaWidth()/5};areaEnter.attr("transform",function(d){return"translate("+(xScale(d.key)+(rangeBand()-areaWidth())*.5)+", 0)"});distroplots.watchTransition(renderWatch,"nv-distroplot-x-group: distroplots").style("stroke-opacity",1).style("fill-opacity",.5).attr("transform",function(d){return"translate("+(xScale(d.key)+(rangeBand()-areaWidth())*.5)+", 0)"});yVScale.map(function(d){d.range([areaWidth()/2,0])});if(!plotType){showOnlyOutliers=false;if(!observationType)observationType="random"}areaEnter.each(function(d,i){var box=d3.select(this);[getWl,getWh].forEach(function(f){var key=f===getWl?"low":"high";box.append("line").style("opacity",function(){return!hideWhiskers?"0":"1"}).attr("class","nv-distroplot-whisker nv-distroplot-"+key);box.append("line").style("opacity",function(){return hideWhiskers?"0":"1"}).attr("class","nv-distroplot-tick nv-distroplot-"+key)})});[getWl,getWh].forEach(function(f){var key=f===getWl?"low":"high";var endpoint=f===getWl?getQ1:getQ3;distroplots.select("line.nv-distroplot-whisker.nv-distroplot-"+key).watchTransition(renderWatch,"nv-distroplot-x-group: distroplots").attr("x1",areaCenter()).attr("y1",function(d){return plotType!="violin"?yScale(f(d)):yScale(getQ2(d))}).attr("x2",areaCenter()).attr("y2",function(d){return plotType=="box"?yScale(endpoint(d)):yScale(getQ2(d))}).style("opacity",function(){return hideWhiskers?"0":"1"});distroplots.select("line.nv-distroplot-tick.nv-distroplot-"+key).watchTransition(renderWatch,"nv-distroplot-x-group: distroplots").attr("x1",function(d){return plotType!="violin"?tickLeft():areaCenter()}).attr("y1",function(d,i){return plotType!="violin"?yScale(f(d)):yScale(getQ2(d))}).attr("x2",function(d){return plotType!="violin"?tickRight():areaCenter()}).attr("y2",function(d,i){return plotType!="violin"?yScale(f(d)):yScale(getQ2(d))}).style("opacity",function(){return hideWhiskers?"0":"1"})});[getWl,getWh].forEach(function(f){var key=f===getWl?"low":"high";areaEnter.selectAll(".nv-distroplot-"+key).on("mouseover",function(d,i,j){d3.select(this.parentNode).selectAll("line.nv-distroplot-"+key).classed("hover",true);dispatch.elementMouseover({value:key=="low"?"Lower whisker":"Upper whisker",series:{key:f(d).toFixed(2),color:getColor(d)||color(d,j)},e:d3.event})}).on("mouseout",function(d,i,j){d3.select(this.parentNode).selectAll("line.nv-distroplot-"+key).classed("hover",false);dispatch.elementMouseout({value:key=="low"?"Lower whisker":"Upper whisker",series:{key:f(d).toFixed(2),color:getColor(d)||color(d,j)},e:d3.event})}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})})});areaEnter.each(function(d,i){var violin=d3.select(this);["left","right"].forEach(function(side){["line","area"].forEach(function(d){violin.append("path").attr("class","nv-distribution-"+d+" nv-distribution-"+side).attr("transform","rotate(90,0,0)   translate(0,"+(side=="left"?-areaWidth():0)+")"+(side=="left"?"":" scale(1,-1)"))})});areaEnter.selectAll(".nv-distribution-line").style("fill","none");areaEnter.selectAll(".nv-distribution-area").style("stroke","none").style("opacity",.7)});distroplots.each(function(d,i){var violin=d3.select(this);var objData=plotType=="box"?makeNotchBox(areaLeft(),tickLeft(),areaCenter(),d):d.values.kde;violin.selectAll("path").datum(objData);var tmpScale=yVScale[i];var interp=plotType=="box"?"linear":"basis";if(plotType=="box"||plotType=="violin"){["left","right"].forEach(function(side){distroplots.selectAll(".nv-distribution-line.nv-distribution-"+side).attr("d",d3.svg.line().x(function(e){return plotType=="box"?e.y:yScale(e.x)}).y(function(e){return plotType=="box"?e.x:tmpScale(e.y)}).interpolate(interp)).attr("transform","rotate(90,0,0)   translate(0,"+(side=="left"?-areaWidth():0)+")"+(side=="left"?"":" scale(1,-1)")).style("opacity",!plotType?"0":"1");distroplots.selectAll(".nv-distribution-area.nv-distribution-"+side).attr("d",d3.svg.area().x(function(e){return plotType=="box"?e.y:yScale(e.x)}).y(function(e){return plotType=="box"?e.x:tmpScale(e.y)}).y0(areaWidth()/2).interpolate(interp)).attr("transform","rotate(90,0,0)   translate(0,"+(side=="left"?-areaWidth():0)+")"+(side=="left"?"":" scale(1,-1)")).style("opacity",!plotType?"0":"1")})}else{distroplots.selectAll(".nv-distribution-area").watchTransition(renderWatch,"nv-distribution-area: distroplots").style("opacity",!plotType?"0":"1");distroplots.selectAll(".nv-distribution-line").watchTransition(renderWatch,"nv-distribution-line: distroplots").style("opacity",!plotType?"0":"1")}});distroplots.selectAll("path").on("mouseover",function(d,i,j){d=d3.select(this.parentNode).datum();d3.select(this).classed("hover",true);dispatch.elementMouseover({key:d.key,value:"Group "+d.key+" stats",series:[{key:"max",value:getMax(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"Q3",value:getQ3(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"Q2",value:getQ2(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"Q1",value:getQ1(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"min",value:getMin(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"mean",value:getMean(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"std. dev.",value:getDev(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"count",value:d.values.count,color:getColor(d)||color(d,j)},{key:"num. outliers",value:d.values.num_outlier,color:getColor(d)||color(d,j)}],data:d,index:i,e:d3.event})}).on("mouseout",function(d,i,j){d3.select(this).classed("hover",false);d=d3.select(this.parentNode).datum();dispatch.elementMouseout({key:d.key,value:"Group "+d.key+" stats",series:[{key:"max",value:getMax(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"Q3",value:getQ3(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"Q2",value:getQ2(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"Q1",value:getQ1(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"min",value:getMin(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"mean",value:getMean(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"std. dev.",value:getDev(d).toFixed(2),color:getColor(d)||color(d,j)},{key:"count",value:d.values.count,color:getColor(d)||color(d,j)},{key:"num. outliers",value:d.values.num_outlier,color:getColor(d)||color(d,j)}],data:d,index:i,e:d3.event})}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})});areaEnter.append("line").attr("class",function(d){return"nv-distroplot-middle"});distroplots.selectAll("line.nv-distroplot-middle").watchTransition(renderWatch,"nv-distroplot-x-group: distroplots line").attr("x1",notchBox?tickLeft:plotType!="violin"?areaLeft:tickLeft()).attr("y1",function(d,i,j){return centralTendency=="mean"?yScale(getMean(d)):yScale(getQ2(d))}).attr("x2",notchBox?tickRight:plotType!="violin"?areaRight:tickRight()).attr("y2",function(d,i){return centralTendency=="mean"?yScale(getMean(d)):yScale(getQ2(d))}).style("opacity",centralTendency?"1":"0");distroplots.selectAll(".nv-distroplot-middle").on("mouseover",function(d,i,j){if(d3.select(this).style("opacity")==0)return;var fillColor=d3.select(this.parentNode).style("fill");d3.select(this).classed("hover",true);dispatch.elementMouseover({value:centralTendency=="mean"?"Mean":"Median",series:{key:centralTendency=="mean"?getMean(d).toFixed(2):getQ2(d).toFixed(2),color:fillColor},e:d3.event})}).on("mouseout",function(d,i,j){if(d3.select(this).style("opacity")==0)return;d3.select(this).classed("hover",false);var fillColor=d3.select(this.parentNode).style("fill");dispatch.elementMouseout({value:centralTendency=="mean"?"Mean":"Median",series:{key:centralTendency=="mean"?getMean(d).toFixed(2):getQ2(d).toFixed(2),color:fillColor},e:d3.event})}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})});var obsWrap=distroplots.selectAll("g.nv-distroplot-observation").data(function(d){return getValsObj(d)},function(d){return d.object_constancy});var obsGroup=obsWrap.enter().append("g").attr("class","nv-distroplot-observation");obsGroup.append("circle").style({opacity:0});obsGroup.append("line").style("stroke-width",1).style({stroke:d3.rgb(85,85,85),opacity:0});obsWrap.exit().remove();obsWrap.attr("class",function(d){return"nv-distroplot-observation "+(isOutlier(d)&&plotType=="box"?"nv-distroplot-outlier":"nv-distroplot-non-outlier")});if(observationType=="line"){distroplots.selectAll("g.nv-distroplot-observation line").watchTransition(renderWatch,"nv-distrolot-x-group: nv-distoplot-observation").attr("x1",tickLeft()+areaWidth()/4).attr("x2",tickRight()-areaWidth()/4).attr("y1",function(d){return yScale(d.datum)}).attr("y2",function(d){return yScale(d.datum)})}else{distroplots.selectAll("g.nv-distroplot-observation circle").watchTransition(renderWatch,"nv-distroplot: nv-distroplot-observation").attr("cy",function(d){return yScale(d.datum)}).attr("r",pointSize);distroplots.selectAll("g.nv-distroplot-observation circle").watchTransition(renderWatch,"nv-distroplot: nv-distroplot-observation").attr("cx",function(d){return observationType=="swarm"?d.x+areaWidth()/2:observationType=="random"?areaWidth()/2+d.randX*areaWidth()/2:areaWidth()/2})}if(observationType!==false){if(!showOnlyOutliers){distroplots.selectAll(observationType=="line"?"line":"circle").watchTransition(renderWatch,"nv-distroplot: nv-distroplot-observation").style("opacity",1)}else{distroplots.selectAll(".nv-distroplot-outlier "+(observationType=="line"?"line":"circle")).watchTransition(renderWatch,"nv-distroplot: nv-distroplot-observation").style("opacity",1);distroplots.selectAll(".nv-distroplot-non-outlier "+(observationType=="line"?"line":"circle")).watchTransition(renderWatch,"nv-distroplot: nv-distroplot-observation").style("opacity",0)}}distroplots.selectAll(".nv-distroplot-observation"+(observationType=="line"?" circle":" line")).watchTransition(renderWatch,"nv-distroplot: nv-distoplot-observation").style("opacity",0);distroplots.selectAll(".nv-distroplot-observation").on("mouseover",function(d,i,j){var pt=d3.select(this);if(showOnlyOutliers&&plotType=="box"&&!isOutlier(d))return;var fillColor=d3.select(this.parentNode).style("fill");pt.classed("hover",true);dispatch.elementMouseover({value:plotType=="box"&&isOutlier(d)?"Outlier":"Observation",series:{key:d.datum.toFixed(2),color:fillColor},e:d3.event})}).on("mouseout",function(d,i,j){var pt=d3.select(this);var fillColor=d3.select(this.parentNode).style("fill");pt.classed("hover",false);dispatch.elementMouseout({value:plotType=="box"&&isOutlier(d)?"Outlier":"Observation",series:{key:d.datum.toFixed(2),color:fillColor},e:d3.event})}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})})});renderWatch.renderEnd("nv-distroplot-x-group immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},maxBoxWidth:{get:function(){return maxBoxWidth},set:function(_){maxBoxWidth=_}},x:{get:function(){return getX},set:function(_){getX=_}},y:{get:function(){return getY},set:function(_){getY=_}},plotType:{get:function(){return plotType},set:function(_){plotType=_}},observationType:{get:function(){return observationType},set:function(_){observationType=_}},whiskerDef:{get:function(){return whiskerDef},set:function(_){whiskerDef=_}},notchBox:{get:function(){return notchBox},set:function(_){notchBox=_}},hideWhiskers:{get:function(){return hideWhiskers},set:function(_){hideWhiskers=_}},colorGroup:{get:function(){return colorGroup},set:function(_){colorGroup=_}},centralTendency:{get:function(){return centralTendency},set:function(_){centralTendency=_}},bandwidth:{get:function(){return bandwidth},set:function(_){bandwidth=_}},clampViolin:{get:function(){return clampViolin},set:function(_){clampViolin=_}},resolution:{get:function(){return resolution},set:function(_){resolution=_}},xScale:{get:function(){return xScale},set:function(_){xScale=_}},yScale:{get:function(){return yScale},set:function(_){yScale=_}},showOnlyOutliers:{get:function(){return showOnlyOutliers},set:function(_){showOnlyOutliers=_}},jitter:{get:function(){return jitter},set:function(_){jitter=_}},squash:{get:function(){return squash},set:function(_){squash=_}},pointSize:{get:function(){return pointSize},set:function(_){pointSize=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},recalcData:{get:function(){reformatDat=prepData(container.datum())}},itemColor:{get:function(){return getColor},set:function(_){getColor=_}},id:{get:function(){return id},set:function(_){id=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}}});nv.utils.initOptions(chart);return chart};nv.models.distroPlotChart=function(){"use strict";var distroplot=nv.models.distroPlot(),xAxis=nv.models.axis(),yAxis=nv.models.axis();var margin={top:25,right:10,bottom:40,left:60},width=null,height=null,color=nv.utils.getColor(),showXAxis=true,showYAxis=true,rightAlignYAxis=false,staggerLabels=false,xLabel=false,yLabel=false,tooltip=nv.models.tooltip(),x,y,noData="No Data Available.",dispatch=d3.dispatch("stateChange","beforeUpdate","renderEnd"),duration=500;xAxis.orient("bottom").showMaxMin(false).tickFormat(function(d){return d});yAxis.orient(rightAlignYAxis?"right":"left").tickFormat(d3.format(",.1f"));tooltip.duration(0);var renderWatch=nv.utils.renderWatch(dispatch,duration);var colorGroup0,marginTop0=margin.top,x0,y0,resolution0,bandwidth0,clampViolin0;var dataCache;function dataHasChanged(d){if(arraysEqual(d,dataCache)){return false}else{dataCache=JSON.parse(JSON.stringify(d));return true}}function arraysEqual(arr1,arr2){if(arr1.length!==arr2.length)return false;for(var i=arr1.length;i--;){if("object_constancy"in arr1[i])delete arr1[i].object_constancy;if("object_constancy"in arr2[i])delete arr2[i].object_constancy;if(!objectEquals(arr1[i],arr2[i])){return false}}return true}function objectEquals(a,b){var aProps=Object.getOwnPropertyNames(a);var bProps=Object.getOwnPropertyNames(b);if(aProps.length!=bProps.length){return false}for(var i=0;i<aProps.length;i++){var propName=aProps[i];if(a[propName]!==b[propName]){return false}}return true}function chart(selection){renderWatch.reset();renderWatch.models(distroplot);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=(width||parseInt(container.style("width"))||960)-margin.left-margin.right;var availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom;if(typeof dataCache==="undefined"){dataCache=JSON.parse(JSON.stringify(data))}chart.update=function(){dispatch.beforeUpdate();var opts=distroplot.options();if(colorGroup0!==opts.colorGroup()||x0!==opts.x()||y0!==opts.y()||bandwidth0!==opts.bandwidth()||resolution0!==opts.resolution()||clampViolin0!==opts.clampViolin()||dataHasChanged(data)){distroplot.recalcData()}container.transition().duration(duration).call(chart)};chart.container=this;if(typeof d3.beeswarm!=="function"&&chart.options().observationType()=="swarm"){var xPos=margin.left+availableWidth/2;noData='Please include the library https://github.com/Kcnarf/d3-beeswarm to use "swarm".';nv.utils.noData(chart,container);return chart}else if(!data||!data.length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}x=distroplot.xScale();y=distroplot.yScale().clamp(true);var wrap=container.selectAll("g.nv-wrap.nv-distroPlot").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-distroPlot").append("g");var defsEnter=gEnter.append("defs");var g=wrap.select("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line");gEnter.append("g").attr("class","nv-distroWrap");gEnter.attr("transform","translate("+margin.left+","+margin.top+")");g.watchTransition(renderWatch,"nv-wrap: wrap").attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}distroplot.width(availableWidth).height(availableHeight);var distroWrap=g.select(".nv-distroWrap").datum(data);distroWrap.transition().call(distroplot);defsEnter.append("clipPath").attr("id","nv-x-label-clip-"+distroplot.id()).append("rect");g.select("#nv-x-label-clip-"+distroplot.id()+" rect").attr("width",x.rangeBand()*(staggerLabels?2:1)).attr("height",16).attr("x",-x.rangeBand()/(staggerLabels?1:2));if(showXAxis){xAxis.scale(x).ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");g.select(".nv-x.nv-axis").call(xAxis);var xTicks=g.select(".nv-x.nv-axis").selectAll("g");if(staggerLabels){xTicks.selectAll("text").attr("transform",function(d,i,j){return"translate(0,"+(j%2===0?"5":"17")+")"})}}if(showYAxis){yAxis.scale(y).ticks(Math.floor(availableHeight/36)).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").call(yAxis)}g.select(".nv-zeroLine line").attr("x1",0).attr("x2",availableWidth).attr("y1",y(0)).attr("y2",y(0));colorGroup0=distroplot.options().colorGroup();x0=distroplot.options().x();y0=distroplot.options().y();bandwidth0=distroplot.options().bandwidth();resolution0=distroplot.options().resolution();clampViolin0=distroplot.options().clampViolin()});renderWatch.renderEnd("nv-distroplot chart immediate");return chart}distroplot.dispatch.on("elementMouseover.tooltip",function(evt){tooltip.data(evt).hidden(false)});distroplot.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.data(evt).hidden(true)});distroplot.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.dispatch=dispatch;chart.distroplot=distroplot;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},staggerLabels:{get:function(){return staggerLabels},set:function(_){staggerLabels=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},tooltipContent:{get:function(){return tooltip},set:function(_){tooltip=_}},noData:{get:function(){return noData},set:function(_){noData=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);distroplot.duration(duration);xAxis.duration(duration);yAxis.duration(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);distroplot.color(color)}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(_?"right":"left")}},xLabel:{get:function(){return xLabel},set:function(_){xLabel=_;xAxis.axisLabel(xLabel)}},yLabel:{get:function(){return yLabel},set:function(_){yLabel=_;yAxis.axisLabel(yLabel)}}});nv.utils.inheritOptions(chart,distroplot);nv.utils.initOptions(chart);return chart};nv.models.focus=function(content){"use strict";var content=content||nv.models.line(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),brush=d3.svg.brush();var margin={top:10,right:0,bottom:30,left:0},color=nv.utils.defaultColor(),width=null,height=70,showXAxis=true,showYAxis=false,rightAlignYAxis=false,ticks=null,x,y,brushExtent=null,duration=250,dispatch=d3.dispatch("brush","onBrush","renderEnd"),syncBrushing=true;content.interactive(false);content.pointActive(function(d){return false});var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();renderWatch.models(content);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this);nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=height-margin.top-margin.bottom;chart.update=function(){if(duration===0){container.call(chart)}else{container.transition().duration(duration).call(chart)}};chart.container=this;x=content.xScale();y=content.yScale();var wrap=container.selectAll("g.nv-focus").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-focus").append("g");var g=wrap.select("g");wrap.attr("transform","translate("+margin.left+","+margin.top+")");gEnter.append("g").attr("class","nv-background").append("rect");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-contentWrap");gEnter.append("g").attr("class","nv-brushBackground");gEnter.append("g").attr("class","nv-x nv-brush");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}g.select(".nv-background rect").attr("width",availableWidth).attr("height",availableHeight);content.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));var contentWrap=g.select(".nv-contentWrap").datum(data.filter(function(d){return!d.disabled}));d3.transition(contentWrap).call(content);brush.x(x).on("brush",function(){onBrush(syncBrushing)});brush.on("brushend",function(){if(!syncBrushing){dispatch.onBrush(brush.empty()?x.domain():brush.extent())}});if(brushExtent)brush.extent(brushExtent);var brushBG=g.select(".nv-brushBackground").selectAll("g").data([brushExtent||brush.extent()]);var brushBGenter=brushBG.enter().append("g");brushBGenter.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",availableHeight);brushBGenter.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",availableHeight);var gBrush=g.select(".nv-x.nv-brush").call(brush);gBrush.selectAll("rect").attr("height",availableHeight);gBrush.selectAll(".resize").append("path").attr("d",resizePath);onBrush(true);g.select(".nv-background rect").attr("width",availableWidth).attr("height",availableHeight);if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");d3.transition(g.select(".nv-x.nv-axis")).call(xAxis)}if(showYAxis){yAxis.scale(y)._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0);d3.transition(g.select(".nv-y.nv-axis")).call(yAxis)}g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");function resizePath(d){var e=+(d=="e"),x=e?1:-1,y=availableHeight/3;return"M"+.5*x+","+y+"A6,6 0 0 "+e+" "+6.5*x+","+(y+6)+"V"+(2*y-6)+"A6,6 0 0 "+e+" "+.5*x+","+2*y+"Z"+"M"+2.5*x+","+(y+8)+"V"+(2*y-8)+"M"+4.5*x+","+(y+8)+"V"+(2*y-8)}function updateBrushBG(){if(!brush.empty())brush.extent(brushExtent);brushBG.data([brush.empty()?x.domain():brushExtent]).each(function(d,i){var leftWidth=x(d[0])-x.range()[0],rightWidth=availableWidth-x(d[1]);d3.select(this).select(".left").attr("width",leftWidth<0?0:leftWidth);d3.select(this).select(".right").attr("x",x(d[1])).attr("width",rightWidth<0?0:rightWidth)})}function onBrush(shouldDispatch){brushExtent=brush.empty()?null:brush.extent();var extent=brush.empty()?x.domain():brush.extent();dispatch.brush({extent:extent,brush:brush});updateBrushBG();if(shouldDispatch){dispatch.onBrush(extent)}}});renderWatch.renderEnd("focus immediate");return chart}chart.dispatch=dispatch;chart.content=content;chart.brush=brush;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},brushExtent:{get:function(){return brushExtent},set:function(_){brushExtent=_}},syncBrushing:{get:function(){return syncBrushing},set:function(_){syncBrushing=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);content.duration(duration);xAxis.duration(duration);yAxis.duration(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);content.color(color)}},interpolate:{get:function(){return content.interpolate()},set:function(_){content.interpolate(_)}},xTickFormat:{get:function(){return xAxis.tickFormat()},set:function(_){xAxis.tickFormat(_)}},yTickFormat:{get:function(){return yAxis.tickFormat()},set:function(_){yAxis.tickFormat(_)}},x:{get:function(){return content.x()},set:function(_){content.x(_)}},y:{get:function(){return content.y()},set:function(_){content.y(_)}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(rightAlignYAxis?"right":"left")}}});nv.utils.inheritOptions(chart,content);nv.utils.initOptions(chart);return chart};nv.models.forceDirectedGraph=function(){"use strict";var margin={top:2,right:0,bottom:2,left:0},width=400,height=32,container=null,dispatch=d3.dispatch("renderEnd"),color=nv.utils.getColor(["#000"]),tooltip=nv.models.tooltip(),noData=null,linkStrength=.1,friction=.9,linkDist=30,charge=-120,gravity=.1,theta=.8,alpha=.1,radius=5,nodeExtras=function(nodes){},linkExtras=function(links){},getX=d3.functor(0),getY=d3.functor(0);var renderWatch=nv.utils.renderWatch(dispatch);function chart(selection){renderWatch.reset();selection.each(function(data){container=d3.select(this);nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);container.attr("width",availableWidth).attr("height",availableHeight);if(!data||!data.links||!data.nodes){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}container.selectAll("*").remove();var nodeFieldSet=new Set;data.nodes.forEach(function(node){var keys=Object.keys(node);keys.forEach(function(key){nodeFieldSet.add(key)})});var force=d3.layout.force().nodes(data.nodes).links(data.links).size([availableWidth,availableHeight]).linkStrength(linkStrength).friction(friction).linkDistance(linkDist).charge(charge).gravity(gravity).theta(theta).alpha(alpha).start();var link=container.selectAll(".link").data(data.links).enter().append("line").attr("class","nv-force-link").style("stroke-width",function(d){return Math.sqrt(d.value)});var node=container.selectAll(".node").data(data.nodes).enter().append("g").attr("class","nv-force-node").call(force.drag);node.append("circle").attr("r",radius).style("fill",function(d){return color(d)}).on("mouseover",function(evt){container.select(".nv-series-"+evt.seriesIndex+" .nv-distx-"+evt.pointIndex).attr("y1",evt.py);container.select(".nv-series-"+evt.seriesIndex+" .nv-disty-"+evt.pointIndex).attr("x2",evt.px);var nodeColor=color(evt);evt.series=[];nodeFieldSet.forEach(function(field){evt.series.push({color:nodeColor,key:field,value:evt[field]})});tooltip.data(evt).hidden(false)}).on("mouseout",function(d){tooltip.hidden(true)});tooltip.headerFormatter(function(d){return"Node"});linkExtras(link);nodeExtras(node);force.on("tick",function(){link.attr("x1",function(d){return d.source.x}).attr("y1",function(d){return d.source.y}).attr("x2",function(d){return d.target.x}).attr("y2",function(d){return d.target.y});node.attr("transform",function(d){return"translate("+d.x+", "+d.y+")"})})});return chart}chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},linkStrength:{get:function(){return linkStrength},set:function(_){linkStrength=_}},friction:{get:function(){return friction},set:function(_){friction=_}},linkDist:{get:function(){return linkDist},set:function(_){linkDist=_}},charge:{get:function(){return charge},set:function(_){charge=_}},gravity:{get:function(){return gravity},set:function(_){gravity=_}},theta:{get:function(){return theta},set:function(_){theta=_}},alpha:{get:function(){return alpha},set:function(_){alpha=_}},radius:{get:function(){return radius},set:function(_){radius=_}},x:{get:function(){return getX},set:function(_){getX=d3.functor(_)}},y:{get:function(){return getY},set:function(_){getY=d3.functor(_)}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},noData:{get:function(){return noData},set:function(_){noData=_}},nodeExtras:{get:function(){return nodeExtras},set:function(_){nodeExtras=_}},linkExtras:{get:function(){return linkExtras},set:function(_){linkExtras=_}}});chart.dispatch=dispatch;chart.tooltip=tooltip;nv.utils.initOptions(chart);return chart};nv.models.furiousLegend=function(){"use strict";var margin={top:5,right:0,bottom:5,left:0},width=400,height=20,getKey=function(d){return d.key},keyFormatter=function(d){return d},color=nv.utils.getColor(),maxKeyLength=20,align=true,padding=28,rightAlign=true,updateState=true,radioButtonMode=false,expanded=false,dispatch=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),vers="classic";function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,container=d3.select(this);nv.utils.initSVG(container);var wrap=container.selectAll("g.nv-legend").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-legend").append("g");var g=wrap.select("g");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var series=g.selectAll(".nv-series").data(function(d){if(vers!="furious")return d;return d.filter(function(n){return expanded?true:!n.disengaged})});var seriesEnter=series.enter().append("g").attr("class","nv-series");var seriesShape;if(vers=="classic"){seriesEnter.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5);seriesShape=series.select("circle")}else if(vers=="furious"){seriesEnter.append("rect").style("stroke-width",2).attr("class","nv-legend-symbol").attr("rx",3).attr("ry",3);seriesShape=series.select("rect");seriesEnter.append("g").attr("class","nv-check-box").property("innerHTML",'<path d="M0.5,5 L22.5,5 L22.5,26.5 L0.5,26.5 L0.5,5 Z" class="nv-box"></path><path d="M5.5,12.8618467 L11.9185089,19.2803556 L31,0.198864511" class="nv-check"></path>').attr("transform","translate(-10,-8)scale(0.5)");var seriesCheckbox=series.select(".nv-check-box");seriesCheckbox.each(function(d,i){d3.select(this).selectAll("path").attr("stroke",setTextColor(d,i))})}seriesEnter.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");var seriesText=series.select("text.nv-legend-text");series.on("mouseover",function(d,i){dispatch.legendMouseover(d,i)}).on("mouseout",function(d,i){dispatch.legendMouseout(d,i)}).on("click",function(d,i){dispatch.legendClick(d,i);var data=series.data();if(updateState){if(vers=="classic"){if(radioButtonMode){data.forEach(function(series){series.disabled=true});d.disabled=false}else{d.disabled=!d.disabled;if(data.every(function(series){return series.disabled})){data.forEach(function(series){series.disabled=false})}}}else if(vers=="furious"){if(expanded){d.disengaged=!d.disengaged;d.userDisabled=d.userDisabled==undefined?!!d.disabled:d.userDisabled;d.disabled=d.disengaged||d.userDisabled}else if(!expanded){d.disabled=!d.disabled;d.userDisabled=d.disabled;var engaged=data.filter(function(d){return!d.disengaged});if(engaged.every(function(series){return series.userDisabled})){data.forEach(function(series){series.disabled=series.userDisabled=false})}}}dispatch.stateChange({disabled:data.map(function(d){return!!d.disabled}),disengaged:data.map(function(d){return!!d.disengaged})})}}).on("dblclick",function(d,i){if(vers=="furious"&&expanded)return;dispatch.legendDblclick(d,i);if(updateState){var data=series.data();data.forEach(function(series){series.disabled=true;if(vers=="furious")series.userDisabled=series.disabled});d.disabled=false;if(vers=="furious")d.userDisabled=d.disabled;dispatch.stateChange({disabled:data.map(function(d){return!!d.disabled})})}});series.classed("nv-disabled",function(d){return d.userDisabled});series.exit().remove();seriesText.attr("fill",setTextColor).text(function(d){return keyFormatter(getKey(d))});var versPadding;switch(vers){case"furious":versPadding=23;break;case"classic":versPadding=20}if(align){var seriesWidths=[];series.each(function(d,i){var legendText;if(keyFormatter(getKey(d))&&keyFormatter(getKey(d)).length>maxKeyLength){var trimmedKey=keyFormatter(getKey(d)).substring(0,maxKeyLength);legendText=d3.select(this).select("text").text(trimmedKey+"...");d3.select(this).append("svg:title").text(keyFormatter(getKey(d)))}else{legendText=d3.select(this).select("text")}var nodeTextLength;try{nodeTextLength=legendText.node().getComputedTextLength();if(nodeTextLength<=0)throw Error()}catch(e){nodeTextLength=nv.utils.calcApproxTextWidth(legendText)}seriesWidths.push(nodeTextLength+padding)});var seriesPerRow=0;var legendWidth=0;var columnWidths=[];while(legendWidth<availableWidth&&seriesPerRow<seriesWidths.length){columnWidths[seriesPerRow]=seriesWidths[seriesPerRow];legendWidth+=seriesWidths[seriesPerRow++]}if(seriesPerRow===0)seriesPerRow=1;while(legendWidth>availableWidth&&seriesPerRow>1){columnWidths=[];seriesPerRow--;for(var k=0;k<seriesWidths.length;k++){if(seriesWidths[k]>(columnWidths[k%seriesPerRow]||0))columnWidths[k%seriesPerRow]=seriesWidths[k]}legendWidth=columnWidths.reduce(function(prev,cur,index,array){return prev+cur})}var xPositions=[];for(var i=0,curX=0;i<seriesPerRow;i++){xPositions[i]=curX;curX+=columnWidths[i]}series.attr("transform",function(d,i){return"translate("+xPositions[i%seriesPerRow]+","+(5+Math.floor(i/seriesPerRow)*versPadding)+")"});if(rightAlign){g.attr("transform","translate("+(width-margin.right-legendWidth)+","+margin.top+")")}else{g.attr("transform","translate(0"+","+margin.top+")")}height=margin.top+margin.bottom+Math.ceil(seriesWidths.length/seriesPerRow)*versPadding}else{var ypos=5,newxpos=5,maxwidth=0,xpos;series.attr("transform",function(d,i){var length=d3.select(this).select("text").node().getComputedTextLength()+padding;xpos=newxpos;if(width<margin.left+margin.right+xpos+length){newxpos=xpos=5;ypos+=versPadding}newxpos+=length;if(newxpos>maxwidth)maxwidth=newxpos;return"translate("+xpos+","+ypos+")"});g.attr("transform","translate("+(width-margin.right-maxwidth)+","+margin.top+")");height=margin.top+margin.bottom+ypos+15}if(vers=="furious"){seriesShape.attr("width",function(d,i){return seriesText[0][i].getComputedTextLength()+27}).attr("height",18).attr("y",-9).attr("x",-15)}seriesShape.style("fill",setBGColor).style("stroke",function(d,i){return d.color||color(d,i)})});function setTextColor(d,i){if(vers!="furious")return"#000";if(expanded){return d.disengaged?color(d,i):"#fff"}else if(!expanded){return!!d.disabled?color(d,i):"#fff"}}function setBGColor(d,i){if(expanded&&vers=="furious"){return d.disengaged?"#fff":color(d,i)}else{return!!d.disabled?"#fff":color(d,i)}}return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},key:{get:function(){return getKey},set:function(_){getKey=_}},keyFormatter:{get:function(){return keyFormatter},set:function(_){keyFormatter=_}},align:{get:function(){return align},set:function(_){align=_}},rightAlign:{get:function(){return rightAlign},set:function(_){rightAlign=_}},maxKeyLength:{get:function(){return maxKeyLength},set:function(_){maxKeyLength=_}},padding:{get:function(){return padding},set:function(_){padding=_}},updateState:{get:function(){return updateState},set:function(_){updateState=_}},radioButtonMode:{get:function(){return radioButtonMode},set:function(_){radioButtonMode=_}},expanded:{get:function(){return expanded},set:function(_){expanded=_}},vers:{get:function(){return vers},set:function(_){vers=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});nv.utils.initOptions(chart);return chart};nv.models.heatMap=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,id=Math.floor(Math.random()*1e4),container,xScale=d3.scale.ordinal(),yScale=d3.scale.ordinal(),colorScale=false,getX=function(d){return d.x},getY=function(d){return d.y},getCellValue=function(d){return d.value},showCellValues=true,cellValueFormat=function(d){return typeof d==="number"?d.toFixed(0):d},cellAspectRatio=false,cellRadius=2,cellBorderWidth=4,normalize=false,highContrastText=true,xDomain,yDomain,xMetaColorScale=nv.utils.defaultColor(),yMetaColorScale=nv.utils.defaultColor(),missingDataColor="#bcbcbc",missingDataLabel="",metaOffset=5,xRange,yRange,xMeta,yMeta,colorRange,colorDomain,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),duration=250,xMetaHeight=function(d){return cellHeight/3},yMetaWidth=function(d){return cellWidth/3},showGrid=false;function cellTextColor(bgColor){if(highContrastText){var rgbColor=d3.rgb(bgColor);var r=rgbColor.r;var g=rgbColor.g;var b=rgbColor.b;var yiq=(r*299+g*587+b*114)/1e3;return yiq>=128?"#404040":"#EDEDED"}else{return"black"}}function getHeatmapValues(data,axis){var vals={};data.forEach(function(cell,i){if(axis=="row"){if(!(getIY(cell)in vals))vals[getIY(cell)]=[];vals[getIY(cell)].push(getCellValue(cell))}else if(axis=="col"){if(!(getIX(cell)in vals))vals[getIX(cell)]=[];vals[getIX(cell)].push(getCellValue(cell))}else if(axis==null){if(!(0 in vals))vals[0]=[];vals[0].push(getCellValue(cell))}});return vals}function mad(dat){var med=d3.median(dat);var vals=dat.map(function(d){return Math.abs(d-med)});return d3.median(vals)}function cellColor(d){var colorVal=normalize?getNorm(d):getCellValue(d);return cellsAreNumeric()&&!isNaN(colorVal)||typeof colorVal!=="undefined"?colorScale(colorVal):missingDataColor}function getColorDomain(){if(cellsAreNumeric()){return normalize?d3.extent(prepedData,function(d){return getNorm(d)}):d3.extent(uniqueColor)}else if(!cellsAreNumeric()){return uniqueColor}}function cellsAreNumeric(){return typeof uniqueColor[0]==="number"}function normalizeData(dat){var normTypes=["centerRow","robustCenterRow","centerScaleRow","robustCenterScaleRow","centerColumn","robustCenterColumn","centerScaleColumn","robustCenterScaleColumn","centerAll","robustCenterAll","centerScaleAll","robustCenterScaleAll"];if(normTypes.indexOf(normalize)!=-1){var xVals=Object.keys(uniqueX),yVals=Object.keys(uniqueY);var scale=normalize.includes("Scale")?true:false,agg=normalize.includes("robust")?"median":"mean",axis=normalize.includes("Row")?"row":normalize.includes("Column")?"col":null,vals=getHeatmapValues(dat,axis);var stat={};var dev={};for(var key in vals){stat[key]=agg=="mean"?d3.mean(vals[key]):d3.median(vals[key]);if(scale)dev[key]=agg=="mean"?d3.deviation(vals[key]):mad(vals[key])}dat.forEach(function(cell,i){if(cellsAreNumeric()){if(axis=="row"){var key=getIY(cell)}else if(axis=="col"){var key=getIX(cell)}else if(axis==null){var key=0}var normVal=getCellValue(cell)-stat[key];if(scale){cell._cellPos.norm=normVal/dev[key]}else{cell._cellPos.norm=normVal}}else{cell._cellPos.norm=getCellValue(cell)}})}else{normalize=false}return dat}function prepData(data){uniqueX={},uniqueY={},uniqueColor=[],uniqueXMeta=[],uniqueYMeta=[],uniqueCells=[];var warnings=[];var sortedCells={};var ix=0,iy=0;var combo,idx=0;data.forEach(function(cell){var valX=getX(cell),valY=getY(cell),valColor=getCellValue(cell);if(!(valX in uniqueX)){uniqueX[valX]=ix;ix++;sortedCells[valX]={};if(typeof xMeta==="function")uniqueXMeta.push(xMeta(cell))}if(!(valY in uniqueY)){uniqueY[valY]=iy;iy++;sortedCells[valX][valY]={};if(typeof yMeta==="function")uniqueYMeta.push(yMeta(cell))}if(uniqueColor.indexOf(valColor)==-1)uniqueColor.push(valColor);cell._cellPos={idx:idx,ix:uniqueX[valX],iy:uniqueY[valY]};idx++;combo=[valX,valY];if(!isArrayInArray(uniqueCells,combo)){uniqueCells.push(combo);sortedCells[valX][valY]=cell}else if(warnings.indexOf(valX+valY)==-1){warnings.push(valX+valY);console.warn("The row/column position "+valX+"/"+valY+" has multiple values; ensure each cell has only a single value.")}});uniqueColor=uniqueColor.sort();var reformatData=[];Object.keys(uniqueY).forEach(function(j){Object.keys(uniqueX).forEach(function(i){var cellVal=sortedCells[i][j];if(cellVal){reformatData.push(cellVal)}else{var cellPos={idx:idx,ix:uniqueX[i],iy:uniqueY[j]};idx++;reformatData.push({_cellPos:cellPos})}})});return normalize?normalizeData(reformatData):reformatData}function isArrayInArray(arr,item){var item_as_string=JSON.stringify(item);var contains=arr.some(function(ele){return JSON.stringify(ele)===item_as_string});return contains}function removeAllHoverClasses(){d3.selectAll(".cell-hover").classed("cell-hover",false);d3.selectAll(".no-hover").classed("no-hover",false);d3.selectAll(".row-hover").classed("row-hover",false);d3.selectAll(".column-hover").classed("column-hover",false)}var cellValueLabel=function(d){var val=!normalize?cellValueFormat(getCellValue(d)):cellValueFormat(getNorm(d));return cellsAreNumeric()&&!isNaN(val)||typeof val!=="undefined"?val:missingDataLabel};function sortObjByVals(obj){return Object.keys(obj).sort(function(a,b){return obj[a]-obj[b]})}function getKeyByValue(object,value){return Object.keys(object).filter(function(key){return object[key]===value})[0]}var prepedData,cellHeight,cellWidth;var uniqueX={},uniqueY={},uniqueColor=[];var uniqueXMeta=[],uniqueYMeta=[],uniqueCells=[];var renderWatch=nv.utils.renderWatch(dispatch,duration);var RdYlBu=["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"];var getCellPos=function(d){return d._cellPos};var getIX=function(d){return getCellPos(d).ix};var getIY=function(d){return getCellPos(d).iy};var getNorm=function(d){return getCellPos(d).norm};var getIdx=function(d){return getCellPos(d).idx};function chart(selection){renderWatch.reset();selection.each(function(data){prepedData=prepData(data);var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;cellWidth=availableWidth/Object.keys(uniqueX).length;cellHeight=cellAspectRatio?cellWidth/cellAspectRatio:availableHeight/Object.keys(uniqueY).length;if(cellAspectRatio)availableHeight=cellHeight*Object.keys(uniqueY).length-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);xScale.domain(xDomain||sortObjByVals(uniqueX)).rangeBands(xRange||[0,availableWidth-cellBorderWidth/2]);yScale.domain(yDomain||sortObjByVals(uniqueY)).rangeBands(yRange||[0,availableHeight-cellBorderWidth/2]);colorScale=cellsAreNumeric()?d3.scale.quantize():d3.scale.ordinal();colorScale.domain(colorDomain||getColorDomain()).range(colorRange||RdYlBu);var wrap=container.selectAll("g.nv-heatMapWrap").data([prepedData]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-heatMapWrap");wrapEnter.append("g").attr("class","cellWrap");wrap.watchTransition(renderWatch,"nv-wrap: heatMapWrap").attr("transform","translate("+margin.left+","+margin.top+")");var gridWrap=wrapEnter.append("g").attr("class","cellGrid").style("opacity",1e-6);var gridLinesV=wrap.select(".cellGrid").selectAll(".gridLines.verticalGrid").data(Object.values(uniqueX).concat([Object.values(uniqueX).length]));gridLinesV.enter().append("line").attr("class","gridLines verticalGrid");gridLinesV.exit().remove();var gridLinesH=wrap.select(".cellGrid").selectAll(".gridLines.horizontalGrid").data(Object.values(uniqueY).concat([Object.values(uniqueY).length]));gridLinesH.enter().append("line").attr("class","gridLines horizontalGrid");gridLinesH.exit().remove();var cellWrap=wrap.select(".cellWrap").selectAll(".nv-cell").data(function(d){return d},function(e){return getIdx(e)});var xMetaWrap=wrapEnter.append("g").attr("class","xMetaWrap").attr("transform",function(){return"translate(0,"+(-xMetaHeight()-cellBorderWidth-metaOffset)+")"});var xMetas=wrap.select(".xMetaWrap").selectAll(".x-meta").data(uniqueXMeta);var xMetaEnter=xMetas.enter().append("rect").attr("class","x-meta meta").attr("width",cellWidth-cellBorderWidth).attr("height",xMetaHeight()).attr("transform","translate(0,0)").attr("fill",function(d){return xMetaColorScale(d)});var yMetaWrap=wrapEnter.append("g").attr("class","yMetaWrap").attr("transform",function(d,i){return"translate("+(-yMetaWidth()-cellBorderWidth-metaOffset)+",0)"});var yMetas=wrap.select(".yMetaWrap").selectAll(".y-meta").data(uniqueYMeta);var yMetaEnter=yMetas.enter().append("rect").attr("class","y-meta meta").attr("width",yMetaWidth()).attr("height",cellHeight-cellBorderWidth).attr("transform",function(d,i){return"translate(0,0)"}).attr("fill",function(d,i){return yMetaColorScale(d)});xMetas.exit().remove();yMetas.exit().remove();var cellsEnter=cellWrap.enter().append("g").style("opacity",1e-6).attr("transform",function(d){return"translate(0,"+getIY(d)*cellHeight+")"}).attr("data-row",function(d){return getIY(d)}).attr("data-column",function(d){return getIX(d)});cellsEnter.append("rect");cellsEnter.append("text").attr("text-anchor","middle").attr("dy",4).attr("class","cell-text");cellWrap.selectAll("rect").watchTransition(renderWatch,"heatMap: rect").attr("width",cellWidth-cellBorderWidth).attr("height",cellHeight-cellBorderWidth).attr("rx",cellRadius).attr("ry",cellRadius).style("stroke",function(d){return cellColor(d)});cellWrap.attr("class",function(d){return isNaN(getCellValue(d))?"nv-cell cell-missing":"nv-cell"}).watchTransition(renderWatch,"heatMap: cells").style({opacity:1,fill:function(d){return cellColor(d)}}).attr("transform",function(d){return"translate("+getIX(d)*cellWidth+","+getIY(d)*cellHeight+")"}).attr("class",function(d){return isNaN(getCellValue(d))?"nv-cell cell-missing":"nv-cell"});cellWrap.exit().remove();cellWrap.selectAll("text").watchTransition(renderWatch,"heatMap: cells text").text(function(d){return cellValueLabel(d)}).attr("x",function(d){return(cellWidth-cellBorderWidth)/2}).attr("y",function(d){return(cellHeight-cellBorderWidth)/2}).style("fill",function(d){return cellTextColor(cellColor(d))}).style("opacity",function(){return showCellValues?1:0});wrap.selectAll(".verticalGrid").watchTransition(renderWatch,"heatMap: gridLines").attr("y1",0).attr("y2",availableHeight-cellBorderWidth).attr("x1",function(d){return d*cellWidth-cellBorderWidth/2}).attr("x2",function(d){return d*cellWidth-cellBorderWidth/2});var numHLines=Object.keys(uniqueY).length;wrap.selectAll(".horizontalGrid").watchTransition(renderWatch,"heatMap: gridLines").attr("x1",function(d){return d==0||d==numHLines?-cellBorderWidth:0}).attr("x2",function(d){return d==0||d==numHLines?availableWidth:availableWidth-cellBorderWidth}).attr("y1",function(d){return d*cellHeight-cellBorderWidth/2}).attr("y2",function(d){return d*cellHeight-cellBorderWidth/2});wrap.select(".cellGrid").watchTransition(renderWatch,"heatMap: gridLines").style({"stroke-width":cellBorderWidth,opacity:function(){return showGrid?1:1e-6}});var xMetaRect=wrap.selectAll(".x-meta");var yMetaRect=wrap.selectAll(".y-meta");var allMetaRect=wrap.selectAll(".meta");xMetas.watchTransition(renderWatch,"heatMap: xMetaRect").attr("width",cellWidth-cellBorderWidth).attr("height",xMetaHeight()).attr("transform",function(d,i){return"translate("+i*cellWidth+",0)"});yMetas.watchTransition(renderWatch,"heatMap: yMetaRect").attr("width",yMetaWidth()).attr("height",cellHeight-cellBorderWidth).attr("transform",function(d,i){return"translate(0,"+i*cellHeight+")"});wrap.select(".xMetaWrap").watchTransition(renderWatch,"heatMap: xMetaWrap").attr("transform",function(d,i){return"translate(0,"+(-xMetaHeight()-cellBorderWidth-metaOffset)+")"}).style("opacity",function(){return xMeta!==false?1:0});wrap.select(".yMetaWrap").watchTransition(renderWatch,"heatMap: yMetaWrap").attr("transform",function(d,i){return"translate("+(-yMetaWidth()-cellBorderWidth-metaOffset)+",0)"}).style("opacity",function(){return yMeta!==false?1:0});cellWrap.on("mouseover",function(d,i){var idx=getIdx(d);var ix=getIX(d);var iy=getIY(d);d3.selectAll(".nv-cell").each(function(e){if(idx==getIdx(e)){d3.select(this).classed("cell-hover",true);d3.select(this).classed("no-hover",false)}else{d3.select(this).classed("no-hover",true);d3.select(this).classed("cell-hover",false)}if(ix==getIX(e)){d3.select(this).classed("no-hover",false);d3.select(this).classed("column-hover",true)}if(iy==getIY(e)){d3.select(this).classed("no-hover",false);d3.select(this).classed("row-hover",true)}});d3.selectAll(".x-meta").each(function(e,j){if(j==ix){d3.select(this).classed("cell-hover",true);d3.select(this).classed("no-hover",false)}else{d3.select(this).classed("no-hover",true);d3.select(this).classed("cell-hover",false)}});d3.selectAll(".y-meta").each(function(e,j){if(j==iy){d3.select(this).classed("cell-hover",true);d3.select(this).classed("no-hover",false)}else{d3.select(this).classed("no-hover",true);d3.select(this).classed("cell-hover",false)}});dispatch.elementMouseover({value:getKeyByValue(uniqueX,ix)+" & "+getKeyByValue(uniqueY,iy),series:{value:cellValueLabel(d),color:d3.select(this).select("rect").style("fill")},e:d3.event})}).on("mouseout",function(d,i){var bBox=d3.select(this).select("rect").node().getBBox();var coordinates=d3.mouse(d3.select(".nv-heatMap").node());var x=coordinates[0];var y=coordinates[1];if(x+cellBorderWidth>=availableWidth||y+cellBorderWidth>=availableHeight||x<0||y<0){removeAllHoverClasses();dispatch.elementMouseout({e:d3.event})}}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})});allMetaRect.on("mouseover",function(d,i){var isColMeta=d3.select(this).attr("class").indexOf("x-meta")!=-1?true:false;d3.selectAll(".nv-cell").each(function(e){if(isColMeta&&i==getIX(e)){d3.select(this).classed("column-hover",true);d3.select(this).classed("no-hover",false)}else if(!isColMeta&&i-uniqueXMeta.length==getIY(e)){d3.select(this).classed("row-hover",true);d3.select(this).classed("no-hover",false)}else{d3.select(this).classed("no-hover",true);d3.select(this).classed("column-hover",false);d3.select(this).classed("row-hover",false)}d3.select(this).classed("cell-hover",false)});d3.selectAll(".meta").classed("no-hover",true);d3.select(this).classed("cell-hover",true);d3.select(this).classed("no-hover",false);dispatch.elementMouseover({value:isColMeta?"Column meta":"Row meta",series:{value:d,color:d3.select(this).style("fill")}})}).on("mouseout",function(d,i){var isColMeta=d3.select(this).attr("class").indexOf("x-meta")!=-1?true:false;var bBox=d3.select(this).node().getBBox();var coordinates=d3.mouse(d3.select(isColMeta?".xMetaWrap":".yMetaWrap").node());var x=coordinates[0];var y=coordinates[1];if(y<0||x<0||isColMeta&&x+cellBorderWidth>=availableWidth||!isColMeta&&y+cellBorderWidth>=availableHeight){removeAllHoverClasses();dispatch.elementMouseout({e:d3.event})}}).on("mousemove",function(d,i){dispatch.elementMousemove({e:d3.event})})});renderWatch.renderEnd("heatMap immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showCellValues:{get:function(){return showCellValues},set:function(_){showCellValues=_}},x:{get:function(){return getX},set:function(_){getX=_}},y:{get:function(){return getY},set:function(_){getY=_}},cellValue:{get:function(){return getCellValue},set:function(_){getCellValue=_}},missingDataColor:{get:function(){return missingDataColor},set:function(_){missingDataColor=_}},missingDataLabel:{get:function(){return missingDataLabel},set:function(_){missingDataLabel=_}},xScale:{get:function(){return xScale},set:function(_){xScale=_}},yScale:{get:function(){return yScale},set:function(_){yScale=_}},colorScale:{get:function(){return colorScale},set:function(_){colorScale=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},colorRange:{get:function(){return colorRange},set:function(_){colorRange=_}},colorDomain:{get:function(){return colorDomain},set:function(_){colorDomain=_}},xMeta:{get:function(){return xMeta},set:function(_){xMeta=_}},yMeta:{get:function(){return yMeta},set:function(_){yMeta=_}},xMetaColorScale:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},yMetaColorScale:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},cellAspectRatio:{get:function(){return cellAspectRatio},set:function(_){cellAspectRatio=_}},cellRadius:{get:function(){return cellRadius},set:function(_){cellRadius=_}},cellHeight:{get:function(){return cellHeight}},cellWidth:{get:function(){return cellWidth}},normalize:{get:function(){return normalize},set:function(_){normalize=_}},cellBorderWidth:{get:function(){return cellBorderWidth},set:function(_){cellBorderWidth=_}},highContrastText:{get:function(){return highContrastText},set:function(_){highContrastText=_}},cellValueFormat:{get:function(){return cellValueFormat},set:function(_){cellValueFormat=_}},id:{get:function(){return id},set:function(_){id=_}},metaOffset:{get:function(){return metaOffset},set:function(_){metaOffset=_}},xMetaHeight:{get:function(){return xMetaHeight},set:function(_){xMetaHeight=_}},yMetaWidth:{get:function(){return yMetaWidth},set:function(_){yMetaWidth=_}},showGrid:{get:function(){return showGrid},set:function(_){showGrid=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}}});nv.utils.initOptions(chart);return chart};nv.models.heatMapChart=function(){"use strict";var heatMap=nv.models.heatMap(),legend=nv.models.legend(),legendRowMeta=nv.models.legend(),legendColumnMeta=nv.models.legend(),tooltip=nv.models.tooltip(),xAxis=nv.models.axis(),yAxis=nv.models.axis();var margin={top:20,right:10,bottom:50,left:60},marginTop=null,width=null,height=null,color=nv.utils.getColor(),showLegend=true,staggerLabels=false,showXAxis=true,showYAxis=true,alignYAxis="left",alignXAxis="top",rotateLabels=0,title=false,x,y,noData=null,dispatch=d3.dispatch("beforeUpdate","renderEnd"),duration=250;xAxis.orient(alignXAxis).showMaxMin(false).tickFormat(function(d){return d});yAxis.orient(alignYAxis).showMaxMin(false).tickFormat(function(d){return d});tooltip.duration(0).headerEnabled(true).keyFormatter(function(d,i){return xAxis.tickFormat()(d,i)});function quantizeLegendValues(){var e=heatMap.colorScale(),legendVals;if(typeof e.domain()[0]==="string"){legendVals=e.domain()}else{legendVals=e.range().map(function(color){var d=e.invertExtent(color);if(d[0]===null)d[0]=e.domain()[0];if(d[1]===null)d[1]=e.domain()[1];return d})}return legendVals}function hasRowMeta(){return typeof heatMap.yMeta()==="function"}function hasColumnMeta(){return typeof heatMap.xMeta()==="function"}var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();renderWatch.models(heatMap);renderWatch.models(xAxis);renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){dispatch.beforeUpdate();container.transition().duration(duration).call(chart)};chart.container=this;if(!data||!data.length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}x=heatMap.xScale();y=heatMap.yScale();var wrap=container.selectAll("g.nv-wrap").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-heatMap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");g.attr("transform","translate("+margin.left+","+margin.top+")");heatMap.width(availableWidth).height(availableHeight);var heatMapWrap=g.select(".nv-heatMap").datum(data.filter(function(d){return!d.disabled}));heatMapWrap.transition().call(heatMap);if(heatMap.cellAspectRatio()){availableHeight=heatMap.cellHeight()*y.domain().length;heatMap.height(availableHeight)}xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);var axisX=g.select(".nv-x.nv-axis");axisX.call(xAxis).watchTransition(renderWatch,"heatMap: axisX").selectAll(".tick").style("opacity",function(){return showXAxis?1:0});var xTicks=axisX.selectAll("g");xTicks.selectAll(".tick text").attr("transform",function(d,i,j){var rot=rotateLabels!=0?rotateLabels:"0";var stagger=staggerLabels?j%2==0?"5":"17":"0";return"translate(0, "+stagger+") rotate("+rot+" 0,0)"}).style("text-anchor",rotateLabels>0?"start":rotateLabels<0?"end":"middle");var yPos=-5;if(hasColumnMeta()){axisX.selectAll("text").style("text-anchor","middle");yPos=-heatMap.xMetaHeight()()/2-heatMap.metaOffset()+3}if(alignXAxis=="bottom"){axisX.watchTransition(renderWatch,"heatMap: axisX").attr("transform","translate(0,"+(availableHeight-yPos)+")");if(heatMap.xMeta()!==false){var pos=availableHeight+heatMap.metaOffset()+heatMap.cellBorderWidth();g.select(".xMetaWrap").watchTransition(renderWatch,"heatMap: xMetaWrap").attr("transform",function(d,i){return"translate(0,"+pos+")"})}}else{axisX.watchTransition(renderWatch,"heatMap: axisX").attr("transform","translate(0,"+yPos+")")}yAxis.scale(y)._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0);var axisY=g.select(".nv-y.nv-axis");axisY.call(yAxis).watchTransition(renderWatch,"heatMap: axisY").selectAll(".tick").style("opacity",function(){return showYAxis?1:0});var xPos=-5;if(hasRowMeta()){axisY.selectAll("text").style("text-anchor","middle");xPos=-heatMap.yMetaWidth()()/2-heatMap.metaOffset()}if(alignYAxis=="right"){axisY.attr("transform","translate("+(availableWidth-xPos)+",0)");if(heatMap.yMeta()!==false){var pos=availableWidth+heatMap.metaOffset()+heatMap.cellBorderWidth();g.select(".yMetaWrap").watchTransition(renderWatch,"heatMap: yMetaWrap").attr("transform",function(d,i){return"translate("+pos+",0)"})}}else{axisY.attr("transform","translate("+xPos+",0)")}var legendWrap=g.select(".nv-legendWrap");legend.width(availableWidth).color(heatMap.colorScale().range());var legendVal=quantizeLegendValues().map(function(d){if(Array.isArray(d)){return{key:d[0].toFixed(1)+" - "+d[1].toFixed(1)}}else{return{key:d}}});legendWrap.datum(legendVal).call(legend).attr("transform","translate(0,"+(alignXAxis=="top"?availableHeight:-30)+")");legendWrap.watchTransition(renderWatch,"heatMap: nv-legendWrap").style("opacity",function(){return showLegend?1:0})});d3.selectAll(".nv-axis").selectAll("line").style("stroke-opacity",0);d3.select(".nv-y").select("path.domain").remove();renderWatch.renderEnd("heatMap chart immediate");return chart}heatMap.dispatch.on("elementMouseover.tooltip",function(evt){tooltip.data(evt).hidden(false)});heatMap.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});heatMap.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.dispatch=dispatch;chart.heatMap=heatMap;chart.legend=legend;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},noData:{get:function(){return noData},set:function(_){noData=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},staggerLabels:{get:function(){return staggerLabels},set:function(_){staggerLabels=_}},rotateLabels:{get:function(){return rotateLabels},set:function(_){rotateLabels=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);heatMap.duration(duration);xAxis.duration(duration);yAxis.duration(duration)}},alignYAxis:{get:function(){return alignYAxis},set:function(_){alignYAxis=_;yAxis.orient(_)}},alignXAxis:{get:function(){return alignXAxis},set:function(_){alignXAxis=_;xAxis.orient(_)}}});nv.utils.inheritOptions(chart,heatMap);nv.utils.initOptions(chart);return chart};nv.models.historicalBar=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=null,height=null,id=Math.floor(Math.random()*1e4),container=null,x=d3.scale.linear(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},forceX=[],forceY=[0],padData=false,clipEdge=true,color=nv.utils.defaultColor(),xDomain,yDomain,xRange,yRange,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),interactive=true;var renderWatch=nv.utils.renderWatch(dispatch,0);function chart(selection){selection.each(function(data){renderWatch.reset();container=d3.select(this);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);nv.utils.initSVG(container);x.domain(xDomain||d3.extent(data[0].values.map(getX).concat(forceX)));if(padData)x.range(xRange||[availableWidth*.5/data[0].values.length,availableWidth*(data[0].values.length-.5)/data[0].values.length]);else x.range(xRange||[0,availableWidth]);y.domain(yDomain||d3.extent(data[0].values.map(getY).concat(forceY))).range(yRange||[availableHeight,0]);if(x.domain()[0]===x.domain()[1])x.domain()[0]?x.domain([x.domain()[0]-x.domain()[0]*.01,x.domain()[1]+x.domain()[1]*.01]):x.domain([-1,1]);if(y.domain()[0]===y.domain()[1])y.domain()[0]?y.domain([y.domain()[0]+y.domain()[0]*.01,y.domain()[1]-y.domain()[1]*.01]):y.domain([-1,1]);var wrap=container.selectAll("g.nv-wrap.nv-historicalBar-"+id).data([data[0].values]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+id);var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-bars");wrap.attr("transform","translate("+margin.left+","+margin.top+")");container.on("click",function(d,i){dispatch.chartClick({data:d,index:i,pos:d3.event,id:id})});defsEnter.append("clipPath").attr("id","nv-chart-clip-path-"+id).append("rect");wrap.select("#nv-chart-clip-path-"+id+" rect").attr("width",availableWidth).attr("height",availableHeight);g.attr("clip-path",clipEdge?"url(#nv-chart-clip-path-"+id+")":"");var bars=wrap.select(".nv-bars").selectAll(".nv-bar").data(function(d){return d},function(d,i){return getX(d,i)});bars.exit().remove();bars.enter().append("rect").attr("x",0).attr("y",function(d,i){return nv.utils.NaNtoZero(y(Math.max(0,getY(d,i))))}).attr("height",function(d,i){return nv.utils.NaNtoZero(Math.abs(y(getY(d,i))-y(0)))}).attr("transform",function(d,i){return"translate("+(x(getX(d,i))-availableWidth/data[0].values.length*.45)+",0)"}).on("mouseover",function(d,i){if(!interactive)return;d3.select(this).classed("hover",true);dispatch.elementMouseover({data:d,index:i,color:d3.select(this).style("fill")})}).on("mouseout",function(d,i){if(!interactive)return;d3.select(this).classed("hover",false);dispatch.elementMouseout({data:d,index:i,color:d3.select(this).style("fill")})}).on("mousemove",function(d,i){if(!interactive)return;dispatch.elementMousemove({data:d,index:i,color:d3.select(this).style("fill")})}).on("click",function(d,i){if(!interactive)return;var element=this;dispatch.elementClick({data:d,index:i,color:d3.select(this).style("fill"),event:d3.event,element:element});d3.event.stopPropagation()}).on("dblclick",function(d,i){if(!interactive)return;dispatch.elementDblClick({data:d,index:i,color:d3.select(this).style("fill")});d3.event.stopPropagation()});bars.attr("fill",function(d,i){return color(d,i)}).attr("class",function(d,i,j){return(getY(d,i)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+j+"-"+i}).watchTransition(renderWatch,"bars").attr("transform",function(d,i){return"translate("+(x(getX(d,i))-availableWidth/data[0].values.length*.45)+",0)"}).attr("width",availableWidth/data[0].values.length*.9);bars.watchTransition(renderWatch,"bars").attr("y",function(d,i){var rval=getY(d,i)<0?y(0):y(0)-y(getY(d,i))<1?y(0)-1:y(getY(d,i));return nv.utils.NaNtoZero(rval)}).attr("height",function(d,i){return nv.utils.NaNtoZero(Math.max(Math.abs(y(getY(d,i))-y(0)),1))})});renderWatch.renderEnd("historicalBar immediate");return chart}chart.highlightPoint=function(pointIndex,isHoverOver){container.select(".nv-bars .nv-bar-0-"+pointIndex).classed("hover",isHoverOver)};chart.clearHighlights=function(){container.select(".nv-bars .nv-bar.hover").classed("hover",false)};chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},forceX:{get:function(){return forceX},set:function(_){forceX=_}},forceY:{get:function(){return forceY},set:function(_){forceY=_}},padData:{get:function(){return padData},set:function(_){padData=_}},x:{get:function(){return getX},set:function(_){getX=_}},y:{get:function(){return getY},set:function(_){getY=_}},xScale:{get:function(){return x},set:function(_){x=_}},yScale:{get:function(){return y},set:function(_){y=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},clipEdge:{get:function(){return clipEdge},set:function(_){clipEdge=_}},id:{get:function(){return id},set:function(_){id=_}},interactive:{get:function(){return interactive},set:function(_){interactive=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});nv.utils.initOptions(chart);return chart};nv.models.historicalBarChart=function(bar_model){"use strict";var bars=bar_model||nv.models.historicalBar(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),interactiveLayer=nv.interactiveGuideline(),tooltip=nv.models.tooltip();var margin={top:30,right:90,bottom:50,left:90},marginTop=null,color=nv.utils.defaultColor(),width=null,height=null,showLegend=false,showXAxis=true,showYAxis=true,rightAlignYAxis=false,useInteractiveGuideline=false,x,y,state={},defaultState=null,noData=null,dispatch=d3.dispatch("tooltipHide","stateChange","changeState","renderEnd"),transitionDuration=250;xAxis.orient("bottom").tickPadding(7);yAxis.orient(rightAlignYAxis?"right":"left");tooltip.duration(0).headerEnabled(false).valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});var renderWatch=nv.utils.renderWatch(dispatch,0);function chart(selection){selection.each(function(data){renderWatch.reset();renderWatch.models(bars);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){container.transition().duration(transitionDuration).call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}x=bars.xScale();y=bars.yScale();var wrap=container.selectAll("g.nv-wrap.nv-historicalBarChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-barsWrap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-interactive");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{legend.width(availableWidth);g.select(".nv-legendWrap").datum(data).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}wrap.select(".nv-legendWrap").attr("transform","translate(0,"+-margin.top+")")}wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}if(useInteractiveGuideline){interactiveLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-interactive").call(interactiveLayer)}bars.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));var barsWrap=g.select(".nv-barsWrap").datum(data.filter(function(d){return!d.disabled}));barsWrap.transition().call(bars);if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");g.select(".nv-x.nv-axis").transition().call(xAxis)}if(showYAxis){yAxis.scale(y)._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").transition().call(yAxis)}interactiveLayer.dispatch.on("elementMousemove",function(e){bars.clearHighlights();var singlePoint,pointIndex,pointXLocation,allData=[];data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series,i){pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());bars.highlightPoint(pointIndex,true);var point=series.values[pointIndex];if(point===undefined)return;if(singlePoint===undefined)singlePoint=point;if(pointXLocation===undefined)pointXLocation=chart.xScale()(chart.x()(point,pointIndex));allData.push({key:series.key,value:chart.y()(point,pointIndex),color:color(series,series.seriesIndex),data:series.values[pointIndex]})});var xValue=xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));interactiveLayer.tooltip.valueFormatter(function(d,i){return yAxis.tickFormat()(d)}).data({value:xValue,index:pointIndex,series:allData})();interactiveLayer.renderGuideLine(pointXLocation)});interactiveLayer.dispatch.on("elementMouseout",function(e){dispatch.tooltipHide();bars.clearHighlights()});legend.dispatch.on("legendClick",function(d,i){d.disabled=!d.disabled;if(!data.filter(function(d){return!d.disabled}).length){data.map(function(d){d.disabled=false;wrap.selectAll(".nv-series").classed("disabled",false);return d})}state.disabled=data.map(function(d){return!!d.disabled});dispatch.stateChange(state);selection.transition().call(chart)});legend.dispatch.on("legendDblclick",function(d){data.forEach(function(d){d.disabled=true});d.disabled=false;state.disabled=data.map(function(d){return!!d.disabled});dispatch.stateChange(state);chart.update()});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()})});renderWatch.renderEnd("historicalBarChart immediate");return chart}bars.dispatch.on("elementMouseover.tooltip",function(evt){evt["series"]={key:chart.x()(evt.data),value:chart.y()(evt.data),color:evt.color};tooltip.data(evt).hidden(false)});bars.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});bars.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.dispatch=dispatch;chart.bars=bars;chart.legend=legend;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.interactiveLayer=interactiveLayer;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},noData:{get:function(){return noData},set:function(_){noData=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color);bars.color(color)}},duration:{get:function(){return transitionDuration},set:function(_){transitionDuration=_;renderWatch.reset(transitionDuration);yAxis.duration(transitionDuration);xAxis.duration(transitionDuration)}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(_?"right":"left")}},useInteractiveGuideline:{get:function(){return useInteractiveGuideline},set:function(_){useInteractiveGuideline=_;if(_===true){chart.interactive(false)}}}});nv.utils.inheritOptions(chart,bars);nv.utils.initOptions(chart);return chart};nv.models.ohlcBarChart=function(){var chart=nv.models.historicalBarChart(nv.models.ohlcBar());chart.useInteractiveGuideline(true);chart.interactiveLayer.tooltip.contentGenerator(function(data){var d=data.series[0].data;var color=d.open<d.close?"2ca02c":"d62728";return""+'<h3 style="color: #'+color+'">'+data.value+"</h3>"+"<table>"+"<tr><td>open:</td><td>"+chart.yAxis.tickFormat()(d.open)+"</td></tr>"+"<tr><td>close:</td><td>"+chart.yAxis.tickFormat()(d.close)+"</td></tr>"+"<tr><td>high</td><td>"+chart.yAxis.tickFormat()(d.high)+"</td></tr>"+"<tr><td>low:</td><td>"+chart.yAxis.tickFormat()(d.low)+"</td></tr>"+"</table>"});return chart};nv.models.candlestickBarChart=function(){var chart=nv.models.historicalBarChart(nv.models.candlestickBar());chart.useInteractiveGuideline(true);chart.interactiveLayer.tooltip.contentGenerator(function(data){var d=data.series[0].data;var color=d.open<d.close?"2ca02c":"d62728";return""+'<h3 style="color: #'+color+'">'+data.value+"</h3>"+"<table>"+"<tr><td>open:</td><td>"+chart.yAxis.tickFormat()(d.open)+"</td></tr>"+"<tr><td>close:</td><td>"+chart.yAxis.tickFormat()(d.close)+"</td></tr>"+"<tr><td>high</td><td>"+chart.yAxis.tickFormat()(d.high)+"</td></tr>"+"<tr><td>low:</td><td>"+chart.yAxis.tickFormat()(d.low)+"</td></tr>"+"</table>"});return chart};nv.models.legend=function(){"use strict";var margin={top:5,right:0,bottom:5,left:0},width=400,height=20,getKey=function(d){return d.key},keyFormatter=function(d){return d},color=nv.utils.getColor(),maxKeyLength=20,align=true,padding=32,rightAlign=true,updateState=true,enableDoubleClick=true,radioButtonMode=false,expanded=false,dispatch=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),vers="classic";function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,container=d3.select(this);nv.utils.initSVG(container);var wrap=container.selectAll("g.nv-legend").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-legend").append("g");var g=wrap.select("g");if(rightAlign)wrap.attr("transform","translate("+-margin.right+","+margin.top+")");else wrap.attr("transform","translate("+margin.left+","+margin.top+")");var series=g.selectAll(".nv-series").data(function(d){if(vers!="furious")return d;return d.filter(function(n){return expanded?true:!n.disengaged})});var seriesEnter=series.enter().append("g").attr("class","nv-series");var seriesShape;var versPadding;switch(vers){case"furious":versPadding=23;break;case"classic":versPadding=20}if(vers=="classic"){seriesEnter.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5);seriesShape=series.select(".nv-legend-symbol")}else if(vers=="furious"){seriesEnter.append("rect").style("stroke-width",2).attr("class","nv-legend-symbol").attr("rx",3).attr("ry",3);seriesShape=series.select(".nv-legend-symbol");seriesEnter.append("g").attr("class","nv-check-box").property("innerHTML",'<path d="M0.5,5 L22.5,5 L22.5,26.5 L0.5,26.5 L0.5,5 Z" class="nv-box"></path><path d="M5.5,12.8618467 L11.9185089,19.2803556 L31,0.198864511" class="nv-check"></path>').attr("transform","translate(-10,-8)scale(0.5)");var seriesCheckbox=series.select(".nv-check-box");seriesCheckbox.each(function(d,i){d3.select(this).selectAll("path").attr("stroke",setTextColor(d,i))})}seriesEnter.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");var seriesText=series.select("text.nv-legend-text");series.on("mouseover",function(d,i){dispatch.legendMouseover(d,i)}).on("mouseout",function(d,i){dispatch.legendMouseout(d,i)}).on("click",function(d,i){dispatch.legendClick(d,i);var data=series.data();if(updateState){if(vers=="classic"){if(radioButtonMode){data.forEach(function(series){series.disabled=true});d.disabled=false}else{d.disabled=!d.disabled;if(data.every(function(series){return series.disabled})){data.forEach(function(series){series.disabled=false})}}}else if(vers=="furious"){if(expanded){d.disengaged=!d.disengaged;d.userDisabled=d.userDisabled==undefined?!!d.disabled:d.userDisabled;d.disabled=d.disengaged||d.userDisabled}else if(!expanded){d.disabled=!d.disabled;d.userDisabled=d.disabled;var engaged=data.filter(function(d){return!d.disengaged});if(engaged.every(function(series){return series.userDisabled})){data.forEach(function(series){series.disabled=series.userDisabled=false})}}}dispatch.stateChange({disabled:data.map(function(d){return!!d.disabled}),disengaged:data.map(function(d){return!!d.disengaged})})}}).on("dblclick",function(d,i){if(enableDoubleClick){if(vers=="furious"&&expanded)return;dispatch.legendDblclick(d,i);if(updateState){var data=series.data();data.forEach(function(series){series.disabled=true;if(vers=="furious")series.userDisabled=series.disabled});d.disabled=false;if(vers=="furious")d.userDisabled=d.disabled;dispatch.stateChange({disabled:data.map(function(d){return!!d.disabled})})}}});series.classed("nv-disabled",function(d){return d.userDisabled});series.exit().remove();seriesText.attr("fill",setTextColor).text(function(d){return keyFormatter(getKey(d))});var legendWidth=0;if(align){var seriesWidths=[];series.each(function(d,i){var legendText;if(keyFormatter(getKey(d))&&keyFormatter(getKey(d)).length>maxKeyLength){var trimmedKey=keyFormatter(getKey(d)).substring(0,maxKeyLength);legendText=d3.select(this).select("text").text(trimmedKey+"...");d3.select(this).append("svg:title").text(keyFormatter(getKey(d)))}else{legendText=d3.select(this).select("text")}var nodeTextLength;try{nodeTextLength=legendText.node().getComputedTextLength();if(nodeTextLength<=0)throw Error()}catch(e){nodeTextLength=nv.utils.calcApproxTextWidth(legendText)}seriesWidths.push(nodeTextLength+padding)});var seriesPerRow=0;var columnWidths=[];legendWidth=0;while(legendWidth<availableWidth&&seriesPerRow<seriesWidths.length){columnWidths[seriesPerRow]=seriesWidths[seriesPerRow];legendWidth+=seriesWidths[seriesPerRow++]}if(seriesPerRow===0)seriesPerRow=1;while(legendWidth>availableWidth&&seriesPerRow>1){columnWidths=[];seriesPerRow--;for(var k=0;k<seriesWidths.length;k++){if(seriesWidths[k]>(columnWidths[k%seriesPerRow]||0))columnWidths[k%seriesPerRow]=seriesWidths[k]}legendWidth=columnWidths.reduce(function(prev,cur,index,array){return prev+cur})}var xPositions=[];for(var i=0,curX=0;i<seriesPerRow;i++){xPositions[i]=curX;curX+=columnWidths[i]}series.attr("transform",function(d,i){return"translate("+xPositions[i%seriesPerRow]+","+(5+Math.floor(i/seriesPerRow)*versPadding)+")"});if(rightAlign){g.attr("transform","translate("+(width-margin.right-legendWidth)+","+margin.top+")")}else{g.attr("transform","translate(0"+","+margin.top+")")}height=margin.top+margin.bottom+Math.ceil(seriesWidths.length/seriesPerRow)*versPadding}else{var ypos=5,newxpos=5,maxwidth=0,xpos;series.attr("transform",function(d,i){var length=d3.select(this).select("text").node().getComputedTextLength()+padding;xpos=newxpos;if(width<margin.left+margin.right+xpos+length){newxpos=xpos=5;ypos+=versPadding}newxpos+=length;if(newxpos>maxwidth)maxwidth=newxpos;if(legendWidth<xpos+maxwidth){legendWidth=xpos+maxwidth}return"translate("+xpos+","+ypos+")"});g.attr("transform","translate("+(width-margin.right-maxwidth)+","+margin.top+")");height=margin.top+margin.bottom+ypos+15}if(vers=="furious"){seriesShape.attr("width",function(d,i){return seriesText[0][i].getComputedTextLength()+27}).attr("height",18).attr("y",-9).attr("x",-15);gEnter.insert("rect",":first-child").attr("class","nv-legend-bg").attr("fill","#eee").attr("opacity",0);var seriesBG=g.select(".nv-legend-bg");seriesBG.transition().duration(300).attr("x",-versPadding).attr("width",legendWidth+versPadding-12).attr("height",height+10).attr("y",-margin.top-10).attr("opacity",expanded?1:0)}seriesShape.style("fill",setBGColor).style("fill-opacity",setBGOpacity).style("stroke",setBGColor)});function setTextColor(d,i){if(vers!="furious")return"#000";if(expanded){return d.disengaged?"#000":"#fff"}else if(!expanded){if(!d.color)d.color=color(d,i);return!!d.disabled?d.color:"#fff"}}function setBGColor(d,i){if(expanded&&vers=="furious"){return d.disengaged?"#eee":d.color||color(d,i)}else{return d.color||color(d,i)}}function setBGOpacity(d,i){if(expanded&&vers=="furious"){return 1}else{return!!d.disabled?0:1}}return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},key:{get:function(){return getKey},set:function(_){getKey=_}},keyFormatter:{get:function(){return keyFormatter},set:function(_){keyFormatter=_}},align:{get:function(){return align},set:function(_){align=_}},maxKeyLength:{get:function(){return maxKeyLength},set:function(_){maxKeyLength=_}},rightAlign:{get:function(){return rightAlign},set:function(_){rightAlign=_}},padding:{get:function(){return padding},set:function(_){padding=_}},updateState:{get:function(){return updateState},set:function(_){updateState=_}},enableDoubleClick:{get:function(){return enableDoubleClick},set:function(_){enableDoubleClick=_}},radioButtonMode:{get:function(){return radioButtonMode},set:function(_){radioButtonMode=_}},expanded:{get:function(){return expanded},set:function(_){expanded=_}},vers:{get:function(){return vers},set:function(_){vers=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});nv.utils.initOptions(chart);return chart};nv.models.line=function(){"use strict";var scatter=nv.models.scatter();var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,container=null,strokeWidth=1.5,color=nv.utils.defaultColor(),getX=function(d){return d.x},getY=function(d){return d.y},defined=function(d,i){return!isNaN(getY(d,i))&&getY(d,i)!==null},isArea=function(d){return d.area},clipEdge=false,x,y,interpolate="linear",duration=250,dispatch=d3.dispatch("elementClick","elementMouseover","elementMouseout","renderEnd");scatter.pointSize(16).pointDomain([16,256]);var x0,y0,renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();renderWatch.models(scatter);selection.each(function(data){container=d3.select(this);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);nv.utils.initSVG(container);x=scatter.xScale();y=scatter.yScale();x0=x0||x;y0=y0||y;var wrap=container.selectAll("g.nv-wrap.nv-line").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-line");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-groups");gEnter.append("g").attr("class","nv-scatterWrap");wrap.attr("transform","translate("+margin.left+","+margin.top+")");scatter.width(availableWidth).height(availableHeight);var scatterWrap=wrap.select(".nv-scatterWrap");scatterWrap.call(scatter);defsEnter.append("clipPath").attr("id","nv-edge-clip-"+scatter.id()).append("rect");wrap.select("#nv-edge-clip-"+scatter.id()+" rect").attr("width",availableWidth).attr("height",availableHeight>0?availableHeight:0);g.attr("clip-path",clipEdge?"url(#nv-edge-clip-"+scatter.id()+")":"");scatterWrap.attr("clip-path",clipEdge?"url(#nv-edge-clip-"+scatter.id()+")":"");var groups=wrap.select(".nv-groups").selectAll(".nv-group").data(function(d){return d},function(d){return d.key});groups.enter().append("g").style("stroke-opacity",1e-6).style("stroke-width",function(d){return d.strokeWidth||strokeWidth}).style("fill-opacity",1e-6);groups.exit().remove();groups.attr("class",function(d,i){return(d.classed||"")+" nv-group nv-series-"+i}).classed("hover",function(d){return d.hover}).style("fill",function(d,i){return color(d,i)}).style("stroke",function(d,i){return color(d,i)});groups.watchTransition(renderWatch,"line: groups").style("stroke-opacity",1).style("fill-opacity",function(d){return d.fillOpacity||.5});var areaPaths=groups.selectAll("path.nv-area").data(function(d){return isArea(d)?[d]:[]});areaPaths.enter().append("path").attr("class","nv-area").attr("d",function(d){return d3.svg.area().interpolate(interpolate).defined(defined).x(function(d,i){return nv.utils.NaNtoZero(x0(getX(d,i)))}).y0(function(d,i){return nv.utils.NaNtoZero(y0(getY(d,i)))}).y1(function(d,i){return y0(y.domain()[0]<=0?y.domain()[1]>=0?0:y.domain()[1]:y.domain()[0])}).apply(this,[d.values])});groups.exit().selectAll("path.nv-area").remove();areaPaths.watchTransition(renderWatch,"line: areaPaths").attr("d",function(d){return d3.svg.area().interpolate(interpolate).defined(defined).x(function(d,i){return nv.utils.NaNtoZero(x(getX(d,i)))}).y0(function(d,i){return nv.utils.NaNtoZero(y(getY(d,i)))}).y1(function(d,i){return y(y.domain()[0]<=0?y.domain()[1]>=0?0:y.domain()[1]:y.domain()[0])}).apply(this,[d.values])});var linePaths=groups.selectAll("path.nv-line").data(function(d){return[d.values]});linePaths.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(interpolate).defined(defined).x(function(d,i){return nv.utils.NaNtoZero(x0(getX(d,i)))}).y(function(d,i){return nv.utils.NaNtoZero(y0(getY(d,i)))}));linePaths.watchTransition(renderWatch,"line: linePaths").attr("d",d3.svg.line().interpolate(interpolate).defined(defined).x(function(d,i){return nv.utils.NaNtoZero(x(getX(d,i)))}).y(function(d,i){return nv.utils.NaNtoZero(y(getY(d,i)))}));x0=x.copy();y0=y.copy()});renderWatch.renderEnd("line immediate");return chart}chart.dispatch=dispatch;chart.scatter=scatter;scatter.dispatch.on("elementClick",function(){dispatch.elementClick.apply(this,arguments)});scatter.dispatch.on("elementMouseover",function(){dispatch.elementMouseover.apply(this,arguments)});scatter.dispatch.on("elementMouseout",function(){dispatch.elementMouseout.apply(this,arguments)});chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},defined:{get:function(){return defined},set:function(_){defined=_}},interpolate:{get:function(){return interpolate},set:function(_){interpolate=_}},clipEdge:{get:function(){return clipEdge},set:function(_){clipEdge=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);scatter.duration(duration)}},isArea:{get:function(){return isArea},set:function(_){isArea=d3.functor(_)}},x:{get:function(){return getX},set:function(_){getX=_;scatter.x(_)}},y:{get:function(){return getY},set:function(_){getY=_;scatter.y(_)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);scatter.color(color)}}});nv.utils.inheritOptions(chart,scatter);nv.utils.initOptions(chart);return chart};nv.models.lineChart=function(){"use strict";var lines=nv.models.line(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),interactiveLayer=nv.interactiveGuideline(),zoomLayer=nv.zoomLayer(),tooltip=nv.models.tooltip(),focus=nv.models.focus(nv.models.line());var margin={top:30,right:20,bottom:50,left:60},marginTop=null,color=nv.utils.defaultColor(),width=null,height=null,showLegend=true,legendPosition="top",showXAxis=true,showYAxis=true,rightAlignYAxis=false,useInteractiveGuideline=false,x,y,zoomType=null,focusEnable=false,state=nv.utils.state(),defaultState=null,noData=null,dispatch=d3.dispatch("stateChange","changeState","renderEnd","zoom"),duration=250;xAxis.orient("bottom").tickPadding(7);yAxis.orient(rightAlignYAxis?"right":"left");lines.clipEdge(true).duration(0);tooltip.valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});interactiveLayer.tooltip.valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});var renderWatch=nv.utils.renderWatch(dispatch,duration);var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled})}}};var stateSetter=function(data){return function(state){if(state.active!==undefined)data.forEach(function(series,i){series.disabled=!state.active[i]})}};function chart(selection){renderWatch.reset();renderWatch.models(lines);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this);nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin)-(focusEnable?focus.height():0);chart.update=function(){if(duration===0){container.call(chart)}else{container.transition().duration(duration).call(chart)}};chart.container=this;state.setter(stateSetter(data),chart.update).getter(stateGetter(data)).update();state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}focus.dispatch.on("onBrush",function(extent){onBrush(extent)});x=lines.xScale();y=lines.yScale();var wrap=container.selectAll("g.nv-wrap.nv-lineChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-legendWrap");var focusEnter=gEnter.append("g").attr("class","nv-focus");focusEnter.append("g").attr("class","nv-background").append("rect");focusEnter.append("g").attr("class","nv-x nv-axis");focusEnter.append("g").attr("class","nv-y nv-axis");focusEnter.append("g").attr("class","nv-linesWrap");focusEnter.append("g").attr("class","nv-interactive");focusEnter.append("g").attr("class","nv-zoomLayer");var contextEnter=gEnter.append("g").attr("class","nv-focusWrap");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{legend.width(availableWidth);g.select(".nv-legendWrap").datum(data).call(legend);if(legendPosition==="bottom"){margin.bottom=xAxis.height()+legend.height();availableHeight=nv.utils.availableHeight(height,container,margin);g.select(".nv-legendWrap").attr("transform","translate(0,"+(availableHeight+xAxis.height())+")")}else if(legendPosition==="top"){if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)-(focusEnable?focus.height():0)}wrap.select(".nv-legendWrap").attr("transform","translate(0,"+-margin.top+")")}}wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}if(useInteractiveGuideline){interactiveLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-interactive").call(interactiveLayer);zoomLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-zoomLayer").call(zoomLayer)}if(zoomType&&zoomType=="x"){if(wrap.selectAll(".nv-zoomLayer g.button").node()==null){var resetZoomButton=wrap.select(".nv-zoomLayer").append("g").attr("class","button").attr("cursor","pointer");resetZoomButton.append("rect").attr("x",availableWidth-72-20).attr("y",4).attr("rx",2).attr("ry",2).attr("width",78).attr("height",25).attr("fill","#fff").attr("stroke","#999").attr("strokeWidth",1);resetZoomButton.append("text").attr("x",availableWidth-72-10).attr("y",22).text("Rest Zoom");resetZoomButton.on("click",function(){var min=d3.min(container.data()[0],function(d){return d3.min(d.values,function(d){return chart.x()(d)})});var max=d3.max(container.data()[0],function(d){return d3.max(d.values,function(d){return chart.x()(d)})});chart.options({xDomain:[min,max]});dispatch.zoom({type:"reset",xDomain:[min,max]});chart.update()})}else{wrap.select(".nv-zoomLayer g.button rect").attr("x",availableWidth-72-20);wrap.select(".nv-zoomLayer g.button text").attr("x",availableWidth-72-10)}}g.select(".nv-focus .nv-background rect").attr("width",availableWidth).attr("height",availableHeight);lines.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));var linesWrap=g.select(".nv-linesWrap").datum(data.filter(function(d){return!d.disabled}));if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0)}if(showYAxis){yAxis.scale(y)._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0)}function updateXAxis(){if(showXAxis){g.select(".nv-focus .nv-x.nv-axis").transition().duration(duration).call(xAxis)}}function updateYAxis(){if(showYAxis){g.select(".nv-focus .nv-y.nv-axis").transition().duration(duration).call(yAxis)}}g.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+availableHeight+")");if(!focusEnable&&focus.brush.extent()===null){linesWrap.transition().call(lines);updateXAxis();updateYAxis()}else{focus.width(availableWidth);g.select(".nv-focusWrap").style("display",focusEnable?"initial":"none").attr("transform","translate(0,"+(availableHeight+margin.bottom+focus.margin().top)+")").call(focus);var extent=focus.brush.empty()?focus.xDomain():focus.brush.extent();if(extent!==null){onBrush(extent)}}legend.dispatch.on("stateChange",function(newState){for(var key in newState)state[key]=newState[key];dispatch.stateChange(state);chart.update()});interactiveLayer.dispatch.on("elementMousemove",function(e){lines.clearHighlights();var singlePoint,pointIndex,pointXLocation,allData=[];data.filter(function(series,i){series.seriesIndex=i;return!series.disabled&&!series.disableTooltip}).forEach(function(series,i){var extent=focus.brush.extent()!==null?focus.brush.empty()?focus.xScale().domain():focus.brush.extent():x.domain();var currentValues=series.values.filter(function(d,i){if(extent[0]<=extent[1]){return lines.x()(d,i)>=extent[0]&&lines.x()(d,i)<=extent[1]}else{return lines.x()(d,i)>=extent[1]&&lines.x()(d,i)<=extent[0]}});if(currentValues.length>0){pointIndex=nv.interactiveBisect(currentValues,e.pointXValue,lines.x());var point=currentValues[pointIndex];var pointYValue=chart.y()(point,pointIndex);if(pointYValue!==null){lines.highlightPoint(i,series.values.indexOf(point),true)}if(point===undefined)return;if(singlePoint===undefined)singlePoint=point;if(pointXLocation===undefined)pointXLocation=chart.xScale()(chart.x()(point,pointIndex));allData.push({key:series.key,value:pointYValue,color:color(series,series.seriesIndex),data:point})}});if(allData.length>2){var yValue=chart.yScale().invert(e.mouseY);var domainExtent=Math.abs(chart.yScale().domain()[0]-chart.yScale().domain()[1]);var threshold=.03*domainExtent;var indexToHighlight=nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);if(indexToHighlight!==null)allData[indexToHighlight].highlight=true}var defaultValueFormatter=function(d,i){return d==null?"N/A":yAxis.tickFormat()(d)};if(typeof pointIndex!=="undefined"){interactiveLayer.tooltip.valueFormatter(interactiveLayer.tooltip.valueFormatter()||defaultValueFormatter).data({value:chart.x()(singlePoint,pointIndex),index:pointIndex,series:allData})();interactiveLayer.renderGuideLine(pointXLocation)}});interactiveLayer.dispatch.on("elementClick",function(e){var pointXLocation,allData=[];data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series){var pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());var point=series.values[pointIndex];if(typeof point==="undefined")return;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex));var yPos=chart.yScale()(chart.y()(point,pointIndex));allData.push({point:point,pointIndex:pointIndex,pos:[pointXLocation,yPos],seriesIndex:series.seriesIndex,series:series})});lines.dispatch.elementClick(allData)});interactiveLayer.dispatch.on("elementMouseout",function(e){lines.clearHighlights()});if(zoomType=="x"){var currentXValue=null;var dragStartX=null;var dragStartXValue=null;var dragStartYValue=null;zoomLayer.dispatch.on("elementMousemove",function(e){if(dragStartXValue===null){return}var pointXLocation;currentXValue=e.pointXValue;data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series){var pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());var point=series.values[pointIndex];if(typeof point==="undefined")return;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex))});zoomLayer.updateSelectArea(dragStartX,pointXLocation)});zoomLayer.dispatch.on("elementDragStart",function(e){var pointXLocation;dragStartXValue=e.pointXValue;data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series){var pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());var point=series.values[pointIndex];if(typeof point==="undefined")return;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex))});dragStartX=pointXLocation;zoomLayer.renderSelectArea(pointXLocation)});zoomLayer.dispatch.on("elementDragEnd",function(e){if(dragStartXValue!=currentXValue){var xDomain=[d3.min([dragStartXValue,currentXValue]),d3.max([dragStartXValue,currentXValue])];chart.options({xDomain:xDomain});chart.update();dispatch.zoom({type:"zoom",xDomain:xDomain})}dragStartXValue=null;dragStartX=null;zoomLayer.removeSelectArea()})}focus.dispatch.on("onBrush",function(extent){onBrush(extent)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"&&data.length===e.disabled.length){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()});function resizePath(d){var e=+(d=="e"),x=e?1:-1,y=availableHeight/3;return"M"+.5*x+","+y+"A6,6 0 0 "+e+" "+6.5*x+","+(y+6)+"V"+(2*y-6)+"A6,6 0 0 "+e+" "+.5*x+","+2*y+"Z"+"M"+2.5*x+","+(y+8)+"V"+(2*y-8)+"M"+4.5*x+","+(y+8)+"V"+(2*y-8)}function onBrush(extent){var focusLinesWrap=g.select(".nv-focus .nv-linesWrap").datum(data.filter(function(d){return!d.disabled}).map(function(d,i){return{key:d.key,area:d.area,classed:d.classed,values:d.values.filter(function(d,i){return lines.x()(d,i)>=extent[0]&&lines.x()(d,i)<=extent[1]}),disableTooltip:d.disableTooltip}}));focusLinesWrap.transition().duration(duration).call(lines);updateXAxis();updateYAxis()}});renderWatch.renderEnd("lineChart immediate");return chart}lines.dispatch.on("elementMouseover.tooltip",function(evt){if(!evt.series.disableTooltip){tooltip.data(evt).hidden(false)}});lines.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});chart.dispatch=dispatch;chart.lines=lines;chart.legend=legend;chart.focus=focus;chart.xAxis=xAxis;chart.x2Axis=focus.xAxis;chart.yAxis=yAxis;chart.y2Axis=focus.yAxis;chart.interactiveLayer=interactiveLayer;chart.tooltip=tooltip;chart.state=state;chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},legendPosition:{get:function(){return legendPosition},set:function(_){legendPosition=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},zoomType:{get:function(){return zoomType},set:function(_){zoomType=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},noData:{get:function(){return noData},set:function(_){noData=_}},focusEnable:{get:function(){return focusEnable},set:function(_){focusEnable=_}},focusHeight:{get:function(){return focus.height()},set:function(_){focus.height(_)}},focusShowAxisX:{get:function(){return focus.showXAxis()},set:function(_){focus.showXAxis(_)}},focusShowAxisY:{get:function(){return focus.showYAxis()},set:function(_){focus.showYAxis(_)}},brushExtent:{get:function(){return focus.brushExtent()},set:function(_){focus.brushExtent(_)}},focusMargin:{get:function(){return focus.margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}focus.margin.right=_.right!==undefined?_.right:focus.margin.right;focus.margin.bottom=_.bottom!==undefined?_.bottom:focus.margin.bottom;focus.margin.left=_.left!==undefined?_.left:focus.margin.left}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);lines.duration(duration);focus.duration(duration);xAxis.duration(duration);yAxis.duration(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color);lines.color(color);focus.color(color)}},interpolate:{get:function(){return lines.interpolate()},set:function(_){lines.interpolate(_);focus.interpolate(_)}},xTickFormat:{get:function(){return xAxis.tickFormat()},set:function(_){xAxis.tickFormat(_);focus.xTickFormat(_)}},yTickFormat:{get:function(){return yAxis.tickFormat()},set:function(_){yAxis.tickFormat(_);focus.yTickFormat(_)}},x:{get:function(){return lines.x()},set:function(_){lines.x(_);focus.x(_)}},y:{get:function(){return lines.y()},set:function(_){lines.y(_);focus.y(_)}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(rightAlignYAxis?"right":"left")}},useInteractiveGuideline:{get:function(){return useInteractiveGuideline},set:function(_){useInteractiveGuideline=_;if(useInteractiveGuideline){lines.interactive(false);lines.useVoronoi(false)}}}});nv.utils.inheritOptions(chart,lines);nv.utils.initOptions(chart);return chart};nv.models.lineWithFocusChart=function(){return nv.models.lineChart().margin({bottom:30}).focusEnable(true)};nv.models.linePlusBarChart=function(){"use strict";var lines=nv.models.line(),lines2=nv.models.line(),bars=nv.models.historicalBar(),bars2=nv.models.historicalBar(),xAxis=nv.models.axis(),x2Axis=nv.models.axis(),y1Axis=nv.models.axis(),y2Axis=nv.models.axis(),y3Axis=nv.models.axis(),y4Axis=nv.models.axis(),legend=nv.models.legend(),brush=d3.svg.brush(),tooltip=nv.models.tooltip();var margin={top:30,right:30,bottom:30,left:60},marginTop=null,margin2={top:0,right:30,bottom:20,left:60},width=null,height=null,getX=function(d){return d.x},getY=function(d){return d.y},color=nv.utils.defaultColor(),showLegend=true,focusEnable=true,focusShowAxisY=false,focusShowAxisX=true,focusHeight=50,extent,brushExtent=null,x,x2,y1,y2,y3,y4,noData=null,dispatch=d3.dispatch("brush","stateChange","changeState"),transitionDuration=0,state=nv.utils.state(),defaultState=null,legendLeftAxisHint=" (left axis)",legendRightAxisHint=" (right axis)",switchYAxisOrder=false;lines.clipEdge(true);lines2.interactive(false);lines2.pointActive(function(d){return false});xAxis.orient("bottom").tickPadding(5);y1Axis.orient("left");y2Axis.orient("right");x2Axis.orient("bottom").tickPadding(5);y3Axis.orient("left");y4Axis.orient("right");tooltip.headerEnabled(true).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});var getBarsAxis=function(){return switchYAxisOrder?{main:y2Axis,focus:y4Axis}:{main:y1Axis,focus:y3Axis}};var getLinesAxis=function(){return switchYAxisOrder?{main:y1Axis,focus:y3Axis}:{main:y2Axis,focus:y4Axis}};var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled})}}};var stateSetter=function(data){return function(state){if(state.active!==undefined)data.forEach(function(series,i){series.disabled=!state.active[i]})}};var allDisabled=function(data){return data.every(function(series){return series.disabled})};function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight1=nv.utils.availableHeight(height,container,margin)-(focusEnable?focusHeight:0),availableHeight2=focusHeight-margin2.top-margin2.bottom;chart.update=function(){container.transition().duration(transitionDuration).call(chart)};chart.container=this;state.setter(stateSetter(data),chart.update).getter(stateGetter(data)).update();state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}var dataBars=data.filter(function(d){return!d.disabled&&d.bar});var dataLines=data.filter(function(d){return!d.bar});if(dataBars.length&&!switchYAxisOrder){x=bars.xScale()}else{x=lines.xScale()}x2=x2Axis.scale();y1=switchYAxisOrder?lines.yScale():bars.yScale();y2=switchYAxisOrder?bars.yScale():lines.yScale();y3=switchYAxisOrder?lines2.yScale():bars2.yScale();y4=switchYAxisOrder?bars2.yScale():lines2.yScale();var series1=data.filter(function(d){return!d.disabled&&(switchYAxisOrder?!d.bar:d.bar)}).map(function(d){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i)}})});var series2=data.filter(function(d){return!d.disabled&&(switchYAxisOrder?d.bar:!d.bar)}).map(function(d){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i)}})});x.range([0,availableWidth]);x2.domain(d3.extent(d3.merge(series1.concat(series2)),function(d){return d.x})).range([0,availableWidth]);var wrap=container.selectAll("g.nv-wrap.nv-linePlusBar").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-legendWrap");var focusEnter=gEnter.append("g").attr("class","nv-focus");focusEnter.append("g").attr("class","nv-x nv-axis");focusEnter.append("g").attr("class","nv-y1 nv-axis");focusEnter.append("g").attr("class","nv-y2 nv-axis");focusEnter.append("g").attr("class","nv-barsWrap");focusEnter.append("g").attr("class","nv-linesWrap");var contextEnter=gEnter.append("g").attr("class","nv-context");contextEnter.append("g").attr("class","nv-x nv-axis");contextEnter.append("g").attr("class","nv-y1 nv-axis");contextEnter.append("g").attr("class","nv-y2 nv-axis");contextEnter.append("g").attr("class","nv-barsWrap");contextEnter.append("g").attr("class","nv-linesWrap");contextEnter.append("g").attr("class","nv-brushBackground");contextEnter.append("g").attr("class","nv-x nv-brush");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{var legendWidth=legend.align()?availableWidth/2:availableWidth;var legendXPosition=legend.align()?legendWidth:0;legend.width(legendWidth);g.select(".nv-legendWrap").datum(data.map(function(series){series.originalKey=series.originalKey===undefined?series.key:series.originalKey;if(switchYAxisOrder){series.key=series.originalKey+(series.bar?legendRightAxisHint:legendLeftAxisHint)}else{series.key=series.originalKey+(series.bar?legendLeftAxisHint:legendRightAxisHint)}return series})).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight1=nv.utils.availableHeight(height,container,margin)-focusHeight}g.select(".nv-legendWrap").attr("transform","translate("+legendXPosition+","+-margin.top+")")}wrap.attr("transform","translate("+margin.left+","+margin.top+")");g.select(".nv-context").style("display",focusEnable?"initial":"none");bars2.width(availableWidth).height(availableHeight2).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled&&data[i].bar}));lines2.width(availableWidth).height(availableHeight2).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled&&!data[i].bar}));var bars2Wrap=g.select(".nv-context .nv-barsWrap").datum(dataBars.length?dataBars:[{values:[]}]);var lines2Wrap=g.select(".nv-context .nv-linesWrap").datum(allDisabled(dataLines)?[{values:[]}]:dataLines.filter(function(dataLine){return!dataLine.disabled}));g.select(".nv-context").attr("transform","translate(0,"+(availableHeight1+margin.bottom+margin2.top)+")");bars2Wrap.transition().call(bars2);lines2Wrap.transition().call(lines2);if(focusShowAxisX){x2Axis._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight2,0);g.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y3.range()[0]+")");g.select(".nv-context .nv-x.nv-axis").transition().call(x2Axis)}if(focusShowAxisY){y3Axis.scale(y3)._ticks(availableHeight2/36).tickSize(-availableWidth,0);y4Axis.scale(y4)._ticks(availableHeight2/36).tickSize(dataBars.length?0:-availableWidth,0);g.select(".nv-context .nv-y3.nv-axis").style("opacity",dataBars.length?1:0).attr("transform","translate(0,"+x2.range()[0]+")");g.select(".nv-context .nv-y2.nv-axis").style("opacity",dataLines.length?1:0).attr("transform","translate("+x2.range()[1]+",0)");g.select(".nv-context .nv-y1.nv-axis").transition().call(y3Axis);g.select(".nv-context .nv-y2.nv-axis").transition().call(y4Axis)}brush.x(x2).on("brush",onBrush);if(brushExtent)brush.extent(brushExtent);var brushBG=g.select(".nv-brushBackground").selectAll("g").data([brushExtent||brush.extent()]);var brushBGenter=brushBG.enter().append("g");brushBGenter.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",availableHeight2);brushBGenter.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",availableHeight2);var gBrush=g.select(".nv-x.nv-brush").call(brush);gBrush.selectAll("rect").attr("height",availableHeight2);gBrush.selectAll(".resize").append("path").attr("d",resizePath);legend.dispatch.on("stateChange",function(newState){for(var key in newState)state[key]=newState[key];dispatch.stateChange(state);chart.update()});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()});function resizePath(d){var e=+(d=="e"),x=e?1:-1,y=availableHeight2/3;return"M"+.5*x+","+y+"A6,6 0 0 "+e+" "+6.5*x+","+(y+6)+"V"+(2*y-6)+"A6,6 0 0 "+e+" "+.5*x+","+2*y+"Z"+"M"+2.5*x+","+(y+8)+"V"+(2*y-8)+"M"+4.5*x+","+(y+8)+"V"+(2*y-8)}function updateBrushBG(){if(!brush.empty())brush.extent(brushExtent);brushBG.data([brush.empty()?x2.domain():brushExtent]).each(function(d,i){var leftWidth=x2(d[0])-x2.range()[0],rightWidth=x2.range()[1]-x2(d[1]);d3.select(this).select(".left").attr("width",leftWidth<0?0:leftWidth);d3.select(this).select(".right").attr("x",x2(d[1])).attr("width",rightWidth<0?0:rightWidth)})}function onBrush(){brushExtent=brush.empty()?null:brush.extent();extent=brush.empty()?x2.domain():brush.extent();dispatch.brush({extent:extent,brush:brush});updateBrushBG();bars.width(availableWidth).height(availableHeight1).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled&&data[i].bar}));lines.width(availableWidth).height(availableHeight1).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled&&!data[i].bar}));var focusBarsWrap=g.select(".nv-focus .nv-barsWrap").datum(!dataBars.length?[{values:[]}]:dataBars.map(function(d,i){return{key:d.key,values:d.values.filter(function(d,i){return bars.x()(d,i)>=extent[0]&&bars.x()(d,i)<=extent[1]})}}));var focusLinesWrap=g.select(".nv-focus .nv-linesWrap").datum(allDisabled(dataLines)?[{values:[]}]:dataLines.filter(function(dataLine){return!dataLine.disabled}).map(function(d,i){return{area:d.area,fillOpacity:d.fillOpacity,strokeWidth:d.strokeWidth,key:d.key,values:d.values.filter(function(d,i){return lines.x()(d,i)>=extent[0]&&lines.x()(d,i)<=extent[1]})}}));if(dataBars.length&&!switchYAxisOrder){x=bars.xScale()}else{x=lines.xScale()}xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight1,0);xAxis.domain([Math.ceil(extent[0]),Math.floor(extent[1])]);g.select(".nv-x.nv-axis").transition().duration(transitionDuration).call(xAxis);focusBarsWrap.transition().duration(transitionDuration).call(bars);focusLinesWrap.transition().duration(transitionDuration).call(lines);g.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+y1.range()[0]+")");y1Axis.scale(y1)._ticks(nv.utils.calcTicksY(availableHeight1/36,data)).tickSize(-availableWidth,0);y2Axis.scale(y2)._ticks(nv.utils.calcTicksY(availableHeight1/36,data));if(!switchYAxisOrder){y2Axis.tickSize(dataBars.length?0:-availableWidth,0)}else{y2Axis.tickSize(dataLines.length?0:-availableWidth,0)}var barsOpacity=dataBars.length?1:0;var linesOpacity=dataLines.length&&!allDisabled(dataLines)?1:0;var y1Opacity=switchYAxisOrder?linesOpacity:barsOpacity;var y2Opacity=switchYAxisOrder?barsOpacity:linesOpacity;g.select(".nv-focus .nv-y1.nv-axis").style("opacity",y1Opacity);g.select(".nv-focus .nv-y2.nv-axis").style("opacity",y2Opacity).attr("transform","translate("+x.range()[1]+",0)");g.select(".nv-focus .nv-y1.nv-axis").transition().duration(transitionDuration).call(y1Axis);g.select(".nv-focus .nv-y2.nv-axis").transition().duration(transitionDuration).call(y2Axis)}onBrush()});return chart}lines.dispatch.on("elementMouseover.tooltip",function(evt){tooltip.duration(100).valueFormatter(function(d,i){return getLinesAxis().main.tickFormat()(d,i)}).data(evt).hidden(false)});lines.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});bars.dispatch.on("elementMouseover.tooltip",function(evt){evt.value=chart.x()(evt.data);evt["series"]={value:chart.y()(evt.data),color:evt.color};tooltip.duration(0).valueFormatter(function(d,i){return getBarsAxis().main.tickFormat()(d,i)}).data(evt).hidden(false)});bars.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});bars.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.dispatch=dispatch;chart.legend=legend;chart.lines=lines;chart.lines2=lines2;chart.bars=bars;chart.bars2=bars2;chart.xAxis=xAxis;chart.x2Axis=x2Axis;chart.y1Axis=y1Axis;chart.y2Axis=y2Axis;chart.y3Axis=y3Axis;chart.y4Axis=y4Axis;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},brushExtent:{get:function(){return brushExtent},set:function(_){brushExtent=_}},noData:{get:function(){return noData},set:function(_){noData=_}},focusEnable:{get:function(){return focusEnable},set:function(_){focusEnable=_}},focusHeight:{get:function(){return focusHeight},set:function(_){focusHeight=_}},focusShowAxisX:{get:function(){return focusShowAxisX},set:function(_){focusShowAxisX=_}},focusShowAxisY:{get:function(){return focusShowAxisY},set:function(_){focusShowAxisY=_}},legendLeftAxisHint:{get:function(){return legendLeftAxisHint},set:function(_){legendLeftAxisHint=_}},legendRightAxisHint:{get:function(){return legendRightAxisHint},set:function(_){legendRightAxisHint=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},focusMargin:{get:function(){return margin2},set:function(_){margin2.top=_.top!==undefined?_.top:margin2.top;margin2.right=_.right!==undefined?_.right:margin2.right;margin2.bottom=_.bottom!==undefined?_.bottom:margin2.bottom;margin2.left=_.left!==undefined?_.left:margin2.left}},duration:{get:function(){return transitionDuration},set:function(_){transitionDuration=_}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color)}},x:{get:function(){return getX},set:function(_){getX=_;lines.x(_);lines2.x(_);bars.x(_);bars2.x(_)}},y:{get:function(){return getY},set:function(_){getY=_;lines.y(_);lines2.y(_);bars.y(_);bars2.y(_)}},switchYAxisOrder:{get:function(){return switchYAxisOrder},set:function(_){if(switchYAxisOrder!==_){var y1=y1Axis;y1Axis=y2Axis;y2Axis=y1;var y3=y3Axis;y3Axis=y4Axis;y4Axis=y3}switchYAxisOrder=_;y1Axis.orient("left");y2Axis.orient("right");y3Axis.orient("left");y4Axis.orient("right")}}});nv.utils.inheritOptions(chart,lines);nv.utils.initOptions(chart);return chart};nv.models.multiBar=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,x=d3.scale.ordinal(),y=d3.scale.linear(),id=Math.floor(Math.random()*1e4),container=null,getX=function(d){return d.x},getY=function(d){return d.y},forceY=[0],clipEdge=true,stacked=false,stackOffset="zero",color=nv.utils.defaultColor(),hideable=false,barColor=null,disabled,duration=500,xDomain,yDomain,xRange,yRange,groupSpacing=.1,fillOpacity=.75,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd");var x0,y0,renderWatch=nv.utils.renderWatch(dispatch,duration);var last_datalength=0;function chart(selection){renderWatch.reset();selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);var nonStackableCount=0;var endFn=function(d,i){if(d.series===data.length-1&&i===data[0].values.length-1)return true;return false};if(hideable&&data.length)hideable=[{values:data[0].values.map(function(d){return{x:d.x,y:0,series:d.series,size:.01}})}];if(stacked){var parsed=d3.layout.stack().offset(stackOffset).values(function(d){return d.values}).y(getY)(!data.length&&hideable?hideable:data);parsed.forEach(function(series,i){if(series.nonStackable){data[i].nonStackableSeries=nonStackableCount++;parsed[i]=data[i]}else{if(i>0&&parsed[i-1].nonStackable){parsed[i].values.map(function(d,j){d.y0-=parsed[i-1].values[j].y;d.y1=d.y0+d.y})}}});data=parsed}data.forEach(function(series,i){series.values.forEach(function(point){point.series=i;point.key=series.key})});if(stacked&&data.length>0){data[0].values.map(function(d,i){var posBase=0,negBase=0;data.map(function(d,idx){if(!data[idx].nonStackable){var f=d.values[i];f.size=Math.abs(f.y);if(f.y<0){f.y1=negBase;negBase=negBase-f.size}else{f.y1=f.size+posBase;posBase=posBase+f.size}}})})}var seriesData=xDomain&&yDomain?[]:data.map(function(d,idx){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i),y0:d.y0,y1:d.y1,idx:idx}})});x.domain(xDomain||d3.merge(seriesData).map(function(d){return d.x})).rangeBands(xRange||[0,availableWidth],groupSpacing);y.domain(yDomain||d3.extent(d3.merge(seriesData).map(function(d){var domain=d.y;if(stacked&&!data[d.idx].nonStackable){if(d.y>0){domain=d.y1}else{domain=d.y1+d.y}}return domain}).concat(forceY))).range(yRange||[availableHeight,0]);if(x.domain()[0]===x.domain()[1])x.domain()[0]?x.domain([x.domain()[0]-x.domain()[0]*.01,x.domain()[1]+x.domain()[1]*.01]):x.domain([-1,1]);if(y.domain()[0]===y.domain()[1])y.domain()[0]?y.domain([y.domain()[0]+y.domain()[0]*.01,y.domain()[1]-y.domain()[1]*.01]):y.domain([-1,1]);x0=x0||x;y0=y0||y;var wrap=container.selectAll("g.nv-wrap.nv-multibar").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-groups");wrap.attr("transform","translate("+margin.left+","+margin.top+")");defsEnter.append("clipPath").attr("id","nv-edge-clip-"+id).append("rect");wrap.select("#nv-edge-clip-"+id+" rect").attr("width",availableWidth).attr("height",availableHeight);g.attr("clip-path",clipEdge?"url(#nv-edge-clip-"+id+")":"");var groups=wrap.select(".nv-groups").selectAll(".nv-group").data(function(d){return d},function(d,i){return i});groups.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);var exitTransition=renderWatch.transition(groups.exit().selectAll("rect.nv-bar"),"multibarExit",Math.min(100,duration)).attr("y",function(d,i,j){var yVal=y0(0)||0;if(stacked){if(data[d.series]&&!data[d.series].nonStackable){yVal=y0(d.y0)}}return yVal}).attr("height",0).remove();if(exitTransition.delay)exitTransition.delay(function(d,i){var delay=i*(duration/(last_datalength+1))-i;return delay});groups.attr("class",function(d,i){return"nv-group nv-series-"+i}).classed("hover",function(d){return d.hover}).style("fill",function(d,i){return color(d,i)}).style("stroke",function(d,i){return color(d,i)});groups.style("stroke-opacity",1).style("fill-opacity",fillOpacity);var bars=groups.selectAll("rect.nv-bar").data(function(d){return hideable&&!data.length?hideable.values:d.values});bars.exit().remove();var barsEnter=bars.enter().append("rect").attr("class",function(d,i){return getY(d,i)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(d,i,j){return stacked&&!data[j].nonStackable?0:j*x.rangeBand()/data.length}).attr("y",function(d,i,j){return y0(stacked&&!data[j].nonStackable?d.y0:0)||0}).attr("height",0).attr("width",function(d,i,j){return x.rangeBand()/(stacked&&!data[j].nonStackable?1:data.length)}).attr("transform",function(d,i){return"translate("+x(getX(d,i))+",0)"});bars.style("fill",function(d,i,j){return color(d,j,i)}).style("stroke",function(d,i,j){return color(d,j,i)}).on("mouseover",function(d,i,j){d3.select(this).classed("hover",true);dispatch.elementMouseover({data:d,index:i,series:data[j],color:d3.select(this).style("fill")})}).on("mouseout",function(d,i,j){d3.select(this).classed("hover",false);dispatch.elementMouseout({data:d,index:i,series:data[j],color:d3.select(this).style("fill")})}).on("mousemove",function(d,i,j){dispatch.elementMousemove({data:d,index:i,series:data[j],color:d3.select(this).style("fill")})}).on("click",function(d,i,j){var element=this;dispatch.elementClick({data:d,index:i,series:data[j],color:d3.select(this).style("fill"),event:d3.event,element:element});d3.event.stopPropagation()}).on("dblclick",function(d,i,j){dispatch.elementDblClick({data:d,index:i,series:data[j],color:d3.select(this).style("fill")});d3.event.stopPropagation()});bars.attr("class",function(d,i){return getY(d,i)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(d,i){return"translate("+x(getX(d,i))+",0)"});if(barColor){if(!disabled)disabled=data.map(function(){return true});bars.style("fill",function(d,i,j){return d3.rgb(barColor(d,i)).darker(disabled.map(function(d,i){return i}).filter(function(d,i){return!disabled[i]})[j]).toString()}).style("stroke",function(d,i,j){return d3.rgb(barColor(d,i)).darker(disabled.map(function(d,i){return i}).filter(function(d,i){return!disabled[i]})[j]).toString()})}var barSelection=bars.watchTransition(renderWatch,"multibar",Math.min(250,duration)).delay(function(d,i){return i*duration/data[0].values.length});if(stacked){barSelection.attr("y",function(d,i,j){var yVal=0;if(!data[j].nonStackable){yVal=y(d.y1)}else{if(getY(d,i)<0){yVal=y(0)}else{if(y(0)-y(getY(d,i))<-1){yVal=y(0)-1}else{yVal=y(getY(d,i))||0}}}return yVal}).attr("height",function(d,i,j){if(!data[j].nonStackable){return Math.max(Math.abs(y(d.y+d.y0)-y(d.y0)),0)}else{return Math.max(Math.abs(y(getY(d,i))-y(0)),0)||0}}).attr("x",function(d,i,j){var width=0;if(data[j].nonStackable){width=d.series*x.rangeBand()/data.length;if(data.length!==nonStackableCount){width=data[j].nonStackableSeries*x.rangeBand()/(nonStackableCount*2)}}return width}).attr("width",function(d,i,j){if(!data[j].nonStackable){return x.rangeBand()}else{var width=x.rangeBand()/nonStackableCount;if(data.length!==nonStackableCount){width=x.rangeBand()/(nonStackableCount*2)}return width}})}else{barSelection.attr("x",function(d,i){return d.series*x.rangeBand()/data.length}).attr("width",x.rangeBand()/data.length).attr("y",function(d,i){return getY(d,i)<0?y(0):y(0)-y(getY(d,i))<1?y(0)-1:y(getY(d,i))||0}).attr("height",function(d,i){return Math.max(Math.abs(y(getY(d,i))-y(0)),1)||0})}x0=x.copy();y0=y.copy();if(data[0]&&data[0].values){last_datalength=data[0].values.length}});renderWatch.renderEnd("multibar immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},x:{get:function(){return getX},set:function(_){getX=_}},y:{get:function(){return getY},set:function(_){getY=_}},xScale:{get:function(){return x},set:function(_){x=_}},yScale:{get:function(){return y},set:function(_){y=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},forceY:{get:function(){return forceY},set:function(_){forceY=_}},stacked:{get:function(){return stacked},set:function(_){stacked=_}},stackOffset:{get:function(){return stackOffset},set:function(_){stackOffset=_}},clipEdge:{get:function(){return clipEdge},set:function(_){clipEdge=_}},disabled:{get:function(){return disabled},set:function(_){disabled=_}},id:{get:function(){return id},set:function(_){id=_}},hideable:{get:function(){return hideable},set:function(_){hideable=_}},groupSpacing:{get:function(){return groupSpacing},set:function(_){groupSpacing=_}},fillOpacity:{get:function(){return fillOpacity},set:function(_){fillOpacity=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},barColor:{get:function(){return barColor},set:function(_){barColor=_?nv.utils.getColor(_):null}}});nv.utils.initOptions(chart);return chart};nv.models.multiBarChart=function(){"use strict";var multibar=nv.models.multiBar(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),interactiveLayer=nv.interactiveGuideline(),legend=nv.models.legend(),controls=nv.models.legend(),tooltip=nv.models.tooltip();var margin={top:30,right:20,bottom:50,left:60},marginTop=null,width=null,height=null,color=nv.utils.defaultColor(),showControls=true,controlLabels={},showLegend=true,legendPosition=null,showXAxis=true,showYAxis=true,rightAlignYAxis=false,reduceXTicks=true,staggerLabels=false,wrapLabels=false,rotateLabels=0,x,y,state=nv.utils.state(),defaultState=null,noData=null,dispatch=d3.dispatch("stateChange","changeState","renderEnd"),controlWidth=function(){return showControls?180:0},duration=250,useInteractiveGuideline=false;state.stacked=false;multibar.stacked(false);xAxis.orient("bottom").tickPadding(7).showMaxMin(false).tickFormat(function(d){return d});yAxis.orient(rightAlignYAxis?"right":"left").tickFormat(d3.format(",.1f"));tooltip.duration(0).valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});interactiveLayer.tooltip.valueFormatter(function(d,i){return d==null?"N/A":yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});interactiveLayer.tooltip.valueFormatter(function(d,i){return d==null?"N/A":yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});interactiveLayer.tooltip.duration(0).valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});controls.updateState(false);var renderWatch=nv.utils.renderWatch(dispatch);var stacked=false;var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled}),stacked:stacked}}};var stateSetter=function(data){return function(state){if(state.stacked!==undefined)stacked=state.stacked;if(state.active!==undefined)data.forEach(function(series,i){series.disabled=!state.active[i]})}};function chart(selection){renderWatch.reset();renderWatch.models(multibar);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){if(duration===0)container.call(chart);else container.transition().duration(duration).call(chart)};chart.container=this;state.setter(stateSetter(data),chart.update).getter(stateGetter(data)).update();state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}x=multibar.xScale();y=multibar.yScale();var wrap=container.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-barsWrap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");gEnter.append("g").attr("class","nv-interactive");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{if(legendPosition==="bottom"){legend.width(availableWidth-margin.right);g.select(".nv-legendWrap").datum(data).call(legend);margin.bottom=xAxis.height()+legend.height();availableHeight=nv.utils.availableHeight(height,container,margin);g.select(".nv-legendWrap").attr("transform","translate(0,"+(availableHeight+xAxis.height())+")")}else{legend.width(availableWidth-controlWidth());g.select(".nv-legendWrap").datum(data).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}g.select(".nv-legendWrap").attr("transform","translate("+controlWidth()+","+-margin.top+")")}}if(!showControls){g.select(".nv-controlsWrap").selectAll("*").remove()}else{var controlsData=[{key:controlLabels.grouped||"Grouped",disabled:multibar.stacked()},{key:controlLabels.stacked||"Stacked",disabled:!multibar.stacked()}];controls.width(controlWidth()).color(["#444","#444","#444"]);g.select(".nv-controlsWrap").datum(controlsData).attr("transform","translate(0,"+-margin.top+")").call(controls)}wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}multibar.disabled(data.map(function(series){return series.disabled})).width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));var barsWrap=g.select(".nv-barsWrap").datum(data.filter(function(d){return!d.disabled}));barsWrap.call(multibar);if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");g.select(".nv-x.nv-axis").call(xAxis);var xTicks=g.select(".nv-x.nv-axis > g").selectAll("g");xTicks.selectAll("line, text").style("opacity",1);if(staggerLabels){var getTranslate=function(x,y){return"translate("+x+","+y+")"};var staggerUp=5,staggerDown=17;xTicks.selectAll("text").attr("transform",function(d,i,j){return getTranslate(0,j%2==0?staggerUp:staggerDown)});var totalInBetweenTicks=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(d,i){return getTranslate(0,i===0||totalInBetweenTicks%2!==0?staggerDown:staggerUp)})}if(wrapLabels){g.selectAll(".tick text").call(nv.utils.wrapTicks,chart.xAxis.rangeBand())}if(reduceXTicks)xTicks.filter(function(d,i){return i%Math.ceil(data[0].values.length/(availableWidth/100))!==0}).selectAll("text, line").style("opacity",0);if(rotateLabels)xTicks.selectAll(".tick text").attr("transform","rotate("+rotateLabels+" 0,0)").style("text-anchor",rotateLabels>0?"start":"end");g.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}if(showYAxis){yAxis.scale(y)._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").call(yAxis)}if(useInteractiveGuideline){interactiveLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-interactive").call(interactiveLayer)}legend.dispatch.on("stateChange",function(newState){for(var key in newState)state[key]=newState[key];dispatch.stateChange(state);chart.update()});controls.dispatch.on("legendClick",function(d,i){if(!d.disabled)return;controlsData=controlsData.map(function(s){s.disabled=true;return s});d.disabled=false;switch(d.key){case"Grouped":case controlLabels.grouped:multibar.stacked(false);break;case"Stacked":case controlLabels.stacked:multibar.stacked(true);break}state.stacked=multibar.stacked();dispatch.stateChange(state);chart.update()});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}if(typeof e.stacked!=="undefined"){multibar.stacked(e.stacked);state.stacked=e.stacked;stacked=e.stacked}chart.update()});if(useInteractiveGuideline){interactiveLayer.dispatch.on("elementMousemove",function(e){if(e.pointXValue==undefined)return;var singlePoint,pointIndex,pointXLocation,xValue,allData=[];data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series,i){pointIndex=x.domain().indexOf(e.pointXValue);var point=series.values[pointIndex];if(point===undefined)return;xValue=point.x;if(singlePoint===undefined)singlePoint=point;if(pointXLocation===undefined)pointXLocation=e.mouseX;allData.push({key:series.key,value:chart.y()(point,pointIndex),color:color(series,series.seriesIndex),data:series.values[pointIndex]})});interactiveLayer.tooltip.data({value:xValue,index:pointIndex,series:allData})();interactiveLayer.renderGuideLine(pointXLocation)});interactiveLayer.dispatch.on("elementMouseout",function(e){interactiveLayer.tooltip.hidden(true)})}else{multibar.dispatch.on("elementMouseover.tooltip",function(evt){evt.value=chart.x()(evt.data);evt["series"]={key:evt.data.key,value:chart.y()(evt.data),color:evt.color};tooltip.data(evt).hidden(false)});multibar.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});multibar.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()})}});renderWatch.renderEnd("multibarchart immediate");return chart}chart.dispatch=dispatch;chart.multibar=multibar;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.state=state;chart.tooltip=tooltip;chart.interactiveLayer=interactiveLayer;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},legendPosition:{get:function(){return legendPosition},set:function(_){legendPosition=_}},showControls:{get:function(){return showControls},set:function(_){showControls=_}},controlLabels:{get:function(){return controlLabels},set:function(_){controlLabels=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},noData:{get:function(){return noData},set:function(_){noData=_}},reduceXTicks:{get:function(){return reduceXTicks},set:function(_){reduceXTicks=_}},rotateLabels:{get:function(){return rotateLabels},set:function(_){rotateLabels=_}},staggerLabels:{get:function(){return staggerLabels},set:function(_){staggerLabels=_}},wrapLabels:{get:function(){return wrapLabels},set:function(_){wrapLabels=!!_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;multibar.duration(duration);xAxis.duration(duration);yAxis.duration(duration);renderWatch.reset(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color)}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(rightAlignYAxis?"right":"left")}},useInteractiveGuideline:{get:function(){return useInteractiveGuideline},set:function(_){useInteractiveGuideline=_}},barColor:{get:function(){return multibar.barColor},set:function(_){multibar.barColor(_);legend.color(function(d,i){return d3.rgb("#ccc").darker(i*1.5).toString()})}}});nv.utils.inheritOptions(chart,multibar);nv.utils.initOptions(chart);return chart};nv.models.multiBarHorizontal=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,id=Math.floor(Math.random()*1e4),container=null,x=d3.scale.ordinal(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},getYerr=function(d){return d.yErr},forceY=[0],color=nv.utils.defaultColor(),barColor=null,disabled,stacked=false,showValues=false,showBarLabels=false,valuePadding=60,groupSpacing=.1,fillOpacity=.75,valueFormat=d3.format(",.2f"),delay=1200,xDomain,yDomain,xRange,yRange,duration=250,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd");var x0,y0;var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);if(stacked)data=d3.layout.stack().offset("zero").values(function(d){return d.values}).y(getY)(data);data.forEach(function(series,i){series.values.forEach(function(point){point.series=i;point.key=series.key})});if(stacked)data[0].values.map(function(d,i){var posBase=0,negBase=0;data.map(function(d){var f=d.values[i];f.size=Math.abs(f.y);if(f.y<0){f.y1=negBase-f.size;negBase=negBase-f.size}else{f.y1=posBase;posBase=posBase+f.size}})});var seriesData=xDomain&&yDomain?[]:data.map(function(d){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i),y0:d.y0,y1:d.y1}})});x.domain(xDomain||d3.merge(seriesData).map(function(d){return d.x})).rangeBands(xRange||[0,availableHeight],groupSpacing);y.domain(yDomain||d3.extent(d3.merge(seriesData).map(function(d){return stacked?d.y>0?d.y1+d.y:d.y1:d.y}).concat(forceY)));if(showValues&&!stacked)y.range(yRange||[y.domain()[0]<0?valuePadding:0,availableWidth-(y.domain()[1]>0?valuePadding:0)]);else y.range(yRange||[0,availableWidth]);x0=x0||x;y0=y0||d3.scale.linear().domain(y.domain()).range([y(0),y(0)]);var wrap=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-groups");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var groups=wrap.select(".nv-groups").selectAll(".nv-group").data(function(d){return d},function(d,i){return i});groups.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);groups.exit().watchTransition(renderWatch,"multibarhorizontal: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();groups.attr("class",function(d,i){return"nv-group nv-series-"+i}).classed("hover",function(d){return d.hover}).style("fill",function(d,i){return color(d,i)}).style("stroke",function(d,i){return color(d,i)});groups.watchTransition(renderWatch,"multibarhorizontal: groups").style("stroke-opacity",1).style("fill-opacity",fillOpacity);var bars=groups.selectAll("g.nv-bar").data(function(d){return d.values});bars.exit().remove();var barsEnter=bars.enter().append("g").attr("transform",function(d,i,j){return"translate("+y0(stacked?d.y0:0)+","+(stacked?0:j*x.rangeBand()/data.length+x(getX(d,i)))+")"});barsEnter.append("rect").attr("width",0).attr("height",x.rangeBand()/(stacked?1:data.length));bars.on("mouseover",function(d,i){d3.select(this).classed("hover",true);dispatch.elementMouseover({data:d,index:i,color:d3.select(this).style("fill")})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false);dispatch.elementMouseout({data:d,index:i,color:d3.select(this).style("fill")})}).on("mouseout",function(d,i){dispatch.elementMouseout({data:d,index:i,color:d3.select(this).style("fill")})}).on("mousemove",function(d,i){dispatch.elementMousemove({data:d,index:i,color:d3.select(this).style("fill")})}).on("click",function(d,i){var element=this;dispatch.elementClick({data:d,index:i,color:d3.select(this).style("fill"),event:d3.event,element:element});d3.event.stopPropagation()}).on("dblclick",function(d,i){dispatch.elementDblClick({data:d,index:i,color:d3.select(this).style("fill")});d3.event.stopPropagation()});if(getYerr(data[0],0)){barsEnter.append("polyline");bars.select("polyline").attr("fill","none").attr("points",function(d,i){var xerr=getYerr(d,i),mid=.8*x.rangeBand()/((stacked?1:data.length)*2);xerr=xerr.length?xerr:[-Math.abs(xerr),Math.abs(xerr)];xerr=xerr.map(function(e){return y(e+(getY(d,i)<0?0:getY(d,i)))-y(0)});var a=[[xerr[0],-mid],[xerr[0],mid],[xerr[0],0],[xerr[1],0],[xerr[1],-mid],[xerr[1],mid]];return a.map(function(path){return path.join(",")}).join(" ")}).attr("transform",function(d,i){var mid=x.rangeBand()/((stacked?1:data.length)*2);return"translate(0, "+mid+")"})}barsEnter.append("text");if(showValues&&!stacked){bars.select("text").attr("text-anchor",function(d,i){return getY(d,i)<0?"end":"start"}).attr("y",x.rangeBand()/(data.length*2)).attr("dy",".32em").text(function(d,i){var t=valueFormat(getY(d,i)),yerr=getYerr(d,i);if(yerr===undefined)return t;if(!yerr.length)return t+"±"+valueFormat(Math.abs(yerr));return t+"+"+valueFormat(Math.abs(yerr[1]))+"-"+valueFormat(Math.abs(yerr[0]))});bars.watchTransition(renderWatch,"multibarhorizontal: bars").select("text").attr("x",function(d,i){return getY(d,i)<0?-4:y(getY(d,i))-y(0)+4})}else{bars.selectAll("text").text("")}if(showBarLabels&&!stacked){barsEnter.append("text").classed("nv-bar-label",true);bars.select("text.nv-bar-label").attr("text-anchor",function(d,i){return getY(d,i)<0?"start":"end"}).attr("y",x.rangeBand()/(data.length*2)).attr("dy",".32em").text(function(d,i){return getX(d,i)});bars.watchTransition(renderWatch,"multibarhorizontal: bars").select("text.nv-bar-label").attr("x",function(d,i){return getY(d,i)<0?y(0)-y(getY(d,i))+4:-4})}else{bars.selectAll("text.nv-bar-label").text("")}bars.attr("class",function(d,i){return getY(d,i)<0?"nv-bar negative":"nv-bar positive"});if(barColor){if(!disabled)disabled=data.map(function(){return true});bars.style("fill",function(d,i,j){return d3.rgb(barColor(d,i)).darker(disabled.map(function(d,i){return i}).filter(function(d,i){return!disabled[i]})[j]).toString()}).style("stroke",function(d,i,j){return d3.rgb(barColor(d,i)).darker(disabled.map(function(d,i){return i}).filter(function(d,i){return!disabled[i]})[j]).toString()})}if(stacked)bars.watchTransition(renderWatch,"multibarhorizontal: bars").attr("transform",function(d,i){return"translate("+y(d.y1)+","+x(getX(d,i))+")"}).select("rect").attr("width",function(d,i){return Math.abs(y(getY(d,i)+d.y0)-y(d.y0))||0}).attr("height",x.rangeBand());else bars.watchTransition(renderWatch,"multibarhorizontal: bars").attr("transform",function(d,i){return"translate("+(getY(d,i)<0?y(getY(d,i)):y(0))+","+(d.series*x.rangeBand()/data.length+x(getX(d,i)))+")"}).select("rect").attr("height",x.rangeBand()/data.length).attr("width",function(d,i){return Math.max(Math.abs(y(getY(d,i))-y(0)),1)||0});x0=x.copy();y0=y.copy()});renderWatch.renderEnd("multibarHorizontal immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},x:{get:function(){return getX},set:function(_){getX=_}},y:{get:function(){return getY},set:function(_){getY=_}},yErr:{get:function(){return getYerr},set:function(_){getYerr=_}},xScale:{get:function(){return x},set:function(_){x=_}},yScale:{get:function(){return y},set:function(_){y=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},forceY:{get:function(){return forceY},set:function(_){forceY=_}},stacked:{get:function(){return stacked},set:function(_){stacked=_}},showValues:{get:function(){return showValues},set:function(_){showValues=_}},disabled:{get:function(){return disabled},set:function(_){disabled=_}},id:{get:function(){return id},set:function(_){id=_}},valueFormat:{get:function(){return valueFormat},set:function(_){valueFormat=_}},valuePadding:{get:function(){return valuePadding},set:function(_){valuePadding=_}},groupSpacing:{get:function(){return groupSpacing},set:function(_){groupSpacing=_}},fillOpacity:{get:function(){return fillOpacity},set:function(_){fillOpacity=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},barColor:{get:function(){return barColor},set:function(_){barColor=_?nv.utils.getColor(_):null}}});nv.utils.initOptions(chart);return chart};nv.models.multiBarHorizontalChart=function(){"use strict";var multibar=nv.models.multiBarHorizontal(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend().height(30),controls=nv.models.legend().height(30),tooltip=nv.models.tooltip();var margin={top:30,right:20,bottom:50,left:60},marginTop=null,width=null,height=null,color=nv.utils.defaultColor(),showControls=true,controlsPosition="top",controlLabels={},showLegend=true,legendPosition="top",showXAxis=true,showYAxis=true,stacked=false,x,y,state=nv.utils.state(),defaultState=null,noData=null,dispatch=d3.dispatch("stateChange","changeState","renderEnd"),controlWidth=function(){return showControls?180:0},duration=250;state.stacked=false;multibar.stacked(stacked);xAxis.orient("left").tickPadding(5).showMaxMin(false).tickFormat(function(d){return d});yAxis.orient("bottom").tickFormat(d3.format(",.1f"));tooltip.duration(0).valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)}).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)});controls.updateState(false);var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled}),stacked:stacked}}};var stateSetter=function(data){return function(state){if(state.stacked!==undefined)stacked=state.stacked;if(state.active!==undefined)data.forEach(function(series,i){series.disabled=!state.active[i]})}};var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();renderWatch.models(multibar);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){container.transition().duration(duration).call(chart)};chart.container=this;stacked=multibar.stacked();state.setter(stateSetter(data),chart.update).getter(stateGetter(data)).update();state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}x=multibar.xScale();y=multibar.yScale().clamp(true);var wrap=container.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line");gEnter.append("g").attr("class","nv-barsWrap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{legend.width(availableWidth-controlWidth());g.select(".nv-legendWrap").datum(data).call(legend);if(legendPosition==="bottom"){margin.bottom=xAxis.height()+legend.height();availableHeight=nv.utils.availableHeight(height,container,margin);g.select(".nv-legendWrap").attr("transform","translate("+controlWidth()+","+(availableHeight+xAxis.height())+")")}else if(legendPosition==="top"){if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}g.select(".nv-legendWrap").attr("transform","translate("+controlWidth()+","+-margin.top+")")}}if(!showControls){g.select(".nv-controlsWrap").selectAll("*").remove()}else{var controlsData=[{key:controlLabels.grouped||"Grouped",disabled:multibar.stacked()},{key:controlLabels.stacked||"Stacked",disabled:!multibar.stacked()}];controls.width(controlWidth()).color(["#444","#444","#444"]);if(controlsPosition==="bottom"){margin.bottom=xAxis.height()+legend.height();availableHeight=nv.utils.availableHeight(height,container,margin);g.select(".nv-controlsWrap").datum(controlsData).attr("transform","translate(0,"+(availableHeight+xAxis.height())+")").call(controls)}else if(controlsPosition==="top"){g.select(".nv-controlsWrap").datum(controlsData).attr("transform","translate(0,"+-margin.top+")").call(controls)}}wrap.attr("transform","translate("+margin.left+","+margin.top+")");multibar.disabled(data.map(function(series){return series.disabled})).width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));var barsWrap=g.select(".nv-barsWrap").datum(data.filter(function(d){return!d.disabled}));barsWrap.transition().call(multibar);if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksY(availableHeight/24,data)).tickSize(-availableWidth,0);g.select(".nv-x.nv-axis").call(xAxis);var xTicks=g.select(".nv-x.nv-axis").selectAll("g");xTicks.selectAll("line, text")}if(showYAxis){yAxis.scale(y)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-y.nv-axis").attr("transform","translate(0,"+availableHeight+")");g.select(".nv-y.nv-axis").call(yAxis)}g.select(".nv-zeroLine line").attr("x1",y(0)).attr("x2",y(0)).attr("y1",0).attr("y2",-availableHeight);legend.dispatch.on("stateChange",function(newState){for(var key in newState)state[key]=newState[key];dispatch.stateChange(state);chart.update()});controls.dispatch.on("legendClick",function(d,i){if(!d.disabled)return;controlsData=controlsData.map(function(s){s.disabled=true;return s});d.disabled=false;switch(d.key){case"Grouped":case controlLabels.grouped:multibar.stacked(false);break;case"Stacked":case controlLabels.stacked:multibar.stacked(true);break}state.stacked=multibar.stacked();dispatch.stateChange(state);stacked=multibar.stacked();chart.update()});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}if(typeof e.stacked!=="undefined"){multibar.stacked(e.stacked);state.stacked=e.stacked;stacked=e.stacked}chart.update()})});renderWatch.renderEnd("multibar horizontal chart immediate");return chart}multibar.dispatch.on("elementMouseover.tooltip",function(evt){evt.value=chart.x()(evt.data);evt["series"]={key:evt.data.key,value:chart.y()(evt.data),color:evt.color};tooltip.data(evt).hidden(false)});multibar.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});multibar.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.dispatch=dispatch;chart.multibar=multibar;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.state=state;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},legendPosition:{get:function(){return legendPosition},set:function(_){legendPosition=_}},controlsPosition:{get:function(){return controlsPosition},set:function(_){controlsPosition=_}},showControls:{get:function(){return showControls},set:function(_){showControls=_}},controlLabels:{get:function(){return controlLabels},set:function(_){controlLabels=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},noData:{get:function(){return noData},set:function(_){noData=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);multibar.duration(duration);xAxis.duration(duration);yAxis.duration(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color)}},barColor:{get:function(){return multibar.barColor},set:function(_){multibar.barColor(_);legend.color(function(d,i){return d3.rgb("#ccc").darker(i*1.5).toString()})}}});nv.utils.inheritOptions(chart,multibar);nv.utils.initOptions(chart);return chart};nv.models.multiChart=function(){"use strict";var margin={top:30,right:20,bottom:50,left:60},marginTop=null,color=nv.utils.defaultColor(),width=null,height=null,showLegend=true,noData=null,yDomain1,yDomain2,yDomainMinY1,yDomainMinY2,yDomainRatioY1=1,yDomainRatioY2=1,getX=function(d){return d.x},getY=function(d){return d.y},interpolate="linear",useVoronoi=true,interactiveLayer=nv.interactiveGuideline(),useInteractiveGuideline=false,zoomType=null,legendRightAxisHint=" (right axis)",duration=250;var x=d3.scale.linear(),yScale1=d3.scale.linear(),yScale2=d3.scale.linear(),lines1=nv.models.line().yScale(yScale1).duration(duration),lines2=nv.models.line().yScale(yScale2).duration(duration),scatters1=nv.models.scatter().yScale(yScale1).duration(duration),scatters2=nv.models.scatter().yScale(yScale2).duration(duration),bars1=nv.models.multiBar().stacked(false).yScale(yScale1).duration(duration),bars2=nv.models.multiBar().stacked(false).yScale(yScale2).duration(duration),stack1=nv.models.stackedArea().yScale(yScale1).duration(duration),stack2=nv.models.stackedArea().yScale(yScale2).duration(duration),xAxis=nv.models.axis().scale(x).orient("bottom").tickPadding(5).duration(duration),yAxis1=nv.models.axis().scale(yScale1).orient("left").duration(duration),yAxis2=nv.models.axis().scale(yScale2).orient("right").duration(duration),legend=nv.models.legend().height(30).align(false),tooltip=nv.models.tooltip(),dispatch=d3.dispatch("zoom");var charts=[lines1,lines2,scatters1,scatters2,bars1,bars2,stack1,stack2];function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;var divContainer=d3.select(this.parentNode);nv.utils.initSVG(container);chart.update=function(){container.transition().call(chart)};chart.container=this;var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);var dataLines1=data.filter(function(d){return d.type=="line"&&d.yAxis==1});var dataLines2=data.filter(function(d){return d.type=="line"&&d.yAxis==2});var dataScatters1=data.filter(function(d){return d.type=="scatter"&&d.yAxis==1});var dataScatters2=data.filter(function(d){return d.type=="scatter"&&d.yAxis==2});var dataBars1=data.filter(function(d){return d.type=="bar"&&d.yAxis==1});var dataBars2=data.filter(function(d){return d.type=="bar"&&d.yAxis==2});var dataStack1=data.filter(function(d){return d.type=="area"&&d.yAxis==1});var dataStack2=data.filter(function(d){return d.type=="area"&&d.yAxis==2});if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}var series_mapper=function(d){return d.values.map(function(d,i){return{x:getX(d),y:getY(d)}})};var is_stacked=function(d){return d.type=="area"||d.type=="bar"&&d.yAxis==1&&bars1.stacked()||d.type=="bar"&&d.yAxis==2&&bars2.stacked()};var series1=data.filter(function(d){return!d.disabled&&d.yAxis==1}).map(series_mapper);var series1_stacked=data.filter(function(d){return!d.disabled&&d.yAxis==1&&is_stacked(d)}).map(series_mapper);var series2=data.filter(function(d){return!d.disabled&&d.yAxis==2}).map(series_mapper);var series2_stacked=data.filter(function(d){return!d.disabled&&d.yAxis==2&&is_stacked(d)}).map(series_mapper);x.domain(d3.extent(d3.merge(series1.concat(series2)),function(d){return d.x})).range([0,availableWidth]);var wrap=container.selectAll("g.wrap.multiChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y1 nv-axis");gEnter.append("g").attr("class","nv-y2 nv-axis");gEnter.append("g").attr("class","stack1Wrap");gEnter.append("g").attr("class","stack2Wrap");gEnter.append("g").attr("class","bars1Wrap");gEnter.append("g").attr("class","bars2Wrap");gEnter.append("g").attr("class","scatters1Wrap");gEnter.append("g").attr("class","scatters2Wrap");gEnter.append("g").attr("class","lines1Wrap");gEnter.append("g").attr("class","lines2Wrap");gEnter.append("g").attr("class","legendWrap");gEnter.append("g").attr("class","nv-interactive");gEnter.append("g").attr("class","nv-zoomLayer");var g=wrap.select("g");var color_array=data.map(function(d,i){return data[i].color||color(d,i)});if(!showLegend){g.select(".legendWrap").selectAll("*").remove()}else{var legendWidth=legend.align()?availableWidth/2:availableWidth;var legendXPosition=legend.align()?legendWidth:0;legend.width(legendWidth);legend.color(color_array);g.select(".legendWrap").datum(data.map(function(series){series.originalKey=series.originalKey===undefined?series.key:series.originalKey;series.key=series.originalKey+(series.yAxis==1?"":legendRightAxisHint);return series})).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}g.select(".legendWrap").attr("transform","translate("+legendXPosition+","+-margin.top+")")}lines1.width(availableWidth).height(availableHeight).interpolate(interpolate).color(color_array.filter(function(d,i){return!data[i].disabled&&data[i].yAxis==1&&data[i].type=="line"}));lines2.width(availableWidth).height(availableHeight).interpolate(interpolate).color(color_array.filter(function(d,i){return!data[i].disabled&&data[i].yAxis==2&&data[i].type=="line"}));scatters1.width(availableWidth).height(availableHeight).color(color_array.filter(function(d,i){return!data[i].disabled&&data[i].yAxis==1&&data[i].type=="scatter"}));scatters2.width(availableWidth).height(availableHeight).color(color_array.filter(function(d,i){return!data[i].disabled&&data[i].yAxis==2&&data[i].type=="scatter"}));bars1.width(availableWidth).height(availableHeight).color(color_array.filter(function(d,i){return!data[i].disabled&&data[i].yAxis==1&&data[i].type=="bar"}));bars2.width(availableWidth).height(availableHeight).color(color_array.filter(function(d,i){return!data[i].disabled&&data[i].yAxis==2&&data[i].type=="bar"}));stack1.width(availableWidth).height(availableHeight).interpolate(interpolate).color(color_array.filter(function(d,i){return!data[i].disabled&&data[i].yAxis==1&&data[i].type=="area"}));stack2.width(availableWidth).height(availableHeight).interpolate(interpolate).color(color_array.filter(function(d,i){return!data[i].disabled&&data[i].yAxis==2&&data[i].type=="area"}));g.attr("transform","translate("+margin.left+","+margin.top+")");var lines1Wrap=g.select(".lines1Wrap").datum(dataLines1.filter(function(d){return!d.disabled}));var scatters1Wrap=g.select(".scatters1Wrap").datum(dataScatters1.filter(function(d){return!d.disabled}));var bars1Wrap=g.select(".bars1Wrap").datum(dataBars1.filter(function(d){return!d.disabled}));var stack1Wrap=g.select(".stack1Wrap").datum(dataStack1.filter(function(d){return!d.disabled}));var lines2Wrap=g.select(".lines2Wrap").datum(dataLines2.filter(function(d){return!d.disabled}));var scatters2Wrap=g.select(".scatters2Wrap").datum(dataScatters2.filter(function(d){return!d.disabled}));var bars2Wrap=g.select(".bars2Wrap").datum(dataBars2.filter(function(d){return!d.disabled}));var stack2Wrap=g.select(".stack2Wrap").datum(dataStack2.filter(function(d){return!d.disabled}));var extraValue1BarStacked=[];if(bars1.stacked()&&dataBars1.length){var extraValue1BarStacked=dataBars1.filter(function(d){return!d.disabled}).map(function(a){return a.values});if(extraValue1BarStacked.length>0)extraValue1BarStacked=extraValue1BarStacked.reduce(function(a,b){return a.map(function(aVal,i){return{x:aVal.x,y:aVal.y+b[i].y}})})}if(dataBars1.length){extraValue1BarStacked.push({x:0,y:0})}var extraValue2BarStacked=[];if(bars2.stacked()&&dataBars2.length){var extraValue2BarStacked=dataBars2.filter(function(d){return!d.disabled}).map(function(a){return a.values});if(extraValue2BarStacked.length>0)extraValue2BarStacked=extraValue2BarStacked.reduce(function(a,b){return a.map(function(aVal,i){return{x:aVal.x,y:aVal.y+b[i].y}})})}if(dataBars2.length){extraValue2BarStacked.push({x:0,y:0})}function getStackedAreaYs(series){return d3.transpose(series).map(function(x){return x.map(function(g){return g.y})}).map(function(x){return d3.sum(x)})}var ydomain1=yDomain1||d3.extent(d3.merge(series1).concat(extraValue1BarStacked),function(d){return d.y});if(typeof yDomainMinY1==="number")ydomain1[0]=yDomainMinY1;ydomain1[1]/=yDomainRatioY1;yScale1.domain(ydomain1).range([0,availableHeight]);var series1_stacked_y_domain=d3.max(getStackedAreaYs(series1_stacked));if(series1_stacked_y_domain){yScale1.domain([0,Math.max(series1_stacked_y_domain,yScale1.domain()[1])]).range([0,availableHeight])}var ydomain2=yDomain2||d3.extent(d3.merge(series2).concat(extraValue2BarStacked),function(d){return d.y});if(typeof yDomainMinY2==="number")ydomain2[0]=yDomainMinY2;ydomain2[1]/=yDomainRatioY2;yScale2.domain(ydomain2).range([0,availableHeight]);var series2_stacked_y_domain=d3.max(getStackedAreaYs(series2_stacked));if(series2_stacked_y_domain){yScale2.domain([0,Math.max(series2_stacked_y_domain,yScale2.domain()[1])]).range([0,availableHeight])}lines1.yDomain(yScale1.domain());scatters1.yDomain(yScale1.domain());bars1.yDomain(yScale1.domain());stack1.yDomain(yScale1.domain());lines2.yDomain(yScale2.domain());scatters2.yDomain(yScale2.domain());bars2.yDomain(yScale2.domain());stack2.yDomain(yScale2.domain());if(dataStack1.length){d3.transition(stack1Wrap).call(stack1)}if(dataStack2.length){d3.transition(stack2Wrap).call(stack2)}if(dataBars1.length){d3.transition(bars1Wrap).call(bars1)}if(dataBars2.length){d3.transition(bars2Wrap).call(bars2)}if(dataLines1.length){d3.transition(lines1Wrap).call(lines1)}if(dataLines2.length){d3.transition(lines2Wrap).call(lines2)}if(dataScatters1.length){d3.transition(scatters1Wrap).call(scatters1)}if(dataScatters2.length){d3.transition(scatters2Wrap).call(scatters2)}xAxis._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+availableHeight+")");d3.transition(g.select(".nv-x.nv-axis")).call(xAxis);yAxis1._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0);d3.transition(g.select(".nv-y1.nv-axis")).call(yAxis1);yAxis2._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0);d3.transition(g.select(".nv-y2.nv-axis")).call(yAxis2);g.select(".nv-y1.nv-axis").classed("nv-disabled",series1.length?false:true).attr("transform","translate("+x.range()[0]+",0)");g.select(".nv-y2.nv-axis").classed("nv-disabled",series2.length?false:true).attr("transform","translate("+x.range()[1]+",0)");legend.dispatch.on("stateChange",function(newState){chart.update()});function set_stroke_hints(container,dataSeries,maxY){var min_ratio=.02;var unstroked_idx=-1;function stroke_hint(i,hint){container.selectAll(".nv-area-"+i).classed("nv-area-stroke-hint",hint)}dataSeries.filter(function(d){return!d.disabled}).map(function(d,i){var max_value=d3.max(d.values,function(pt){return pt[1]});var ratio=max_value/maxY;if(ratio>=min_ratio){if(unstroked_idx>=0)stroke_hint(unstroked_idx,true);stroke_hint(i,true);unstroked_idx=-1}else{stroke_hint(i,false);unstroked_idx=i}})}set_stroke_hints(stack1Wrap,dataStack1,series1_stacked_y_domain);set_stroke_hints(stack2Wrap,dataStack2,series2_stacked_y_domain);if(useInteractiveGuideline){interactiveLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-interactive").call(interactiveLayer);zoomLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(divContainer).xScale(x);wrap.select(".nv-zoomLayer").call(zoomLayer)}function mouseover_line(evt){var yaxis=evt.series.yAxis===2?yAxis2:yAxis1;evt.value=evt.point.x;evt.series={value:evt.point.y,color:evt.point.color,key:evt.series.key};tooltip.duration(0).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)}).valueFormatter(function(d,i){return yaxis.tickFormat()(d,i)}).data(evt).hidden(false)}function mouseover_scatter(evt){var yaxis=evt.series.yAxis===2?yAxis2:yAxis1;evt.value=evt.point.x;evt.series={value:evt.point.y,color:evt.point.color,key:evt.series.key};tooltip.duration(100).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)}).valueFormatter(function(d,i){return yaxis.tickFormat()(d,i)}).data(evt).hidden(false)}function mouseover_stack(evt){var yaxis=evt.series.yAxis===2?yAxis2:yAxis1;evt.point["x"]=stack1.x()(evt.point);evt.point["y"]=stack1.y()(evt.point);tooltip.duration(0).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)}).valueFormatter(function(d,i){return yaxis.tickFormat()(d,i)}).data(evt).hidden(false)}function mouseover_bar(evt){var yaxis=evt.series.yAxis===2?yAxis2:yAxis1;evt.value=bars1.x()(evt.data);evt["series"]={value:bars1.y()(evt.data),color:evt.color,key:evt.data.key};tooltip.duration(0).headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)}).valueFormatter(function(d,i){return yaxis.tickFormat()(d,i)}).data(evt).hidden(false)}function clearHighlights(){for(var i=0,il=charts.length;i<il;i++){var chart=charts[i];try{chart.clearHighlights()}catch(e){}}}function highlightPoint(series,pointIndex,b,pointYValue){var chartMap={line:{yAxis1:{chart:lines1,data:dataLines1},yAxis2:{chart:lines2,data:dataLines2}},scatter:{yAxis1:{chart:scatters1,data:dataScatters1},yAxis2:{chart:scatters2,data:dataScatters2}},bar:{yAxis1:{chart:bars1,data:dataBars1},yAxis2:{chart:bars2,data:dataBars2}},area:{yAxis1:{chart:stack1,data:dataStack1},yAxis2:{chart:stack2,data:dataStack2}}};var relevantChart=chartMap[series.type]["yAxis"+series.yAxis].chart;var relevantDatasets=chartMap[series.type]["yAxis"+series.yAxis].data.filter(function(series){return!series.disabled});var seriesIndex=relevantDatasets.reduce(function(seriesIndex,dataSet,i){return dataSet.key===series.key?i:seriesIndex},0);try{relevantChart.highlightPoint(seriesIndex,pointIndex,b,pointYValue)}catch(e){}}if(useInteractiveGuideline){interactiveLayer.dispatch.on("elementMousemove",function(e){clearHighlights();var singlePoint,pointIndex,pointXLocation,allData=[];data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series,i){var extent=x.domain();var currentValues=series.values.filter(function(d,i){return chart.x()(d,i)>=extent[0]&&chart.x()(d,i)<=extent[1]});pointIndex=nv.interactiveBisect(currentValues,e.pointXValue,chart.x());var point=currentValues[pointIndex];var pointYValue=chart.y()(point,pointIndex);if(pointYValue!==null&&!isNaN(pointYValue)&&!series.noHighlightSeries){highlightPoint(series,pointIndex,true)}if(point===undefined)return;if(singlePoint===undefined)singlePoint=point;if(pointXLocation===undefined)pointXLocation=x(chart.x()(point,pointIndex));allData.push({key:series.key,value:pointYValue,color:color(series,series.seriesIndex),data:point,yAxis:series.yAxis==2?yAxis2:yAxis1,yAxis_idx:series.yAxis})});var defaultValueFormatter=function(d,i){var yAxis=allData[i].yAxis;return d==null?"N/A":yAxis.tickFormat()(d)};interactiveLayer.tooltip.headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)}).valueFormatter(interactiveLayer.tooltip.valueFormatter()||defaultValueFormatter).data({value:chart.x()(singlePoint,pointIndex),index:pointIndex,series:allData})();interactiveLayer.renderGuideLine(pointXLocation)});interactiveLayer.dispatch.on("elementMouseout",function(e){clearHighlights()});if(zoomType==="x"){var currentXValue=null;var dragStartX=null;var dragStartXValue=null;var dragStartYValue=null;zoomLayer.dispatch.on("elementMousemove",function(e){if(zoomType!=="x")return;if(dragStartXValue===null){return}var pointXLocation;currentXValue=e.pointXValue;data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series){var pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());var point=series.values[pointIndex];if(typeof point==="undefined")return;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex))});zoomLayer.updateSelectArea(dragStartX,pointXLocation)});zoomLayer.dispatch.on("elementDragStart",function(e){if(zoomType!=="x")return;var pointXLocation;dragStartXValue=e.pointXValue;data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series){var pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());var point=series.values[pointIndex];if(typeof point==="undefined")return;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex))});dragStartX=pointXLocation;zoomLayer.renderSelectArea(pointXLocation)});zoomLayer.dispatch.on("elementDragAbort",function(e){dragStartXValue=null;dragStartX=null;zoomLayer.removeSelectArea()});zoomLayer.dispatch.on("elementDragEnd",function(e){if(zoomType!=="x")return;var MIN_X_DISTANCE=3;if(dragStartXValue&&Math.abs(dragStartXValue-currentXValue)>=MIN_X_DISTANCE){var xDomain=[d3.min([dragStartXValue,currentXValue]),d3.max([dragStartXValue,currentXValue])];dispatch.zoom({type:"zoom",xDomain:xDomain})}dragStartXValue=null;dragStartX=null;zoomLayer.removeSelectArea()})}}else{lines1.dispatch.on("elementMouseover.tooltip",mouseover_line);lines2.dispatch.on("elementMouseover.tooltip",mouseover_line);lines1.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});lines2.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});scatters1.dispatch.on("elementMouseover.tooltip",mouseover_scatter);scatters2.dispatch.on("elementMouseover.tooltip",mouseover_scatter);scatters1.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});scatters2.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});stack1.dispatch.on("elementMouseover.tooltip",mouseover_stack);stack2.dispatch.on("elementMouseover.tooltip",mouseover_stack);stack1.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});stack2.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});bars1.dispatch.on("elementMouseover.tooltip",mouseover_bar);bars2.dispatch.on("elementMouseover.tooltip",mouseover_bar);bars1.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});bars2.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});bars1.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});bars2.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()})}});return chart}chart.dispatch=dispatch;chart.legend=legend;chart.lines1=lines1;chart.lines2=lines2;chart.scatters1=scatters1;chart.scatters2=scatters2;chart.bars1=bars1;chart.bars2=bars2;chart.stack1=stack1;chart.stack2=stack2;chart.xAxis=xAxis;chart.yAxis1=yAxis1;chart.yAxis2=yAxis2;chart.tooltip=tooltip;chart.interactiveLayer=interactiveLayer;var zoomLayer=nv.zoomLayer();chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},xScale:{get:function(){return x},set:function(_){x=_;xAxis.scale(x)}},yDomainMinY1:{get:function(){return yDomainMinY1},set:function(_){yDomainMinY1=_}},yDomainMinY2:{get:function(){return yDomainMinY2},set:function(_){yDomainMinY2=_}},yDomainRatioY1:{get:function(){return yDomainRatioY1},set:function(_){yDomainRatioY1=_}},yDomainRatioY2:{get:function(){return yDomainRatioY2},set:function(_){yDomainRatioY2=_}},yDomain1:{get:function(){return yDomain1},set:function(_){yDomain1=_}},yDomain2:{get:function(){return yDomain2},set:function(_){yDomain2=_}},noData:{get:function(){return noData},set:function(_){noData=_}},interpolate:{get:function(){return interpolate},set:function(_){interpolate=_}},legendRightAxisHint:{get:function(){return legendRightAxisHint},set:function(_){legendRightAxisHint=_}},zoomType:{get:function(){return zoomType},set:function(_){zoomType=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},x:{get:function(){return getX},set:function(_){getX=_;lines1.x(_);lines2.x(_);scatters1.x(_);scatters2.x(_);bars1.x(_);bars2.x(_);stack1.x(_);stack2.x(_)}},y:{get:function(){return getY},set:function(_){getY=_;lines1.y(_);lines2.y(_);scatters1.y(_);scatters2.y(_);stack1.y(_);stack2.y(_);bars1.y(_);bars2.y(_)}},useVoronoi:{get:function(){return useVoronoi},set:function(_){useVoronoi=_;lines1.useVoronoi(_);lines2.useVoronoi(_);stack1.useVoronoi(_);stack2.useVoronoi(_)}},useInteractiveGuideline:{get:function(){return useInteractiveGuideline},set:function(_){useInteractiveGuideline=_;if(useInteractiveGuideline){lines1.interactive(false);lines1.useVoronoi(false);lines2.interactive(false);lines2.useVoronoi(false);stack1.interactive(false);stack1.useVoronoi(false);stack2.interactive(false);stack2.useVoronoi(false);scatters1.interactive(false);scatters2.interactive(false)}}},duration:{get:function(){return duration},set:function(_){duration=_;[lines1,lines2,stack1,stack2,scatters1,scatters2,xAxis,yAxis1,yAxis2].forEach(function(model){model.duration(duration)})}}});nv.utils.initOptions(chart);return chart};nv.models.ohlcBar=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=null,height=null,id=Math.floor(Math.random()*1e4),container=null,x=d3.scale.linear(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},getOpen=function(d){return d.open},getClose=function(d){return d.close},getHigh=function(d){return d.high},getLow=function(d){return d.low},forceX=[],forceY=[],padData=false,clipEdge=true,color=nv.utils.defaultColor(),interactive=false,xDomain,yDomain,xRange,yRange,dispatch=d3.dispatch("stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");function chart(selection){selection.each(function(data){container=d3.select(this);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);nv.utils.initSVG(container);var w=availableWidth/data[0].values.length*.9;x.domain(xDomain||d3.extent(data[0].values.map(getX).concat(forceX)));if(padData)x.range(xRange||[availableWidth*.5/data[0].values.length,availableWidth*(data[0].values.length-.5)/data[0].values.length]);else x.range(xRange||[5+w/2,availableWidth-w/2-5]);y.domain(yDomain||[d3.min(data[0].values.map(getLow).concat(forceY)),d3.max(data[0].values.map(getHigh).concat(forceY))]).range(yRange||[availableHeight,0]);if(x.domain()[0]===x.domain()[1])x.domain()[0]?x.domain([x.domain()[0]-x.domain()[0]*.01,x.domain()[1]+x.domain()[1]*.01]):x.domain([-1,1]);if(y.domain()[0]===y.domain()[1])y.domain()[0]?y.domain([y.domain()[0]+y.domain()[0]*.01,y.domain()[1]-y.domain()[1]*.01]):y.domain([-1,1]);var wrap=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([data[0].values]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-ticks");wrap.attr("transform","translate("+margin.left+","+margin.top+")");container.on("click",function(d,i){dispatch.chartClick({data:d,index:i,pos:d3.event,id:id})});defsEnter.append("clipPath").attr("id","nv-chart-clip-path-"+id).append("rect");wrap.select("#nv-chart-clip-path-"+id+" rect").attr("width",availableWidth).attr("height",availableHeight);g.attr("clip-path",clipEdge?"url(#nv-chart-clip-path-"+id+")":"");var ticks=wrap.select(".nv-ticks").selectAll(".nv-tick").data(function(d){return d});ticks.exit().remove();ticks.enter().append("path").attr("class",function(d,i,j){return(getOpen(d,i)>getClose(d,i)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+j+"-"+i}).attr("d",function(d,i){return"m0,0l0,"+(y(getOpen(d,i))-y(getHigh(d,i)))+"l"+-w/2+",0l"+w/2+",0l0,"+(y(getLow(d,i))-y(getOpen(d,i)))+"l0,"+(y(getClose(d,i))-y(getLow(d,i)))+"l"+w/2+",0l"+-w/2+",0z"}).attr("transform",function(d,i){return"translate("+x(getX(d,i))+","+y(getHigh(d,i))+")"}).attr("fill",function(d,i){return color[0]}).attr("stroke",function(d,i){return color[0]}).attr("x",0).attr("y",function(d,i){return y(Math.max(0,getY(d,i)))}).attr("height",function(d,i){return Math.abs(y(getY(d,i))-y(0))});ticks.attr("class",function(d,i,j){return(getOpen(d,i)>getClose(d,i)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+j+"-"+i});d3.transition(ticks).attr("transform",function(d,i){return"translate("+x(getX(d,i))+","+y(getHigh(d,i))+")"}).attr("d",function(d,i){var w=availableWidth/data[0].values.length*.9;return"m0,0l0,"+(y(getOpen(d,i))-y(getHigh(d,i)))+"l"+-w/2+",0l"+w/2+",0l0,"+(y(getLow(d,i))-y(getOpen(d,i)))+"l0,"+(y(getClose(d,i))-y(getLow(d,i)))+"l"+w/2+",0l"+-w/2+",0z"})});return chart}chart.highlightPoint=function(pointIndex,isHoverOver){chart.clearHighlights();container.select(".nv-ohlcBar .nv-tick-0-"+pointIndex).classed("hover",isHoverOver)};chart.clearHighlights=function(){container.select(".nv-ohlcBar .nv-tick.hover").classed("hover",false)};chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},xScale:{get:function(){return x},set:function(_){x=_}},yScale:{get:function(){return y},set:function(_){y=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},forceX:{get:function(){return forceX},set:function(_){forceX=_}},forceY:{get:function(){return forceY},set:function(_){forceY=_}},padData:{get:function(){return padData},set:function(_){padData=_}},clipEdge:{get:function(){return clipEdge},set:function(_){clipEdge=_}},id:{get:function(){return id},set:function(_){id=_}},interactive:{get:function(){return interactive},set:function(_){interactive=_}},x:{get:function(){return getX},set:function(_){getX=_}},y:{get:function(){return getY},set:function(_){getY=_}},open:{get:function(){return getOpen()},set:function(_){getOpen=_}},close:{get:function(){return getClose()},set:function(_){getClose=_}},high:{get:function(){return getHigh},set:function(_){getHigh=_}},low:{get:function(){return getLow},set:function(_){getLow=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!=undefined?_.top:margin.top;margin.right=_.right!=undefined?_.right:margin.right;margin.bottom=_.bottom!=undefined?_.bottom:margin.bottom;margin.left=_.left!=undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});nv.utils.initOptions(chart);return chart};nv.models.parallelCoordinates=function(){"use strict";var margin={top:30,right:0,bottom:10,left:0},width=null,height=null,availableWidth=null,availableHeight=null,x=d3.scale.ordinal(),y={},undefinedValuesLabel="undefined values",dimensionData=[],enabledDimensions=[],dimensionNames=[],displayBrush=true,color=nv.utils.defaultColor(),filters=[],active=[],dragging=[],axisWithUndefinedValues=[],lineTension=1,foreground,background,dimensions,line=d3.svg.line(),axis=d3.svg.axis(),dispatch=d3.dispatch("brushstart","brush","brushEnd","dimensionsOrder","stateChange","elementClick","elementMouseover","elementMouseout","elementMousemove","renderEnd","activeChanged");var renderWatch=nv.utils.renderWatch(dispatch);function chart(selection){renderWatch.reset();selection.each(function(data){var container=d3.select(this);availableWidth=nv.utils.availableWidth(width,container,margin);availableHeight=nv.utils.availableHeight(height,container,margin);nv.utils.initSVG(container);if(data[0].values===undefined){var newData=[];data.forEach(function(d){var val={};var key=Object.keys(d);key.forEach(function(k){if(k!=="name")val[k]=d[k]});newData.push({key:d.name,values:val})});data=newData}var dataValues=data.map(function(d){return d.values});if(active.length===0){active=data}dimensionNames=dimensionData.sort(function(a,b){return a.currentPosition-b.currentPosition}).map(function(d){return d.key});enabledDimensions=dimensionData.filter(function(d){return!d.disabled});x.rangePoints([0,availableWidth],1).domain(enabledDimensions.map(function(d){return d.key}));var oldDomainMaxValue={};var displayMissingValuesline=false;var currentTicks=[];dimensionNames.forEach(function(d){var extent=d3.extent(dataValues,function(p){return+p[d]});var min=extent[0];var max=extent[1];var onlyUndefinedValues=false;if(isNaN(min)||isNaN(max)){onlyUndefinedValues=true;min=0;max=0}if(min===max){min=min-1;max=max+1}var f=filters.filter(function(k){return k.dimension==d});if(f.length!==0){if(onlyUndefinedValues){min=y[d].domain()[0];max=y[d].domain()[1]}else if(!f[0].hasOnlyNaN&&displayBrush){min=min>f[0].extent[0]?f[0].extent[0]:min;max=max<f[0].extent[1]?f[0].extent[1]:max}else if(f[0].hasNaN){max=max<f[0].extent[1]?f[0].extent[1]:max;oldDomainMaxValue[d]=y[d].domain()[1];displayMissingValuesline=true}}y[d]=d3.scale.linear().domain([min,max]).range([(availableHeight-12)*.9,0]);axisWithUndefinedValues=[];y[d].brush=d3.svg.brush().y(y[d]).on("brushstart",brushstart).on("brush",brush).on("brushend",brushend)});var wrap=container.selectAll("g.nv-wrap.nv-parallelCoordinates").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-parallelCoordinates");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-parallelCoordinates background");gEnter.append("g").attr("class","nv-parallelCoordinates foreground");gEnter.append("g").attr("class","nv-parallelCoordinates missingValuesline");wrap.attr("transform","translate("+margin.left+","+margin.top+")");line.interpolate("cardinal").tension(lineTension);axis.orient("left");var axisDrag=d3.behavior.drag().on("dragstart",dragStart).on("drag",dragMove).on("dragend",dragEnd);var missingValuesline,missingValueslineText;var step=x.range()[1]-x.range()[0];step=isNaN(step)?x.range()[0]:step;if(!isNaN(step)){var lineData=[0+step/2,availableHeight-12,availableWidth-step/2,availableHeight-12];missingValuesline=wrap.select(".missingValuesline").selectAll("line").data([lineData]);missingValuesline.enter().append("line");missingValuesline.exit().remove();missingValuesline.attr("x1",function(d){return d[0]}).attr("y1",function(d){return d[1]}).attr("x2",function(d){return d[2]}).attr("y2",function(d){return d[3]});missingValueslineText=wrap.select(".missingValuesline").selectAll("text").data([undefinedValuesLabel]);missingValueslineText.append("text").data([undefinedValuesLabel]);missingValueslineText.enter().append("text");missingValueslineText.exit().remove();missingValueslineText.attr("y",availableHeight).attr("x",availableWidth-92-step/2).text(function(d){return d})}background=wrap.select(".background").selectAll("path").data(data);background.enter().append("path");background.exit().remove();background.attr("d",path);foreground=wrap.select(".foreground").selectAll("path").data(data);foreground.enter().append("path");foreground.exit().remove();foreground.attr("d",path).style("stroke-width",function(d,i){if(isNaN(d.strokeWidth)){d.strokeWidth=1}return d.strokeWidth}).attr("stroke",function(d,i){return d.color||color(d,i)});foreground.on("mouseover",function(d,i){d3.select(this).classed("hover",true).style("stroke-width",d.strokeWidth+2+"px").style("stroke-opacity",1);dispatch.elementMouseover({label:d.name,color:d.color||color(d,i),values:d.values,dimensions:enabledDimensions})});foreground.on("mouseout",function(d,i){d3.select(this).classed("hover",false).style("stroke-width",d.strokeWidth+"px").style("stroke-opacity",.7);dispatch.elementMouseout({label:d.name,index:i})});foreground.on("mousemove",function(d,i){dispatch.elementMousemove()});foreground.on("click",function(d){dispatch.elementClick({id:d.id})});dimensions=g.selectAll(".dimension").data(enabledDimensions);var dimensionsEnter=dimensions.enter().append("g").attr("class","nv-parallelCoordinates dimension");dimensions.attr("transform",function(d){return"translate("+x(d.key)+",0)"});dimensionsEnter.append("g").attr("class","nv-axis");dimensionsEnter.append("text").attr("class","nv-label").style("cursor","move").attr("dy","-1em").attr("text-anchor","middle").on("mouseover",function(d,i){dispatch.elementMouseover({label:d.tooltip||d.key,color:d.color})}).on("mouseout",function(d,i){dispatch.elementMouseout({label:d.tooltip})}).on("mousemove",function(d,i){dispatch.elementMousemove()}).call(axisDrag);dimensionsEnter.append("g").attr("class","nv-brushBackground");dimensions.exit().remove();dimensions.select(".nv-label").text(function(d){return d.key});restoreBrush(displayBrush);var actives=dimensionNames.filter(function(p){return!y[p].brush.empty()}),extents=actives.map(function(p){return y[p].brush.extent()});var formerActive=active.slice(0);active=[];foreground.style("display",function(d){var isActive=actives.every(function(p,i){if((isNaN(d.values[p])||isNaN(parseFloat(d.values[p])))&&extents[i][0]==y[p].brush.y().domain()[0]){return true}return extents[i][0]<=d.values[p]&&d.values[p]<=extents[i][1]&&!isNaN(parseFloat(d.values[p]))});if(isActive)active.push(d);return!isActive?"none":null});if(filters.length>0||!nv.utils.arrayEquals(active,formerActive)){dispatch.activeChanged(active)}function path(d){return line(enabledDimensions.map(function(p){if(isNaN(d.values[p.key])||isNaN(parseFloat(d.values[p.key]))||displayMissingValuesline){var domain=y[p.key].domain();var range=y[p.key].range();var min=domain[0]-(domain[1]-domain[0])/9;if(axisWithUndefinedValues.indexOf(p.key)<0){var newscale=d3.scale.linear().domain([min,domain[1]]).range([availableHeight-12,range[1]]);y[p.key].brush.y(newscale);axisWithUndefinedValues.push(p.key)}if(isNaN(d.values[p.key])||isNaN(parseFloat(d.values[p.key]))){return[x(p.key),y[p.key](min)]}}if(missingValuesline!==undefined){if(axisWithUndefinedValues.length>0||displayMissingValuesline){missingValuesline.style("display","inline");missingValueslineText.style("display","inline")}else{missingValuesline.style("display","none");missingValueslineText.style("display","none")}}return[x(p.key),y[p.key](d.values[p.key])]}))}function restoreBrush(visible){filters.forEach(function(f){var brushDomain=y[f.dimension].brush.y().domain();if(f.hasOnlyNaN){f.extent[1]=(y[f.dimension].domain()[1]-brushDomain[0])*(f.extent[1]-f.extent[0])/(oldDomainMaxValue[f.dimension]-f.extent[0])+brushDomain[0]}if(f.hasNaN){f.extent[0]=brushDomain[0]}if(visible)y[f.dimension].brush.extent(f.extent)});dimensions.select(".nv-brushBackground").each(function(d){d3.select(this).call(y[d.key].brush)}).selectAll("rect").attr("x",-8).attr("width",16);updateTicks()}function brushstart(){if(displayBrush===false){displayBrush=true;restoreBrush(true)}}function brush(){actives=dimensionNames.filter(function(p){return!y[p].brush.empty()});extents=actives.map(function(p){return y[p].brush.extent()});filters=[];actives.forEach(function(d,i){filters[i]={dimension:d,extent:extents[i],hasNaN:false,hasOnlyNaN:false}});active=[];foreground.style("display",function(d){var isActive=actives.every(function(p,i){if((isNaN(d.values[p])||isNaN(parseFloat(d.values[p])))&&extents[i][0]==y[p].brush.y().domain()[0])return true;return extents[i][0]<=d.values[p]&&d.values[p]<=extents[i][1]&&!isNaN(parseFloat(d.values[p]))});if(isActive)active.push(d);return isActive?null:"none"});updateTicks();dispatch.brush({filters:filters,active:active})}function brushend(){var hasActiveBrush=actives.length>0?true:false;filters.forEach(function(f){if(f.extent[0]===y[f.dimension].brush.y().domain()[0]&&axisWithUndefinedValues.indexOf(f.dimension)>=0)f.hasNaN=true;if(f.extent[1]<y[f.dimension].domain()[0])f.hasOnlyNaN=true});dispatch.brushEnd(active,hasActiveBrush)}function updateTicks(){dimensions.select(".nv-axis").each(function(d,i){var f=filters.filter(function(k){return k.dimension==d.key});currentTicks[d.key]=y[d.key].domain();if(f.length!=0&&displayBrush){currentTicks[d.key]=[];if(f[0].extent[1]>y[d.key].domain()[0])currentTicks[d.key]=[f[0].extent[1]];if(f[0].extent[0]>=y[d.key].domain()[0])currentTicks[d.key].push(f[0].extent[0])}d3.select(this).call(axis.scale(y[d.key]).tickFormat(d.format).tickValues(currentTicks[d.key]))})}function dragStart(d){dragging[d.key]=this.parentNode.__origin__=x(d.key);background.attr("visibility","hidden")}function dragMove(d){dragging[d.key]=Math.min(availableWidth,Math.max(0,this.parentNode.__origin__+=d3.event.x));foreground.attr("d",path);enabledDimensions.sort(function(a,b){return dimensionPosition(a.key)-dimensionPosition(b.key)});enabledDimensions.forEach(function(d,i){return d.currentPosition=i});x.domain(enabledDimensions.map(function(d){return d.key}));dimensions.attr("transform",function(d){return"translate("+dimensionPosition(d.key)+")"})}function dragEnd(d,i){delete this.parentNode.__origin__;delete dragging[d.key];d3.select(this.parentNode).attr("transform","translate("+x(d.key)+")");foreground.attr("d",path);background.attr("d",path).attr("visibility",null);dispatch.dimensionsOrder(enabledDimensions)}function dimensionPosition(d){var v=dragging[d];return v==null?x(d):v}});return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},dimensionData:{get:function(){return dimensionData},set:function(_){dimensionData=_}},displayBrush:{get:function(){return displayBrush},set:function(_){displayBrush=_}},filters:{get:function(){return filters},set:function(_){filters=_}},active:{get:function(){return active},set:function(_){active=_}},lineTension:{get:function(){return lineTension},set:function(_){lineTension=_}},undefinedValuesLabel:{get:function(){return undefinedValuesLabel},set:function(_){undefinedValuesLabel=_}},dimensions:{get:function(){return dimensionData.map(function(d){return d.key})},set:function(_){nv.deprecated("dimensions","use dimensionData instead");if(dimensionData.length===0){_.forEach(function(k){dimensionData.push({key:k})})}else{_.forEach(function(k,i){dimensionData[i].key=k})}}},dimensionNames:{get:function(){return dimensionData.map(function(d){return d.key})},set:function(_){nv.deprecated("dimensionNames","use dimensionData instead");dimensionNames=[];if(dimensionData.length===0){_.forEach(function(k){dimensionData.push({key:k})})}else{_.forEach(function(k,i){dimensionData[i].key=k})}}},dimensionFormats:{get:function(){return dimensionData.map(function(d){return d.format})},set:function(_){nv.deprecated("dimensionFormats","use dimensionData instead");if(dimensionData.length===0){_.forEach(function(f){dimensionData.push({format:f})})}else{_.forEach(function(f,i){dimensionData[i].format=f})}}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});nv.utils.initOptions(chart);return chart};nv.models.parallelCoordinatesChart=function(){"use strict";var parallelCoordinates=nv.models.parallelCoordinates();var legend=nv.models.legend();var tooltip=nv.models.tooltip();var dimensionTooltip=nv.models.tooltip();var margin={top:0,right:0,bottom:0,left:0},marginTop=null,width=null,height=null,showLegend=true,color=nv.utils.defaultColor(),state=nv.utils.state(),dimensionData=[],displayBrush=true,defaultState=null,noData=null,nanValue="undefined",dispatch=d3.dispatch("dimensionsOrder","brushEnd","stateChange","changeState","renderEnd"),controlWidth=function(){return showControls?180:0};var renderWatch=nv.utils.renderWatch(dispatch);var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled})}}};var stateSetter=function(data){return function(state){if(state.active!==undefined){data.forEach(function(series,i){series.disabled=!state.active[i]})}}};tooltip.contentGenerator(function(data){var str='<table><thead><tr><td class="legend-color-guide"><div style="background-color:'+data.color+'"></div></td><td><strong>'+data.key+"</strong></td></tr></thead>";if(data.series.length!==0){str=str+'<tbody><tr><td height ="10px"></td></tr>';data.series.forEach(function(d){str=str+'<tr><td class="legend-color-guide"><div style="background-color:'+d.color+'"></div></td><td class="key">'+d.key+'</td><td class="value">'+d.value+"</td></tr>"});str=str+"</tbody>"}str=str+"</table>";return str});function chart(selection){renderWatch.reset();renderWatch.models(parallelCoordinates);selection.each(function(data){var container=d3.select(this);nv.utils.initSVG(container);var that=this;var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){container.call(chart)};chart.container=this;state.setter(stateSetter(dimensionData),chart.update).getter(stateGetter(dimensionData)).update();state.disabled=dimensionData.map(function(d){return!!d.disabled});dimensionData=dimensionData.map(function(d){d.disabled=!!d.disabled;return d});dimensionData.forEach(function(d,i){d.originalPosition=isNaN(d.originalPosition)?i:d.originalPosition;d.currentPosition=isNaN(d.currentPosition)?i:d.currentPosition});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}var wrap=container.selectAll("g.nv-wrap.nv-parallelCoordinatesChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-parallelCoordinatesChart").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-parallelCoordinatesWrap");gEnter.append("g").attr("class","nv-legendWrap");g.select("rect").attr("width",availableWidth).attr("height",availableHeight>0?availableHeight:0);if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{legend.width(availableWidth).color(function(d){return"rgb(188,190,192)"});g.select(".nv-legendWrap").datum(dimensionData.sort(function(a,b){return a.originalPosition-b.originalPosition})).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}wrap.select(".nv-legendWrap").attr("transform","translate( 0 ,"+-margin.top+")")}wrap.attr("transform","translate("+margin.left+","+margin.top+")");parallelCoordinates.width(availableWidth).height(availableHeight).dimensionData(dimensionData).displayBrush(displayBrush);var parallelCoordinatesWrap=g.select(".nv-parallelCoordinatesWrap ").datum(data);parallelCoordinatesWrap.transition().call(parallelCoordinates);parallelCoordinates.dispatch.on("brushEnd",function(active,hasActiveBrush){if(hasActiveBrush){displayBrush=true;dispatch.brushEnd(active)}else{displayBrush=false}});legend.dispatch.on("stateChange",function(newState){for(var key in newState){state[key]=newState[key]}dispatch.stateChange(state);chart.update()});parallelCoordinates.dispatch.on("dimensionsOrder",function(e){dimensionData.sort(function(a,b){return a.currentPosition-b.currentPosition});var isSorted=false;dimensionData.forEach(function(d,i){d.currentPosition=i;if(d.currentPosition!==d.originalPosition)isSorted=true});dispatch.dimensionsOrder(dimensionData,isSorted)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){dimensionData.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()})});renderWatch.renderEnd("parraleleCoordinateChart immediate");return chart}parallelCoordinates.dispatch.on("elementMouseover.tooltip",function(evt){var tp={key:evt.label,color:evt.color,series:[]};if(evt.values){Object.keys(evt.values).forEach(function(d){var dim=evt.dimensions.filter(function(dd){return dd.key===d})[0];if(dim){var v;if(isNaN(evt.values[d])||isNaN(parseFloat(evt.values[d]))){v=nanValue}else{v=dim.format(evt.values[d])}tp.series.push({idx:dim.currentPosition,key:d,value:v,color:dim.color})}});tp.series.sort(function(a,b){return a.idx-b.idx})}tooltip.data(tp).hidden(false)});parallelCoordinates.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});parallelCoordinates.dispatch.on("elementMousemove.tooltip",function(){tooltip()});chart.dispatch=dispatch;chart.parallelCoordinates=parallelCoordinates;chart.legend=legend;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},dimensionData:{get:function(){return dimensionData},set:function(_){dimensionData=_}},displayBrush:{get:function(){return displayBrush},set:function(_){displayBrush=_}},noData:{get:function(){return noData},set:function(_){noData=_}},nanValue:{get:function(){return nanValue},set:function(_){nanValue=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color);parallelCoordinates.color(color)}}});nv.utils.inheritOptions(chart,parallelCoordinates);nv.utils.initOptions(chart);return chart};nv.models.pie=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=500,height=500,getX=function(d){return d.x},getY=function(d){return d.y},id=Math.floor(Math.random()*1e4),container=null,color=nv.utils.defaultColor(),valueFormat=d3.format(",.2f"),showLabels=true,labelsOutside=false,labelType="key",labelThreshold=.02,hideOverlapLabels=false,donut=false,title=false,growOnHover=true,titleOffset=0,labelSunbeamLayout=false,startAngle=false,padAngle=false,endAngle=false,cornerRadius=0,donutRatio=.5,duration=250,arcsRadius=[],dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd");var arcs=[];var arcsOver=[];var renderWatch=nv.utils.renderWatch(dispatch);function chart(selection){renderWatch.reset();selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom,radius=Math.min(availableWidth,availableHeight)/2,arcsRadiusOuter=[],arcsRadiusInner=[];container=d3.select(this);if(arcsRadius.length===0){var outer=radius-radius/10;var inner=donutRatio*radius;for(var i=0;i<data[0].length;i++){arcsRadiusOuter.push(outer);arcsRadiusInner.push(inner)}}else{if(growOnHover){arcsRadiusOuter=arcsRadius.map(function(d){return(d.outer-d.outer/10)*radius});arcsRadiusInner=arcsRadius.map(function(d){return(d.inner-d.inner/10)*radius});donutRatio=d3.min(arcsRadius.map(function(d){return d.inner-d.inner/10}))}else{arcsRadiusOuter=arcsRadius.map(function(d){return d.outer*radius});arcsRadiusInner=arcsRadius.map(function(d){return d.inner*radius});donutRatio=d3.min(arcsRadius.map(function(d){return d.inner}))}}nv.utils.initSVG(container);var wrap=container.selectAll(".nv-wrap.nv-pie").data(data);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+id);var gEnter=wrapEnter.append("g");var g=wrap.select("g");var g_pie=gEnter.append("g").attr("class","nv-pie");gEnter.append("g").attr("class","nv-pieLabels");wrap.attr("transform","translate("+margin.left+","+margin.top+")");g.select(".nv-pie").attr("transform","translate("+availableWidth/2+","+availableHeight/2+")");g.select(".nv-pieLabels").attr("transform","translate("+availableWidth/2+","+availableHeight/2+")");container.on("click",function(d,i){dispatch.chartClick({data:d,index:i,pos:d3.event,id:id})});arcs=[];arcsOver=[];for(var i=0;i<data[0].length;i++){var arc=d3.svg.arc().outerRadius(arcsRadiusOuter[i]);var arcOver=d3.svg.arc().outerRadius(arcsRadiusOuter[i]+5);if(startAngle!==false){arc.startAngle(startAngle);arcOver.startAngle(startAngle)}if(endAngle!==false){arc.endAngle(endAngle);arcOver.endAngle(endAngle)}if(donut){arc.innerRadius(arcsRadiusInner[i]);arcOver.innerRadius(arcsRadiusInner[i])}if(arc.cornerRadius&&cornerRadius){arc.cornerRadius(cornerRadius);arcOver.cornerRadius(cornerRadius)}arcs.push(arc);arcsOver.push(arcOver)}var pie=d3.layout.pie().sort(null).value(function(d){return d.disabled?0:getY(d)});if(pie.padAngle&&padAngle){pie.padAngle(padAngle)}if(donut&&title){g_pie.append("text").attr("class","nv-pie-title");wrap.select(".nv-pie-title").style("text-anchor","middle").text(function(d){return title}).style("font-size",Math.min(availableWidth,availableHeight)*donutRatio*2/(title.length+2)+"px").attr("dy","0.35em").attr("transform",function(d,i){return"translate(0, "+titleOffset+")"})}var slices=wrap.select(".nv-pie").selectAll(".nv-slice").data(pie);var pieLabels=wrap.select(".nv-pieLabels").selectAll(".nv-label").data(pie);slices.exit().remove();pieLabels.exit().remove();var ae=slices.enter().append("g");ae.attr("class","nv-slice");ae.on("mouseover",function(d,i){d3.select(this).classed("hover",true);if(growOnHover){d3.select(this).select("path").transition().duration(70).attr("d",arcsOver[i])}dispatch.elementMouseover({data:d.data,index:i,color:d3.select(this).style("fill"),percent:(d.endAngle-d.startAngle)/(2*Math.PI)})});ae.on("mouseout",function(d,i){d3.select(this).classed("hover",false);if(growOnHover){d3.select(this).select("path").transition().duration(50).attr("d",arcs[i])}dispatch.elementMouseout({data:d.data,index:i})});ae.on("mousemove",function(d,i){dispatch.elementMousemove({data:d.data,index:i})});ae.on("click",function(d,i){var element=this;dispatch.elementClick({data:d.data,index:i,color:d3.select(this).style("fill"),event:d3.event,element:element})});ae.on("dblclick",function(d,i){dispatch.elementDblClick({data:d.data,index:i,color:d3.select(this).style("fill")})});slices.attr("fill",function(d,i){return color(d.data,i)});slices.attr("stroke",function(d,i){return color(d.data,i)});var paths=ae.append("path").each(function(d){this._current=d});slices.select("path").transition().duration(duration).attr("d",function(d,i){return arcs[i](d)}).attrTween("d",arcTween);if(showLabels){var labelsArc=[];for(var i=0;i<data[0].length;i++){labelsArc.push(arcs[i]);if(labelsOutside){if(donut){labelsArc[i]=d3.svg.arc().outerRadius(arcs[i].outerRadius());if(startAngle!==false)labelsArc[i].startAngle(startAngle);if(endAngle!==false)labelsArc[i].endAngle(endAngle)}}else if(!donut){labelsArc[i].innerRadius(0)}}pieLabels.enter().append("g").classed("nv-label",true).each(function(d,i){var group=d3.select(this);group.attr("transform",function(d,i){if(labelSunbeamLayout){d.outerRadius=arcsRadiusOuter[i]+10;d.innerRadius=arcsRadiusOuter[i]+15;var rotateAngle=(d.startAngle+d.endAngle)/2*(180/Math.PI);if((d.startAngle+d.endAngle)/2<Math.PI){rotateAngle-=90}else{rotateAngle+=90}return"translate("+labelsArc[i].centroid(d)+") rotate("+rotateAngle+")"}else{d.outerRadius=radius+10;d.innerRadius=radius+15;return"translate("+labelsArc[i].centroid(d)+")"}});group.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3);group.append("text").style("text-anchor",labelSunbeamLayout?(d.startAngle+d.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});var labelLocationHash={};var avgHeight=14;var avgWidth=140;var createHashKey=function(coordinates){return Math.floor(coordinates[0]/avgWidth)*avgWidth+","+Math.floor(coordinates[1]/avgHeight)*avgHeight};var getSlicePercentage=function(d){return(d.endAngle-d.startAngle)/(2*Math.PI)};pieLabels.watchTransition(renderWatch,"pie labels").attr("transform",function(d,i){if(labelSunbeamLayout){d.outerRadius=arcsRadiusOuter[i]+10;d.innerRadius=arcsRadiusOuter[i]+15;var rotateAngle=(d.startAngle+d.endAngle)/2*(180/Math.PI);if((d.startAngle+d.endAngle)/2<Math.PI){rotateAngle-=90}else{rotateAngle+=90}return"translate("+labelsArc[i].centroid(d)+") rotate("+rotateAngle+")"}else{d.outerRadius=radius+10;d.innerRadius=radius+15;var center=labelsArc[i].centroid(d);var percent=getSlicePercentage(d);if(d.value&&percent>=labelThreshold){var hashKey=createHashKey(center);if(labelLocationHash[hashKey]){center[1]-=avgHeight}labelLocationHash[createHashKey(center)]=true}return"translate("+center+")"}});pieLabels.select(".nv-label text").style("text-anchor",function(d,i){return labelSunbeamLayout?(d.startAngle+d.endAngle)/2<Math.PI?"start":"end":"middle"}).text(function(d,i){var percent=getSlicePercentage(d);var label="";if(!d.value||percent<labelThreshold)return"";if(typeof labelType==="function"){label=labelType(d,i,{key:getX(d.data),value:getY(d.data),percent:valueFormat(percent)})}else{switch(labelType){case"key":label=getX(d.data);break;case"value":label=valueFormat(getY(d.data));break;case"percent":label=d3.format("%")(percent);break}}return label});if(hideOverlapLabels){pieLabels.each(function(d,i){if(!this.getBBox)return;var bb=this.getBBox(),center=labelsArc[i].centroid(d);var topLeft={x:center[0]+bb.x,y:center[1]+bb.y};var topRight={x:topLeft.x+bb.width,y:topLeft.y};var bottomLeft={x:topLeft.x,y:topLeft.y+bb.height};var bottomRight={x:topLeft.x+bb.width,y:topLeft.y+bb.height};d.visible=nv.utils.pointIsInArc(topLeft,d,arc)&&nv.utils.pointIsInArc(topRight,d,arc)&&nv.utils.pointIsInArc(bottomLeft,d,arc)&&nv.utils.pointIsInArc(bottomRight,d,arc)}).style("display",function(d){return d.visible?null:"none"})}}function angle(d){var a=(d.startAngle+d.endAngle)*90/Math.PI-90;return a>90?a-180:a}function arcTween(a,idx){a.endAngle=isNaN(a.endAngle)?0:a.endAngle;a.startAngle=isNaN(a.startAngle)?0:a.startAngle;if(!donut)a.innerRadius=0;var i=d3.interpolate(this._current,a);this._current=i(0);return function(t){return arcs[idx](i(t))}}});renderWatch.renderEnd("pie immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{arcsRadius:{get:function(){return arcsRadius},set:function(_){arcsRadius=_}},width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLabels:{get:function(){return showLabels},set:function(_){showLabels=_}},title:{get:function(){return title},set:function(_){title=_}},titleOffset:{get:function(){return titleOffset},set:function(_){titleOffset=_}},labelThreshold:{get:function(){return labelThreshold},set:function(_){labelThreshold=_}},hideOverlapLabels:{get:function(){return hideOverlapLabels},set:function(_){hideOverlapLabels=_}},valueFormat:{get:function(){return valueFormat},set:function(_){valueFormat=_}},x:{get:function(){return getX},set:function(_){getX=_}},id:{get:function(){return id},set:function(_){id=_}},endAngle:{get:function(){return endAngle},set:function(_){endAngle=_}},startAngle:{get:function(){return startAngle},set:function(_){startAngle=_}},padAngle:{get:function(){return padAngle},set:function(_){padAngle=_}},cornerRadius:{get:function(){return cornerRadius},set:function(_){cornerRadius=_}},donutRatio:{get:function(){return donutRatio},set:function(_){donutRatio=_}},labelsOutside:{get:function(){return labelsOutside},set:function(_){labelsOutside=_}},labelSunbeamLayout:{get:function(){return labelSunbeamLayout},set:function(_){labelSunbeamLayout=_}},donut:{get:function(){return donut},set:function(_){donut=_}},growOnHover:{get:function(){return growOnHover},set:function(_){growOnHover=_}},pieLabelsOutside:{get:function(){return labelsOutside},set:function(_){labelsOutside=_;nv.deprecated("pieLabelsOutside","use labelsOutside instead")}},donutLabelsOutside:{get:function(){return labelsOutside},set:function(_){labelsOutside=_;nv.deprecated("donutLabelsOutside","use labelsOutside instead")}},labelFormat:{get:function(){return valueFormat},set:function(_){valueFormat=_;nv.deprecated("labelFormat","use valueFormat instead")}},margin:{get:function(){return margin},set:function(_){margin.top=typeof _.top!="undefined"?_.top:margin.top;margin.right=typeof _.right!="undefined"?_.right:margin.right;margin.bottom=typeof _.bottom!="undefined"?_.bottom:margin.bottom;margin.left=typeof _.left!="undefined"?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}},y:{get:function(){return getY},set:function(_){getY=d3.functor(_)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},labelType:{get:function(){return labelType},set:function(_){labelType=_||"key"}}});nv.utils.initOptions(chart);return chart};nv.models.pieChart=function(){"use strict";var pie=nv.models.pie();var legend=nv.models.legend();var tooltip=nv.models.tooltip();var margin={top:30,right:20,bottom:20,left:20},marginTop=null,width=null,height=null,showTooltipPercent=false,showLegend=true,legendPosition="top",color=nv.utils.defaultColor(),state=nv.utils.state(),defaultState=null,noData=null,duration=250,dispatch=d3.dispatch("stateChange","changeState","renderEnd");tooltip.duration(0).headerEnabled(false).valueFormatter(function(d,i){return pie.valueFormat()(d,i)});var renderWatch=nv.utils.renderWatch(dispatch);var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled})}}};var stateSetter=function(data){return function(state){if(state.active!==undefined){data.forEach(function(series,i){series.disabled=!state.active[i]})}}};function chart(selection){renderWatch.reset();renderWatch.models(pie);selection.each(function(data){var container=d3.select(this);nv.utils.initSVG(container);var that=this;var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){container.transition().call(chart)};chart.container=this;state.setter(stateSetter(data),chart.update).getter(stateGetter(data)).update();state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}var wrap=container.selectAll("g.nv-wrap.nv-pieChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-pieWrap");gEnter.append("g").attr("class","nv-legendWrap");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{if(legendPosition==="top"){legend.width(availableWidth).key(pie.x());wrap.select(".nv-legendWrap").datum(data).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}wrap.select(".nv-legendWrap").attr("transform","translate(0,"+-margin.top+")")}else if(legendPosition==="right"){var legendWidth=nv.models.legend().width();if(availableWidth/2<legendWidth){legendWidth=availableWidth/2}legend.height(availableHeight).key(pie.x());legend.width(legendWidth);availableWidth-=legend.width();wrap.select(".nv-legendWrap").datum(data).call(legend).attr("transform","translate("+availableWidth+",0)")}else if(legendPosition==="bottom"){legend.width(availableWidth).key(pie.x());wrap.select(".nv-legendWrap").datum(data).call(legend);margin.bottom=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin);wrap.select(".nv-legendWrap").attr("transform","translate(0,"+availableHeight+")")}}wrap.attr("transform","translate("+margin.left+","+margin.top+")");pie.width(availableWidth).height(availableHeight);var pieWrap=g.select(".nv-pieWrap").datum([data]);d3.transition(pieWrap).call(pie);legend.dispatch.on("stateChange",function(newState){for(var key in newState){state[key]=newState[key]}dispatch.stateChange(state);chart.update()});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()})});renderWatch.renderEnd("pieChart immediate");return chart}pie.dispatch.on("elementMouseover.tooltip",function(evt){evt["series"]={key:chart.x()(evt.data),value:chart.y()(evt.data),color:evt.color,percent:evt.percent};if(!showTooltipPercent){delete evt.percent;delete evt.series.percent}tooltip.data(evt).hidden(false)});pie.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});pie.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.legend=legend;chart.dispatch=dispatch;chart.pie=pie;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},noData:{get:function(){return noData},set:function(_){noData=_}},showTooltipPercent:{get:function(){return showTooltipPercent},set:function(_){showTooltipPercent=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},legendPosition:{get:function(){return legendPosition},set:function(_){legendPosition=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},color:{get:function(){return color},set:function(_){color=_;legend.color(color);pie.color(color)}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);pie.duration(duration)}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}}});nv.utils.inheritOptions(chart,pie);nv.utils.initOptions(chart);return chart};nv.models.sankey=function(){"use strict";var sankey={},nodeWidth=24,nodePadding=8,size=[1,1],nodes=[],links=[],sinksRight=true;var layout=function(iterations){computeNodeLinks();computeNodeValues();computeNodeBreadths();computeNodeDepths(iterations)};var relayout=function(){computeLinkDepths()};var link=function(){var curvature=.5;function link(d){var x0=d.source.x+d.source.dx,x1=d.target.x,xi=d3.interpolateNumber(x0,x1),x2=xi(curvature),x3=xi(1-curvature),y0=d.source.y+d.sy+d.dy/2,y1=d.target.y+d.ty+d.dy/2;var linkPath="M"+x0+","+y0+"C"+x2+","+y0+" "+x3+","+y1+" "+x1+","+y1;return linkPath}link.curvature=function(_){if(!arguments.length)return curvature;curvature=+_;return link};return link};var center=function(node){return node.y+node.dy/2};function computeNodeLinks(){nodes.forEach(function(node){node.sourceLinks=[];node.targetLinks=[]});links.forEach(function(link){var source=link.source,target=link.target;if(typeof source==="number")source=link.source=nodes[link.source];if(typeof target==="number")target=link.target=nodes[link.target];source.sourceLinks.push(link);target.targetLinks.push(link)})}function computeNodeValues(){nodes.forEach(function(node){node.value=Math.max(d3.sum(node.sourceLinks,value),d3.sum(node.targetLinks,value))})}function computeNodeBreadths(){var remainingNodes=nodes,nextNodes,x=0;while(remainingNodes.length&&x<nodes.length){nextNodes=[];remainingNodes.forEach(function(node){node.x=x;node.dx=nodeWidth;node.sourceLinks.forEach(function(link){if(nextNodes.indexOf(link.target)<0){nextNodes.push(link.target)}})});remainingNodes=nextNodes;++x}if(sinksRight){moveSinksRight(x)}scaleNodeBreadths((size[0]-nodeWidth)/(x-1))}function moveSourcesRight(){nodes.forEach(function(node){if(!node.targetLinks.length){node.x=d3.min(node.sourceLinks,function(d){return d.target.x})-1}})}function moveSinksRight(x){nodes.forEach(function(node){if(!node.sourceLinks.length){node.x=x-1}})}function scaleNodeBreadths(kx){nodes.forEach(function(node){node.x*=kx})}function computeNodeDepths(iterations){var nodesByBreadth=d3.nest().key(function(d){return d.x}).sortKeys(d3.ascending).entries(nodes).map(function(d){return d.values});initializeNodeDepth();resolveCollisions();computeLinkDepths();for(var alpha=1;iterations>0;--iterations){relaxRightToLeft(alpha*=.99);resolveCollisions();computeLinkDepths();relaxLeftToRight(alpha);resolveCollisions();computeLinkDepths()}function initializeNodeDepth(){var ky=d3.min(nodesByBreadth,function(nodes){return(size[1]-(nodes.length-1)*nodePadding)/d3.sum(nodes,value)});nodesByBreadth.forEach(function(nodes){nodes.forEach(function(node,i){node.y=i;node.dy=node.value*ky})});links.forEach(function(link){link.dy=link.value*ky})}function relaxLeftToRight(alpha){nodesByBreadth.forEach(function(nodes,breadth){nodes.forEach(function(node){if(node.targetLinks.length){var y=d3.sum(node.targetLinks,weightedSource)/d3.sum(node.targetLinks,value);node.y+=(y-center(node))*alpha}})});function weightedSource(link){return(link.source.y+link.sy+link.dy/2)*link.value}}function relaxRightToLeft(alpha){nodesByBreadth.slice().reverse().forEach(function(nodes){nodes.forEach(function(node){if(node.sourceLinks.length){var y=d3.sum(node.sourceLinks,weightedTarget)/d3.sum(node.sourceLinks,value);node.y+=(y-center(node))*alpha}})});function weightedTarget(link){return(link.target.y+link.ty+link.dy/2)*link.value}}function resolveCollisions(){nodesByBreadth.forEach(function(nodes){var node,dy,y0=0,n=nodes.length,i;nodes.sort(ascendingDepth);for(i=0;i<n;++i){node=nodes[i];dy=y0-node.y;if(dy>0)node.y+=dy;y0=node.y+node.dy+nodePadding}dy=y0-nodePadding-size[1];if(dy>0){y0=node.y-=dy;for(i=n-2;i>=0;--i){node=nodes[i];dy=node.y+node.dy+nodePadding-y0;if(dy>0)node.y-=dy;y0=node.y}}})}function ascendingDepth(a,b){return a.y-b.y}}function computeLinkDepths(){nodes.forEach(function(node){node.sourceLinks.sort(ascendingTargetDepth);node.targetLinks.sort(ascendingSourceDepth)});nodes.forEach(function(node){var sy=0,ty=0;node.sourceLinks.forEach(function(link){link.sy=sy;sy+=link.dy});node.targetLinks.forEach(function(link){link.ty=ty;ty+=link.dy})});function ascendingSourceDepth(a,b){return a.source.y-b.source.y}function ascendingTargetDepth(a,b){return a.target.y-b.target.y}}function value(x){return x.value}sankey.options=nv.utils.optionsFunc.bind(sankey);sankey._options=Object.create({},{nodeWidth:{get:function(){return nodeWidth},set:function(_){nodeWidth=+_}},nodePadding:{get:function(){return nodePadding},set:function(_){nodePadding=_}},nodes:{get:function(){return nodes},set:function(_){nodes=_}},links:{get:function(){return links},set:function(_){links=_}},size:{get:function(){return size},set:function(_){size=_}},sinksRight:{get:function(){return sinksRight},set:function(_){sinksRight=_}},layout:{get:function(){layout(32)},set:function(_){layout(_)}},relayout:{get:function(){relayout()},set:function(_){}},center:{get:function(){return center()},set:function(_){if(typeof _==="function"){center=_}}},link:{get:function(){return link()},set:function(_){if(typeof _==="function"){link=_}return link()}}});nv.utils.initOptions(sankey);return sankey};nv.models.sankeyChart=function(){"use strict";var margin={top:5,right:0,bottom:5,left:0},sankey=nv.models.sankey(),width=600,height=400,nodeWidth=36,nodePadding=40,units="units",center=undefined;var formatNumber=d3.format(",.0f");var format=function(d){return formatNumber(d)+" "+units};var color=d3.scale.category20();var linkTitle=function(d){return d.source.name+" → "+d.target.name+"\n"+format(d.value)};var nodeFillColor=function(d){return d.color=color(d.name.replace(/ .*/,""))};var nodeStrokeColor=function(d){return d3.rgb(d.color).darker(2)};var nodeTitle=function(d){return d.name+"\n"+format(d.value)};var showError=function(element,message){element.append("text").attr("x",0).attr("y",0).attr("class","nvd3-sankey-chart-error").attr("text-anchor","middle").text(message)};function chart(selection){selection.each(function(data){var testData={nodes:[{node:1,name:"Test 1"},{node:2,name:"Test 2"},{node:3,name:"Test 3"},{node:4,name:"Test 4"},{node:5,name:"Test 5"},{node:6,name:"Test 6"}],links:[{source:0,target:1,value:2295},{source:0,target:5,value:1199},{source:1,target:2,value:1119},{source:1,target:5,value:1176},{source:2,target:3,value:487},{source:2,target:5,value:632},{source:3,target:4,value:301},{source:3,target:5,value:186}]};var isDataValid=false;var dataAvailable=false;if((typeof data["nodes"]==="object"&&data["nodes"].length)>=0&&(typeof data["links"]==="object"&&data["links"].length)>=0){isDataValid=true}if(data["nodes"]&&data["nodes"].length>0&&data["links"]&&data["links"].length>0){dataAvailable=true}if(!isDataValid){console.error("NVD3 Sankey chart error:","invalid data format for",data);console.info("Valid data format is: ",testData,JSON.stringify(testData));showError(selection,"Error loading chart, data is invalid");return false}if(!dataAvailable){showError(selection,"No data available");return false}var svg=selection.append("svg").attr("width",width).attr("height",height).append("g").attr("class","nvd3 nv-wrap nv-sankeyChart");sankey.nodeWidth(nodeWidth).nodePadding(nodePadding).size([width,height]);var path=sankey.link();sankey.nodes(data.nodes).links(data.links).layout(32).center(center);var link=svg.append("g").selectAll(".link").data(data.links).enter().append("path").attr("class","link").attr("d",path).style("stroke-width",function(d){return Math.max(1,d.dy)}).sort(function(a,b){return b.dy-a.dy});link.append("title").text(linkTitle);var node=svg.append("g").selectAll(".node").data(data.nodes).enter().append("g").attr("class","node").attr("transform",function(d){return"translate("+d.x+","+d.y+")"}).call(d3.behavior.drag().origin(function(d){return d}).on("dragstart",function(){this.parentNode.appendChild(this)}).on("drag",dragmove));node.append("rect").attr("height",function(d){return d.dy}).attr("width",sankey.nodeWidth()).style("fill",nodeFillColor).style("stroke",nodeStrokeColor).append("title").text(nodeTitle);node.append("text").attr("x",-6).attr("y",function(d){return d.dy/2}).attr("dy",".35em").attr("text-anchor","end").attr("transform",null).text(function(d){return d.name}).filter(function(d){return d.x<width/2}).attr("x",6+sankey.nodeWidth()).attr("text-anchor","start");function dragmove(d){d3.select(this).attr("transform","translate("+d.x+","+(d.y=Math.max(0,Math.min(height-d.dy,d3.event.y)))+")");sankey.relayout();link.attr("d",path)}});return chart}chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{units:{get:function(){return units},set:function(_){units=_}},width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},format:{get:function(){return format},set:function(_){format=_}},linkTitle:{get:function(){return linkTitle},set:function(_){linkTitle=_}},nodeWidth:{get:function(){return nodeWidth},set:function(_){nodeWidth=_}},nodePadding:{get:function(){return nodePadding},set:function(_){nodePadding=_}},center:{get:function(){return center},set:function(_){center=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},nodeStyle:{get:function(){return{}},set:function(_){nodeFillColor=_.fillColor!==undefined?_.fillColor:nodeFillColor;nodeStrokeColor=_.strokeColor!==undefined?_.strokeColor:nodeStrokeColor;nodeTitle=_.title!==undefined?_.title:nodeTitle}}});nv.utils.initOptions(chart);return chart};nv.models.scatter=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=null,height=null,color=nv.utils.defaultColor(),pointBorderColor=null,id=Math.floor(Math.random()*1e5),container=null,x=d3.scale.linear(),y=d3.scale.linear(),z=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},getSize=function(d){return d.size||1},getShape=function(d){return d.shape||"circle"},forceX=[],forceY=[],forceSize=[],interactive=true,pointActive=function(d){return!d.notActive},padData=false,padDataOuter=.1,clipEdge=false,clipVoronoi=true,showVoronoi=false,clipRadius=function(){return 25},xDomain=null,yDomain=null,xRange=null,yRange=null,sizeDomain=null,sizeRange=null,singlePoint=false,dispatch=d3.dispatch("elementClick","elementDblClick","elementMouseover","elementMouseout","renderEnd"),useVoronoi=true,duration=250,interactiveUpdateDelay=300,showLabels=false;var x0,y0,z0,xDom,yDom,width0,height0,timeoutID,needsUpdate=false,renderWatch=nv.utils.renderWatch(dispatch,duration),_sizeRange_def=[16,256],_cache={};function getCache(d){var key,val;key=d[0].series+":"+d[1];val=_cache[key]=_cache[key]||{};return val}function delCache(d){var key,val;key=d[0].series+":"+d[1];delete _cache[key]}function getDiffs(d){var i,key,val,cache=getCache(d),diffs=false;for(i=1;i<arguments.length;i+=2){key=arguments[i];val=arguments[i+1](d[0],d[1]);if(cache[key]!==val||!cache.hasOwnProperty(key)){cache[key]=val;diffs=true}}return diffs}function chart(selection){renderWatch.reset();selection.each(function(data){container=d3.select(this);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);nv.utils.initSVG(container);data.forEach(function(series,i){series.values.forEach(function(point){point.series=i})});var logScale=typeof chart.yScale().base==="function";var seriesData=xDomain&&yDomain&&sizeDomain?[]:d3.merge(data.map(function(d){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i),size:getSize(d,i)}})}));x.domain(xDomain||d3.extent(seriesData.map(function(d){return d.x}).concat(forceX)));if(padData&&data[0])x.range(xRange||[(availableWidth*padDataOuter+availableWidth)/(2*data[0].values.length),availableWidth-availableWidth*(1+padDataOuter)/(2*data[0].values.length)]);else x.range(xRange||[0,availableWidth]);if(logScale){var min=d3.min(seriesData.map(function(d){if(d.y!==0)return d.y}));y.clamp(true).domain(yDomain||d3.extent(seriesData.map(function(d){if(d.y!==0)return d.y;else return min*.1}).concat(forceY))).range(yRange||[availableHeight,0])}else{y.domain(yDomain||d3.extent(seriesData.map(function(d){return d.y}).concat(forceY))).range(yRange||[availableHeight,0])}z.domain(sizeDomain||d3.extent(seriesData.map(function(d){return d.size}).concat(forceSize))).range(sizeRange||_sizeRange_def);singlePoint=x.domain()[0]===x.domain()[1]||y.domain()[0]===y.domain()[1];if(x.domain()[0]===x.domain()[1])x.domain()[0]?x.domain([x.domain()[0]-x.domain()[0]*.01,x.domain()[1]+x.domain()[1]*.01]):x.domain([-1,1]);if(y.domain()[0]===y.domain()[1])y.domain()[0]?y.domain([y.domain()[0]-y.domain()[0]*.01,y.domain()[1]+y.domain()[1]*.01]):y.domain([-1,1]);if(isNaN(x.domain()[0])){x.domain([-1,1])}if(isNaN(y.domain()[0])){y.domain([-1,1])}x0=x0||x;y0=y0||y;z0=z0||z;var scaleDiff=x(1)!==x0(1)||y(1)!==y0(1)||z(1)!==z0(1);width0=width0||width;height0=height0||height;var sizeDiff=width0!==width||height0!==height;xDom=xDom||[];var domainDiff=xDom[0]!==x.domain()[0]||xDom[1]!==x.domain()[1];xDom=x.domain();yDom=yDom||[];domainDiff=domainDiff||yDom[0]!==y.domain()[0]||yDom[1]!==y.domain()[1];yDom=y.domain();var wrap=container.selectAll("g.nv-wrap.nv-scatter").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+id);var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");wrap.classed("nv-single-point",singlePoint);gEnter.append("g").attr("class","nv-groups");gEnter.append("g").attr("class","nv-point-paths");wrapEnter.append("g").attr("class","nv-point-clips");wrap.attr("transform","translate("+margin.left+","+margin.top+")");defsEnter.append("clipPath").attr("id","nv-edge-clip-"+id).append("rect").attr("transform","translate( -10, -10)");wrap.select("#nv-edge-clip-"+id+" rect").attr("width",availableWidth+20).attr("height",availableHeight>0?availableHeight+20:0);g.attr("clip-path",clipEdge?"url(#nv-edge-clip-"+id+")":"");function updateInteractiveLayer(){needsUpdate=false;if(!interactive)return false;container.selectAll(".nv-point.hover").classed("hover",false);wrap.select(".nv-point-paths").selectAll("path").remove();if(useVoronoi===true){var vertices=d3.merge(data.map(function(group,groupIndex){return group.values.map(function(point,pointIndex){var pX=getX(point,pointIndex);var pY=getY(point,pointIndex);return[nv.utils.NaNtoZero(x(pX))+Math.random()*1e-4,nv.utils.NaNtoZero(y(pY))+Math.random()*1e-4,groupIndex,pointIndex,point]}).filter(function(pointArray,pointIndex){return pointActive(pointArray[4],pointIndex)})}));if(vertices.length==0)return false;if(vertices.length<3){vertices.push([x.range()[0]-20,y.range()[0]-20,null,null]);vertices.push([x.range()[1]+20,y.range()[1]+20,null,null]);vertices.push([x.range()[0]-20,y.range()[0]+20,null,null]);vertices.push([x.range()[1]+20,y.range()[1]-20,null,null])}var bounds=d3.geom.polygon([[-10,-10],[-10,height+10],[width+10,height+10],[width+10,-10]]);var epsilon=1e-4;vertices=vertices.sort(function(a,b){return a[0]-b[0]||a[1]-b[1]});for(var i=0;i<vertices.length-1;){if(Math.abs(vertices[i][0]-vertices[i+1][0])<epsilon&&Math.abs(vertices[i][1]-vertices[i+1][1])<epsilon){vertices.splice(i+1,1)}else{i++}}var voronoi=d3.geom.voronoi(vertices).map(function(d,i){if(d.length===0){return null}return{data:bounds.clip(d),series:vertices[i][2],point:vertices[i][3]}});var pointPaths=wrap.select(".nv-point-paths").selectAll("path").data(voronoi);var vPointPaths=pointPaths.enter().append("svg:path").attr("d",function(d){if(!d||!d.data||d.data.length===0)return"M 0 0";else return"M"+d.data.join(",")+"Z"}).attr("id",function(d,i){return"nv-path-"+i}).attr("clip-path",function(d,i){return"url(#nv-clip-"+id+"-"+i+")"});if(showVoronoi){vPointPaths.style("fill",d3.rgb(230,230,230)).style("fill-opacity",.4).style("stroke-opacity",1).style("stroke",d3.rgb(200,200,200))}if(clipVoronoi){wrap.select(".nv-point-clips").selectAll("*").remove();var pointClips=wrap.select(".nv-point-clips").selectAll("clipPath").data(vertices);var vPointClips=pointClips.enter().append("svg:clipPath").attr("id",function(d,i){return"nv-clip-"+id+"-"+i}).append("svg:circle").attr("cx",function(d){return d[0]}).attr("cy",function(d){return d[1]}).attr("r",clipRadius)}var mouseEventCallback=function(el,d,mDispatch){if(needsUpdate)return 0;var series=data[d.series];if(series===undefined)return;var point=series.values[d.point];point["color"]=color(series,d.series);point["x"]=getX(point);point["y"]=getY(point);var box=container.node().getBoundingClientRect();var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var pos={left:x(getX(point,d.point))+box.left+scrollLeft+margin.left+10,top:y(getY(point,d.point))+box.top+scrollTop+margin.top+10};mDispatch({point:point,series:series,pos:pos,relativePos:[x(getX(point,d.point))+margin.left,y(getY(point,d.point))+margin.top],seriesIndex:d.series,pointIndex:d.point,event:d3.event,element:el})};pointPaths.on("click",function(d){mouseEventCallback(this,d,dispatch.elementClick)}).on("dblclick",function(d){mouseEventCallback(this,d,dispatch.elementDblClick)}).on("mouseover",function(d){mouseEventCallback(this,d,dispatch.elementMouseover)}).on("mouseout",function(d,i){mouseEventCallback(this,d,dispatch.elementMouseout)})}else{wrap.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(d,i){if(needsUpdate||!data[d[0].series])return 0;var series=data[d[0].series],point=series.values[i];var element=this;dispatch.elementClick({point:point,series:series,pos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],relativePos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],seriesIndex:d[0].series,pointIndex:i,event:d3.event,element:element})}).on("dblclick",function(d,i){if(needsUpdate||!data[d[0].series])return 0;var series=data[d[0].series],point=series.values[i];dispatch.elementDblClick({point:point,series:series,pos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],relativePos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],seriesIndex:d[0].series,pointIndex:i})}).on("mouseover",function(d,i){if(needsUpdate||!data[d[0].series])return 0;var series=data[d[0].series],point=series.values[i];dispatch.elementMouseover({point:point,series:series,pos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],relativePos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],seriesIndex:d[0].series,pointIndex:i,color:color(d[0],i)})}).on("mouseout",function(d,i){if(needsUpdate||!data[d[0].series])return 0;var series=data[d[0].series],point=series.values[i];dispatch.elementMouseout({point:point,series:series,pos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],relativePos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],seriesIndex:d[0].series,pointIndex:i,color:color(d[0],i)})})}}needsUpdate=true;var groups=wrap.select(".nv-groups").selectAll(".nv-group").data(function(d){return d},function(d){return d.key});groups.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);groups.exit().remove();groups.attr("class",function(d,i){return(d.classed||"")+" nv-group nv-series-"+i}).classed("nv-noninteractive",!interactive).classed("hover",function(d){return d.hover});groups.watchTransition(renderWatch,"scatter: groups").style("fill",function(d,i){return color(d,i)}).style("stroke",function(d,i){return d.pointBorderColor||pointBorderColor||color(d,i)}).style("stroke-opacity",1).style("fill-opacity",.5);var points=groups.selectAll("path.nv-point").data(function(d){return d.values.map(function(point,pointIndex){return[point,pointIndex]}).filter(function(pointArray,pointIndex){return pointActive(pointArray[0],pointIndex)})});points.enter().append("path").attr("class",function(d){return"nv-point nv-point-"+d[1]}).style("fill",function(d){return d.color}).style("stroke",function(d){return d.color}).attr("transform",function(d){return"translate("+nv.utils.NaNtoZero(x0(getX(d[0],d[1])))+","+nv.utils.NaNtoZero(y0(getY(d[0],d[1])))+")"}).attr("d",nv.utils.symbol().type(function(d){return getShape(d[0])}).size(function(d){return z(getSize(d[0],d[1]))}));points.exit().each(delCache).remove();groups.exit().selectAll("path.nv-point").watchTransition(renderWatch,"scatter exit").attr("transform",function(d){return"translate("+nv.utils.NaNtoZero(x(getX(d[0],d[1])))+","+nv.utils.NaNtoZero(y(getY(d[0],d[1])))+")"}).remove();points.filter(function(d){return getDiffs(d,"x",getX,"y",getY)||scaleDiff||sizeDiff||domainDiff}).watchTransition(renderWatch,"scatter points").attr("transform",function(d){return"translate("+nv.utils.NaNtoZero(x(getX(d[0],d[1])))+","+nv.utils.NaNtoZero(y(getY(d[0],d[1])))+")"});points.filter(function(d){return getDiffs(d,"shape",getShape,"size",getSize)||scaleDiff||sizeDiff||domainDiff}).watchTransition(renderWatch,"scatter points").attr("d",nv.utils.symbol().type(function(d){return getShape(d[0])}).size(function(d){return z(getSize(d[0],d[1]))}));if(showLabels){var titles=groups.selectAll(".nv-label").data(function(d){return d.values.map(function(point,pointIndex){return[point,pointIndex]}).filter(function(pointArray,pointIndex){return pointActive(pointArray[0],pointIndex)})});titles.enter().append("text").style("fill",function(d,i){return d.color}).style("stroke-opacity",0).style("fill-opacity",1).attr("transform",function(d){var dx=nv.utils.NaNtoZero(x0(getX(d[0],d[1])))+Math.sqrt(z(getSize(d[0],d[1]))/Math.PI)+2;return"translate("+dx+","+nv.utils.NaNtoZero(y0(getY(d[0],d[1])))+")"}).text(function(d,i){return d[0].label});titles.exit().remove();groups.exit().selectAll("path.nv-label").watchTransition(renderWatch,"scatter exit").attr("transform",function(d){var dx=nv.utils.NaNtoZero(x(getX(d[0],d[1])))+Math.sqrt(z(getSize(d[0],d[1]))/Math.PI)+2;return"translate("+dx+","+nv.utils.NaNtoZero(y(getY(d[0],d[1])))+")"}).remove();titles.each(function(d){d3.select(this).classed("nv-label",true).classed("nv-label-"+d[1],false).classed("hover",false)});titles.watchTransition(renderWatch,"scatter labels").text(function(d,i){return d[0].label}).attr("transform",function(d){var dx=nv.utils.NaNtoZero(x(getX(d[0],d[1])))+Math.sqrt(z(getSize(d[0],d[1]))/Math.PI)+2;return"translate("+dx+","+nv.utils.NaNtoZero(y(getY(d[0],d[1])))+")"})}if(interactiveUpdateDelay){clearTimeout(timeoutID);timeoutID=setTimeout(updateInteractiveLayer,interactiveUpdateDelay)}else{updateInteractiveLayer()}x0=x.copy();y0=y.copy();z0=z.copy();width0=width;height0=height});renderWatch.renderEnd("scatter immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._calls=new function(){this.clearHighlights=function(){nv.dom.write(function(){container.selectAll(".nv-point.hover").classed("hover",false)});return null};this.highlightPoint=function(seriesIndex,pointIndex,isHoverOver){nv.dom.write(function(){container.select(".nv-groups").selectAll(".nv-series-"+seriesIndex).selectAll(".nv-point-"+pointIndex).classed("hover",isHoverOver)})}};dispatch.on("elementMouseover.point",function(d){if(interactive)chart._calls.highlightPoint(d.seriesIndex,d.pointIndex,true)});dispatch.on("elementMouseout.point",function(d){if(interactive)chart._calls.highlightPoint(d.seriesIndex,d.pointIndex,false)});chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},xScale:{get:function(){return x},set:function(_){x=_}},yScale:{get:function(){return y},set:function(_){y=_}},pointScale:{get:function(){return z},set:function(_){z=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},pointDomain:{get:function(){return sizeDomain},set:function(_){sizeDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},pointRange:{get:function(){return sizeRange},set:function(_){sizeRange=_}},forceX:{get:function(){return forceX},set:function(_){forceX=_}},forceY:{get:function(){return forceY},set:function(_){forceY=_}},forcePoint:{get:function(){return forceSize},set:function(_){forceSize=_}},interactive:{get:function(){return interactive},set:function(_){interactive=_}},pointActive:{get:function(){return pointActive},set:function(_){pointActive=_}},padDataOuter:{get:function(){return padDataOuter},set:function(_){padDataOuter=_}},padData:{get:function(){return padData},set:function(_){padData=_}},clipEdge:{get:function(){return clipEdge},set:function(_){clipEdge=_}},clipVoronoi:{get:function(){return clipVoronoi},set:function(_){clipVoronoi=_}},clipRadius:{get:function(){return clipRadius},set:function(_){clipRadius=_}},showVoronoi:{get:function(){return showVoronoi},set:function(_){showVoronoi=_}},id:{get:function(){return id},set:function(_){id=_}},interactiveUpdateDelay:{get:function(){return interactiveUpdateDelay},set:function(_){interactiveUpdateDelay=_}},showLabels:{get:function(){return showLabels},set:function(_){showLabels=_}},pointBorderColor:{get:function(){return pointBorderColor},set:function(_){pointBorderColor=_}},x:{get:function(){return getX},set:function(_){getX=d3.functor(_)}},y:{get:function(){return getY},set:function(_){getY=d3.functor(_)}},pointSize:{get:function(){return getSize},set:function(_){getSize=d3.functor(_)}},pointShape:{get:function(){return getShape},set:function(_){getShape=d3.functor(_)}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},useVoronoi:{get:function(){return useVoronoi},set:function(_){useVoronoi=_;if(useVoronoi===false){clipVoronoi=false}}}});nv.utils.initOptions(chart);return chart};nv.models.scatterChart=function(){"use strict";var scatter=nv.models.scatter(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),distX=nv.models.distribution(),distY=nv.models.distribution(),tooltip=nv.models.tooltip();var margin={top:30,right:20,bottom:50,left:75},marginTop=null,width=null,height=null,container=null,color=nv.utils.defaultColor(),x=scatter.xScale(),y=scatter.yScale(),showDistX=false,showDistY=false,showLegend=true,showXAxis=true,showYAxis=true,rightAlignYAxis=false,state=nv.utils.state(),defaultState=null,dispatch=d3.dispatch("stateChange","changeState","renderEnd"),noData=null,duration=250,showLabels=false;scatter.xScale(x).yScale(y);xAxis.orient("bottom").tickPadding(10);yAxis.orient(rightAlignYAxis?"right":"left").tickPadding(10);distX.axis("x");distY.axis("y");tooltip.headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)}).valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)});var x0,y0,renderWatch=nv.utils.renderWatch(dispatch,duration);var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled})}}};var stateSetter=function(data){return function(state){if(state.active!==undefined)data.forEach(function(series,i){series.disabled=!state.active[i]})}};function chart(selection){renderWatch.reset();renderWatch.models(scatter);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);if(showDistX)renderWatch.models(distX);if(showDistY)renderWatch.models(distY);selection.each(function(data){var that=this;container=d3.select(this);nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){if(duration===0)container.call(chart);else container.transition().duration(duration).call(chart)};chart.container=this;state.setter(stateSetter(data),chart.update).getter(stateGetter(data)).update();state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);renderWatch.renderEnd("scatter immediate");return chart}else{container.selectAll(".nv-noData").remove()}x=scatter.xScale();y=scatter.yScale();var wrap=container.selectAll("g.nv-wrap.nv-scatterChart").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+scatter.id());var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-scatterWrap");gEnter.append("g").attr("class","nv-regressionLinesWrap");gEnter.append("g").attr("class","nv-distWrap");gEnter.append("g").attr("class","nv-legendWrap");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{var legendWidth=availableWidth;legend.width(legendWidth);wrap.select(".nv-legendWrap").datum(data).call(legend);if(!marginTop&&legend.height()!==margin.top){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)}wrap.select(".nv-legendWrap").attr("transform","translate(0"+","+-margin.top+")")}wrap.attr("transform","translate("+margin.left+","+margin.top+")");scatter.width(availableWidth).height(availableHeight).color(data.map(function(d,i){d.color=d.color||color(d,i);return d.color}).filter(function(d,i){return!data[i].disabled})).showLabels(showLabels);wrap.select(".nv-scatterWrap").datum(data.filter(function(d){return!d.disabled})).call(scatter);wrap.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+scatter.id()+")");var regWrap=wrap.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(d){return d});regWrap.enter().append("g").attr("class","nv-regLines");var regLine=regWrap.selectAll(".nv-regLine").data(function(d){return[d]});regLine.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);regLine.filter(function(d){return d.intercept&&d.slope}).watchTransition(renderWatch,"scatterPlusLineChart: regline").attr("x1",x.range()[0]).attr("x2",x.range()[1]).attr("y1",function(d,i){return y(x.domain()[0]*d.slope+d.intercept)}).attr("y2",function(d,i){return y(x.domain()[1]*d.slope+d.intercept)}).style("stroke",function(d,i,j){return color(d,j)}).style("stroke-opacity",function(d,i){return d.disabled||typeof d.slope==="undefined"||typeof d.intercept==="undefined"?0:1});if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")").call(xAxis)}if(showYAxis){yAxis.scale(y)._ticks(nv.utils.calcTicksY(availableHeight/36,data)).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").call(yAxis)}distX.getData(scatter.x()).scale(x).width(availableWidth).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));gEnter.select(".nv-distWrap").append("g").attr("class","nv-distributionX");g.select(".nv-distributionX").attr("transform","translate(0,"+y.range()[0]+")").datum(data.filter(function(d){return!d.disabled})).call(distX).style("opacity",function(){return showDistX?"1":"1e-6"}).watchTransition(renderWatch,"scatterPlusLineChart").style("opacity",function(){return showDistX?"1":"1e-6"});distY.getData(scatter.y()).scale(y).width(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));gEnter.select(".nv-distWrap").append("g").attr("class","nv-distributionY");g.select(".nv-distributionY").attr("transform","translate("+(rightAlignYAxis?availableWidth:-distY.size())+",0)").datum(data.filter(function(d){return!d.disabled})).call(distY).style("opacity",function(){return showDistY?"1":"1e-6"}).watchTransition(renderWatch,"scatterPlusLineChart").style("opacity",function(){return showDistY?"1":"1e-6"});legend.dispatch.on("stateChange",function(newState){for(var key in newState)state[key]=newState[key];dispatch.stateChange(state);chart.update()});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()});scatter.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true);container.select(".nv-chart-"+scatter.id()+" .nv-series-"+evt.seriesIndex+" .nv-distx-"+evt.pointIndex).attr("y1",0);container.select(".nv-chart-"+scatter.id()+" .nv-series-"+evt.seriesIndex+" .nv-disty-"+evt.pointIndex).attr("x2",distY.size())});scatter.dispatch.on("elementMouseover.tooltip",function(evt){container.select(".nv-series-"+evt.seriesIndex+" .nv-distx-"+evt.pointIndex).attr("y1",evt.relativePos[1]-availableHeight);container.select(".nv-series-"+evt.seriesIndex+" .nv-disty-"+evt.pointIndex).attr("x2",evt.relativePos[0]+distX.size());tooltip.data(evt).hidden(false)});x0=x.copy();y0=y.copy()});renderWatch.renderEnd("scatter with line immediate");return chart}chart.dispatch=dispatch;chart.scatter=scatter;chart.legend=legend;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.distX=distX;chart.distY=distY;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},container:{get:function(){return container},set:function(_){container=_}},showDistX:{get:function(){return showDistX},set:function(_){showDistX=_}},showDistY:{get:function(){return showDistY},set:function(_){showDistY=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},noData:{get:function(){return noData},set:function(_){noData=_}},duration:{get:function(){return duration},set:function(_){duration=_}},showLabels:{get:function(){return showLabels},set:function(_){showLabels=_}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(_?"right":"left")}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color);distX.color(color);distY.color(color)}}});nv.utils.inheritOptions(chart,scatter);nv.utils.initOptions(chart);return chart};nv.models.sparkline=function(){"use strict";var margin={top:2,right:0,bottom:2,left:0},width=400,height=32,container=null,animate=true,x=d3.scale.linear(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},color=nv.utils.getColor(["#000"]),xDomain,yDomain,xRange,yRange,showMinMaxPoints=true,showCurrentPoint=true,dispatch=d3.dispatch("renderEnd");var renderWatch=nv.utils.renderWatch(dispatch);function chart(selection){renderWatch.reset();selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);x.domain(xDomain||d3.extent(data,getX)).range(xRange||[0,availableWidth]);y.domain(yDomain||d3.extent(data,getY)).range(yRange||[availableHeight,0]);var wrap=container.selectAll("g.nv-wrap.nv-sparkline").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var gEnter=wrapEnter.append("g");var g=wrap.select("g");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var paths=wrap.selectAll("path").data(function(d){return[d]});paths.enter().append("path");paths.exit().remove();paths.style("stroke",function(d,i){return d.color||color(d,i)}).attr("d",d3.svg.line().x(function(d,i){return x(getX(d,i))}).y(function(d,i){return y(getY(d,i))}));var points=wrap.selectAll("circle.nv-point").data(function(data){var yValues=data.map(function(d,i){return getY(d,i)});function pointIndex(index){if(index!=-1){var result=data[index];result.pointIndex=index;return result}else{return null}}var maxPoint=pointIndex(yValues.lastIndexOf(y.domain()[1])),minPoint=pointIndex(yValues.indexOf(y.domain()[0])),currentPoint=pointIndex(yValues.length-1);return[showMinMaxPoints?minPoint:null,showMinMaxPoints?maxPoint:null,showCurrentPoint?currentPoint:null].filter(function(d){return d!=null})});points.enter().append("circle");points.exit().remove();points.attr("cx",function(d,i){return x(getX(d,d.pointIndex))}).attr("cy",function(d,i){return y(getY(d,d.pointIndex))}).attr("r",2).attr("class",function(d,i){return getX(d,d.pointIndex)==x.domain()[1]?"nv-point nv-currentValue":getY(d,d.pointIndex)==y.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});renderWatch.renderEnd("sparkline immediate");return chart}chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},xDomain:{get:function(){return xDomain},set:function(_){xDomain=_}},yDomain:{get:function(){return yDomain},set:function(_){yDomain=_}},xRange:{get:function(){return xRange},set:function(_){xRange=_}},yRange:{get:function(){return yRange},set:function(_){yRange=_}},xScale:{get:function(){return x},set:function(_){x=_}},yScale:{get:function(){return y},set:function(_){y=_}},animate:{get:function(){return animate},set:function(_){animate=_}},showMinMaxPoints:{get:function(){return showMinMaxPoints},set:function(_){showMinMaxPoints=_}},showCurrentPoint:{get:function(){return showCurrentPoint},set:function(_){showCurrentPoint=_}},x:{get:function(){return getX},set:function(_){getX=d3.functor(_)}},y:{get:function(){return getY},set:function(_){getY=d3.functor(_)}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});chart.dispatch=dispatch;nv.utils.initOptions(chart);return chart};nv.models.sparklinePlus=function(){"use strict";var sparkline=nv.models.sparkline();var margin={top:15,right:100,bottom:10,left:50},width=null,height=null,x,y,index=[],paused=false,xTickFormat=d3.format(",r"),yTickFormat=d3.format(",.2f"),showLastValue=true,alignValue=true,rightAlignValue=false,noData=null,dispatch=d3.dispatch("renderEnd");var renderWatch=nv.utils.renderWatch(dispatch);function chart(selection){renderWatch.reset();renderWatch.models(sparkline);selection.each(function(data){var container=d3.select(this);nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){container.call(chart)};chart.container=this;if(!data||!data.length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}var currentValue=sparkline.y()(data[data.length-1],data.length-1);x=sparkline.xScale();y=sparkline.yScale();var wrap=container.selectAll("g.nv-wrap.nv-sparklineplus").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-sparklineWrap");gEnter.append("g").attr("class","nv-valueWrap");gEnter.append("g").attr("class","nv-hoverArea");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var sparklineWrap=g.select(".nv-sparklineWrap");sparkline.width(availableWidth).height(availableHeight);sparklineWrap.call(sparkline);if(showLastValue){var valueWrap=g.select(".nv-valueWrap");var value=valueWrap.selectAll(".nv-currentValue").data([currentValue]);value.enter().append("text").attr("class","nv-currentValue").attr("dx",rightAlignValue?-8:8).attr("dy",".9em").style("text-anchor",rightAlignValue?"end":"start");value.attr("x",availableWidth+(rightAlignValue?margin.right:0)).attr("y",alignValue?function(d){return y(d)}:0).style("fill",sparkline.color()(data[data.length-1],data.length-1)).text(yTickFormat(currentValue))}gEnter.select(".nv-hoverArea").append("rect").on("mousemove",sparklineHover).on("click",function(){paused=!paused}).on("mouseout",function(){index=[];updateValueLine()});g.select(".nv-hoverArea rect").attr("transform",function(d){return"translate("+-margin.left+","+-margin.top+")"}).attr("width",availableWidth+margin.left+margin.right).attr("height",availableHeight+margin.top);function updateValueLine(){if(paused)return;var hoverValue=g.selectAll(".nv-hoverValue").data(index);var hoverEnter=hoverValue.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);hoverValue.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();hoverValue.attr("transform",function(d){return"translate("+x(sparkline.x()(data[d],d))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!index.length)return;hoverEnter.append("line").attr("x1",0).attr("y1",-margin.top).attr("x2",0).attr("y2",availableHeight);hoverEnter.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-margin.top).attr("text-anchor","end").attr("dy",".9em");g.select(".nv-hoverValue .nv-xValue").text(xTickFormat(sparkline.x()(data[index[0]],index[0])));hoverEnter.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-margin.top).attr("text-anchor","start").attr("dy",".9em");g.select(".nv-hoverValue .nv-yValue").text(yTickFormat(sparkline.y()(data[index[0]],index[0])))}function sparklineHover(){if(paused)return;var pos=d3.mouse(this)[0]-margin.left;function getClosestIndex(data,x){var distance=Math.abs(sparkline.x()(data[0],0)-x);var closestIndex=0;for(var i=0;i<data.length;i++){if(Math.abs(sparkline.x()(data[i],i)-x)<distance){distance=Math.abs(sparkline.x()(data[i],i)-x);closestIndex=i}}return closestIndex}index=[getClosestIndex(data,Math.round(x.invert(pos)))];updateValueLine()}});renderWatch.renderEnd("sparklinePlus immediate");return chart}chart.dispatch=dispatch;chart.sparkline=sparkline;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},xTickFormat:{get:function(){return xTickFormat},set:function(_){xTickFormat=_}},yTickFormat:{get:function(){return yTickFormat},set:function(_){yTickFormat=_}},showLastValue:{get:function(){return showLastValue},set:function(_){showLastValue=_}},alignValue:{get:function(){return alignValue},set:function(_){alignValue=_}},rightAlignValue:{get:function(){return rightAlignValue},set:function(_){rightAlignValue=_}},noData:{get:function(){return noData},set:function(_){noData=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}}});nv.utils.inheritOptions(chart,sparkline);nv.utils.initOptions(chart);return chart};nv.models.stackedArea=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,color=nv.utils.defaultColor(),id=Math.floor(Math.random()*1e5),container=null,getX=function(d){return d.x},getY=function(d){return d.y},defined=function(d,i){return!isNaN(getY(d,i))&&getY(d,i)!==null},style="stack",offset="zero",order="default",interpolate="linear",clipEdge=false,x,y,scatter=nv.models.scatter(),duration=250,transformData=function(d,y0,y){d.display={y:y,y0:y0}},areaY1=function(d){return y(d.display.y+d.display.y0)},dispatch=d3.dispatch("areaClick","areaMouseover","areaMouseout","renderEnd","elementClick","elementMouseover","elementMouseout");scatter.pointSize(2.2).pointDomain([2.2,2.2]);var renderWatch=nv.utils.renderWatch(dispatch,duration);function chart(selection){renderWatch.reset();renderWatch.models(scatter);selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom;container=d3.select(this);nv.utils.initSVG(container);x=scatter.xScale();y=scatter.yScale();var dataRaw=data;data.forEach(function(aseries,i){aseries.seriesIndex=i;aseries.values=aseries.values.map(function(d,j){d.index=j;d.seriesIndex=i;return d})});var dataFiltered=data.filter(function(series){return!series.disabled});data=d3.layout.stack().order(order).offset(offset).values(function(d){return d.values}).x(getX).y(getY).out(transformData)(dataFiltered);var wrap=container.selectAll("g.nv-wrap.nv-stackedarea").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-areaWrap");gEnter.append("g").attr("class","nv-scatterWrap");wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(scatter.forceY().length==0){scatter.forceY().push(0)}scatter.width(availableWidth).height(availableHeight).x(getX).y(function(d){if(d.display!==undefined){return d.display.y+d.display.y0}}).color(data.map(function(d,i){d.color=d.color||color(d,d.seriesIndex);return d.color}));var scatterWrap=g.select(".nv-scatterWrap").datum(data);scatterWrap.call(scatter);defsEnter.append("clipPath").attr("id","nv-edge-clip-"+id).append("rect");wrap.select("#nv-edge-clip-"+id+" rect").attr("width",availableWidth).attr("height",availableHeight);g.attr("clip-path",clipEdge?"url(#nv-edge-clip-"+id+")":"");var area=d3.svg.area().defined(defined).x(function(d,i){return x(getX(d,i))}).y0(function(d){return y(d.display.y0)}).y1(areaY1).interpolate(interpolate);var zeroArea=d3.svg.area().defined(defined).x(function(d,i){return x(getX(d,i))}).y0(function(d){return y(d.display.y0)}).y1(function(d){return y(d.display.y0)}).interpolate(interpolate);var path=g.select(".nv-areaWrap").selectAll("path.nv-area").data(function(d){return d});path.enter().append("path").attr("class",function(d,i){return"nv-area nv-area-"+i}).attr("d",function(d,i){return zeroArea(d.values,d.seriesIndex)}).on("mouseover",function(d,i){d3.select(this).classed("hover",true);dispatch.areaMouseover({point:d,series:d.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:d.seriesIndex})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false);dispatch.areaMouseout({point:d,series:d.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:d.seriesIndex})}).on("click",function(d,i){d3.select(this).classed("hover",false);dispatch.areaClick({point:d,series:d.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:d.seriesIndex})});path.exit().remove();path.style("fill",function(d,i){return d.color||color(d,d.seriesIndex)}).style("stroke",function(d,i){return d.color||color(d,d.seriesIndex)});path.watchTransition(renderWatch,"stackedArea path").attr("d",function(d,i){return area(d.values,i)});scatter.dispatch.on("elementMouseover.area",function(e){g.select(".nv-chart-"+id+" .nv-area-"+e.seriesIndex).classed("hover",true)});scatter.dispatch.on("elementMouseout.area",function(e){g.select(".nv-chart-"+id+" .nv-area-"+e.seriesIndex).classed("hover",false)});chart.d3_stackedOffset_stackPercent=function(stackData){var n=stackData.length,m=stackData[0].length,i,j,o,y0=[];for(j=0;j<m;++j){for(i=0,o=0;i<dataRaw.length;i++){o+=getY(dataRaw[i].values[j])}if(o)for(i=0;i<n;i++){stackData[i][j][1]/=o}else{for(i=0;i<n;i++){stackData[i][j][1]=0}}}for(j=0;j<m;++j)y0[j]=0;return y0}});renderWatch.renderEnd("stackedArea immediate");return chart}chart.dispatch=dispatch;chart.scatter=scatter;scatter.dispatch.on("elementClick",function(){dispatch.elementClick.apply(this,arguments)});scatter.dispatch.on("elementMouseover",function(){dispatch.elementMouseover.apply(this,arguments)});scatter.dispatch.on("elementMouseout",function(){dispatch.elementMouseout.apply(this,arguments)});chart.interpolate=function(_){if(!arguments.length)return interpolate;interpolate=_;return chart};chart.duration=function(_){if(!arguments.length)return duration;duration=_;renderWatch.reset(duration);scatter.duration(duration);return chart};chart.dispatch=dispatch;chart.scatter=scatter;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},defined:{get:function(){return defined},set:function(_){defined=_}},clipEdge:{get:function(){return clipEdge},set:function(_){clipEdge=_}},offset:{get:function(){return offset},set:function(_){offset=_}},order:{get:function(){return order},set:function(_){order=_}},interpolate:{get:function(){return interpolate},set:function(_){interpolate=_}},x:{get:function(){return getX},set:function(_){getX=d3.functor(_)}},y:{get:function(){return getY},set:function(_){getY=d3.functor(_)}},areaY1:{get:function(){return areaY1},set:function(_){areaY1=d3.functor(_)}},transformData:{get:function(){return transformData},set:function(_){transformData=d3.functor(_)}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}},style:{get:function(){return style},set:function(_){style=_;switch(style){case"stack":chart.offset("zero");chart.order("default");break;case"stream":chart.offset("wiggle");chart.order("inside-out");break;case"stream-center":chart.offset("silhouette");chart.order("inside-out");break;case"expand":chart.offset("expand");chart.order("default");break;case"stack_percent":chart.offset(chart.d3_stackedOffset_stackPercent);chart.order("default");break}}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);scatter.duration(duration)}}});nv.utils.inheritOptions(chart,scatter);nv.utils.initOptions(chart);return chart};nv.models.stackedAreaChart=function(){"use strict";var stacked=nv.models.stackedArea(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),controls=nv.models.legend(),interactiveLayer=nv.interactiveGuideline(),tooltip=nv.models.tooltip(),focus=nv.models.focus(nv.models.stackedArea());var margin={top:10,right:25,bottom:50,left:60},marginTop=null,width=null,height=null,color=nv.utils.defaultColor(),showControls=true,showLegend=true,legendPosition="top",showXAxis=true,showYAxis=true,rightAlignYAxis=false,focusEnable=false,useInteractiveGuideline=false,showTotalInTooltip=true,totalLabel="TOTAL",x,y,state=nv.utils.state(),defaultState=null,noData=null,dispatch=d3.dispatch("stateChange","changeState","renderEnd"),controlWidth=250,controlOptions=["Stacked","Stream","Expanded"],controlLabels={},duration=250;state.style=stacked.style();xAxis.orient("bottom").tickPadding(7);yAxis.orient(rightAlignYAxis?"right":"left");tooltip.headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)}).valueFormatter(function(d,i){return yAxis.tickFormat()(d,i)});interactiveLayer.tooltip.headerFormatter(function(d,i){return xAxis.tickFormat()(d,i)}).valueFormatter(function(d,i){return d==null?"N/A":yAxis.tickFormat()(d,i)});var oldYTickFormat=null,oldValueFormatter=null;controls.updateState(false);var renderWatch=nv.utils.renderWatch(dispatch);var style=stacked.style();var stateGetter=function(data){return function(){return{active:data.map(function(d){return!d.disabled}),style:stacked.style()}}};var stateSetter=function(data){return function(state){if(state.style!==undefined)style=state.style;if(state.active!==undefined)data.forEach(function(series,i){series.disabled=!state.active[i]})}};var percentFormatter=d3.format("%");function chart(selection){renderWatch.reset();renderWatch.models(stacked);if(showXAxis)renderWatch.models(xAxis);if(showYAxis)renderWatch.models(yAxis);selection.each(function(data){var container=d3.select(this),that=this;nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin),availableHeight=nv.utils.availableHeight(height,container,margin)-(focusEnable?focus.height():0);chart.update=function(){container.transition().duration(duration).call(chart)};chart.container=this;state.setter(stateSetter(data),chart.update).getter(stateGetter(data)).update();state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}x=stacked.xScale();y=stacked.yScale();var wrap=container.selectAll("g.nv-wrap.nv-stackedAreaChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");var focusEnter=gEnter.append("g").attr("class","nv-focus");focusEnter.append("g").attr("class","nv-background").append("rect");focusEnter.append("g").attr("class","nv-x nv-axis");focusEnter.append("g").attr("class","nv-y nv-axis");focusEnter.append("g").attr("class","nv-stackedWrap");focusEnter.append("g").attr("class","nv-interactive");var contextEnter=gEnter.append("g").attr("class","nv-focusWrap");if(!showLegend){g.select(".nv-legendWrap").selectAll("*").remove()}else{var legendWidth=showControls&&legendPosition==="top"?availableWidth-controlWidth:availableWidth;legend.width(legendWidth);g.select(".nv-legendWrap").datum(data).call(legend);if(legendPosition==="bottom"){var xAxisHeight=xAxis.height();margin.bottom=Math.max(legend.height()+xAxisHeight,margin.bottom);availableHeight=nv.utils.availableHeight(height,container,margin)-(focusEnable?focus.height():0);var legendTop=availableHeight+xAxisHeight;g.select(".nv-legendWrap").attr("transform","translate(0,"+legendTop+")")}else if(legendPosition==="top"){if(!marginTop&&margin.top!=legend.height()){margin.top=legend.height();availableHeight=nv.utils.availableHeight(height,container,margin)-(focusEnable?focus.height():0)}g.select(".nv-legendWrap").attr("transform","translate("+(availableWidth-legendWidth)+","+-margin.top+")")}}if(!showControls){g.select(".nv-controlsWrap").selectAll("*").remove()}else{var controlsData=[{key:controlLabels.stacked||"Stacked",metaKey:"Stacked",disabled:stacked.style()!="stack",style:"stack"},{key:controlLabels.stream||"Stream",metaKey:"Stream",disabled:stacked.style()!="stream",style:"stream"},{key:controlLabels.stream_center||"Stream Center",metaKey:"Stream_Center",disabled:stacked.style()!="stream_center",style:"stream-center"},{key:controlLabels.expanded||"Expanded",metaKey:"Expanded",disabled:stacked.style()!="expand",style:"expand"},{key:controlLabels.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:stacked.style()!="stack_percent",style:"stack_percent"}];controlWidth=controlOptions.length/3*260;controlsData=controlsData.filter(function(d){return controlOptions.indexOf(d.metaKey)!==-1});controls.width(controlWidth).color(["#444","#444","#444"]);g.select(".nv-controlsWrap").datum(controlsData).call(controls);var requiredTop=Math.max(controls.height(),showLegend&&legendPosition==="top"?legend.height():0);if(margin.top!=requiredTop){margin.top=requiredTop;availableHeight=nv.utils.availableHeight(height,container,margin)-(focusEnable?focus.height():0)}g.select(".nv-controlsWrap").attr("transform","translate(0,"+-margin.top+")")}wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}if(useInteractiveGuideline){interactiveLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-interactive").call(interactiveLayer)}g.select(".nv-focus .nv-background rect").attr("width",availableWidth).attr("height",availableHeight);stacked.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));var stackedWrap=g.select(".nv-focus .nv-stackedWrap").datum(data.filter(function(d){return!d.disabled}));if(showXAxis){xAxis.scale(x)._ticks(nv.utils.calcTicksX(availableWidth/100,data)).tickSize(-availableHeight,0)}if(showYAxis){var ticks;if(stacked.offset()==="wiggle"){ticks=0}else{ticks=nv.utils.calcTicksY(availableHeight/36,data)}yAxis.scale(y)._ticks(ticks).tickSize(-availableWidth,0)}function updateXAxis(){if(showXAxis){g.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+availableHeight+")").transition().duration(duration).call(xAxis)}}function updateYAxis(){if(showYAxis){if(stacked.style()==="expand"||stacked.style()==="stack_percent"){var currentFormat=yAxis.tickFormat();if(!oldYTickFormat||currentFormat!==percentFormatter)oldYTickFormat=currentFormat;yAxis.tickFormat(percentFormatter)}else{if(oldYTickFormat){yAxis.tickFormat(oldYTickFormat);oldYTickFormat=null}}g.select(".nv-focus .nv-y.nv-axis").transition().duration(0).call(yAxis)}}if(!focusEnable){stackedWrap.transition().call(stacked);updateXAxis();updateYAxis()}else{focus.width(availableWidth);g.select(".nv-focusWrap").attr("transform","translate(0,"+(availableHeight+margin.bottom+focus.margin().top)+")").datum(data.filter(function(d){return!d.disabled})).call(focus);var extent=focus.brush.empty()?focus.xDomain():focus.brush.extent();if(extent!==null){onBrush(extent)}}stacked.dispatch.on("areaClick.toggle",function(e){if(data.filter(function(d){return!d.disabled}).length===1)data.forEach(function(d){d.disabled=false});else data.forEach(function(d,i){d.disabled=i!=e.seriesIndex});state.disabled=data.map(function(d){return!!d.disabled});dispatch.stateChange(state);chart.update()});legend.dispatch.on("stateChange",function(newState){for(var key in newState)state[key]=newState[key];dispatch.stateChange(state);chart.update()});controls.dispatch.on("legendClick",function(d,i){if(!d.disabled)return;controlsData=controlsData.map(function(s){s.disabled=true;return s});d.disabled=false;stacked.style(d.style);state.style=stacked.style();dispatch.stateChange(state);chart.update()});interactiveLayer.dispatch.on("elementMousemove",function(e){stacked.clearHighlights();var singlePoint,pointIndex,pointXLocation,allData=[],valueSum=0,allNullValues=true,atleastOnePoint=false;data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series,i){pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());var point=series.values[pointIndex];var pointYValue=chart.y()(point,pointIndex);if(pointYValue!=null&&pointYValue>0){stacked.highlightPoint(i,pointIndex,true);atleastOnePoint=true}if(i===data.length-1&&!atleastOnePoint){stacked.highlightPoint(i,pointIndex,true)}if(typeof point==="undefined")return;if(typeof singlePoint==="undefined")singlePoint=point;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex));var tooltipValue=stacked.style()=="expand"?point.display.y:chart.y()(point,pointIndex);allData.push({key:series.key,value:tooltipValue,color:color(series,series.seriesIndex),point:point});if(showTotalInTooltip&&stacked.style()!="expand"&&tooltipValue!=null){valueSum+=tooltipValue;allNullValues=false}});allData.reverse();if(allData.length>2){var yValue=chart.yScale().invert(e.mouseY);var yDistMax=Infinity,indexToHighlight=null;allData.forEach(function(series,i){yValue=Math.abs(yValue);var stackedY0=Math.abs(series.point.display.y0);var stackedY=Math.abs(series.point.display.y);if(yValue>=stackedY0&&yValue<=stackedY+stackedY0){indexToHighlight=i;return}});if(indexToHighlight!=null)allData[indexToHighlight].highlight=true}if(showTotalInTooltip&&stacked.style()!="expand"&&allData.length>=2&&!allNullValues){allData.push({key:totalLabel,value:valueSum,total:true})}var xValue=chart.x()(singlePoint,pointIndex);var valueFormatter=interactiveLayer.tooltip.valueFormatter();if(stacked.style()==="expand"||stacked.style()==="stack_percent"){if(!oldValueFormatter){oldValueFormatter=valueFormatter}valueFormatter=d3.format(".1%")}else{if(oldValueFormatter){valueFormatter=oldValueFormatter;oldValueFormatter=null}}interactiveLayer.tooltip.valueFormatter(valueFormatter).data({value:xValue,series:allData})();interactiveLayer.renderGuideLine(pointXLocation)});interactiveLayer.dispatch.on("elementMouseout",function(e){stacked.clearHighlights()});focus.dispatch.on("onBrush",function(extent){onBrush(extent)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"&&data.length===e.disabled.length){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}if(typeof e.style!=="undefined"){stacked.style(e.style);style=e.style}chart.update()});function onBrush(extent){var stackedWrap=g.select(".nv-focus .nv-stackedWrap").datum(data.filter(function(d){return!d.disabled}).map(function(d,i){return{key:d.key,area:d.area,classed:d.classed,values:d.values.filter(function(d,i){return stacked.x()(d,i)>=extent[0]&&stacked.x()(d,i)<=extent[1]}),disableTooltip:d.disableTooltip}}));stackedWrap.transition().duration(duration).call(stacked);updateXAxis();updateYAxis()}});renderWatch.renderEnd("stacked Area chart immediate");return chart}stacked.dispatch.on("elementMouseover.tooltip",function(evt){evt.point["x"]=stacked.x()(evt.point);evt.point["y"]=stacked.y()(evt.point);tooltip.data(evt).hidden(false)});stacked.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});chart.dispatch=dispatch;chart.stacked=stacked;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.x2Axis=focus.xAxis;chart.yAxis=yAxis;chart.y2Axis=focus.yAxis;chart.interactiveLayer=interactiveLayer;chart.tooltip=tooltip;chart.focus=focus;chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},showLegend:{get:function(){return showLegend},set:function(_){showLegend=_}},legendPosition:{get:function(){return legendPosition},set:function(_){legendPosition=_}},showXAxis:{get:function(){return showXAxis},set:function(_){showXAxis=_}},showYAxis:{get:function(){return showYAxis},set:function(_){showYAxis=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},noData:{get:function(){return noData},set:function(_){noData=_}},showControls:{get:function(){return showControls},set:function(_){showControls=_}},controlLabels:{get:function(){return controlLabels},set:function(_){controlLabels=_}},controlOptions:{get:function(){return controlOptions},set:function(_){controlOptions=_}},showTotalInTooltip:{get:function(){return showTotalInTooltip},set:function(_){showTotalInTooltip=_}},totalLabel:{get:function(){return totalLabel},set:function(_){totalLabel=_}},focusEnable:{get:function(){return focusEnable},set:function(_){focusEnable=_}},focusHeight:{get:function(){return focus.height()},set:function(_){focus.height(_)}},brushExtent:{get:function(){return focus.brushExtent()},set:function(_){focus.brushExtent(_)}},margin:{get:function(){return margin},set:function(_){if(_.top!==undefined){margin.top=_.top;marginTop=_.top}margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left}},focusMargin:{get:function(){return focus.margin},set:function(_){focus.margin.top=_.top!==undefined?_.top:focus.margin.top;focus.margin.right=_.right!==undefined?_.right:focus.margin.right;focus.margin.bottom=_.bottom!==undefined?_.bottom:focus.margin.bottom;focus.margin.left=_.left!==undefined?_.left:focus.margin.left}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);stacked.duration(duration);xAxis.duration(duration);yAxis.duration(duration)}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_);legend.color(color);stacked.color(color);focus.color(color)}},x:{get:function(){return stacked.x()},set:function(_){stacked.x(_);focus.x(_)}},y:{get:function(){return stacked.y()},set:function(_){stacked.y(_);focus.y(_)}},rightAlignYAxis:{get:function(){return rightAlignYAxis},set:function(_){rightAlignYAxis=_;yAxis.orient(rightAlignYAxis?"right":"left")}},useInteractiveGuideline:{get:function(){return useInteractiveGuideline},set:function(_){useInteractiveGuideline=!!_;chart.interactive(!_);chart.useVoronoi(!_);stacked.scatter.interactive(!_)}}});nv.utils.inheritOptions(chart,stacked);nv.utils.initOptions(chart);return chart};nv.models.stackedAreaWithFocusChart=function(){return nv.models.stackedAreaChart().margin({bottom:30}).focusEnable(true)};nv.models.sunburst=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=600,height=600,mode="count",modes={count:function(d){return 1},value:function(d){return d.value||d.size},size:function(d){return d.value||d.size}},id=Math.floor(Math.random()*1e4),container=null,color=nv.utils.defaultColor(),showLabels=false,labelFormat=function(d){if(mode==="count"){return d.name+" #"+d.value}else{return d.name+" "+(d.value||d.size)}},labelThreshold=.02,sort=function(d1,d2){return d1.name>d2.name},key=function(d,i){if(d.parent!==undefined){return d.name+"-"+d.parent.name+"-"+i}else{return d.name}},groupColorByParent=true,duration=500,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMousemove","elementMouseover","elementMouseout","renderEnd");var x=d3.scale.linear().range([0,2*Math.PI]);var y=d3.scale.sqrt();var partition=d3.layout.partition().sort(sort);var node,availableWidth,availableHeight,radius;var prevPositions={};var arc=d3.svg.arc().startAngle(function(d){return Math.max(0,Math.min(2*Math.PI,x(d.x)))}).endAngle(function(d){return Math.max(0,Math.min(2*Math.PI,x(d.x+d.dx)))}).innerRadius(function(d){return Math.max(0,y(d.y))}).outerRadius(function(d){return Math.max(0,y(d.y+d.dy))});function rotationToAvoidUpsideDown(d){var centerAngle=computeCenterAngle(d);if(centerAngle>90){return 180}else{return 0}}function computeCenterAngle(d){var startAngle=Math.max(0,Math.min(2*Math.PI,x(d.x)));var endAngle=Math.max(0,Math.min(2*Math.PI,x(d.x+d.dx)));var centerAngle=(startAngle+endAngle)/2*(180/Math.PI)-90;return centerAngle}function computeNodePercentage(d){var startAngle=Math.max(0,Math.min(2*Math.PI,x(d.x)));var endAngle=Math.max(0,Math.min(2*Math.PI,x(d.x+d.dx)));return(endAngle-startAngle)/(2*Math.PI)}function labelThresholdMatched(d){var startAngle=Math.max(0,Math.min(2*Math.PI,x(d.x)));var endAngle=Math.max(0,Math.min(2*Math.PI,x(d.x+d.dx)));var size=endAngle-startAngle;return size>labelThreshold}function arcTweenZoom(e,i){var xd=d3.interpolate(x.domain(),[node.x,node.x+node.dx]),yd=d3.interpolate(y.domain(),[node.y,1]),yr=d3.interpolate(y.range(),[node.y?20:0,radius]);if(i===0){return function(){return arc(e)}}else{return function(t){x.domain(xd(t));y.domain(yd(t)).range(yr(t));return arc(e)}}}function arcTweenUpdate(d){var ipo=d3.interpolate({x:d.x0,dx:d.dx0,y:d.y0,dy:d.dy0},d);return function(t){var b=ipo(t);d.x0=b.x;d.dx0=b.dx;d.y0=b.y;d.dy0=b.dy;return arc(b)}}function updatePrevPosition(node){var k=key(node);if(!prevPositions[k])prevPositions[k]={};var pP=prevPositions[k];pP.dx=node.dx;pP.x=node.x;pP.dy=node.dy;pP.y=node.y}function storeRetrievePrevPositions(nodes){nodes.forEach(function(n){var k=key(n);var pP=prevPositions[k];if(pP){n.dx0=pP.dx;n.x0=pP.x;n.dy0=pP.dy;n.y0=pP.y}else{n.dx0=n.dx;n.x0=n.x;n.dy0=n.dy;n.y0=n.y}updatePrevPosition(n)})}function zoomClick(d){var labels=container.selectAll("text");var path=container.selectAll("path");labels.transition().attr("opacity",0);node=d;path.transition().duration(duration).attrTween("d",arcTweenZoom).each("end",function(e){if(e.x>=d.x&&e.x<d.x+d.dx){if(e.depth>=d.depth){var parentNode=d3.select(this.parentNode);var arcText=parentNode.select("text");arcText.transition().duration(duration).text(function(e){return labelFormat(e)}).attr("opacity",function(d){if(labelThresholdMatched(d)){return 1}else{return 0}}).attr("transform",function(){var width=this.getBBox().width;if(e.depth===0)return"translate("+width/2*-1+",0)";else if(e.depth===d.depth){return"translate("+(y(e.y)+5)+",0)"}else{var centerAngle=computeCenterAngle(e);var rotation=rotationToAvoidUpsideDown(e);if(rotation===0){return"rotate("+centerAngle+")translate("+(y(e.y)+5)+",0)"}else{return"rotate("+centerAngle+")translate("+(y(e.y)+width+5)+",0)rotate("+rotation+")"}}})}}})}var renderWatch=nv.utils.renderWatch(dispatch);function chart(selection){renderWatch.reset();selection.each(function(data){container=d3.select(this);availableWidth=nv.utils.availableWidth(width,container,margin);availableHeight=nv.utils.availableHeight(height,container,margin);radius=Math.min(availableWidth,availableHeight)/2;y.range([0,radius]);var wrap=container.select("g.nvd3.nv-wrap.nv-sunburst");if(!wrap[0][0]){wrap=container.append("g").attr("class","nvd3 nv-wrap nv-sunburst nv-chart-"+id).attr("transform","translate("+(availableWidth/2+margin.left+margin.right)+","+(availableHeight/2+margin.top+margin.bottom)+")")}else{wrap.attr("transform","translate("+(availableWidth/2+margin.left+margin.right)+","+(availableHeight/2+margin.top+margin.bottom)+")")}container.on("click",function(d,i){dispatch.chartClick({data:d,index:i,pos:d3.event,id:id})});partition.value(modes[mode]||modes["count"]);var nodes=partition.nodes(data[0]).reverse();storeRetrievePrevPositions(nodes);var cG=wrap.selectAll(".arc-container").data(nodes,key);var cGE=cG.enter().append("g").attr("class","arc-container");cGE.append("path").attr("d",arc).style("fill",function(d){if(d.color){return d.color}else if(groupColorByParent){return color((d.children?d:d.parent).name)}else{return color(d.name)}}).style("stroke","#FFF").on("click",function(d,i){zoomClick(d);dispatch.elementClick({data:d,index:i})}).on("mouseover",function(d,i){d3.select(this).classed("hover",true).style("opacity",.8);dispatch.elementMouseover({data:d,color:d3.select(this).style("fill"),percent:computeNodePercentage(d)})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false).style("opacity",1);dispatch.elementMouseout({data:d})}).on("mousemove",function(d,i){dispatch.elementMousemove({data:d})});cG.each(function(d){d3.select(this).select("path").transition().duration(duration).attrTween("d",arcTweenUpdate)});if(showLabels){cG.selectAll("text").remove();cG.append("text").text(function(e){return labelFormat(e)}).transition().duration(duration).attr("opacity",function(d){if(labelThresholdMatched(d)){return 1}else{return 0}}).attr("transform",function(d){var width=this.getBBox().width;if(d.depth===0){return"rotate(0)translate("+width/2*-1+",0)"}else{var centerAngle=computeCenterAngle(d);var rotation=rotationToAvoidUpsideDown(d);if(rotation===0){return"rotate("+centerAngle+")translate("+(y(d.y)+5)+",0)"}else{return"rotate("+centerAngle+")translate("+(y(d.y)+width+5)+",0)rotate("+rotation+")"}}})}zoomClick(nodes[nodes.length-1]);cG.exit().transition().duration(duration).attr("opacity",0).each("end",function(d){var k=key(d);prevPositions[k]=undefined}).remove()});renderWatch.renderEnd("sunburst immediate");return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{width:{get:function(){return width},set:function(_){width=_}},height:{get:function(){return height},set:function(_){height=_}},mode:{get:function(){return mode},set:function(_){mode=_}},id:{get:function(){return id},set:function(_){id=_}},duration:{get:function(){return duration},set:function(_){duration=_}},groupColorByParent:{get:function(){return groupColorByParent},set:function(_){groupColorByParent=!!_}},showLabels:{get:function(){return showLabels},set:function(_){showLabels=!!_}},labelFormat:{get:function(){return labelFormat},set:function(_){labelFormat=_}},labelThreshold:{get:function(){return labelThreshold},set:function(_){labelThreshold=_}},sort:{get:function(){return sort},set:function(_){sort=_}},key:{get:function(){return key},set:function(_){key=_}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!=undefined?_.top:margin.top;margin.right=_.right!=undefined?_.right:margin.right;margin.bottom=_.bottom!=undefined?_.bottom:margin.bottom;margin.left=_.left!=undefined?_.left:margin.left}},color:{get:function(){return color},set:function(_){color=nv.utils.getColor(_)}}});nv.utils.initOptions(chart);return chart};nv.models.sunburstChart=function(){"use strict";var sunburst=nv.models.sunburst();var tooltip=nv.models.tooltip();var margin={top:30,right:20,bottom:20,left:20},width=null,height=null,color=nv.utils.defaultColor(),showTooltipPercent=false,id=Math.round(Math.random()*1e5),defaultState=null,noData=null,duration=250,dispatch=d3.dispatch("stateChange","changeState","renderEnd");var renderWatch=nv.utils.renderWatch(dispatch);tooltip.duration(0).headerEnabled(false).valueFormatter(function(d){return d});function chart(selection){renderWatch.reset();renderWatch.models(sunburst);selection.each(function(data){var container=d3.select(this);nv.utils.initSVG(container);var availableWidth=nv.utils.availableWidth(width,container,margin);var availableHeight=nv.utils.availableHeight(height,container,margin);chart.update=function(){if(duration===0){container.call(chart)}else{container.transition().duration(duration).call(chart)}};chart.container=container;if(!data||!data.length){nv.utils.noData(chart,container);return chart}else{container.selectAll(".nv-noData").remove()}sunburst.width(availableWidth).height(availableHeight).margin(margin);container.call(sunburst)});renderWatch.renderEnd("sunburstChart immediate");return chart}sunburst.dispatch.on("elementMouseover.tooltip",function(evt){evt.series={key:evt.data.name,value:evt.data.value||evt.data.size,color:evt.color,percent:evt.percent};if(!showTooltipPercent){delete evt.percent;delete evt.series.percent}tooltip.data(evt).hidden(false)});sunburst.dispatch.on("elementMouseout.tooltip",function(evt){tooltip.hidden(true)});sunburst.dispatch.on("elementMousemove.tooltip",function(evt){tooltip()});chart.dispatch=dispatch;chart.sunburst=sunburst;chart.tooltip=tooltip;chart.options=nv.utils.optionsFunc.bind(chart);chart._options=Object.create({},{noData:{get:function(){return noData},set:function(_){noData=_}},defaultState:{get:function(){return defaultState},set:function(_){defaultState=_}},showTooltipPercent:{get:function(){return showTooltipPercent},set:function(_){showTooltipPercent=_}},color:{get:function(){return color},set:function(_){color=_;sunburst.color(color)}},duration:{get:function(){return duration},set:function(_){duration=_;renderWatch.reset(duration);sunburst.duration(duration)}},margin:{get:function(){return margin},set:function(_){margin.top=_.top!==undefined?_.top:margin.top;margin.right=_.right!==undefined?_.right:margin.right;margin.bottom=_.bottom!==undefined?_.bottom:margin.bottom;margin.left=_.left!==undefined?_.left:margin.left;sunburst.margin(margin)}}});nv.utils.inheritOptions(chart,sunburst);nv.utils.initOptions(chart);return chart};nv.version="1.8.6-dev"})();(function($){$.fn.areYouSure=function(options){var settings=$.extend({message:"You have unsaved changes!",dirtyClass:"dirty",change:null,silent:false,addRemoveFieldsMarksDirty:false,fieldEvents:"change keyup propertychange input",fieldSelector:":input:not(input[type=submit]):not(input[type=button])"},options);var getValue=function($field){if($field.hasClass("ays-ignore")||$field.hasClass("aysIgnore")||$field.attr("data-ays-ignore")||$field.attr("name")===undefined){return null}if($field.is(":disabled")){return"ays-disabled"}var val;var type=$field.attr("type");if($field.is("select")){type="select"}switch(type){case"checkbox":case"radio":val=$field.is(":checked");break;case"select":val="";$field.find("option").each(function(o){var $option=$(this);if($option.is(":selected")){val+=$option.val()}});break;default:val=$field.val()}return val};var storeOrigValue=function($field){$field.data("ays-orig",getValue($field))};var checkForm=function(evt){var isFieldDirty=function($field){var origValue=$field.data("ays-orig");if(undefined===origValue){return false}return getValue($field)!=origValue};var $form=$(this).is("form")?$(this):$(this).parents("form");if(isFieldDirty($(evt.target))){setDirtyStatus($form,true);return}$fields=$form.find(settings.fieldSelector);if(settings.addRemoveFieldsMarksDirty){var origCount=$form.data("ays-orig-field-count");if(origCount!=$fields.length){setDirtyStatus($form,true);return}}var isDirty=false;$fields.each(function(){$field=$(this);if(isFieldDirty($field)){isDirty=true;return false}});setDirtyStatus($form,isDirty)};var initForm=function($form){var fields=$form.find(settings.fieldSelector);$(fields).each(function(){storeOrigValue($(this))});$(fields).unbind(settings.fieldEvents,checkForm);$(fields).bind(settings.fieldEvents,checkForm);$form.data("ays-orig-field-count",$(fields).length);setDirtyStatus($form,false)};var setDirtyStatus=function($form,isDirty){var changed=isDirty!=$form.hasClass(settings.dirtyClass);$form.toggleClass(settings.dirtyClass,isDirty);if(changed){if(settings.change)settings.change.call($form,$form);if(isDirty)$form.trigger("dirty.areYouSure",[$form]);if(!isDirty)$form.trigger("clean.areYouSure",[$form]);$form.trigger("change.areYouSure",[$form])}};var rescan=function(){var $form=$(this);var fields=$form.find(settings.fieldSelector);$(fields).each(function(){var $field=$(this);if(!$field.data("ays-orig")){storeOrigValue($field);$field.bind(settings.fieldEvents,checkForm)}});$form.trigger("checkform.areYouSure")};var reinitialize=function(){initForm($(this))};if(!settings.silent&&!window.aysUnloadSet){window.aysUnloadSet=true;$(window).bind("beforeunload",function(){$dirtyForms=$("form").filter("."+settings.dirtyClass);if($dirtyForms.length==0){return}if(navigator.userAgent.toLowerCase().match(/msie|chrome/)){if(window.aysHasPrompted){return}window.aysHasPrompted=true;window.setTimeout(function(){window.aysHasPrompted=false},900)}return settings.message})}return this.each(function(elem){if(!$(this).is("form")){return}var $form=$(this);$form.submit(function(){$form.removeClass(settings.dirtyClass)});$form.bind("reset",function(){setDirtyStatus($form,false)});$form.bind("rescan.areYouSure",rescan);$form.bind("reinitialize.areYouSure",reinitialize);$form.bind("checkform.areYouSure",checkForm);initForm($form)})}})(jQuery);(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.moment=factory()})(this,function(){"use strict";var hookCallback;function hooks(){return hookCallback.apply(null,arguments)}function setHookCallback(callback){hookCallback=callback}function isArray(input){return input instanceof Array||Object.prototype.toString.call(input)==="[object Array]"}function isObject(input){return input!=null&&Object.prototype.toString.call(input)==="[object Object]"}function isObjectEmpty(obj){var k;for(k in obj){return false}return true}function isUndefined(input){return input===void 0}function isNumber(input){return typeof input==="number"||Object.prototype.toString.call(input)==="[object Number]"}function isDate(input){return input instanceof Date||Object.prototype.toString.call(input)==="[object Date]"}function map(arr,fn){var res=[],i;for(i=0;i<arr.length;++i){res.push(fn(arr[i],i))}return res}function hasOwnProp(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function extend(a,b){for(var i in b){if(hasOwnProp(b,i)){a[i]=b[i]}}if(hasOwnProp(b,"toString")){a.toString=b.toString}if(hasOwnProp(b,"valueOf")){a.valueOf=b.valueOf}return a}function createUTC(input,format,locale,strict){return createLocalOrUTC(input,format,locale,strict,true).utc()}function defaultParsingFlags(){return{empty:false,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:false,invalidMonth:null,invalidFormat:false,userInvalidated:false,iso:false,parsedDateParts:[],meridiem:null,rfc2822:false,weekdayMismatch:false}}function getParsingFlags(m){if(m._pf==null){m._pf=defaultParsingFlags()}return m._pf}var some;if(Array.prototype.some){some=Array.prototype.some}else{some=function(fun){var t=Object(this);var len=t.length>>>0;for(var i=0;i<len;i++){if(i in t&&fun.call(this,t[i],i,t)){return true}}return false}}var some$1=some;function isValid(m){if(m._isValid==null){var flags=getParsingFlags(m);var parsedParts=some$1.call(flags.parsedDateParts,function(i){return i!=null});var isNowValid=!isNaN(m._d.getTime())&&flags.overflow<0&&!flags.empty&&!flags.invalidMonth&&!flags.invalidWeekday&&!flags.nullInput&&!flags.invalidFormat&&!flags.userInvalidated&&(!flags.meridiem||flags.meridiem&&parsedParts);if(m._strict){isNowValid=isNowValid&&flags.charsLeftOver===0&&flags.unusedTokens.length===0&&flags.bigHour===undefined}if(Object.isFrozen==null||!Object.isFrozen(m)){m._isValid=isNowValid}else{return isNowValid}}return m._isValid}function createInvalid(flags){var m=createUTC(NaN);if(flags!=null){extend(getParsingFlags(m),flags)}else{getParsingFlags(m).userInvalidated=true}return m}var momentProperties=hooks.momentProperties=[];function copyConfig(to,from){var i,prop,val;if(!isUndefined(from._isAMomentObject)){to._isAMomentObject=from._isAMomentObject}if(!isUndefined(from._i)){to._i=from._i}if(!isUndefined(from._f)){to._f=from._f}if(!isUndefined(from._l)){to._l=from._l}if(!isUndefined(from._strict)){to._strict=from._strict}if(!isUndefined(from._tzm)){to._tzm=from._tzm}if(!isUndefined(from._isUTC)){to._isUTC=from._isUTC}if(!isUndefined(from._offset)){to._offset=from._offset}if(!isUndefined(from._pf)){to._pf=getParsingFlags(from)}if(!isUndefined(from._locale)){to._locale=from._locale}if(momentProperties.length>0){for(i=0;i<momentProperties.length;i++){prop=momentProperties[i];val=from[prop];if(!isUndefined(val)){to[prop]=val}}}return to}var updateInProgress=false;function Moment(config){copyConfig(this,config);this._d=new Date(config._d!=null?config._d.getTime():NaN);if(!this.isValid()){this._d=new Date(NaN)}if(updateInProgress===false){updateInProgress=true;hooks.updateOffset(this);updateInProgress=false}}function isMoment(obj){return obj instanceof Moment||obj!=null&&obj._isAMomentObject!=null}function absFloor(number){if(number<0){return Math.ceil(number)||0}else{return Math.floor(number)}}function toInt(argumentForCoercion){var coercedNumber=+argumentForCoercion,value=0;if(coercedNumber!==0&&isFinite(coercedNumber)){value=absFloor(coercedNumber)}return value}function compareArrays(array1,array2,dontConvert){var len=Math.min(array1.length,array2.length),lengthDiff=Math.abs(array1.length-array2.length),diffs=0,i;for(i=0;i<len;i++){if(dontConvert&&array1[i]!==array2[i]||!dontConvert&&toInt(array1[i])!==toInt(array2[i])){diffs++}}return diffs+lengthDiff}function warn(msg){if(hooks.suppressDeprecationWarnings===false&&typeof console!=="undefined"&&console.warn){console.warn("Deprecation warning: "+msg)}}function deprecate(msg,fn){var firstTime=true;return extend(function(){if(hooks.deprecationHandler!=null){hooks.deprecationHandler(null,msg)}if(firstTime){var args=[];var arg;for(var i=0;i<arguments.length;i++){arg="";if(typeof arguments[i]==="object"){arg+="\n["+i+"] ";for(var key in arguments[0]){arg+=key+": "+arguments[0][key]+", "}arg=arg.slice(0,-2)}else{arg=arguments[i]}args.push(arg)}warn(msg+"\nArguments: "+Array.prototype.slice.call(args).join("")+"\n"+(new Error).stack);firstTime=false}return fn.apply(this,arguments)},fn)}var deprecations={};function deprecateSimple(name,msg){if(hooks.deprecationHandler!=null){hooks.deprecationHandler(name,msg)}if(!deprecations[name]){warn(msg);deprecations[name]=true}}hooks.suppressDeprecationWarnings=false;hooks.deprecationHandler=null;function isFunction(input){return input instanceof Function||Object.prototype.toString.call(input)==="[object Function]"}function set(config){var prop,i;for(i in config){prop=config[i];if(isFunction(prop)){this[i]=prop}else{this["_"+i]=prop}}this._config=config;this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function mergeConfigs(parentConfig,childConfig){var res=extend({},parentConfig),prop;for(prop in childConfig){if(hasOwnProp(childConfig,prop)){if(isObject(parentConfig[prop])&&isObject(childConfig[prop])){res[prop]={};extend(res[prop],parentConfig[prop]);extend(res[prop],childConfig[prop])}else if(childConfig[prop]!=null){res[prop]=childConfig[prop]}else{delete res[prop]}}}for(prop in parentConfig){if(hasOwnProp(parentConfig,prop)&&!hasOwnProp(childConfig,prop)&&isObject(parentConfig[prop])){res[prop]=extend({},res[prop])}}return res}function Locale(config){if(config!=null){this.set(config)}}var keys;if(Object.keys){keys=Object.keys}else{keys=function(obj){var i,res=[];for(i in obj){if(hasOwnProp(obj,i)){res.push(i)}}return res}}var keys$1=keys;var defaultCalendar={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function calendar(key,mom,now){var output=this._calendar[key]||this._calendar["sameElse"];return isFunction(output)?output.call(mom,now):output}var defaultLongDateFormat={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function longDateFormat(key){var format=this._longDateFormat[key],formatUpper=this._longDateFormat[key.toUpperCase()];if(format||!formatUpper){return format}this._longDateFormat[key]=formatUpper.replace(/MMMM|MM|DD|dddd/g,function(val){return val.slice(1)});return this._longDateFormat[key]}var defaultInvalidDate="Invalid date";function invalidDate(){return this._invalidDate}var defaultOrdinal="%d";var defaultDayOfMonthOrdinalParse=/\d{1,2}/;function ordinal(number){return this._ordinal.replace("%d",number)}var defaultRelativeTime={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function relativeTime(number,withoutSuffix,string,isFuture){var output=this._relativeTime[string];return isFunction(output)?output(number,withoutSuffix,string,isFuture):output.replace(/%d/i,number)}function pastFuture(diff,output){var format=this._relativeTime[diff>0?"future":"past"];return isFunction(format)?format(output):format.replace(/%s/i,output)}var aliases={};function addUnitAlias(unit,shorthand){var lowerCase=unit.toLowerCase();aliases[lowerCase]=aliases[lowerCase+"s"]=aliases[shorthand]=unit}function normalizeUnits(units){return typeof units==="string"?aliases[units]||aliases[units.toLowerCase()]:undefined}function normalizeObjectUnits(inputObject){var normalizedInput={},normalizedProp,prop;for(prop in inputObject){if(hasOwnProp(inputObject,prop)){normalizedProp=normalizeUnits(prop);if(normalizedProp){normalizedInput[normalizedProp]=inputObject[prop]}}}return normalizedInput}var priorities={};function addUnitPriority(unit,priority){priorities[unit]=priority}function getPrioritizedUnits(unitsObj){var units=[];for(var u in unitsObj){units.push({unit:u,priority:priorities[u]})}units.sort(function(a,b){return a.priority-b.priority});return units}function makeGetSet(unit,keepTime){return function(value){if(value!=null){set$1(this,unit,value);hooks.updateOffset(this,keepTime);return this}else{return get(this,unit)}}}function get(mom,unit){return mom.isValid()?mom._d["get"+(mom._isUTC?"UTC":"")+unit]():NaN}function set$1(mom,unit,value){if(mom.isValid()){mom._d["set"+(mom._isUTC?"UTC":"")+unit](value)}}function stringGet(units){units=normalizeUnits(units);if(isFunction(this[units])){return this[units]()}return this}function stringSet(units,value){if(typeof units==="object"){units=normalizeObjectUnits(units);var prioritized=getPrioritizedUnits(units);for(var i=0;i<prioritized.length;i++){this[prioritized[i].unit](units[prioritized[i].unit])}}else{units=normalizeUnits(units);if(isFunction(this[units])){return this[units](value)}}return this}function zeroFill(number,targetLength,forceSign){var absNumber=""+Math.abs(number),zerosToFill=targetLength-absNumber.length,sign=number>=0;return(sign?forceSign?"+":"":"-")+Math.pow(10,Math.max(0,zerosToFill)).toString().substr(1)+absNumber}var formattingTokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;var localFormattingTokens=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;var formatFunctions={};var formatTokenFunctions={};function addFormatToken(token,padded,ordinal,callback){var func=callback;if(typeof callback==="string"){func=function(){return this[callback]()}}if(token){formatTokenFunctions[token]=func}if(padded){formatTokenFunctions[padded[0]]=function(){return zeroFill(func.apply(this,arguments),padded[1],padded[2])}}if(ordinal){formatTokenFunctions[ordinal]=function(){return this.localeData().ordinal(func.apply(this,arguments),token)}}}function removeFormattingTokens(input){if(input.match(/\[[\s\S]/)){return input.replace(/^\[|\]$/g,"")}return input.replace(/\\/g,"")}function makeFormatFunction(format){var array=format.match(formattingTokens),i,length;for(i=0,length=array.length;i<length;i++){if(formatTokenFunctions[array[i]]){array[i]=formatTokenFunctions[array[i]]}else{array[i]=removeFormattingTokens(array[i])}}return function(mom){var output="",i;for(i=0;i<length;i++){output+=isFunction(array[i])?array[i].call(mom,format):array[i]}return output}}function formatMoment(m,format){if(!m.isValid()){return m.localeData().invalidDate()}format=expandFormat(format,m.localeData());formatFunctions[format]=formatFunctions[format]||makeFormatFunction(format);return formatFunctions[format](m)}function expandFormat(format,locale){var i=5;function replaceLongDateFormatTokens(input){return locale.longDateFormat(input)||input}localFormattingTokens.lastIndex=0;while(i>=0&&localFormattingTokens.test(format)){format=format.replace(localFormattingTokens,replaceLongDateFormatTokens);localFormattingTokens.lastIndex=0;i-=1}return format}var match1=/\d/;var match2=/\d\d/;var match3=/\d{3}/;var match4=/\d{4}/;var match6=/[+-]?\d{6}/;var match1to2=/\d\d?/;var match3to4=/\d\d\d\d?/;var match5to6=/\d\d\d\d\d\d?/;var match1to3=/\d{1,3}/;var match1to4=/\d{1,4}/;var match1to6=/[+-]?\d{1,6}/;var matchUnsigned=/\d+/;var matchSigned=/[+-]?\d+/;var matchOffset=/Z|[+-]\d\d:?\d\d/gi;var matchShortOffset=/Z|[+-]\d\d(?::?\d\d)?/gi;var matchTimestamp=/[+-]?\d+(\.\d{1,3})?/;var matchWord=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;var regexes={};function addRegexToken(token,regex,strictRegex){regexes[token]=isFunction(regex)?regex:function(isStrict,localeData){return isStrict&&strictRegex?strictRegex:regex}}function getParseRegexForToken(token,config){if(!hasOwnProp(regexes,token)){return new RegExp(unescapeFormat(token))}return regexes[token](config._strict,config._locale)}function unescapeFormat(s){return regexEscape(s.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(matched,p1,p2,p3,p4){return p1||p2||p3||p4}))}function regexEscape(s){return s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var tokens={};function addParseToken(token,callback){var i,func=callback;if(typeof token==="string"){token=[token]}if(isNumber(callback)){func=function(input,array){array[callback]=toInt(input)}}for(i=0;i<token.length;i++){tokens[token[i]]=func}}function addWeekParseToken(token,callback){addParseToken(token,function(input,array,config,token){config._w=config._w||{};callback(input,config._w,config,token)})}function addTimeToArrayFromToken(token,input,config){if(input!=null&&hasOwnProp(tokens,token)){tokens[token](input,config._a,config,token)}}var YEAR=0;var MONTH=1;var DATE=2;var HOUR=3;var MINUTE=4;var SECOND=5;var MILLISECOND=6;var WEEK=7;var WEEKDAY=8;var indexOf;if(Array.prototype.indexOf){indexOf=Array.prototype.indexOf}else{indexOf=function(o){var i;for(i=0;i<this.length;++i){if(this[i]===o){return i}}return-1}}var indexOf$1=indexOf;function daysInMonth(year,month){return new Date(Date.UTC(year,month+1,0)).getUTCDate()}addFormatToken("M",["MM",2],"Mo",function(){return this.month()+1});addFormatToken("MMM",0,0,function(format){return this.localeData().monthsShort(this,format)});addFormatToken("MMMM",0,0,function(format){return this.localeData().months(this,format)});addUnitAlias("month","M");addUnitPriority("month",8);addRegexToken("M",match1to2);addRegexToken("MM",match1to2,match2);addRegexToken("MMM",function(isStrict,locale){return locale.monthsShortRegex(isStrict)});addRegexToken("MMMM",function(isStrict,locale){return locale.monthsRegex(isStrict)});addParseToken(["M","MM"],function(input,array){array[MONTH]=toInt(input)-1});addParseToken(["MMM","MMMM"],function(input,array,config,token){var month=config._locale.monthsParse(input,token,config._strict);if(month!=null){array[MONTH]=month}else{getParsingFlags(config).invalidMonth=input}});var MONTHS_IN_FORMAT=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;var defaultLocaleMonths="January_February_March_April_May_June_July_August_September_October_November_December".split("_");function localeMonths(m,format){if(!m){return isArray(this._months)?this._months:this._months["standalone"]}return isArray(this._months)?this._months[m.month()]:this._months[(this._months.isFormat||MONTHS_IN_FORMAT).test(format)?"format":"standalone"][m.month()]}var defaultLocaleMonthsShort="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function localeMonthsShort(m,format){if(!m){return isArray(this._monthsShort)?this._monthsShort:this._monthsShort["standalone"]}return isArray(this._monthsShort)?this._monthsShort[m.month()]:this._monthsShort[MONTHS_IN_FORMAT.test(format)?"format":"standalone"][m.month()]}function handleStrictParse(monthName,format,strict){var i,ii,mom,llc=monthName.toLocaleLowerCase();if(!this._monthsParse){this._monthsParse=[];this._longMonthsParse=[];this._shortMonthsParse=[];for(i=0;i<12;++i){mom=createUTC([2e3,i]);this._shortMonthsParse[i]=this.monthsShort(mom,"").toLocaleLowerCase();this._longMonthsParse[i]=this.months(mom,"").toLocaleLowerCase()}}if(strict){if(format==="MMM"){ii=indexOf$1.call(this._shortMonthsParse,llc);return ii!==-1?ii:null}else{ii=indexOf$1.call(this._longMonthsParse,llc);return ii!==-1?ii:null}}else{if(format==="MMM"){ii=indexOf$1.call(this._shortMonthsParse,llc);if(ii!==-1){return ii}ii=indexOf$1.call(this._longMonthsParse,llc);return ii!==-1?ii:null}else{ii=indexOf$1.call(this._longMonthsParse,llc);if(ii!==-1){return ii}ii=indexOf$1.call(this._shortMonthsParse,llc);return ii!==-1?ii:null}}}function localeMonthsParse(monthName,format,strict){var i,mom,regex;if(this._monthsParseExact){return handleStrictParse.call(this,monthName,format,strict)}if(!this._monthsParse){this._monthsParse=[];this._longMonthsParse=[];this._shortMonthsParse=[]}for(i=0;i<12;i++){mom=createUTC([2e3,i]);if(strict&&!this._longMonthsParse[i]){this._longMonthsParse[i]=new RegExp("^"+this.months(mom,"").replace(".","")+"$","i");this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(mom,"").replace(".","")+"$","i")}if(!strict&&!this._monthsParse[i]){regex="^"+this.months(mom,"")+"|^"+this.monthsShort(mom,"");this._monthsParse[i]=new RegExp(regex.replace(".",""),"i")}if(strict&&format==="MMMM"&&this._longMonthsParse[i].test(monthName)){return i}else if(strict&&format==="MMM"&&this._shortMonthsParse[i].test(monthName)){return i}else if(!strict&&this._monthsParse[i].test(monthName)){return i}}}function setMonth(mom,value){var dayOfMonth;if(!mom.isValid()){return mom}if(typeof value==="string"){if(/^\d+$/.test(value)){value=toInt(value)}else{value=mom.localeData().monthsParse(value);if(!isNumber(value)){return mom}}}dayOfMonth=Math.min(mom.date(),daysInMonth(mom.year(),value));mom._d["set"+(mom._isUTC?"UTC":"")+"Month"](value,dayOfMonth);return mom}function getSetMonth(value){if(value!=null){setMonth(this,value);hooks.updateOffset(this,true);return this}else{return get(this,"Month")}}function getDaysInMonth(){return daysInMonth(this.year(),this.month())}var defaultMonthsShortRegex=matchWord;function monthsShortRegex(isStrict){if(this._monthsParseExact){if(!hasOwnProp(this,"_monthsRegex")){computeMonthsParse.call(this)}if(isStrict){return this._monthsShortStrictRegex}else{return this._monthsShortRegex}}else{if(!hasOwnProp(this,"_monthsShortRegex")){this._monthsShortRegex=defaultMonthsShortRegex}return this._monthsShortStrictRegex&&isStrict?this._monthsShortStrictRegex:this._monthsShortRegex}}var defaultMonthsRegex=matchWord;function monthsRegex(isStrict){if(this._monthsParseExact){if(!hasOwnProp(this,"_monthsRegex")){computeMonthsParse.call(this)}if(isStrict){return this._monthsStrictRegex}else{return this._monthsRegex}}else{if(!hasOwnProp(this,"_monthsRegex")){this._monthsRegex=defaultMonthsRegex}return this._monthsStrictRegex&&isStrict?this._monthsStrictRegex:this._monthsRegex}}function computeMonthsParse(){function cmpLenRev(a,b){return b.length-a.length}var shortPieces=[],longPieces=[],mixedPieces=[],i,mom;for(i=0;i<12;i++){mom=createUTC([2e3,i]);shortPieces.push(this.monthsShort(mom,""));longPieces.push(this.months(mom,""));mixedPieces.push(this.months(mom,""));mixedPieces.push(this.monthsShort(mom,""))}shortPieces.sort(cmpLenRev);longPieces.sort(cmpLenRev);mixedPieces.sort(cmpLenRev);for(i=0;i<12;i++){shortPieces[i]=regexEscape(shortPieces[i]);longPieces[i]=regexEscape(longPieces[i])}for(i=0;i<24;i++){mixedPieces[i]=regexEscape(mixedPieces[i])}this._monthsRegex=new RegExp("^("+mixedPieces.join("|")+")","i");this._monthsShortRegex=this._monthsRegex;this._monthsStrictRegex=new RegExp("^("+longPieces.join("|")+")","i");this._monthsShortStrictRegex=new RegExp("^("+shortPieces.join("|")+")","i")}addFormatToken("Y",0,0,function(){var y=this.year();return y<=9999?""+y:"+"+y});addFormatToken(0,["YY",2],0,function(){return this.year()%100});addFormatToken(0,["YYYY",4],0,"year");addFormatToken(0,["YYYYY",5],0,"year");addFormatToken(0,["YYYYYY",6,true],0,"year");addUnitAlias("year","y");addUnitPriority("year",1);addRegexToken("Y",matchSigned);addRegexToken("YY",match1to2,match2);addRegexToken("YYYY",match1to4,match4);addRegexToken("YYYYY",match1to6,match6);addRegexToken("YYYYYY",match1to6,match6);addParseToken(["YYYYY","YYYYYY"],YEAR);addParseToken("YYYY",function(input,array){array[YEAR]=input.length===2?hooks.parseTwoDigitYear(input):toInt(input)});addParseToken("YY",function(input,array){array[YEAR]=hooks.parseTwoDigitYear(input)});addParseToken("Y",function(input,array){array[YEAR]=parseInt(input,10)});function daysInYear(year){return isLeapYear(year)?366:365}function isLeapYear(year){return year%4===0&&year%100!==0||year%400===0}hooks.parseTwoDigitYear=function(input){return toInt(input)+(toInt(input)>68?1900:2e3)};var getSetYear=makeGetSet("FullYear",true);function getIsLeapYear(){return isLeapYear(this.year())}function createDate(y,m,d,h,M,s,ms){var date=new Date(y,m,d,h,M,s,ms);if(y<100&&y>=0&&isFinite(date.getFullYear())){date.setFullYear(y)}return date}function createUTCDate(y){var date=new Date(Date.UTC.apply(null,arguments));if(y<100&&y>=0&&isFinite(date.getUTCFullYear())){date.setUTCFullYear(y)}return date}function firstWeekOffset(year,dow,doy){var fwd=7+dow-doy,fwdlw=(7+createUTCDate(year,0,fwd).getUTCDay()-dow)%7;return-fwdlw+fwd-1}function dayOfYearFromWeeks(year,week,weekday,dow,doy){var localWeekday=(7+weekday-dow)%7,weekOffset=firstWeekOffset(year,dow,doy),dayOfYear=1+7*(week-1)+localWeekday+weekOffset,resYear,resDayOfYear;if(dayOfYear<=0){resYear=year-1;resDayOfYear=daysInYear(resYear)+dayOfYear}else if(dayOfYear>daysInYear(year)){resYear=year+1;resDayOfYear=dayOfYear-daysInYear(year)}else{resYear=year;resDayOfYear=dayOfYear}return{year:resYear,dayOfYear:resDayOfYear}}function weekOfYear(mom,dow,doy){var weekOffset=firstWeekOffset(mom.year(),dow,doy),week=Math.floor((mom.dayOfYear()-weekOffset-1)/7)+1,resWeek,resYear;if(week<1){resYear=mom.year()-1;resWeek=week+weeksInYear(resYear,dow,doy)}else if(week>weeksInYear(mom.year(),dow,doy)){resWeek=week-weeksInYear(mom.year(),dow,doy);resYear=mom.year()+1}else{resYear=mom.year();resWeek=week}return{week:resWeek,year:resYear}}function weeksInYear(year,dow,doy){var weekOffset=firstWeekOffset(year,dow,doy),weekOffsetNext=firstWeekOffset(year+1,dow,doy);return(daysInYear(year)-weekOffset+weekOffsetNext)/7}addFormatToken("w",["ww",2],"wo","week");addFormatToken("W",["WW",2],"Wo","isoWeek");addUnitAlias("week","w");addUnitAlias("isoWeek","W");addUnitPriority("week",5);addUnitPriority("isoWeek",5);addRegexToken("w",match1to2);addRegexToken("ww",match1to2,match2);addRegexToken("W",match1to2);addRegexToken("WW",match1to2,match2);addWeekParseToken(["w","ww","W","WW"],function(input,week,config,token){week[token.substr(0,1)]=toInt(input)});function localeWeek(mom){return weekOfYear(mom,this._week.dow,this._week.doy).week}var defaultLocaleWeek={dow:0,doy:6};function localeFirstDayOfWeek(){return this._week.dow}function localeFirstDayOfYear(){return this._week.doy}function getSetWeek(input){var week=this.localeData().week(this);return input==null?week:this.add((input-week)*7,"d")}function getSetISOWeek(input){var week=weekOfYear(this,1,4).week;return input==null?week:this.add((input-week)*7,"d")}addFormatToken("d",0,"do","day");addFormatToken("dd",0,0,function(format){return this.localeData().weekdaysMin(this,format)});addFormatToken("ddd",0,0,function(format){return this.localeData().weekdaysShort(this,format)});addFormatToken("dddd",0,0,function(format){return this.localeData().weekdays(this,format)});addFormatToken("e",0,0,"weekday");addFormatToken("E",0,0,"isoWeekday");addUnitAlias("day","d");addUnitAlias("weekday","e");addUnitAlias("isoWeekday","E");addUnitPriority("day",11);addUnitPriority("weekday",11);addUnitPriority("isoWeekday",11);addRegexToken("d",match1to2);addRegexToken("e",match1to2);addRegexToken("E",match1to2);addRegexToken("dd",function(isStrict,locale){return locale.weekdaysMinRegex(isStrict)});addRegexToken("ddd",function(isStrict,locale){return locale.weekdaysShortRegex(isStrict)});addRegexToken("dddd",function(isStrict,locale){return locale.weekdaysRegex(isStrict)});addWeekParseToken(["dd","ddd","dddd"],function(input,week,config,token){var weekday=config._locale.weekdaysParse(input,token,config._strict);if(weekday!=null){week.d=weekday}else{getParsingFlags(config).invalidWeekday=input}});addWeekParseToken(["d","e","E"],function(input,week,config,token){week[token]=toInt(input)});function parseWeekday(input,locale){if(typeof input!=="string"){return input}if(!isNaN(input)){return parseInt(input,10)}input=locale.weekdaysParse(input);if(typeof input==="number"){return input}return null}function parseIsoWeekday(input,locale){if(typeof input==="string"){return locale.weekdaysParse(input)%7||7}return isNaN(input)?null:input}var defaultLocaleWeekdays="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");function localeWeekdays(m,format){if(!m){return isArray(this._weekdays)?this._weekdays:this._weekdays["standalone"]}return isArray(this._weekdays)?this._weekdays[m.day()]:this._weekdays[this._weekdays.isFormat.test(format)?"format":"standalone"][m.day()]}var defaultLocaleWeekdaysShort="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function localeWeekdaysShort(m){return m?this._weekdaysShort[m.day()]:this._weekdaysShort}var defaultLocaleWeekdaysMin="Su_Mo_Tu_We_Th_Fr_Sa".split("_");function localeWeekdaysMin(m){return m?this._weekdaysMin[m.day()]:this._weekdaysMin}function handleStrictParse$1(weekdayName,format,strict){var i,ii,mom,llc=weekdayName.toLocaleLowerCase();if(!this._weekdaysParse){this._weekdaysParse=[];this._shortWeekdaysParse=[];this._minWeekdaysParse=[];for(i=0;i<7;++i){mom=createUTC([2e3,1]).day(i);this._minWeekdaysParse[i]=this.weekdaysMin(mom,"").toLocaleLowerCase();this._shortWeekdaysParse[i]=this.weekdaysShort(mom,"").toLocaleLowerCase();this._weekdaysParse[i]=this.weekdays(mom,"").toLocaleLowerCase()}}if(strict){if(format==="dddd"){ii=indexOf$1.call(this._weekdaysParse,llc);return ii!==-1?ii:null}else if(format==="ddd"){ii=indexOf$1.call(this._shortWeekdaysParse,llc);return ii!==-1?ii:null}else{ii=indexOf$1.call(this._minWeekdaysParse,llc);return ii!==-1?ii:null}}else{if(format==="dddd"){ii=indexOf$1.call(this._weekdaysParse,llc);if(ii!==-1){return ii}ii=indexOf$1.call(this._shortWeekdaysParse,llc);if(ii!==-1){return ii}ii=indexOf$1.call(this._minWeekdaysParse,llc);return ii!==-1?ii:null}else if(format==="ddd"){ii=indexOf$1.call(this._shortWeekdaysParse,llc);if(ii!==-1){return ii}ii=indexOf$1.call(this._weekdaysParse,llc);if(ii!==-1){return ii}ii=indexOf$1.call(this._minWeekdaysParse,llc);return ii!==-1?ii:null}else{ii=indexOf$1.call(this._minWeekdaysParse,llc);if(ii!==-1){return ii}ii=indexOf$1.call(this._weekdaysParse,llc);if(ii!==-1){return ii}ii=indexOf$1.call(this._shortWeekdaysParse,llc);return ii!==-1?ii:null}}}function localeWeekdaysParse(weekdayName,format,strict){var i,mom,regex;if(this._weekdaysParseExact){return handleStrictParse$1.call(this,weekdayName,format,strict)}if(!this._weekdaysParse){this._weekdaysParse=[];this._minWeekdaysParse=[];this._shortWeekdaysParse=[];this._fullWeekdaysParse=[]}for(i=0;i<7;i++){mom=createUTC([2e3,1]).day(i);if(strict&&!this._fullWeekdaysParse[i]){this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(mom,"").replace(".",".?")+"$","i");this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(mom,"").replace(".",".?")+"$","i");this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(mom,"").replace(".",".?")+"$","i")}if(!this._weekdaysParse[i]){regex="^"+this.weekdays(mom,"")+"|^"+this.weekdaysShort(mom,"")+"|^"+this.weekdaysMin(mom,"");this._weekdaysParse[i]=new RegExp(regex.replace(".",""),"i")}if(strict&&format==="dddd"&&this._fullWeekdaysParse[i].test(weekdayName)){return i}else if(strict&&format==="ddd"&&this._shortWeekdaysParse[i].test(weekdayName)){return i}else if(strict&&format==="dd"&&this._minWeekdaysParse[i].test(weekdayName)){return i}else if(!strict&&this._weekdaysParse[i].test(weekdayName)){return i}}}function getSetDayOfWeek(input){if(!this.isValid()){return input!=null?this:NaN}var day=this._isUTC?this._d.getUTCDay():this._d.getDay();if(input!=null){input=parseWeekday(input,this.localeData());return this.add(input-day,"d")}else{return day}}function getSetLocaleDayOfWeek(input){if(!this.isValid()){return input!=null?this:NaN}var weekday=(this.day()+7-this.localeData()._week.dow)%7;return input==null?weekday:this.add(input-weekday,"d")}function getSetISODayOfWeek(input){if(!this.isValid()){return input!=null?this:NaN}if(input!=null){var weekday=parseIsoWeekday(input,this.localeData());return this.day(this.day()%7?weekday:weekday-7)}else{return this.day()||7}}var defaultWeekdaysRegex=matchWord;function weekdaysRegex(isStrict){if(this._weekdaysParseExact){if(!hasOwnProp(this,"_weekdaysRegex")){computeWeekdaysParse.call(this)}if(isStrict){return this._weekdaysStrictRegex}else{return this._weekdaysRegex}}else{if(!hasOwnProp(this,"_weekdaysRegex")){this._weekdaysRegex=defaultWeekdaysRegex}return this._weekdaysStrictRegex&&isStrict?this._weekdaysStrictRegex:this._weekdaysRegex}}var defaultWeekdaysShortRegex=matchWord;function weekdaysShortRegex(isStrict){if(this._weekdaysParseExact){if(!hasOwnProp(this,"_weekdaysRegex")){computeWeekdaysParse.call(this)}if(isStrict){return this._weekdaysShortStrictRegex}else{return this._weekdaysShortRegex}}else{if(!hasOwnProp(this,"_weekdaysShortRegex")){this._weekdaysShortRegex=defaultWeekdaysShortRegex}return this._weekdaysShortStrictRegex&&isStrict?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}}var defaultWeekdaysMinRegex=matchWord;function weekdaysMinRegex(isStrict){if(this._weekdaysParseExact){if(!hasOwnProp(this,"_weekdaysRegex")){computeWeekdaysParse.call(this)}if(isStrict){return this._weekdaysMinStrictRegex}else{return this._weekdaysMinRegex}}else{if(!hasOwnProp(this,"_weekdaysMinRegex")){this._weekdaysMinRegex=defaultWeekdaysMinRegex}return this._weekdaysMinStrictRegex&&isStrict?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}}function computeWeekdaysParse(){function cmpLenRev(a,b){return b.length-a.length}var minPieces=[],shortPieces=[],longPieces=[],mixedPieces=[],i,mom,minp,shortp,longp;for(i=0;i<7;i++){mom=createUTC([2e3,1]).day(i);minp=this.weekdaysMin(mom,"");shortp=this.weekdaysShort(mom,"");longp=this.weekdays(mom,"");minPieces.push(minp);shortPieces.push(shortp);longPieces.push(longp);mixedPieces.push(minp);mixedPieces.push(shortp);mixedPieces.push(longp)}minPieces.sort(cmpLenRev);shortPieces.sort(cmpLenRev);longPieces.sort(cmpLenRev);mixedPieces.sort(cmpLenRev);for(i=0;i<7;i++){shortPieces[i]=regexEscape(shortPieces[i]);longPieces[i]=regexEscape(longPieces[i]);mixedPieces[i]=regexEscape(mixedPieces[i])}this._weekdaysRegex=new RegExp("^("+mixedPieces.join("|")+")","i");this._weekdaysShortRegex=this._weekdaysRegex;this._weekdaysMinRegex=this._weekdaysRegex;this._weekdaysStrictRegex=new RegExp("^("+longPieces.join("|")+")","i");this._weekdaysShortStrictRegex=new RegExp("^("+shortPieces.join("|")+")","i");this._weekdaysMinStrictRegex=new RegExp("^("+minPieces.join("|")+")","i")}function hFormat(){return this.hours()%12||12}function kFormat(){return this.hours()||24}addFormatToken("H",["HH",2],0,"hour");addFormatToken("h",["hh",2],0,hFormat);addFormatToken("k",["kk",2],0,kFormat);addFormatToken("hmm",0,0,function(){return""+hFormat.apply(this)+zeroFill(this.minutes(),2)});addFormatToken("hmmss",0,0,function(){return""+hFormat.apply(this)+zeroFill(this.minutes(),2)+zeroFill(this.seconds(),2)});addFormatToken("Hmm",0,0,function(){return""+this.hours()+zeroFill(this.minutes(),2)});addFormatToken("Hmmss",0,0,function(){return""+this.hours()+zeroFill(this.minutes(),2)+zeroFill(this.seconds(),2)});function meridiem(token,lowercase){addFormatToken(token,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),lowercase)})}meridiem("a",true);meridiem("A",false);addUnitAlias("hour","h");addUnitPriority("hour",13);function matchMeridiem(isStrict,locale){return locale._meridiemParse}addRegexToken("a",matchMeridiem);addRegexToken("A",matchMeridiem);addRegexToken("H",match1to2);addRegexToken("h",match1to2);addRegexToken("k",match1to2);addRegexToken("HH",match1to2,match2);addRegexToken("hh",match1to2,match2);addRegexToken("kk",match1to2,match2);addRegexToken("hmm",match3to4);addRegexToken("hmmss",match5to6);addRegexToken("Hmm",match3to4);addRegexToken("Hmmss",match5to6);addParseToken(["H","HH"],HOUR);addParseToken(["k","kk"],function(input,array,config){var kInput=toInt(input);array[HOUR]=kInput===24?0:kInput});addParseToken(["a","A"],function(input,array,config){config._isPm=config._locale.isPM(input);config._meridiem=input});addParseToken(["h","hh"],function(input,array,config){array[HOUR]=toInt(input);getParsingFlags(config).bigHour=true});addParseToken("hmm",function(input,array,config){var pos=input.length-2;array[HOUR]=toInt(input.substr(0,pos));array[MINUTE]=toInt(input.substr(pos));getParsingFlags(config).bigHour=true});addParseToken("hmmss",function(input,array,config){var pos1=input.length-4;var pos2=input.length-2;array[HOUR]=toInt(input.substr(0,pos1));array[MINUTE]=toInt(input.substr(pos1,2));array[SECOND]=toInt(input.substr(pos2));getParsingFlags(config).bigHour=true});addParseToken("Hmm",function(input,array,config){var pos=input.length-2;array[HOUR]=toInt(input.substr(0,pos));array[MINUTE]=toInt(input.substr(pos))});addParseToken("Hmmss",function(input,array,config){var pos1=input.length-4;var pos2=input.length-2;array[HOUR]=toInt(input.substr(0,pos1));array[MINUTE]=toInt(input.substr(pos1,2));array[SECOND]=toInt(input.substr(pos2))});function localeIsPM(input){return(input+"").toLowerCase().charAt(0)==="p"}var defaultLocaleMeridiemParse=/[ap]\.?m?\.?/i;function localeMeridiem(hours,minutes,isLower){if(hours>11){return isLower?"pm":"PM"}else{return isLower?"am":"AM"}}var getSetHour=makeGetSet("Hours",true);var baseConfig={calendar:defaultCalendar,longDateFormat:defaultLongDateFormat,invalidDate:defaultInvalidDate,ordinal:defaultOrdinal,dayOfMonthOrdinalParse:defaultDayOfMonthOrdinalParse,relativeTime:defaultRelativeTime,months:defaultLocaleMonths,monthsShort:defaultLocaleMonthsShort,week:defaultLocaleWeek,weekdays:defaultLocaleWeekdays,weekdaysMin:defaultLocaleWeekdaysMin,weekdaysShort:defaultLocaleWeekdaysShort,meridiemParse:defaultLocaleMeridiemParse};var locales={};var localeFamilies={};var globalLocale;function normalizeLocale(key){return key?key.toLowerCase().replace("_","-"):key}function chooseLocale(names){var i=0,j,next,locale,split;while(i<names.length){split=normalizeLocale(names[i]).split("-");j=split.length;next=normalizeLocale(names[i+1]);next=next?next.split("-"):null;while(j>0){locale=loadLocale(split.slice(0,j).join("-"));if(locale){return locale}if(next&&next.length>=j&&compareArrays(split,next,true)>=j-1){break}j--}i++}return null}function loadLocale(name){var oldLocale=null;if(!locales[name]&&typeof module!=="undefined"&&module&&module.exports){try{oldLocale=globalLocale._abbr;require("./locale/"+name);getSetGlobalLocale(oldLocale)}catch(e){}}return locales[name]}function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key)}else{data=defineLocale(key,values)}if(data){globalLocale=data}}return globalLocale._abbr}function defineLocale(name,config){if(config!==null){var parentConfig=baseConfig;config.abbr=name;if(locales[name]!=null){deprecateSimple("defineLocaleOverride","use moment.updateLocale(localeName, config) to change "+"an existing locale. moment.defineLocale(localeName, "+"config) should only be used for creating a new locale "+"See http://momentjs.com/guides/#/warnings/define-locale/ for more info.");parentConfig=locales[name]._config}else if(config.parentLocale!=null){if(locales[config.parentLocale]!=null){parentConfig=locales[config.parentLocale]._config}else{if(!localeFamilies[config.parentLocale]){localeFamilies[config.parentLocale]=[]}localeFamilies[config.parentLocale].push({name:name,config:config});return null}}locales[name]=new Locale(mergeConfigs(parentConfig,config));if(localeFamilies[name]){localeFamilies[name].forEach(function(x){defineLocale(x.name,x.config)})}getSetGlobalLocale(name);return locales[name]}else{delete locales[name];return null}}function updateLocale(name,config){if(config!=null){var locale,parentConfig=baseConfig;if(locales[name]!=null){parentConfig=locales[name]._config}config=mergeConfigs(parentConfig,config);locale=new Locale(config);locale.parentLocale=locales[name];locales[name]=locale;getSetGlobalLocale(name)}else{if(locales[name]!=null){if(locales[name].parentLocale!=null){locales[name]=locales[name].parentLocale}else if(locales[name]!=null){delete locales[name]}}}return locales[name]}function getLocale(key){var locale;if(key&&key._locale&&key._locale._abbr){key=key._locale._abbr}if(!key){return globalLocale}if(!isArray(key)){locale=loadLocale(key);if(locale){return locale}key=[key]}return chooseLocale(key)}function listLocales(){return keys$1(locales)}function checkOverflow(m){var overflow;var a=m._a;if(a&&getParsingFlags(m).overflow===-2){overflow=a[MONTH]<0||a[MONTH]>11?MONTH:a[DATE]<1||a[DATE]>daysInMonth(a[YEAR],a[MONTH])?DATE:a[HOUR]<0||a[HOUR]>24||a[HOUR]===24&&(a[MINUTE]!==0||a[SECOND]!==0||a[MILLISECOND]!==0)?HOUR:a[MINUTE]<0||a[MINUTE]>59?MINUTE:a[SECOND]<0||a[SECOND]>59?SECOND:a[MILLISECOND]<0||a[MILLISECOND]>999?MILLISECOND:-1;if(getParsingFlags(m)._overflowDayOfYear&&(overflow<YEAR||overflow>DATE)){overflow=DATE}if(getParsingFlags(m)._overflowWeeks&&overflow===-1){overflow=WEEK}if(getParsingFlags(m)._overflowWeekday&&overflow===-1){overflow=WEEKDAY}getParsingFlags(m).overflow=overflow}return m}var extendedIsoRegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;var basicIsoRegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;var tzRegex=/Z|[+-]\d\d(?::?\d\d)?/;var isoDates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,false],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,false],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,false],["YYYYDDD",/\d{7}/]];var isoTimes=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]];var aspNetJsonRegex=/^\/?Date\((\-?\d+)/i;function configFromISO(config){var i,l,string=config._i,match=extendedIsoRegex.exec(string)||basicIsoRegex.exec(string),allowTime,dateFormat,timeFormat,tzFormat;if(match){getParsingFlags(config).iso=true;for(i=0,l=isoDates.length;i<l;i++){if(isoDates[i][1].exec(match[1])){dateFormat=isoDates[i][0];allowTime=isoDates[i][2]!==false;break}}if(dateFormat==null){config._isValid=false;return}if(match[3]){for(i=0,l=isoTimes.length;i<l;i++){if(isoTimes[i][1].exec(match[3])){timeFormat=(match[2]||" ")+isoTimes[i][0];break}}if(timeFormat==null){config._isValid=false;return}}if(!allowTime&&timeFormat!=null){config._isValid=false;return}if(match[4]){if(tzRegex.exec(match[4])){tzFormat="Z"}else{config._isValid=false;return}}config._f=dateFormat+(timeFormat||"")+(tzFormat||"");configFromStringAndFormat(config)}else{config._isValid=false}}var basicRfcRegex=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;function configFromRFC2822(config){var string,match,dayFormat,dateFormat,timeFormat,tzFormat;var timezones={" GMT":" +0000"," EDT":" -0400"," EST":" -0500"," CDT":" -0500"," CST":" -0600"," MDT":" -0600"," MST":" -0700"," PDT":" -0700"," PST":" -0800"};var military="YXWVUTSRQPONZABCDEFGHIKLM";var timezone,timezoneIndex;string=config._i.replace(/\([^\)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s|\s$/g,"");match=basicRfcRegex.exec(string);if(match){dayFormat=match[1]?"ddd"+(match[1].length===5?", ":" "):"";dateFormat="D MMM "+(match[2].length>10?"YYYY ":"YY ");timeFormat="HH:mm"+(match[4]?":ss":"");if(match[1]){var momentDate=new Date(match[2]);var momentDay=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][momentDate.getDay()];if(match[1].substr(0,3)!==momentDay){getParsingFlags(config).weekdayMismatch=true;config._isValid=false;return}}switch(match[5].length){case 2:if(timezoneIndex===0){timezone=" +0000"}else{timezoneIndex=military.indexOf(match[5][1].toUpperCase())-12;timezone=(timezoneIndex<0?" -":" +")+(""+timezoneIndex).replace(/^-?/,"0").match(/..$/)[0]+"00"}break;case 4:timezone=timezones[match[5]];break;default:timezone=timezones[" GMT"]}match[5]=timezone;config._i=match.splice(1).join("");tzFormat=" ZZ";config._f=dayFormat+dateFormat+timeFormat+tzFormat;configFromStringAndFormat(config);getParsingFlags(config).rfc2822=true}else{config._isValid=false}}function configFromString(config){var matched=aspNetJsonRegex.exec(config._i);if(matched!==null){config._d=new Date(+matched[1]);return}configFromISO(config);if(config._isValid===false){delete config._isValid}else{return}configFromRFC2822(config);if(config._isValid===false){delete config._isValid}else{return}hooks.createFromInputFallback(config)}hooks.createFromInputFallback=deprecate("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), "+"which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are "+"discouraged and will be removed in an upcoming major release. Please refer to "+"http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(config){config._d=new Date(config._i+(config._useUTC?" UTC":""))});function defaults(a,b,c){if(a!=null){return a}if(b!=null){return b}return c}function currentDateArray(config){var nowValue=new Date(hooks.now());if(config._useUTC){return[nowValue.getUTCFullYear(),nowValue.getUTCMonth(),nowValue.getUTCDate()]}return[nowValue.getFullYear(),nowValue.getMonth(),nowValue.getDate()]}function configFromArray(config){var i,date,input=[],currentDate,yearToUse;if(config._d){return}currentDate=currentDateArray(config);if(config._w&&config._a[DATE]==null&&config._a[MONTH]==null){dayOfYearFromWeekInfo(config)}if(config._dayOfYear!=null){yearToUse=defaults(config._a[YEAR],currentDate[YEAR]);if(config._dayOfYear>daysInYear(yearToUse)||config._dayOfYear===0){getParsingFlags(config)._overflowDayOfYear=true}date=createUTCDate(yearToUse,0,config._dayOfYear);config._a[MONTH]=date.getUTCMonth();config._a[DATE]=date.getUTCDate()}for(i=0;i<3&&config._a[i]==null;++i){config._a[i]=input[i]=currentDate[i]}for(;i<7;i++){config._a[i]=input[i]=config._a[i]==null?i===2?1:0:config._a[i]}if(config._a[HOUR]===24&&config._a[MINUTE]===0&&config._a[SECOND]===0&&config._a[MILLISECOND]===0){config._nextDay=true;config._a[HOUR]=0}config._d=(config._useUTC?createUTCDate:createDate).apply(null,input);if(config._tzm!=null){config._d.setUTCMinutes(config._d.getUTCMinutes()-config._tzm)}if(config._nextDay){config._a[HOUR]=24}}function dayOfYearFromWeekInfo(config){var w,weekYear,week,weekday,dow,doy,temp,weekdayOverflow;w=config._w;if(w.GG!=null||w.W!=null||w.E!=null){dow=1;doy=4;weekYear=defaults(w.GG,config._a[YEAR],weekOfYear(createLocal(),1,4).year);week=defaults(w.W,1);weekday=defaults(w.E,1);if(weekday<1||weekday>7){weekdayOverflow=true}}else{dow=config._locale._week.dow;doy=config._locale._week.doy;var curWeek=weekOfYear(createLocal(),dow,doy);weekYear=defaults(w.gg,config._a[YEAR],curWeek.year);week=defaults(w.w,curWeek.week);if(w.d!=null){weekday=w.d;if(weekday<0||weekday>6){weekdayOverflow=true}}else if(w.e!=null){weekday=w.e+dow;if(w.e<0||w.e>6){weekdayOverflow=true}}else{weekday=dow}}if(week<1||week>weeksInYear(weekYear,dow,doy)){getParsingFlags(config)._overflowWeeks=true}else if(weekdayOverflow!=null){getParsingFlags(config)._overflowWeekday=true}else{temp=dayOfYearFromWeeks(weekYear,week,weekday,dow,doy);config._a[YEAR]=temp.year;config._dayOfYear=temp.dayOfYear}}hooks.ISO_8601=function(){};hooks.RFC_2822=function(){};function configFromStringAndFormat(config){if(config._f===hooks.ISO_8601){configFromISO(config);return}if(config._f===hooks.RFC_2822){configFromRFC2822(config);return}config._a=[];getParsingFlags(config).empty=true;var string=""+config._i,i,parsedInput,tokens,token,skipped,stringLength=string.length,totalParsedInputLength=0;tokens=expandFormat(config._f,config._locale).match(formattingTokens)||[];for(i=0;i<tokens.length;i++){token=tokens[i];parsedInput=(string.match(getParseRegexForToken(token,config))||[])[0];if(parsedInput){skipped=string.substr(0,string.indexOf(parsedInput));if(skipped.length>0){getParsingFlags(config).unusedInput.push(skipped)}string=string.slice(string.indexOf(parsedInput)+parsedInput.length);totalParsedInputLength+=parsedInput.length}if(formatTokenFunctions[token]){if(parsedInput){getParsingFlags(config).empty=false}else{getParsingFlags(config).unusedTokens.push(token)}addTimeToArrayFromToken(token,parsedInput,config)}else if(config._strict&&!parsedInput){getParsingFlags(config).unusedTokens.push(token)}}getParsingFlags(config).charsLeftOver=stringLength-totalParsedInputLength;if(string.length>0){getParsingFlags(config).unusedInput.push(string)}if(config._a[HOUR]<=12&&getParsingFlags(config).bigHour===true&&config._a[HOUR]>0){getParsingFlags(config).bigHour=undefined}getParsingFlags(config).parsedDateParts=config._a.slice(0);getParsingFlags(config).meridiem=config._meridiem;config._a[HOUR]=meridiemFixWrap(config._locale,config._a[HOUR],config._meridiem);configFromArray(config);checkOverflow(config)}function meridiemFixWrap(locale,hour,meridiem){var isPm;if(meridiem==null){return hour}if(locale.meridiemHour!=null){return locale.meridiemHour(hour,meridiem)}else if(locale.isPM!=null){isPm=locale.isPM(meridiem);if(isPm&&hour<12){hour+=12}if(!isPm&&hour===12){hour=0}return hour}else{return hour}}function configFromStringAndArray(config){var tempConfig,bestMoment,scoreToBeat,i,currentScore;if(config._f.length===0){getParsingFlags(config).invalidFormat=true;config._d=new Date(NaN);return}for(i=0;i<config._f.length;i++){currentScore=0;tempConfig=copyConfig({},config);if(config._useUTC!=null){tempConfig._useUTC=config._useUTC}tempConfig._f=config._f[i];configFromStringAndFormat(tempConfig);if(!isValid(tempConfig)){continue}currentScore+=getParsingFlags(tempConfig).charsLeftOver;currentScore+=getParsingFlags(tempConfig).unusedTokens.length*10;getParsingFlags(tempConfig).score=currentScore;if(scoreToBeat==null||currentScore<scoreToBeat){scoreToBeat=currentScore;bestMoment=tempConfig}}extend(config,bestMoment||tempConfig)}function configFromObject(config){if(config._d){return}var i=normalizeObjectUnits(config._i);config._a=map([i.year,i.month,i.day||i.date,i.hour,i.minute,i.second,i.millisecond],function(obj){return obj&&parseInt(obj,10)});configFromArray(config)}function createFromConfig(config){var res=new Moment(checkOverflow(prepareConfig(config)));if(res._nextDay){res.add(1,"d");res._nextDay=undefined}return res}function prepareConfig(config){var input=config._i,format=config._f;config._locale=config._locale||getLocale(config._l);if(input===null||format===undefined&&input===""){return createInvalid({nullInput:true})}if(typeof input==="string"){config._i=input=config._locale.preparse(input)}if(isMoment(input)){return new Moment(checkOverflow(input))}else if(isDate(input)){config._d=input}else if(isArray(format)){configFromStringAndArray(config)}else if(format){configFromStringAndFormat(config)}else{configFromInput(config)}if(!isValid(config)){config._d=null}return config}function configFromInput(config){var input=config._i;if(isUndefined(input)){config._d=new Date(hooks.now())}else if(isDate(input)){config._d=new Date(input.valueOf())}else if(typeof input==="string"){configFromString(config)}else if(isArray(input)){config._a=map(input.slice(0),function(obj){return parseInt(obj,10)});configFromArray(config)}else if(isObject(input)){configFromObject(config)}else if(isNumber(input)){config._d=new Date(input)}else{hooks.createFromInputFallback(config)}}function createLocalOrUTC(input,format,locale,strict,isUTC){var c={};if(locale===true||locale===false){strict=locale;locale=undefined}if(isObject(input)&&isObjectEmpty(input)||isArray(input)&&input.length===0){input=undefined}c._isAMomentObject=true;c._useUTC=c._isUTC=isUTC;c._l=locale;c._i=input;c._f=format;c._strict=strict;return createFromConfig(c)}function createLocal(input,format,locale,strict){return createLocalOrUTC(input,format,locale,strict,false)}var prototypeMin=deprecate("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var other=createLocal.apply(null,arguments);if(this.isValid()&&other.isValid()){return other<this?this:other}else{return createInvalid()}});var prototypeMax=deprecate("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var other=createLocal.apply(null,arguments);if(this.isValid()&&other.isValid()){return other>this?this:other}else{return createInvalid()}});function pickBy(fn,moments){var res,i;if(moments.length===1&&isArray(moments[0])){moments=moments[0]}if(!moments.length){return createLocal()}res=moments[0];for(i=1;i<moments.length;++i){if(!moments[i].isValid()||moments[i][fn](res)){res=moments[i]}}return res}function min(){var args=[].slice.call(arguments,0);return pickBy("isBefore",args)}function max(){var args=[].slice.call(arguments,0);return pickBy("isAfter",args)}var now=function(){return Date.now?Date.now():+new Date};var ordering=["year","quarter","month","week","day","hour","minute","second","millisecond"];function isDurationValid(m){for(var key in m){if(!(ordering.indexOf(key)!==-1&&(m[key]==null||!isNaN(m[key])))){return false}}var unitHasDecimal=false;for(var i=0;i<ordering.length;++i){if(m[ordering[i]]){if(unitHasDecimal){return false}if(parseFloat(m[ordering[i]])!==toInt(m[ordering[i]])){unitHasDecimal=true}}}return true}function isValid$1(){return this._isValid}function createInvalid$1(){return createDuration(NaN)}function Duration(duration){var normalizedInput=normalizeObjectUnits(duration),years=normalizedInput.year||0,quarters=normalizedInput.quarter||0,months=normalizedInput.month||0,weeks=normalizedInput.week||0,days=normalizedInput.day||0,hours=normalizedInput.hour||0,minutes=normalizedInput.minute||0,seconds=normalizedInput.second||0,milliseconds=normalizedInput.millisecond||0;this._isValid=isDurationValid(normalizedInput);this._milliseconds=+milliseconds+seconds*1e3+minutes*6e4+hours*1e3*60*60;this._days=+days+weeks*7;this._months=+months+quarters*3+years*12;this._data={};this._locale=getLocale();this._bubble()}function isDuration(obj){return obj instanceof Duration}function absRound(number){if(number<0){return Math.round(-1*number)*-1}else{return Math.round(number)}}function offset(token,separator){addFormatToken(token,0,0,function(){var offset=this.utcOffset();var sign="+";if(offset<0){offset=-offset;sign="-"}return sign+zeroFill(~~(offset/60),2)+separator+zeroFill(~~offset%60,2)})}offset("Z",":");offset("ZZ","");addRegexToken("Z",matchShortOffset);addRegexToken("ZZ",matchShortOffset);addParseToken(["Z","ZZ"],function(input,array,config){config._useUTC=true;config._tzm=offsetFromString(matchShortOffset,input)});var chunkOffset=/([\+\-]|\d\d)/gi;function offsetFromString(matcher,string){var matches=(string||"").match(matcher);if(matches===null){return null}var chunk=matches[matches.length-1]||[];var parts=(chunk+"").match(chunkOffset)||["-",0,0];var minutes=+(parts[1]*60)+toInt(parts[2]);return minutes===0?0:parts[0]==="+"?minutes:-minutes}function cloneWithOffset(input,model){var res,diff;if(model._isUTC){res=model.clone();diff=(isMoment(input)||isDate(input)?input.valueOf():createLocal(input).valueOf())-res.valueOf();res._d.setTime(res._d.valueOf()+diff);hooks.updateOffset(res,false);return res}else{return createLocal(input).local()}}function getDateOffset(m){return-Math.round(m._d.getTimezoneOffset()/15)*15}hooks.updateOffset=function(){};function getSetOffset(input,keepLocalTime,keepMinutes){var offset=this._offset||0,localAdjust;if(!this.isValid()){return input!=null?this:NaN}if(input!=null){if(typeof input==="string"){input=offsetFromString(matchShortOffset,input);if(input===null){return this}}else if(Math.abs(input)<16&&!keepMinutes){input=input*60}if(!this._isUTC&&keepLocalTime){localAdjust=getDateOffset(this)}this._offset=input;this._isUTC=true;if(localAdjust!=null){this.add(localAdjust,"m")}if(offset!==input){if(!keepLocalTime||this._changeInProgress){addSubtract(this,createDuration(input-offset,"m"),1,false)}else if(!this._changeInProgress){this._changeInProgress=true;hooks.updateOffset(this,true);this._changeInProgress=null}}return this}else{return this._isUTC?offset:getDateOffset(this)}}function getSetZone(input,keepLocalTime){if(input!=null){if(typeof input!=="string"){input=-input}this.utcOffset(input,keepLocalTime);return this}else{return-this.utcOffset()}}function setOffsetToUTC(keepLocalTime){return this.utcOffset(0,keepLocalTime)}function setOffsetToLocal(keepLocalTime){if(this._isUTC){this.utcOffset(0,keepLocalTime);this._isUTC=false;if(keepLocalTime){this.subtract(getDateOffset(this),"m")}}return this}function setOffsetToParsedOffset(){if(this._tzm!=null){this.utcOffset(this._tzm,false,true)}else if(typeof this._i==="string"){var tZone=offsetFromString(matchOffset,this._i);if(tZone!=null){this.utcOffset(tZone)}else{this.utcOffset(0,true)}}return this}function hasAlignedHourOffset(input){if(!this.isValid()){return false}input=input?createLocal(input).utcOffset():0;return(this.utcOffset()-input)%60===0}function isDaylightSavingTime(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function isDaylightSavingTimeShifted(){if(!isUndefined(this._isDSTShifted)){return this._isDSTShifted}var c={};copyConfig(c,this);c=prepareConfig(c);if(c._a){var other=c._isUTC?createUTC(c._a):createLocal(c._a);this._isDSTShifted=this.isValid()&&compareArrays(c._a,other.toArray())>0}else{this._isDSTShifted=false}return this._isDSTShifted}function isLocal(){return this.isValid()?!this._isUTC:false}function isUtcOffset(){return this.isValid()?this._isUTC:false}function isUtc(){return this.isValid()?this._isUTC&&this._offset===0:false}var aspNetRegex=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;var isoRegex=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;function createDuration(input,key){var duration=input,match=null,sign,ret,diffRes;if(isDuration(input)){duration={ms:input._milliseconds,d:input._days,M:input._months}}else if(isNumber(input)){duration={};if(key){duration[key]=input}else{duration.milliseconds=input}}else if(!!(match=aspNetRegex.exec(input))){sign=match[1]==="-"?-1:1;duration={y:0,d:toInt(match[DATE])*sign,h:toInt(match[HOUR])*sign,m:toInt(match[MINUTE])*sign,s:toInt(match[SECOND])*sign,ms:toInt(absRound(match[MILLISECOND]*1e3))*sign}}else if(!!(match=isoRegex.exec(input))){sign=match[1]==="-"?-1:1;duration={y:parseIso(match[2],sign),M:parseIso(match[3],sign),w:parseIso(match[4],sign),d:parseIso(match[5],sign),h:parseIso(match[6],sign),m:parseIso(match[7],sign),s:parseIso(match[8],sign)}}else if(duration==null){duration={}}else if(typeof duration==="object"&&("from"in duration||"to"in duration)){diffRes=momentsDifference(createLocal(duration.from),createLocal(duration.to));duration={};duration.ms=diffRes.milliseconds;duration.M=diffRes.months}ret=new Duration(duration);if(isDuration(input)&&hasOwnProp(input,"_locale")){ret._locale=input._locale}return ret}createDuration.fn=Duration.prototype;createDuration.invalid=createInvalid$1;function parseIso(inp,sign){var res=inp&&parseFloat(inp.replace(",","."));return(isNaN(res)?0:res)*sign}function positiveMomentsDifference(base,other){var res={milliseconds:0,months:0};res.months=other.month()-base.month()+(other.year()-base.year())*12;if(base.clone().add(res.months,"M").isAfter(other)){--res.months}res.milliseconds=+other-+base.clone().add(res.months,"M");return res}function momentsDifference(base,other){var res;if(!(base.isValid()&&other.isValid())){return{milliseconds:0,months:0}}other=cloneWithOffset(other,base);if(base.isBefore(other)){res=positiveMomentsDifference(base,other)}else{res=positiveMomentsDifference(other,base);res.milliseconds=-res.milliseconds;res.months=-res.months}return res}function createAdder(direction,name){return function(val,period){var dur,tmp;if(period!==null&&!isNaN(+period)){deprecateSimple(name,"moment()."+name+"(period, number) is deprecated. Please use moment()."+name+"(number, period). "+"See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.");tmp=val;val=period;period=tmp}val=typeof val==="string"?+val:val;dur=createDuration(val,period);addSubtract(this,dur,direction);return this}}function addSubtract(mom,duration,isAdding,updateOffset){var milliseconds=duration._milliseconds,days=absRound(duration._days),months=absRound(duration._months);if(!mom.isValid()){return}updateOffset=updateOffset==null?true:updateOffset;if(milliseconds){mom._d.setTime(mom._d.valueOf()+milliseconds*isAdding)}if(days){set$1(mom,"Date",get(mom,"Date")+days*isAdding)}if(months){setMonth(mom,get(mom,"Month")+months*isAdding)}if(updateOffset){hooks.updateOffset(mom,days||months)}}var add=createAdder(1,"add");var subtract=createAdder(-1,"subtract");function getCalendarFormat(myMoment,now){var diff=myMoment.diff(now,"days",true);return diff<-6?"sameElse":diff<-1?"lastWeek":diff<0?"lastDay":diff<1?"sameDay":diff<2?"nextDay":diff<7?"nextWeek":"sameElse"}function calendar$1(time,formats){var now=time||createLocal(),sod=cloneWithOffset(now,this).startOf("day"),format=hooks.calendarFormat(this,sod)||"sameElse";var output=formats&&(isFunction(formats[format])?formats[format].call(this,now):formats[format]);return this.format(output||this.localeData().calendar(format,this,createLocal(now)))}function clone(){return new Moment(this)}function isAfter(input,units){var localInput=isMoment(input)?input:createLocal(input);if(!(this.isValid()&&localInput.isValid())){return false}units=normalizeUnits(!isUndefined(units)?units:"millisecond");if(units==="millisecond"){return this.valueOf()>localInput.valueOf()}else{return localInput.valueOf()<this.clone().startOf(units).valueOf()}}function isBefore(input,units){var localInput=isMoment(input)?input:createLocal(input);if(!(this.isValid()&&localInput.isValid())){return false}units=normalizeUnits(!isUndefined(units)?units:"millisecond");if(units==="millisecond"){return this.valueOf()<localInput.valueOf()}else{return this.clone().endOf(units).valueOf()<localInput.valueOf()}}function isBetween(from,to,units,inclusivity){inclusivity=inclusivity||"()";return(inclusivity[0]==="("?this.isAfter(from,units):!this.isBefore(from,units))&&(inclusivity[1]===")"?this.isBefore(to,units):!this.isAfter(to,units))}function isSame(input,units){var localInput=isMoment(input)?input:createLocal(input),inputMs;if(!(this.isValid()&&localInput.isValid())){return false}units=normalizeUnits(units||"millisecond");if(units==="millisecond"){return this.valueOf()===localInput.valueOf()}else{inputMs=localInput.valueOf();return this.clone().startOf(units).valueOf()<=inputMs&&inputMs<=this.clone().endOf(units).valueOf()}}function isSameOrAfter(input,units){return this.isSame(input,units)||this.isAfter(input,units)}function isSameOrBefore(input,units){return this.isSame(input,units)||this.isBefore(input,units)}function diff(input,units,asFloat){var that,zoneDelta,delta,output;if(!this.isValid()){return NaN}that=cloneWithOffset(input,this);if(!that.isValid()){return NaN}zoneDelta=(that.utcOffset()-this.utcOffset())*6e4;units=normalizeUnits(units);if(units==="year"||units==="month"||units==="quarter"){output=monthDiff(this,that);if(units==="quarter"){output=output/3}else if(units==="year"){output=output/12}}else{delta=this-that;output=units==="second"?delta/1e3:units==="minute"?delta/6e4:units==="hour"?delta/36e5:units==="day"?(delta-zoneDelta)/864e5:units==="week"?(delta-zoneDelta)/6048e5:delta}return asFloat?output:absFloor(output)}function monthDiff(a,b){var wholeMonthDiff=(b.year()-a.year())*12+(b.month()-a.month()),anchor=a.clone().add(wholeMonthDiff,"months"),anchor2,adjust;if(b-anchor<0){anchor2=a.clone().add(wholeMonthDiff-1,"months");adjust=(b-anchor)/(anchor-anchor2)}else{anchor2=a.clone().add(wholeMonthDiff+1,"months");adjust=(b-anchor)/(anchor2-anchor)}return-(wholeMonthDiff+adjust)||0}hooks.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";hooks.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function toString(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function toISOString(){if(!this.isValid()){return null}var m=this.clone().utc();if(m.year()<0||m.year()>9999){return formatMoment(m,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}if(isFunction(Date.prototype.toISOString)){return this.toDate().toISOString()}return formatMoment(m,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function inspect(){if(!this.isValid()){return"moment.invalid(/* "+this._i+" */)"}var func="moment";var zone="";if(!this.isLocal()){func=this.utcOffset()===0?"moment.utc":"moment.parseZone";zone="Z"}var prefix="["+func+'("]';var year=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY";var datetime="-MM-DD[T]HH:mm:ss.SSS";var suffix=zone+'[")]';return this.format(prefix+year+datetime+suffix)}function format(inputString){if(!inputString){inputString=this.isUtc()?hooks.defaultFormatUtc:hooks.defaultFormat}var output=formatMoment(this,inputString);return this.localeData().postformat(output)}function from(time,withoutSuffix){if(this.isValid()&&(isMoment(time)&&time.isValid()||createLocal(time).isValid())){return createDuration({to:this,from:time}).locale(this.locale()).humanize(!withoutSuffix)}else{return this.localeData().invalidDate()}}function fromNow(withoutSuffix){return this.from(createLocal(),withoutSuffix)}function to(time,withoutSuffix){if(this.isValid()&&(isMoment(time)&&time.isValid()||createLocal(time).isValid())){return createDuration({from:this,to:time}).locale(this.locale()).humanize(!withoutSuffix)}else{return this.localeData().invalidDate()}}function toNow(withoutSuffix){return this.to(createLocal(),withoutSuffix)}function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr}else{newLocaleData=getLocale(key);if(newLocaleData!=null){this._locale=newLocaleData}return this}}var lang=deprecate("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(key){if(key===undefined){return this.localeData()}else{return this.locale(key)}});function localeData(){return this._locale}function startOf(units){units=normalizeUnits(units);switch(units){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}if(units==="week"){this.weekday(0)}if(units==="isoWeek"){this.isoWeekday(1)}if(units==="quarter"){this.month(Math.floor(this.month()/3)*3)}return this}function endOf(units){units=normalizeUnits(units);if(units===undefined||units==="millisecond"){return this}if(units==="date"){units="day"}return this.startOf(units).add(1,units==="isoWeek"?"week":units).subtract(1,"ms")}function valueOf(){return this._d.valueOf()-(this._offset||0)*6e4}function unix(){return Math.floor(this.valueOf()/1e3)}function toDate(){return new Date(this.valueOf())}function toArray(){var m=this;return[m.year(),m.month(),m.date(),m.hour(),m.minute(),m.second(),m.millisecond()]}function toObject(){var m=this;return{years:m.year(),months:m.month(),date:m.date(),hours:m.hours(),minutes:m.minutes(),seconds:m.seconds(),milliseconds:m.milliseconds()}}function toJSON(){return this.isValid()?this.toISOString():null}function isValid$2(){return isValid(this)}function parsingFlags(){return extend({},getParsingFlags(this))}function invalidAt(){return getParsingFlags(this).overflow}function creationData(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}addFormatToken(0,["gg",2],0,function(){return this.weekYear()%100});addFormatToken(0,["GG",2],0,function(){return this.isoWeekYear()%100});function addWeekYearFormatToken(token,getter){addFormatToken(0,[token,token.length],0,getter)}addWeekYearFormatToken("gggg","weekYear");addWeekYearFormatToken("ggggg","weekYear");addWeekYearFormatToken("GGGG","isoWeekYear");addWeekYearFormatToken("GGGGG","isoWeekYear");addUnitAlias("weekYear","gg");addUnitAlias("isoWeekYear","GG");addUnitPriority("weekYear",1);addUnitPriority("isoWeekYear",1);addRegexToken("G",matchSigned);addRegexToken("g",matchSigned);addRegexToken("GG",match1to2,match2);addRegexToken("gg",match1to2,match2);addRegexToken("GGGG",match1to4,match4);addRegexToken("gggg",match1to4,match4);addRegexToken("GGGGG",match1to6,match6);addRegexToken("ggggg",match1to6,match6);addWeekParseToken(["gggg","ggggg","GGGG","GGGGG"],function(input,week,config,token){week[token.substr(0,2)]=toInt(input)});addWeekParseToken(["gg","GG"],function(input,week,config,token){week[token]=hooks.parseTwoDigitYear(input)});function getSetWeekYear(input){return getSetWeekYearHelper.call(this,input,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function getSetISOWeekYear(input){return getSetWeekYearHelper.call(this,input,this.isoWeek(),this.isoWeekday(),1,4)}function getISOWeeksInYear(){return weeksInYear(this.year(),1,4)}function getWeeksInYear(){var weekInfo=this.localeData()._week;return weeksInYear(this.year(),weekInfo.dow,weekInfo.doy)}function getSetWeekYearHelper(input,week,weekday,dow,doy){var weeksTarget;if(input==null){return weekOfYear(this,dow,doy).year}else{weeksTarget=weeksInYear(input,dow,doy);if(week>weeksTarget){week=weeksTarget}return setWeekAll.call(this,input,week,weekday,dow,doy)}}function setWeekAll(weekYear,week,weekday,dow,doy){var dayOfYearData=dayOfYearFromWeeks(weekYear,week,weekday,dow,doy),date=createUTCDate(dayOfYearData.year,0,dayOfYearData.dayOfYear);this.year(date.getUTCFullYear());this.month(date.getUTCMonth());this.date(date.getUTCDate());return this}addFormatToken("Q",0,"Qo","quarter");addUnitAlias("quarter","Q");addUnitPriority("quarter",7);addRegexToken("Q",match1);addParseToken("Q",function(input,array){array[MONTH]=(toInt(input)-1)*3});function getSetQuarter(input){return input==null?Math.ceil((this.month()+1)/3):this.month((input-1)*3+this.month()%3)}addFormatToken("D",["DD",2],"Do","date");addUnitAlias("date","D");addUnitPriority("date",9);addRegexToken("D",match1to2);addRegexToken("DD",match1to2,match2);addRegexToken("Do",function(isStrict,locale){return isStrict?locale._dayOfMonthOrdinalParse||locale._ordinalParse:locale._dayOfMonthOrdinalParseLenient});addParseToken(["D","DD"],DATE);addParseToken("Do",function(input,array){array[DATE]=toInt(input.match(match1to2)[0],10)});var getSetDayOfMonth=makeGetSet("Date",true);addFormatToken("DDD",["DDDD",3],"DDDo","dayOfYear");addUnitAlias("dayOfYear","DDD");addUnitPriority("dayOfYear",4);addRegexToken("DDD",match1to3);addRegexToken("DDDD",match3);addParseToken(["DDD","DDDD"],function(input,array,config){config._dayOfYear=toInt(input)});function getSetDayOfYear(input){var dayOfYear=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return input==null?dayOfYear:this.add(input-dayOfYear,"d")}addFormatToken("m",["mm",2],0,"minute");addUnitAlias("minute","m");addUnitPriority("minute",14);addRegexToken("m",match1to2);addRegexToken("mm",match1to2,match2);addParseToken(["m","mm"],MINUTE);var getSetMinute=makeGetSet("Minutes",false);addFormatToken("s",["ss",2],0,"second");addUnitAlias("second","s");addUnitPriority("second",15);addRegexToken("s",match1to2);addRegexToken("ss",match1to2,match2);addParseToken(["s","ss"],SECOND);var getSetSecond=makeGetSet("Seconds",false);addFormatToken("S",0,0,function(){return~~(this.millisecond()/100)});addFormatToken(0,["SS",2],0,function(){return~~(this.millisecond()/10)});addFormatToken(0,["SSS",3],0,"millisecond");addFormatToken(0,["SSSS",4],0,function(){return this.millisecond()*10});addFormatToken(0,["SSSSS",5],0,function(){return this.millisecond()*100});addFormatToken(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});addFormatToken(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});addFormatToken(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});addFormatToken(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});addUnitAlias("millisecond","ms");addUnitPriority("millisecond",16);addRegexToken("S",match1to3,match1);addRegexToken("SS",match1to3,match2);addRegexToken("SSS",match1to3,match3);var token;for(token="SSSS";token.length<=9;token+="S"){addRegexToken(token,matchUnsigned)}function parseMs(input,array){array[MILLISECOND]=toInt(("0."+input)*1e3)}for(token="S";token.length<=9;token+="S"){addParseToken(token,parseMs)}var getSetMillisecond=makeGetSet("Milliseconds",false);addFormatToken("z",0,0,"zoneAbbr");addFormatToken("zz",0,0,"zoneName");function getZoneAbbr(){return this._isUTC?"UTC":""}function getZoneName(){return this._isUTC?"Coordinated Universal Time":""}var proto=Moment.prototype;proto.add=add;proto.calendar=calendar$1;proto.clone=clone;proto.diff=diff;proto.endOf=endOf;proto.format=format;proto.from=from;proto.fromNow=fromNow;proto.to=to;proto.toNow=toNow;proto.get=stringGet;proto.invalidAt=invalidAt;proto.isAfter=isAfter;proto.isBefore=isBefore;proto.isBetween=isBetween;proto.isSame=isSame;proto.isSameOrAfter=isSameOrAfter;proto.isSameOrBefore=isSameOrBefore;proto.isValid=isValid$2;proto.lang=lang;proto.locale=locale;proto.localeData=localeData;proto.max=prototypeMax;proto.min=prototypeMin;proto.parsingFlags=parsingFlags;proto.set=stringSet;proto.startOf=startOf;proto.subtract=subtract;proto.toArray=toArray;proto.toObject=toObject;proto.toDate=toDate;proto.toISOString=toISOString;proto.inspect=inspect;proto.toJSON=toJSON;proto.toString=toString;proto.unix=unix;proto.valueOf=valueOf;proto.creationData=creationData;proto.year=getSetYear;proto.isLeapYear=getIsLeapYear;proto.weekYear=getSetWeekYear;proto.isoWeekYear=getSetISOWeekYear;proto.quarter=proto.quarters=getSetQuarter;proto.month=getSetMonth;proto.daysInMonth=getDaysInMonth;proto.week=proto.weeks=getSetWeek;proto.isoWeek=proto.isoWeeks=getSetISOWeek;proto.weeksInYear=getWeeksInYear;proto.isoWeeksInYear=getISOWeeksInYear;proto.date=getSetDayOfMonth;proto.day=proto.days=getSetDayOfWeek;proto.weekday=getSetLocaleDayOfWeek;proto.isoWeekday=getSetISODayOfWeek;proto.dayOfYear=getSetDayOfYear;proto.hour=proto.hours=getSetHour;proto.minute=proto.minutes=getSetMinute;proto.second=proto.seconds=getSetSecond;proto.millisecond=proto.milliseconds=getSetMillisecond;proto.utcOffset=getSetOffset;proto.utc=setOffsetToUTC;proto.local=setOffsetToLocal;proto.parseZone=setOffsetToParsedOffset;proto.hasAlignedHourOffset=hasAlignedHourOffset;proto.isDST=isDaylightSavingTime;proto.isLocal=isLocal;proto.isUtcOffset=isUtcOffset;proto.isUtc=isUtc;proto.isUTC=isUtc;proto.zoneAbbr=getZoneAbbr;proto.zoneName=getZoneName;proto.dates=deprecate("dates accessor is deprecated. Use date instead.",getSetDayOfMonth);proto.months=deprecate("months accessor is deprecated. Use month instead",getSetMonth);proto.years=deprecate("years accessor is deprecated. Use year instead",getSetYear);proto.zone=deprecate("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",getSetZone);proto.isDSTShifted=deprecate("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",isDaylightSavingTimeShifted);function createUnix(input){return createLocal(input*1e3)}function createInZone(){return createLocal.apply(null,arguments).parseZone()}function preParsePostFormat(string){return string}var proto$1=Locale.prototype;proto$1.calendar=calendar;proto$1.longDateFormat=longDateFormat;proto$1.invalidDate=invalidDate;proto$1.ordinal=ordinal;proto$1.preparse=preParsePostFormat;proto$1.postformat=preParsePostFormat;proto$1.relativeTime=relativeTime;proto$1.pastFuture=pastFuture;proto$1.set=set;proto$1.months=localeMonths;proto$1.monthsShort=localeMonthsShort;proto$1.monthsParse=localeMonthsParse;proto$1.monthsRegex=monthsRegex;proto$1.monthsShortRegex=monthsShortRegex;proto$1.week=localeWeek;proto$1.firstDayOfYear=localeFirstDayOfYear;proto$1.firstDayOfWeek=localeFirstDayOfWeek;proto$1.weekdays=localeWeekdays;proto$1.weekdaysMin=localeWeekdaysMin;proto$1.weekdaysShort=localeWeekdaysShort;proto$1.weekdaysParse=localeWeekdaysParse;proto$1.weekdaysRegex=weekdaysRegex;proto$1.weekdaysShortRegex=weekdaysShortRegex;proto$1.weekdaysMinRegex=weekdaysMinRegex;proto$1.isPM=localeIsPM;proto$1.meridiem=localeMeridiem;function get$1(format,index,field,setter){var locale=getLocale();var utc=createUTC().set(setter,index);return locale[field](utc,format)}function listMonthsImpl(format,index,field){if(isNumber(format)){index=format;format=undefined}format=format||"";if(index!=null){return get$1(format,index,field,"month")}var i;var out=[];for(i=0;i<12;i++){out[i]=get$1(format,i,field,"month")}return out}function listWeekdaysImpl(localeSorted,format,index,field){if(typeof localeSorted==="boolean"){if(isNumber(format)){index=format;format=undefined}format=format||""}else{format=localeSorted;index=format;localeSorted=false;if(isNumber(format)){index=format;format=undefined}format=format||""}var locale=getLocale(),shift=localeSorted?locale._week.dow:0;if(index!=null){return get$1(format,(index+shift)%7,field,"day")}var i;var out=[];for(i=0;i<7;i++){out[i]=get$1(format,(i+shift)%7,field,"day")}return out}function listMonths(format,index){return listMonthsImpl(format,index,"months")}function listMonthsShort(format,index){return listMonthsImpl(format,index,"monthsShort")}function listWeekdays(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,"weekdays")}function listWeekdaysShort(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,"weekdaysShort")}function listWeekdaysMin(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,"weekdaysMin")}getSetGlobalLocale("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(number){var b=number%10,output=toInt(number%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th";return number+output}});hooks.lang=deprecate("moment.lang is deprecated. Use moment.locale instead.",getSetGlobalLocale);hooks.langData=deprecate("moment.langData is deprecated. Use moment.localeData instead.",getLocale);var mathAbs=Math.abs;function abs(){var data=this._data;this._milliseconds=mathAbs(this._milliseconds);this._days=mathAbs(this._days);this._months=mathAbs(this._months);data.milliseconds=mathAbs(data.milliseconds);data.seconds=mathAbs(data.seconds);data.minutes=mathAbs(data.minutes);data.hours=mathAbs(data.hours);data.months=mathAbs(data.months);data.years=mathAbs(data.years);return this}function addSubtract$1(duration,input,value,direction){var other=createDuration(input,value);duration._milliseconds+=direction*other._milliseconds;duration._days+=direction*other._days;duration._months+=direction*other._months;return duration._bubble()}function add$1(input,value){return addSubtract$1(this,input,value,1)}function subtract$1(input,value){return addSubtract$1(this,input,value,-1)}function absCeil(number){if(number<0){return Math.floor(number)}else{return Math.ceil(number)}}function bubble(){var milliseconds=this._milliseconds;var days=this._days;var months=this._months;var data=this._data;var seconds,minutes,hours,years,monthsFromDays;if(!(milliseconds>=0&&days>=0&&months>=0||milliseconds<=0&&days<=0&&months<=0)){milliseconds+=absCeil(monthsToDays(months)+days)*864e5;days=0;months=0}data.milliseconds=milliseconds%1e3;seconds=absFloor(milliseconds/1e3);data.seconds=seconds%60;minutes=absFloor(seconds/60);data.minutes=minutes%60;hours=absFloor(minutes/60);data.hours=hours%24;days+=absFloor(hours/24);monthsFromDays=absFloor(daysToMonths(days));months+=monthsFromDays;days-=absCeil(monthsToDays(monthsFromDays));years=absFloor(months/12);months%=12;data.days=days;data.months=months;data.years=years;return this}function daysToMonths(days){return days*4800/146097}function monthsToDays(months){return months*146097/4800}function as(units){if(!this.isValid()){return NaN}var days;var months;var milliseconds=this._milliseconds;units=normalizeUnits(units);if(units==="month"||units==="year"){days=this._days+milliseconds/864e5;months=this._months+daysToMonths(days);return units==="month"?months:months/12}else{days=this._days+Math.round(monthsToDays(this._months));switch(units){case"week":return days/7+milliseconds/6048e5;case"day":return days+milliseconds/864e5;case"hour":return days*24+milliseconds/36e5;case"minute":return days*1440+milliseconds/6e4;case"second":return days*86400+milliseconds/1e3;case"millisecond":return Math.floor(days*864e5)+milliseconds;default:throw new Error("Unknown unit "+units)}}}function valueOf$1(){if(!this.isValid()){return NaN}return this._milliseconds+this._days*864e5+this._months%12*2592e6+toInt(this._months/12)*31536e6}function makeAs(alias){return function(){return this.as(alias)}}var asMilliseconds=makeAs("ms");var asSeconds=makeAs("s");var asMinutes=makeAs("m");var asHours=makeAs("h");var asDays=makeAs("d");var asWeeks=makeAs("w");var asMonths=makeAs("M");var asYears=makeAs("y");function get$2(units){units=normalizeUnits(units);return this.isValid()?this[units+"s"]():NaN}function makeGetter(name){return function(){return this.isValid()?this._data[name]:NaN}}var milliseconds=makeGetter("milliseconds");var seconds=makeGetter("seconds");var minutes=makeGetter("minutes");var hours=makeGetter("hours");var days=makeGetter("days");var months=makeGetter("months");var years=makeGetter("years");function weeks(){return absFloor(this.days()/7)}var round=Math.round;var thresholds={ss:44,s:45,m:45,h:22,d:26,M:11};function substituteTimeAgo(string,number,withoutSuffix,isFuture,locale){return locale.relativeTime(number||1,!!withoutSuffix,string,isFuture)}function relativeTime$1(posNegDuration,withoutSuffix,locale){var duration=createDuration(posNegDuration).abs();var seconds=round(duration.as("s"));var minutes=round(duration.as("m"));var hours=round(duration.as("h"));var days=round(duration.as("d"));var months=round(duration.as("M"));var years=round(duration.as("y"));var a=seconds<=thresholds.ss&&["s",seconds]||seconds<thresholds.s&&["ss",seconds]||minutes<=1&&["m"]||minutes<thresholds.m&&["mm",minutes]||hours<=1&&["h"]||hours<thresholds.h&&["hh",hours]||days<=1&&["d"]||days<thresholds.d&&["dd",days]||months<=1&&["M"]||months<thresholds.M&&["MM",months]||years<=1&&["y"]||["yy",years];a[2]=withoutSuffix;a[3]=+posNegDuration>0;a[4]=locale;return substituteTimeAgo.apply(null,a)}function getSetRelativeTimeRounding(roundingFunction){if(roundingFunction===undefined){return round}if(typeof roundingFunction==="function"){round=roundingFunction;return true}return false}function getSetRelativeTimeThreshold(threshold,limit){if(thresholds[threshold]===undefined){return false}if(limit===undefined){return thresholds[threshold]}thresholds[threshold]=limit;if(threshold==="s"){thresholds.ss=limit-1}return true}function humanize(withSuffix){if(!this.isValid()){return this.localeData().invalidDate()}var locale=this.localeData();var output=relativeTime$1(this,!withSuffix,locale);if(withSuffix){output=locale.pastFuture(+this,output)}return locale.postformat(output)}var abs$1=Math.abs;function toISOString$1(){if(!this.isValid()){return this.localeData().invalidDate()}var seconds=abs$1(this._milliseconds)/1e3;var days=abs$1(this._days);var months=abs$1(this._months);var minutes,hours,years;minutes=absFloor(seconds/60);hours=absFloor(minutes/60);seconds%=60;minutes%=60;years=absFloor(months/12);months%=12;var Y=years;var M=months;var D=days;var h=hours;var m=minutes;var s=seconds;var total=this.asSeconds();if(!total){return"P0D"}return(total<0?"-":"")+"P"+(Y?Y+"Y":"")+(M?M+"M":"")+(D?D+"D":"")+(h||m||s?"T":"")+(h?h+"H":"")+(m?m+"M":"")+(s?s+"S":"")}var proto$2=Duration.prototype;proto$2.isValid=isValid$1;proto$2.abs=abs;proto$2.add=add$1;proto$2.subtract=subtract$1;proto$2.as=as;proto$2.asMilliseconds=asMilliseconds;proto$2.asSeconds=asSeconds;proto$2.asMinutes=asMinutes;proto$2.asHours=asHours;proto$2.asDays=asDays;proto$2.asWeeks=asWeeks;proto$2.asMonths=asMonths;proto$2.asYears=asYears;proto$2.valueOf=valueOf$1;proto$2._bubble=bubble;proto$2.get=get$2;proto$2.milliseconds=milliseconds;proto$2.seconds=seconds;proto$2.minutes=minutes;proto$2.hours=hours;proto$2.days=days;proto$2.weeks=weeks;proto$2.months=months;proto$2.years=years;proto$2.humanize=humanize;proto$2.toISOString=toISOString$1;proto$2.toString=toISOString$1;proto$2.toJSON=toISOString$1;proto$2.locale=locale;proto$2.localeData=localeData;proto$2.toIsoString=deprecate("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",toISOString$1);proto$2.lang=lang;addFormatToken("X",0,0,"unix");addFormatToken("x",0,0,"valueOf");addRegexToken("x",matchSigned);addRegexToken("X",matchTimestamp);addParseToken("X",function(input,array,config){config._d=new Date(parseFloat(input,10)*1e3)});addParseToken("x",function(input,array,config){config._d=new Date(toInt(input))});hooks.version="2.18.1";setHookCallback(createLocal);hooks.fn=proto;hooks.min=min;hooks.max=max;hooks.now=now;hooks.utc=createUTC;hooks.unix=createUnix;hooks.months=listMonths;hooks.isDate=isDate;hooks.locale=getSetGlobalLocale;hooks.invalid=createInvalid;hooks.duration=createDuration;hooks.isMoment=isMoment;hooks.weekdays=listWeekdays;hooks.parseZone=createInZone;hooks.localeData=getLocale;hooks.isDuration=isDuration;hooks.monthsShort=listMonthsShort;hooks.weekdaysMin=listWeekdaysMin;hooks.defineLocale=defineLocale;hooks.updateLocale=updateLocale;hooks.locales=listLocales;hooks.weekdaysShort=listWeekdaysShort;hooks.normalizeUnits=normalizeUnits;hooks.relativeTimeRounding=getSetRelativeTimeRounding;hooks.relativeTimeThreshold=getSetRelativeTimeThreshold;hooks.calendarFormat=getCalendarFormat;hooks.prototype=proto;return hooks});(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","moment"],factory)}else if(typeof exports==="object"){module.exports=factory(require("jquery"),require("moment"))}else{if(typeof jQuery==="undefined"){throw"bootstrap-datetimepicker requires jQuery to be loaded first"}if(typeof moment==="undefined"){throw"bootstrap-datetimepicker requires Moment.js to be loaded first"}factory(jQuery,moment)}})(function($,moment){"use strict";if(!moment){throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first")}var dateTimePicker=function(element,options){var picker={},date,viewDate,unset=true,input,component=false,widget=false,use24Hours,minViewModeNumber=0,actualFormat,parseFormats,currentViewMode,datePickerModes=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10},{clsName:"decades",navFnc:"y",navStep:100}],viewModes=["days","months","years","decades"],verticalModes=["top","bottom","auto"],horizontalModes=["left","right","auto"],toolbarPlacements=["default","top","bottom"],keyMap={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},keyState={},hasTimeZone=function(){return moment.tz!==undefined&&options.timeZone!==undefined&&options.timeZone!==null&&options.timeZone!==""},getMoment=function(d){var returnMoment;if(d===undefined||d===null){returnMoment=moment()}else if(moment.isDate(d)||moment.isMoment(d)){returnMoment=moment(d)}else if(hasTimeZone()){returnMoment=moment.tz(d,parseFormats,options.useStrict,options.timeZone)}else{returnMoment=moment(d,parseFormats,options.useStrict)}if(hasTimeZone()){returnMoment.tz(options.timeZone)}return returnMoment},isEnabled=function(granularity){if(typeof granularity!=="string"||granularity.length>1){throw new TypeError("isEnabled expects a single character string parameter")}switch(granularity){case"y":return actualFormat.indexOf("Y")!==-1;case"M":return actualFormat.indexOf("M")!==-1;case"d":return actualFormat.toLowerCase().indexOf("d")!==-1;case"h":case"H":return actualFormat.toLowerCase().indexOf("h")!==-1;case"m":return actualFormat.indexOf("m")!==-1;case"s":return actualFormat.indexOf("s")!==-1;default:return false}},hasTime=function(){return isEnabled("h")||isEnabled("m")||isEnabled("s")},hasDate=function(){return isEnabled("y")||isEnabled("M")||isEnabled("d")},getDatePickerTemplate=function(){var headTemplate=$("<thead>").append($("<tr>").append($("<th>").addClass("prev").attr("data-action","previous").append($("<span>").addClass(options.icons.previous))).append($("<th>").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",options.calendarWeeks?"6":"5")).append($("<th>").addClass("next").attr("data-action","next").append($("<span>").addClass(options.icons.next)))),contTemplate=$("<tbody>").append($("<tr>").append($("<td>").attr("colspan",options.calendarWeeks?"8":"7")));return[$("<div>").addClass("datepicker-days").append($("<table>").addClass("table-condensed").append(headTemplate).append($("<tbody>"))),$("<div>").addClass("datepicker-months").append($("<table>").addClass("table-condensed").append(headTemplate.clone()).append(contTemplate.clone())),$("<div>").addClass("datepicker-years").append($("<table>").addClass("table-condensed").append(headTemplate.clone()).append(contTemplate.clone())),$("<div>").addClass("datepicker-decades").append($("<table>").addClass("table-condensed").append(headTemplate.clone()).append(contTemplate.clone()))]},getTimePickerMainTemplate=function(){var topRow=$("<tr>"),middleRow=$("<tr>"),bottomRow=$("<tr>");if(isEnabled("h")){topRow.append($("<td>").append($("<a>").attr({href:"#",tabindex:"-1",title:options.tooltips.incrementHour}).addClass("btn").attr("data-action","incrementHours").append($("<span>").addClass(options.icons.up))));middleRow.append($("<td>").append($("<span>").addClass("timepicker-hour").attr({"data-time-component":"hours",title:options.tooltips.pickHour}).attr("data-action","showHours")));bottomRow.append($("<td>").append($("<a>").attr({href:"#",tabindex:"-1",title:options.tooltips.decrementHour}).addClass("btn").attr("data-action","decrementHours").append($("<span>").addClass(options.icons.down))))}if(isEnabled("m")){if(isEnabled("h")){topRow.append($("<td>").addClass("separator"));middleRow.append($("<td>").addClass("separator").html(":"));bottomRow.append($("<td>").addClass("separator"))}topRow.append($("<td>").append($("<a>").attr({href:"#",tabindex:"-1",title:options.tooltips.incrementMinute}).addClass("btn").attr("data-action","incrementMinutes").append($("<span>").addClass(options.icons.up))));middleRow.append($("<td>").append($("<span>").addClass("timepicker-minute").attr({"data-time-component":"minutes",title:options.tooltips.pickMinute}).attr("data-action","showMinutes")));bottomRow.append($("<td>").append($("<a>").attr({href:"#",tabindex:"-1",title:options.tooltips.decrementMinute}).addClass("btn").attr("data-action","decrementMinutes").append($("<span>").addClass(options.icons.down))))}if(isEnabled("s")){if(isEnabled("m")){topRow.append($("<td>").addClass("separator"));middleRow.append($("<td>").addClass("separator").html(":"));bottomRow.append($("<td>").addClass("separator"))}topRow.append($("<td>").append($("<a>").attr({href:"#",tabindex:"-1",title:options.tooltips.incrementSecond}).addClass("btn").attr("data-action","incrementSeconds").append($("<span>").addClass(options.icons.up))));middleRow.append($("<td>").append($("<span>").addClass("timepicker-second").attr({"data-time-component":"seconds",title:options.tooltips.pickSecond}).attr("data-action","showSeconds")));bottomRow.append($("<td>").append($("<a>").attr({href:"#",tabindex:"-1",title:options.tooltips.decrementSecond}).addClass("btn").attr("data-action","decrementSeconds").append($("<span>").addClass(options.icons.down))))}if(!use24Hours){topRow.append($("<td>").addClass("separator"));middleRow.append($("<td>").append($("<button>").addClass("btn btn-primary").attr({"data-action":"togglePeriod",tabindex:"-1",title:options.tooltips.togglePeriod})));bottomRow.append($("<td>").addClass("separator"))}return $("<div>").addClass("timepicker-picker").append($("<table>").addClass("table-condensed").append([topRow,middleRow,bottomRow]))},getTimePickerTemplate=function(){var hoursView=$("<div>").addClass("timepicker-hours").append($("<table>").addClass("table-condensed")),minutesView=$("<div>").addClass("timepicker-minutes").append($("<table>").addClass("table-condensed")),secondsView=$("<div>").addClass("timepicker-seconds").append($("<table>").addClass("table-condensed")),ret=[getTimePickerMainTemplate()];if(isEnabled("h")){ret.push(hoursView)}if(isEnabled("m")){ret.push(minutesView)}if(isEnabled("s")){ret.push(secondsView)}return ret},getToolbar=function(){var row=[];if(options.showTodayButton){row.push($("<td>").append($("<a>").attr({"data-action":"today",title:options.tooltips.today}).append($("<span>").addClass(options.icons.today))))}if(!options.sideBySide&&hasDate()&&hasTime()){row.push($("<td>").append($("<a>").attr({"data-action":"togglePicker",title:options.tooltips.selectTime}).append($("<span>").addClass(options.icons.time))))}if(options.showClear){row.push($("<td>").append($("<a>").attr({"data-action":"clear",title:options.tooltips.clear}).append($("<span>").addClass(options.icons.clear))))}if(options.showClose){row.push($("<td>").append($("<a>").attr({"data-action":"close",title:options.tooltips.close}).append($("<span>").addClass(options.icons.close))))}return $("<table>").addClass("table-condensed").append($("<tbody>").append($("<tr>").append(row)))},getTemplate=function(){var template=$("<div>").addClass("bootstrap-datetimepicker-widget dropdown-menu"),dateView=$("<div>").addClass("datepicker").append(getDatePickerTemplate()),timeView=$("<div>").addClass("timepicker").append(getTimePickerTemplate()),content=$("<ul>").addClass("list-unstyled"),toolbar=$("<li>").addClass("picker-switch"+(options.collapse?" accordion-toggle":"")).append(getToolbar());if(options.inline){template.removeClass("dropdown-menu")}if(use24Hours){template.addClass("usetwentyfour")}if(isEnabled("s")&&!use24Hours){template.addClass("wider")}if(options.sideBySide&&hasDate()&&hasTime()){template.addClass("timepicker-sbs");if(options.toolbarPlacement==="top"){template.append(toolbar)}template.append($("<div>").addClass("row").append(dateView.addClass("col-md-6")).append(timeView.addClass("col-md-6")));if(options.toolbarPlacement==="bottom"){template.append(toolbar)}return template}if(options.toolbarPlacement==="top"){content.append(toolbar)}if(hasDate()){content.append($("<li>").addClass(options.collapse&&hasTime()?"collapse in":"").append(dateView))}if(options.toolbarPlacement==="default"){content.append(toolbar)}if(hasTime()){content.append($("<li>").addClass(options.collapse&&hasDate()?"collapse":"").append(timeView))}if(options.toolbarPlacement==="bottom"){content.append(toolbar)}return template.append(content)},dataToOptions=function(){var eData,dataOptions={};if(element.is("input")||options.inline){eData=element.data()}else{eData=element.find("input").data()}if(eData.dateOptions&&eData.dateOptions instanceof Object){dataOptions=$.extend(true,dataOptions,eData.dateOptions)}$.each(options,function(key){var attributeName="date"+key.charAt(0).toUpperCase()+key.slice(1);if(eData[attributeName]!==undefined){dataOptions[key]=eData[attributeName]}});return dataOptions},place=function(){var position=(component||element).position(),offset=(component||element).offset(),vertical=options.widgetPositioning.vertical,horizontal=options.widgetPositioning.horizontal,parent;if(options.widgetParent){parent=options.widgetParent.append(widget)}else if(element.is("input")){parent=element.after(widget).parent()}else if(options.inline){parent=element.append(widget);return}else{parent=element;element.children().first().after(widget)}if(vertical==="auto"){if(offset.top+widget.height()*1.5>=$(window).height()+$(window).scrollTop()&&widget.height()+element.outerHeight()<offset.top){vertical="top"}else{vertical="bottom"}}if(horizontal==="auto"){if(parent.width()<offset.left+widget.outerWidth()/2&&offset.left+widget.outerWidth()>$(window).width()){horizontal="right"}else{horizontal="left"}}if(vertical==="top"){widget.addClass("top").removeClass("bottom")}else{widget.addClass("bottom").removeClass("top")}if(horizontal==="right"){widget.addClass("pull-right")}else{widget.removeClass("pull-right")}if(parent.css("position")==="static"){parent=parent.parents().filter(function(){return $(this).css("position")!=="static"}).first()}if(parent.length===0){throw new Error("datetimepicker component should be placed within a non-static positioned container")}widget.css({top:vertical==="top"?"auto":position.top+element.outerHeight(),bottom:vertical==="top"?parent.outerHeight()-(parent===element?0:position.top):"auto",left:horizontal==="left"?parent===element?0:position.left:"auto",right:horizontal==="left"?"auto":parent.outerWidth()-element.outerWidth()-(parent===element?0:position.left)})},notifyEvent=function(e){if(e.type==="dp.change"&&(e.date&&e.date.isSame(e.oldDate)||!e.date&&!e.oldDate)){return}element.trigger(e)},viewUpdate=function(e){if(e==="y"){e="YYYY"}notifyEvent({type:"dp.update",change:e,viewDate:viewDate.clone()})},showMode=function(dir){if(!widget){return}if(dir){currentViewMode=Math.max(minViewModeNumber,Math.min(3,currentViewMode+dir))}widget.find(".datepicker > div").hide().filter(".datepicker-"+datePickerModes[currentViewMode].clsName).show()},fillDow=function(){var row=$("<tr>"),currentDate=viewDate.clone().startOf("w").startOf("d");if(options.calendarWeeks===true){row.append($("<th>").addClass("cw").text("#"))}while(currentDate.isBefore(viewDate.clone().endOf("w"))){row.append($("<th>").addClass("dow").text(currentDate.format("dd")));currentDate.add(1,"d")}widget.find(".datepicker-days thead").append(row)},isInDisabledDates=function(testDate){return options.disabledDates[testDate.format("YYYY-MM-DD")]===true},isInEnabledDates=function(testDate){return options.enabledDates[testDate.format("YYYY-MM-DD")]===true},isInDisabledHours=function(testDate){return options.disabledHours[testDate.format("H")]===true},isInEnabledHours=function(testDate){return options.enabledHours[testDate.format("H")]===true},isValid=function(targetMoment,granularity){if(!targetMoment.isValid()){return false}if(options.disabledDates&&granularity==="d"&&isInDisabledDates(targetMoment)){return false}if(options.enabledDates&&granularity==="d"&&!isInEnabledDates(targetMoment)){return false}if(options.minDate&&targetMoment.isBefore(options.minDate,granularity)){return false}if(options.maxDate&&targetMoment.isAfter(options.maxDate,granularity)){return false}if(options.daysOfWeekDisabled&&granularity==="d"&&options.daysOfWeekDisabled.indexOf(targetMoment.day())!==-1){return false}if(options.disabledHours&&(granularity==="h"||granularity==="m"||granularity==="s")&&isInDisabledHours(targetMoment)){return false}if(options.enabledHours&&(granularity==="h"||granularity==="m"||granularity==="s")&&!isInEnabledHours(targetMoment)){return false}if(options.disabledTimeIntervals&&(granularity==="h"||granularity==="m"||granularity==="s")){var found=false;$.each(options.disabledTimeIntervals,function(){if(targetMoment.isBetween(this[0],this[1])){found=true;return false}});if(found){return false}}return true},fillMonths=function(){var spans=[],monthsShort=viewDate.clone().startOf("y").startOf("d");while(monthsShort.isSame(viewDate,"y")){spans.push($("<span>").attr("data-action","selectMonth").addClass("month").text(monthsShort.format("MMM")));monthsShort.add(1,"M")}widget.find(".datepicker-months td").empty().append(spans)},updateMonths=function(){var monthsView=widget.find(".datepicker-months"),monthsViewHeader=monthsView.find("th"),months=monthsView.find("tbody").find("span");monthsViewHeader.eq(0).find("span").attr("title",options.tooltips.prevYear);monthsViewHeader.eq(1).attr("title",options.tooltips.selectYear);monthsViewHeader.eq(2).find("span").attr("title",options.tooltips.nextYear);monthsView.find(".disabled").removeClass("disabled");if(!isValid(viewDate.clone().subtract(1,"y"),"y")){monthsViewHeader.eq(0).addClass("disabled")}monthsViewHeader.eq(1).text(viewDate.year());if(!isValid(viewDate.clone().add(1,"y"),"y")){monthsViewHeader.eq(2).addClass("disabled")}months.removeClass("active");if(date.isSame(viewDate,"y")&&!unset){months.eq(date.month()).addClass("active")}months.each(function(index){if(!isValid(viewDate.clone().month(index),"M")){$(this).addClass("disabled")}})},updateYears=function(){var yearsView=widget.find(".datepicker-years"),yearsViewHeader=yearsView.find("th"),startYear=viewDate.clone().subtract(5,"y"),endYear=viewDate.clone().add(6,"y"),html="";yearsViewHeader.eq(0).find("span").attr("title",options.tooltips.prevDecade);yearsViewHeader.eq(1).attr("title",options.tooltips.selectDecade);yearsViewHeader.eq(2).find("span").attr("title",options.tooltips.nextDecade);yearsView.find(".disabled").removeClass("disabled");if(options.minDate&&options.minDate.isAfter(startYear,"y")){yearsViewHeader.eq(0).addClass("disabled")}yearsViewHeader.eq(1).text(startYear.year()+"-"+endYear.year());if(options.maxDate&&options.maxDate.isBefore(endYear,"y")){yearsViewHeader.eq(2).addClass("disabled")}while(!startYear.isAfter(endYear,"y")){html+='<span data-action="selectYear" class="year'+(startYear.isSame(date,"y")&&!unset?" active":"")+(!isValid(startYear,"y")?" disabled":"")+'">'+startYear.year()+"</span>";startYear.add(1,"y")}yearsView.find("td").html(html)},updateDecades=function(){var decadesView=widget.find(".datepicker-decades"),decadesViewHeader=decadesView.find("th"),startDecade=moment({y:viewDate.year()-viewDate.year()%100-1}),endDecade=startDecade.clone().add(100,"y"),startedAt=startDecade.clone(),minDateDecade=false,maxDateDecade=false,endDecadeYear,html="";decadesViewHeader.eq(0).find("span").attr("title",options.tooltips.prevCentury);decadesViewHeader.eq(2).find("span").attr("title",options.tooltips.nextCentury);decadesView.find(".disabled").removeClass("disabled");if(startDecade.isSame(moment({y:1900}))||options.minDate&&options.minDate.isAfter(startDecade,"y")){decadesViewHeader.eq(0).addClass("disabled")}decadesViewHeader.eq(1).text(startDecade.year()+"-"+endDecade.year());if(startDecade.isSame(moment({y:2e3}))||options.maxDate&&options.maxDate.isBefore(endDecade,"y")){decadesViewHeader.eq(2).addClass("disabled")}while(!startDecade.isAfter(endDecade,"y")){endDecadeYear=startDecade.year()+12;minDateDecade=options.minDate&&options.minDate.isAfter(startDecade,"y")&&options.minDate.year()<=endDecadeYear;maxDateDecade=options.maxDate&&options.maxDate.isAfter(startDecade,"y")&&options.maxDate.year()<=endDecadeYear;html+='<span data-action="selectDecade" class="decade'+(date.isAfter(startDecade)&&date.year()<=endDecadeYear?" active":"")+(!isValid(startDecade,"y")&&!minDateDecade&&!maxDateDecade?" disabled":"")+'" data-selection="'+(startDecade.year()+6)+'">'+(startDecade.year()+1)+" - "+(startDecade.year()+12)+"</span>";startDecade.add(12,"y")}html+="<span></span><span></span><span></span>";decadesView.find("td").html(html);decadesViewHeader.eq(1).text(startedAt.year()+1+"-"+startDecade.year())},fillDate=function(){var daysView=widget.find(".datepicker-days"),daysViewHeader=daysView.find("th"),currentDate,html=[],row,clsNames=[],i;if(!hasDate()){return}daysViewHeader.eq(0).find("span").attr("title",options.tooltips.prevMonth);daysViewHeader.eq(1).attr("title",options.tooltips.selectMonth);daysViewHeader.eq(2).find("span").attr("title",options.tooltips.nextMonth);daysView.find(".disabled").removeClass("disabled");daysViewHeader.eq(1).text(viewDate.format(options.dayViewHeaderFormat));if(!isValid(viewDate.clone().subtract(1,"M"),"M")){daysViewHeader.eq(0).addClass("disabled")}if(!isValid(viewDate.clone().add(1,"M"),"M")){daysViewHeader.eq(2).addClass("disabled")}currentDate=viewDate.clone().startOf("M").startOf("w").startOf("d");for(i=0;i<42;i++){if(currentDate.weekday()===0){row=$("<tr>");if(options.calendarWeeks){row.append('<td class="cw">'+currentDate.week()+"</td>")}html.push(row)}clsNames=["day"];if(currentDate.isBefore(viewDate,"M")){clsNames.push("old")}if(currentDate.isAfter(viewDate,"M")){clsNames.push("new")}if(currentDate.isSame(date,"d")&&!unset){clsNames.push("active")}if(!isValid(currentDate,"d")){clsNames.push("disabled")}if(currentDate.isSame(getMoment(),"d")){clsNames.push("today")}if(currentDate.day()===0||currentDate.day()===6){clsNames.push("weekend")}notifyEvent({type:"dp.classify",date:currentDate,classNames:clsNames});row.append('<td data-action="selectDay" data-day="'+currentDate.format("L")+'" class="'+clsNames.join(" ")+'">'+currentDate.date()+"</td>");currentDate.add(1,"d")}daysView.find("tbody").empty().append(html);updateMonths();updateYears();updateDecades()},fillHours=function(){var table=widget.find(".timepicker-hours table"),currentHour=viewDate.clone().startOf("d"),html=[],row=$("<tr>");if(viewDate.hour()>11&&!use24Hours){currentHour.hour(12)}while(currentHour.isSame(viewDate,"d")&&(use24Hours||viewDate.hour()<12&&currentHour.hour()<12||viewDate.hour()>11)){if(currentHour.hour()%4===0){row=$("<tr>");html.push(row)}row.append('<td data-action="selectHour" class="hour'+(!isValid(currentHour,"h")?" disabled":"")+'">'+currentHour.format(use24Hours?"HH":"hh")+"</td>");currentHour.add(1,"h")}table.empty().append(html)},fillMinutes=function(){var table=widget.find(".timepicker-minutes table"),currentMinute=viewDate.clone().startOf("h"),html=[],row=$("<tr>"),step=options.stepping===1?5:options.stepping;while(viewDate.isSame(currentMinute,"h")){if(currentMinute.minute()%(step*4)===0){row=$("<tr>");html.push(row)}row.append('<td data-action="selectMinute" class="minute'+(!isValid(currentMinute,"m")?" disabled":"")+'">'+currentMinute.format("mm")+"</td>");currentMinute.add(step,"m")}table.empty().append(html)},fillSeconds=function(){var table=widget.find(".timepicker-seconds table"),currentSecond=viewDate.clone().startOf("m"),html=[],row=$("<tr>");while(viewDate.isSame(currentSecond,"m")){if(currentSecond.second()%20===0){row=$("<tr>");html.push(row)}row.append('<td data-action="selectSecond" class="second'+(!isValid(currentSecond,"s")?" disabled":"")+'">'+currentSecond.format("ss")+"</td>");currentSecond.add(5,"s")}table.empty().append(html)},fillTime=function(){var toggle,newDate,timeComponents=widget.find(".timepicker span[data-time-component]");if(!use24Hours){toggle=widget.find(".timepicker [data-action=togglePeriod]");newDate=date.clone().add(date.hours()>=12?-12:12,"h");toggle.text(date.format("A"));if(isValid(newDate,"h")){toggle.removeClass("disabled")}else{toggle.addClass("disabled")}}timeComponents.filter("[data-time-component=hours]").text(date.format(use24Hours?"HH":"hh"));timeComponents.filter("[data-time-component=minutes]").text(date.format("mm"));timeComponents.filter("[data-time-component=seconds]").text(date.format("ss"));fillHours();fillMinutes();fillSeconds()},update=function(){if(!widget){return}fillDate();fillTime()},setValue=function(targetMoment){var oldDate=unset?null:date;if(!targetMoment){unset=true;input.val("");element.data("date","");notifyEvent({type:"dp.change",date:false,oldDate:oldDate});update();return}targetMoment=targetMoment.clone().locale(options.locale);if(hasTimeZone()){targetMoment.tz(options.timeZone)}if(options.stepping!==1){targetMoment.minutes(Math.round(targetMoment.minutes()/options.stepping)*options.stepping).seconds(0);while(options.minDate&&targetMoment.isBefore(options.minDate)){targetMoment.add(options.stepping,"minutes")}}if(isValid(targetMoment)){date=targetMoment;viewDate=date.clone();input.val(date.format(actualFormat));element.data("date",date.format(actualFormat));unset=false;update();notifyEvent({type:"dp.change",date:date.clone(),oldDate:oldDate})}else{if(!options.keepInvalid){input.val(unset?"":date.format(actualFormat))}else{notifyEvent({type:"dp.change",date:targetMoment,oldDate:oldDate})}notifyEvent({type:"dp.error",date:targetMoment,oldDate:oldDate})}},hide=function(){var transitioning=false;if(!widget){return picker}widget.find(".collapse").each(function(){var collapseData=$(this).data("collapse");if(collapseData&&collapseData.transitioning){transitioning=true;return false}return true});if(transitioning){return picker}if(component&&component.hasClass("btn")){component.toggleClass("active")}widget.hide();$(window).off("resize",place);widget.off("click","[data-action]");widget.off("mousedown",false);widget.remove();widget=false;notifyEvent({type:"dp.hide",date:date.clone()});input.blur();viewDate=date.clone();return picker},clear=function(){setValue(null)},parseInputDate=function(inputDate){if(options.parseInputDate===undefined){if(!moment.isMoment(inputDate)||inputDate instanceof Date){inputDate=getMoment(inputDate)}}else{inputDate=options.parseInputDate(inputDate)}return inputDate},actions={next:function(){var navFnc=datePickerModes[currentViewMode].navFnc;viewDate.add(datePickerModes[currentViewMode].navStep,navFnc);fillDate();viewUpdate(navFnc)},previous:function(){var navFnc=datePickerModes[currentViewMode].navFnc;viewDate.subtract(datePickerModes[currentViewMode].navStep,navFnc);fillDate();viewUpdate(navFnc)},pickerSwitch:function(){showMode(1)},selectMonth:function(e){var month=$(e.target).closest("tbody").find("span").index($(e.target));viewDate.month(month);if(currentViewMode===minViewModeNumber){setValue(date.clone().year(viewDate.year()).month(viewDate.month()));if(!options.inline){hide()}}else{showMode(-1);fillDate()}viewUpdate("M")},selectYear:function(e){var year=parseInt($(e.target).text(),10)||0;viewDate.year(year);if(currentViewMode===minViewModeNumber){setValue(date.clone().year(viewDate.year()));if(!options.inline){hide()}}else{showMode(-1);fillDate()}viewUpdate("YYYY")},selectDecade:function(e){var year=parseInt($(e.target).data("selection"),10)||0;viewDate.year(year);if(currentViewMode===minViewModeNumber){setValue(date.clone().year(viewDate.year()));if(!options.inline){hide()}}else{showMode(-1);fillDate()}viewUpdate("YYYY")},selectDay:function(e){var day=viewDate.clone();if($(e.target).is(".old")){day.subtract(1,"M")}if($(e.target).is(".new")){day.add(1,"M")}setValue(day.date(parseInt($(e.target).text(),10)));if(!hasTime()&&!options.keepOpen&&!options.inline){hide()}},incrementHours:function(){var newDate=date.clone().add(1,"h");if(isValid(newDate,"h")){setValue(newDate)}},incrementMinutes:function(){var newDate=date.clone().add(options.stepping,"m");if(isValid(newDate,"m")){setValue(newDate)}},incrementSeconds:function(){var newDate=date.clone().add(1,"s");if(isValid(newDate,"s")){setValue(newDate)}},decrementHours:function(){var newDate=date.clone().subtract(1,"h");if(isValid(newDate,"h")){setValue(newDate)}},decrementMinutes:function(){var newDate=date.clone().subtract(options.stepping,"m");if(isValid(newDate,"m")){setValue(newDate)}},decrementSeconds:function(){var newDate=date.clone().subtract(1,"s");if(isValid(newDate,"s")){setValue(newDate)}},togglePeriod:function(){setValue(date.clone().add(date.hours()>=12?-12:12,"h"))},togglePicker:function(e){var $this=$(e.target),$parent=$this.closest("ul"),expanded=$parent.find(".in"),closed=$parent.find(".collapse:not(.in)"),collapseData;if(expanded&&expanded.length){collapseData=expanded.data("collapse");if(collapseData&&collapseData.transitioning){return}if(expanded.collapse){expanded.collapse("hide");closed.collapse("show")}else{expanded.removeClass("in");closed.addClass("in")}if($this.is("span")){$this.toggleClass(options.icons.time+" "+options.icons.date)}else{$this.find("span").toggleClass(options.icons.time+" "+options.icons.date)}}},showPicker:function(){widget.find(".timepicker > div:not(.timepicker-picker)").hide();widget.find(".timepicker .timepicker-picker").show()},showHours:function(){widget.find(".timepicker .timepicker-picker").hide();widget.find(".timepicker .timepicker-hours").show()},showMinutes:function(){widget.find(".timepicker .timepicker-picker").hide();widget.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){widget.find(".timepicker .timepicker-picker").hide();widget.find(".timepicker .timepicker-seconds").show()},selectHour:function(e){var hour=parseInt($(e.target).text(),10);if(!use24Hours){if(date.hours()>=12){if(hour!==12){hour+=12}}else{if(hour===12){hour=0}}}setValue(date.clone().hours(hour));actions.showPicker.call(picker)},selectMinute:function(e){setValue(date.clone().minutes(parseInt($(e.target).text(),10)));actions.showPicker.call(picker)},selectSecond:function(e){setValue(date.clone().seconds(parseInt($(e.target).text(),10)));actions.showPicker.call(picker)},clear:clear,today:function(){var todaysDate=getMoment();if(isValid(todaysDate,"d")){setValue(todaysDate)}},close:hide},doAction=function(e){if($(e.currentTarget).is(".disabled")){return false}actions[$(e.currentTarget).data("action")].apply(picker,arguments);return false},show=function(){var currentMoment,useCurrentGranularity={year:function(m){return m.month(0).date(1).hours(0).seconds(0).minutes(0)},month:function(m){return m.date(1).hours(0).seconds(0).minutes(0)},day:function(m){return m.hours(0).seconds(0).minutes(0)},hour:function(m){return m.seconds(0).minutes(0)},minute:function(m){return m.seconds(0)}};if(input.prop("disabled")||!options.ignoreReadonly&&input.prop("readonly")||widget){return picker}if(input.val()!==undefined&&input.val().trim().length!==0){setValue(parseInputDate(input.val().trim()))}else if(unset&&options.useCurrent&&(options.inline||input.is("input")&&input.val().trim().length===0)){currentMoment=getMoment();if(typeof options.useCurrent==="string"){currentMoment=useCurrentGranularity[options.useCurrent](currentMoment)}setValue(currentMoment)}widget=getTemplate();fillDow();fillMonths();widget.find(".timepicker-hours").hide();widget.find(".timepicker-minutes").hide();widget.find(".timepicker-seconds").hide();update();showMode();$(window).on("resize",place);widget.on("click","[data-action]",doAction);widget.on("mousedown",false);if(component&&component.hasClass("btn")){component.toggleClass("active")}place();widget.show();if(options.focusOnShow&&!input.is(":focus")){input.focus()}notifyEvent({type:"dp.show"});return picker},toggle=function(){return widget?hide():show()},keydown=function(e){var handler=null,index,index2,pressedKeys=[],pressedModifiers={},currentKey=e.which,keyBindKeys,allModifiersPressed,pressed="p";keyState[currentKey]=pressed;for(index in keyState){if(keyState.hasOwnProperty(index)&&keyState[index]===pressed){pressedKeys.push(index);if(parseInt(index,10)!==currentKey){pressedModifiers[index]=true}}}for(index in options.keyBinds){if(options.keyBinds.hasOwnProperty(index)&&typeof options.keyBinds[index]==="function"){keyBindKeys=index.split(" ");if(keyBindKeys.length===pressedKeys.length&&keyMap[currentKey]===keyBindKeys[keyBindKeys.length-1]){allModifiersPressed=true;for(index2=keyBindKeys.length-2;index2>=0;index2--){if(!(keyMap[keyBindKeys[index2]]in pressedModifiers)){allModifiersPressed=false;break}}if(allModifiersPressed){handler=options.keyBinds[index];break}}}}if(handler){handler.call(picker,widget);e.stopPropagation();e.preventDefault()}},keyup=function(e){keyState[e.which]="r";e.stopPropagation();e.preventDefault()},change=function(e){var val=$(e.target).val().trim(),parsedDate=val?parseInputDate(val):null;setValue(parsedDate);e.stopImmediatePropagation();return false},attachDatePickerElementEvents=function(){input.on({change:change,blur:options.debug?"":hide,keydown:keydown,keyup:keyup,focus:options.allowInputToggle?show:""});if(element.is("input")){input.on({focus:show})}else if(component){component.on("click",toggle);component.on("mousedown",false)}},detachDatePickerElementEvents=function(){input.off({change:change,blur:blur,keydown:keydown,keyup:keyup,focus:options.allowInputToggle?hide:""});if(element.is("input")){input.off({focus:show})}else if(component){component.off("click",toggle);component.off("mousedown",false)}},indexGivenDates=function(givenDatesArray){var givenDatesIndexed={};$.each(givenDatesArray,function(){var dDate=parseInputDate(this);if(dDate.isValid()){givenDatesIndexed[dDate.format("YYYY-MM-DD")]=true}});return Object.keys(givenDatesIndexed).length?givenDatesIndexed:false},indexGivenHours=function(givenHoursArray){var givenHoursIndexed={};$.each(givenHoursArray,function(){givenHoursIndexed[this]=true});return Object.keys(givenHoursIndexed).length?givenHoursIndexed:false},initFormatting=function(){var format=options.format||"L LT";actualFormat=format.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(formatInput){var newinput=date.localeData().longDateFormat(formatInput)||formatInput;return newinput.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(formatInput2){return date.localeData().longDateFormat(formatInput2)||formatInput2})});parseFormats=options.extraFormats?options.extraFormats.slice():[];if(parseFormats.indexOf(format)<0&&parseFormats.indexOf(actualFormat)<0){parseFormats.push(actualFormat)}use24Hours=actualFormat.toLowerCase().indexOf("a")<1&&actualFormat.replace(/\[.*?\]/g,"").indexOf("h")<1;if(isEnabled("y")){minViewModeNumber=2}if(isEnabled("M")){minViewModeNumber=1}if(isEnabled("d")){minViewModeNumber=0}currentViewMode=Math.max(minViewModeNumber,currentViewMode);if(!unset){setValue(date)}};picker.destroy=function(){hide();detachDatePickerElementEvents();element.removeData("DateTimePicker");element.removeData("date")};picker.toggle=toggle;picker.show=show;picker.hide=hide;picker.disable=function(){hide();if(component&&component.hasClass("btn")){component.addClass("disabled")}input.prop("disabled",true);return picker};picker.enable=function(){if(component&&component.hasClass("btn")){component.removeClass("disabled")}input.prop("disabled",false);return picker};picker.ignoreReadonly=function(ignoreReadonly){if(arguments.length===0){return options.ignoreReadonly}if(typeof ignoreReadonly!=="boolean"){throw new TypeError("ignoreReadonly () expects a boolean parameter")}options.ignoreReadonly=ignoreReadonly;return picker};picker.options=function(newOptions){if(arguments.length===0){return $.extend(true,{},options)}if(!(newOptions instanceof Object)){throw new TypeError("options() options parameter should be an object")}$.extend(true,options,newOptions);$.each(options,function(key,value){if(picker[key]!==undefined){picker[key](value)}else{throw new TypeError("option "+key+" is not recognized!")}});return picker};picker.date=function(newDate){if(arguments.length===0){if(unset){return null}return date.clone()}if(newDate!==null&&typeof newDate!=="string"&&!moment.isMoment(newDate)&&!(newDate instanceof Date)){throw new TypeError("date() parameter must be one of [null, string, moment or Date]")}setValue(newDate===null?null:parseInputDate(newDate));return picker};picker.format=function(newFormat){if(arguments.length===0){return options.format}if(typeof newFormat!=="string"&&(typeof newFormat!=="boolean"||newFormat!==false)){throw new TypeError("format() expects a string or boolean:false parameter "+newFormat)}options.format=newFormat;if(actualFormat){initFormatting()}return picker};picker.timeZone=function(newZone){if(arguments.length===0){return options.timeZone}if(typeof newZone!=="string"){throw new TypeError("newZone() expects a string parameter")}options.timeZone=newZone;return picker};picker.dayViewHeaderFormat=function(newFormat){if(arguments.length===0){return options.dayViewHeaderFormat}if(typeof newFormat!=="string"){throw new TypeError("dayViewHeaderFormat() expects a string parameter")}options.dayViewHeaderFormat=newFormat;return picker};picker.extraFormats=function(formats){if(arguments.length===0){return options.extraFormats}if(formats!==false&&!(formats instanceof Array)){throw new TypeError("extraFormats() expects an array or false parameter")}options.extraFormats=formats;if(parseFormats){initFormatting()}return picker};picker.disabledDates=function(dates){if(arguments.length===0){return options.disabledDates?$.extend({},options.disabledDates):options.disabledDates}if(!dates){options.disabledDates=false;update();return picker}if(!(dates instanceof Array)){throw new TypeError("disabledDates() expects an array parameter")}options.disabledDates=indexGivenDates(dates);options.enabledDates=false;update();return picker};picker.enabledDates=function(dates){if(arguments.length===0){return options.enabledDates?$.extend({},options.enabledDates):options.enabledDates}if(!dates){options.enabledDates=false;update();return picker}if(!(dates instanceof Array)){throw new TypeError("enabledDates() expects an array parameter")}options.enabledDates=indexGivenDates(dates);options.disabledDates=false;update();return picker};picker.daysOfWeekDisabled=function(daysOfWeekDisabled){if(arguments.length===0){return options.daysOfWeekDisabled.splice(0)}if(typeof daysOfWeekDisabled==="boolean"&&!daysOfWeekDisabled){options.daysOfWeekDisabled=false;update();return picker}if(!(daysOfWeekDisabled instanceof Array)){throw new TypeError("daysOfWeekDisabled() expects an array parameter")}options.daysOfWeekDisabled=daysOfWeekDisabled.reduce(function(previousValue,currentValue){currentValue=parseInt(currentValue,10);if(currentValue>6||currentValue<0||isNaN(currentValue)){return previousValue}if(previousValue.indexOf(currentValue)===-1){previousValue.push(currentValue)}return previousValue},[]).sort();if(options.useCurrent&&!options.keepInvalid){var tries=0;while(!isValid(date,"d")){date.add(1,"d");if(tries===31){throw"Tried 31 times to find a valid date"}tries++}setValue(date)}update();return picker};picker.maxDate=function(maxDate){if(arguments.length===0){return options.maxDate?options.maxDate.clone():options.maxDate}if(typeof maxDate==="boolean"&&maxDate===false){options.maxDate=false;update();return picker}if(typeof maxDate==="string"){if(maxDate==="now"||maxDate==="moment"){maxDate=getMoment()}}var parsedDate=parseInputDate(maxDate);if(!parsedDate.isValid()){throw new TypeError("maxDate() Could not parse date parameter: "+maxDate)}if(options.minDate&&parsedDate.isBefore(options.minDate)){throw new TypeError("maxDate() date parameter is before options.minDate: "+parsedDate.format(actualFormat))}options.maxDate=parsedDate;if(options.useCurrent&&!options.keepInvalid&&date.isAfter(maxDate)){setValue(options.maxDate)}if(viewDate.isAfter(parsedDate)){viewDate=parsedDate.clone().subtract(options.stepping,"m")}update();return picker};picker.minDate=function(minDate){if(arguments.length===0){return options.minDate?options.minDate.clone():options.minDate}if(typeof minDate==="boolean"&&minDate===false){options.minDate=false;update();return picker}if(typeof minDate==="string"){if(minDate==="now"||minDate==="moment"){minDate=getMoment()}}var parsedDate=parseInputDate(minDate);if(!parsedDate.isValid()){throw new TypeError("minDate() Could not parse date parameter: "+minDate)}if(options.maxDate&&parsedDate.isAfter(options.maxDate)){throw new TypeError("minDate() date parameter is after options.maxDate: "+parsedDate.format(actualFormat))}options.minDate=parsedDate;if(options.useCurrent&&!options.keepInvalid&&date.isBefore(minDate)){setValue(options.minDate)}if(viewDate.isBefore(parsedDate)){viewDate=parsedDate.clone().add(options.stepping,"m")}update();return picker};picker.defaultDate=function(defaultDate){if(arguments.length===0){return options.defaultDate?options.defaultDate.clone():options.defaultDate}if(!defaultDate){options.defaultDate=false;return picker}if(typeof defaultDate==="string"){if(defaultDate==="now"||defaultDate==="moment"){defaultDate=getMoment()}else{defaultDate=getMoment(defaultDate)}}var parsedDate=parseInputDate(defaultDate);if(!parsedDate.isValid()){throw new TypeError("defaultDate() Could not parse date parameter: "+defaultDate)}if(!isValid(parsedDate)){throw new TypeError("defaultDate() date passed is invalid according to component setup validations")}options.defaultDate=parsedDate;if(options.defaultDate&&options.inline||input.val().trim()===""){setValue(options.defaultDate)}return picker};picker.locale=function(locale){if(arguments.length===0){return options.locale}if(!moment.localeData(locale)){throw new TypeError("locale() locale "+locale+" is not loaded from moment locales!")}options.locale=locale;date.locale(options.locale);viewDate.locale(options.locale);if(actualFormat){initFormatting()}if(widget){hide();show()}return picker};picker.stepping=function(stepping){if(arguments.length===0){return options.stepping}stepping=parseInt(stepping,10);if(isNaN(stepping)||stepping<1){stepping=1}options.stepping=stepping;return picker};picker.useCurrent=function(useCurrent){var useCurrentOptions=["year","month","day","hour","minute"];if(arguments.length===0){return options.useCurrent}if(typeof useCurrent!=="boolean"&&typeof useCurrent!=="string"){throw new TypeError("useCurrent() expects a boolean or string parameter")}if(typeof useCurrent==="string"&&useCurrentOptions.indexOf(useCurrent.toLowerCase())===-1){throw new TypeError("useCurrent() expects a string parameter of "+useCurrentOptions.join(", "))}options.useCurrent=useCurrent;return picker};picker.collapse=function(collapse){if(arguments.length===0){return options.collapse}if(typeof collapse!=="boolean"){throw new TypeError("collapse() expects a boolean parameter")}if(options.collapse===collapse){return picker}options.collapse=collapse;if(widget){hide();show()}return picker};picker.icons=function(icons){if(arguments.length===0){return $.extend({},options.icons)}if(!(icons instanceof Object)){throw new TypeError("icons() expects parameter to be an Object")}$.extend(options.icons,icons);if(widget){hide();show()}return picker};picker.tooltips=function(tooltips){if(arguments.length===0){return $.extend({},options.tooltips)}if(!(tooltips instanceof Object)){throw new TypeError("tooltips() expects parameter to be an Object")}$.extend(options.tooltips,tooltips);if(widget){hide();show()}return picker};picker.useStrict=function(useStrict){if(arguments.length===0){return options.useStrict}if(typeof useStrict!=="boolean"){throw new TypeError("useStrict() expects a boolean parameter")}options.useStrict=useStrict;return picker};picker.sideBySide=function(sideBySide){if(arguments.length===0){return options.sideBySide}if(typeof sideBySide!=="boolean"){throw new TypeError("sideBySide() expects a boolean parameter")}options.sideBySide=sideBySide;if(widget){hide();show()}return picker};picker.viewMode=function(viewMode){if(arguments.length===0){return options.viewMode}if(typeof viewMode!=="string"){throw new TypeError("viewMode() expects a string parameter")}if(viewModes.indexOf(viewMode)===-1){throw new TypeError("viewMode() parameter must be one of ("+viewModes.join(", ")+") value")}options.viewMode=viewMode;currentViewMode=Math.max(viewModes.indexOf(viewMode),minViewModeNumber);showMode();return picker};picker.toolbarPlacement=function(toolbarPlacement){if(arguments.length===0){return options.toolbarPlacement}if(typeof toolbarPlacement!=="string"){throw new TypeError("toolbarPlacement() expects a string parameter")}if(toolbarPlacements.indexOf(toolbarPlacement)===-1){throw new TypeError("toolbarPlacement() parameter must be one of ("+toolbarPlacements.join(", ")+") value")}options.toolbarPlacement=toolbarPlacement;if(widget){hide();show()}return picker};picker.widgetPositioning=function(widgetPositioning){if(arguments.length===0){return $.extend({},options.widgetPositioning)}if({}.toString.call(widgetPositioning)!=="[object Object]"){throw new TypeError("widgetPositioning() expects an object variable")}if(widgetPositioning.horizontal){if(typeof widgetPositioning.horizontal!=="string"){throw new TypeError("widgetPositioning() horizontal variable must be a string")}widgetPositioning.horizontal=widgetPositioning.horizontal.toLowerCase();if(horizontalModes.indexOf(widgetPositioning.horizontal)===-1){throw new TypeError("widgetPositioning() expects horizontal parameter to be one of ("+horizontalModes.join(", ")+")")}options.widgetPositioning.horizontal=widgetPositioning.horizontal}if(widgetPositioning.vertical){if(typeof widgetPositioning.vertical!=="string"){throw new TypeError("widgetPositioning() vertical variable must be a string")}widgetPositioning.vertical=widgetPositioning.vertical.toLowerCase();if(verticalModes.indexOf(widgetPositioning.vertical)===-1){throw new TypeError("widgetPositioning() expects vertical parameter to be one of ("+verticalModes.join(", ")+")")}options.widgetPositioning.vertical=widgetPositioning.vertical}update();return picker};picker.calendarWeeks=function(calendarWeeks){if(arguments.length===0){return options.calendarWeeks}if(typeof calendarWeeks!=="boolean"){throw new TypeError("calendarWeeks() expects parameter to be a boolean value")}options.calendarWeeks=calendarWeeks;update();return picker};picker.showTodayButton=function(showTodayButton){if(arguments.length===0){return options.showTodayButton}if(typeof showTodayButton!=="boolean"){throw new TypeError("showTodayButton() expects a boolean parameter")}options.showTodayButton=showTodayButton;if(widget){hide();show()}return picker};picker.showClear=function(showClear){if(arguments.length===0){return options.showClear}if(typeof showClear!=="boolean"){throw new TypeError("showClear() expects a boolean parameter")}options.showClear=showClear;if(widget){hide();show()}return picker};picker.widgetParent=function(widgetParent){if(arguments.length===0){return options.widgetParent}if(typeof widgetParent==="string"){widgetParent=$(widgetParent)}if(widgetParent!==null&&(typeof widgetParent!=="string"&&!(widgetParent instanceof $))){throw new TypeError("widgetParent() expects a string or a jQuery object parameter")}options.widgetParent=widgetParent;if(widget){hide();show()}return picker};picker.keepOpen=function(keepOpen){if(arguments.length===0){return options.keepOpen}if(typeof keepOpen!=="boolean"){throw new TypeError("keepOpen() expects a boolean parameter")}options.keepOpen=keepOpen;return picker};picker.focusOnShow=function(focusOnShow){if(arguments.length===0){return options.focusOnShow}if(typeof focusOnShow!=="boolean"){throw new TypeError("focusOnShow() expects a boolean parameter")}options.focusOnShow=focusOnShow;return picker};picker.inline=function(inline){if(arguments.length===0){return options.inline}if(typeof inline!=="boolean"){throw new TypeError("inline() expects a boolean parameter")}options.inline=inline;return picker};picker.clear=function(){clear();return picker};picker.keyBinds=function(keyBinds){if(arguments.length===0){return options.keyBinds}options.keyBinds=keyBinds;return picker};picker.getMoment=function(d){return getMoment(d)};picker.debug=function(debug){if(typeof debug!=="boolean"){throw new TypeError("debug() expects a boolean parameter")}options.debug=debug;return picker};picker.allowInputToggle=function(allowInputToggle){if(arguments.length===0){return options.allowInputToggle}if(typeof allowInputToggle!=="boolean"){throw new TypeError("allowInputToggle() expects a boolean parameter")}options.allowInputToggle=allowInputToggle;return picker};picker.showClose=function(showClose){if(arguments.length===0){return options.showClose}if(typeof showClose!=="boolean"){throw new TypeError("showClose() expects a boolean parameter")}options.showClose=showClose;return picker};picker.keepInvalid=function(keepInvalid){if(arguments.length===0){return options.keepInvalid}if(typeof keepInvalid!=="boolean"){throw new TypeError("keepInvalid() expects a boolean parameter")}options.keepInvalid=keepInvalid;return picker};picker.datepickerInput=function(datepickerInput){if(arguments.length===0){return options.datepickerInput}if(typeof datepickerInput!=="string"){throw new TypeError("datepickerInput() expects a string parameter")}options.datepickerInput=datepickerInput;return picker};picker.parseInputDate=function(parseInputDate){if(arguments.length===0){return options.parseInputDate}if(typeof parseInputDate!=="function"){throw new TypeError("parseInputDate() sholud be as function")}options.parseInputDate=parseInputDate;return picker};picker.disabledTimeIntervals=function(disabledTimeIntervals){if(arguments.length===0){return options.disabledTimeIntervals?$.extend({},options.disabledTimeIntervals):options.disabledTimeIntervals}if(!disabledTimeIntervals){options.disabledTimeIntervals=false;update();return picker}if(!(disabledTimeIntervals instanceof Array)){throw new TypeError("disabledTimeIntervals() expects an array parameter")}options.disabledTimeIntervals=disabledTimeIntervals;update();return picker};picker.disabledHours=function(hours){if(arguments.length===0){return options.disabledHours?$.extend({},options.disabledHours):options.disabledHours}if(!hours){options.disabledHours=false;update();return picker}if(!(hours instanceof Array)){throw new TypeError("disabledHours() expects an array parameter")}options.disabledHours=indexGivenHours(hours);options.enabledHours=false;if(options.useCurrent&&!options.keepInvalid){var tries=0;while(!isValid(date,"h")){date.add(1,"h");if(tries===24){throw"Tried 24 times to find a valid date"}tries++}setValue(date)}update();return picker};picker.enabledHours=function(hours){if(arguments.length===0){return options.enabledHours?$.extend({},options.enabledHours):options.enabledHours}if(!hours){options.enabledHours=false;update();return picker}if(!(hours instanceof Array)){throw new TypeError("enabledHours() expects an array parameter")}options.enabledHours=indexGivenHours(hours);options.disabledHours=false;if(options.useCurrent&&!options.keepInvalid){var tries=0;while(!isValid(date,"h")){date.add(1,"h");if(tries===24){throw"Tried 24 times to find a valid date"}tries++}setValue(date)}update();return picker};picker.viewDate=function(newDate){if(arguments.length===0){return viewDate.clone()}if(!newDate){viewDate=date.clone();return picker}if(typeof newDate!=="string"&&!moment.isMoment(newDate)&&!(newDate instanceof Date)){throw new TypeError("viewDate() parameter must be one of [string, moment or Date]")}viewDate=parseInputDate(newDate);viewUpdate();return picker};if(element.is("input")){input=element}else{input=element.find(options.datepickerInput);if(input.length===0){input=element.find("input")}else if(!input.is("input")){throw new Error('CSS class "'+options.datepickerInput+'" cannot be applied to non input element')}}if(element.hasClass("input-group")){if(element.find(".datepickerbutton").length===0){component=element.find(".input-group-addon")}else{component=element.find(".datepickerbutton")}}if(!options.inline&&!input.is("input")){throw new Error("Could not initialize DateTimePicker without an input element")}date=getMoment();viewDate=date.clone();$.extend(true,options,dataToOptions());picker.options(options);initFormatting();attachDatePickerElementEvents();if(input.prop("disabled")){picker.disable()}if(input.is("input")&&input.val().trim().length!==0){setValue(parseInputDate(input.val().trim()))}else if(options.defaultDate&&input.attr("placeholder")===undefined){setValue(options.defaultDate)}if(options.inline){show()}return picker};$.fn.datetimepicker=function(options){options=options||{};var args=Array.prototype.slice.call(arguments,1),isInstance=true,thisMethods=["destroy","hide","show","toggle"],returnValue;if(typeof options==="object"){return this.each(function(){var $this=$(this),_options;if(!$this.data("DateTimePicker")){_options=$.extend(true,{},$.fn.datetimepicker.defaults,options);$this.data("DateTimePicker",dateTimePicker($this,_options))}})}else if(typeof options==="string"){this.each(function(){var $this=$(this),instance=$this.data("DateTimePicker");if(!instance){throw new Error('bootstrap-datetimepicker("'+options+'") method was called on an element that is not using DateTimePicker')}returnValue=instance[options].apply(instance,args);isInstance=returnValue===instance});if(isInstance||$.inArray(options,thisMethods)>-1){return this}return returnValue}throw new TypeError("Invalid arguments for DateTimePicker: "+options)};$.fn.datetimepicker.defaults={timeZone:"",format:false,dayViewHeaderFormat:"MMMM YYYY",extraFormats:false,stepping:1,minDate:false,maxDate:false,useCurrent:true,collapse:true,locale:moment.locale(),defaultDate:false,disabledDates:false,enabledDates:false,icons:{time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down",previous:"glyphicon glyphicon-chevron-left",next:"glyphicon glyphicon-chevron-right",today:"glyphicon glyphicon-screenshot",clear:"glyphicon glyphicon-trash",close:"glyphicon glyphicon-remove"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time"},useStrict:false,sideBySide:false,daysOfWeekDisabled:false,calendarWeeks:false,viewMode:"days",toolbarPlacement:"default",showTodayButton:false,showClear:false,showClose:false,widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:false,keepOpen:false,focusOnShow:true,inline:false,keepInvalid:false,datepickerInput:".datepickerinput",keyBinds:{up:function(widget){if(!widget){return}var d=this.date()||this.getMoment();if(widget.find(".datepicker").is(":visible")){this.date(d.clone().subtract(7,"d"))}else{this.date(d.clone().add(this.stepping(),"m"))}},down:function(widget){if(!widget){this.show();return}var d=this.date()||this.getMoment();if(widget.find(".datepicker").is(":visible")){this.date(d.clone().add(7,"d"))}else{this.date(d.clone().subtract(this.stepping(),"m"))}},"control up":function(widget){if(!widget){return}var d=this.date()||this.getMoment();if(widget.find(".datepicker").is(":visible")){this.date(d.clone().subtract(1,"y"))}else{this.date(d.clone().add(1,"h"))}},"control down":function(widget){if(!widget){return}var d=this.date()||this.getMoment();if(widget.find(".datepicker").is(":visible")){this.date(d.clone().add(1,"y"))}else{this.date(d.clone().subtract(1,"h"))}},left:function(widget){if(!widget){return}var d=this.date()||this.getMoment();if(widget.find(".datepicker").is(":visible")){this.date(d.clone().subtract(1,"d"))}},right:function(widget){if(!widget){return}var d=this.date()||this.getMoment();if(widget.find(".datepicker").is(":visible")){this.date(d.clone().add(1,"d"))}},pageUp:function(widget){if(!widget){return}var d=this.date()||this.getMoment();if(widget.find(".datepicker").is(":visible")){this.date(d.clone().subtract(1,"M"))}},pageDown:function(widget){if(!widget){return}var d=this.date()||this.getMoment();if(widget.find(".datepicker").is(":visible")){this.date(d.clone().add(1,"M"))}},enter:function(){this.hide()},escape:function(){this.hide()},"control space":function(widget){if(!widget){return}if(widget.find(".timepicker").is(":visible")){widget.find('.btn[data-action="togglePeriod"]').click()}},t:function(){this.date(this.getMoment())},delete:function(){this.clear()}},debug:false,allowInputToggle:false,disabledTimeIntervals:false,disabledHours:false,enabledHours:false,viewDate:false};return $.fn.datetimepicker});"use strict";function transform(real,imag){if(real.length!=imag.length)throw"Mismatched lengths";var n=real.length;if(n==0)return;else if((n&n-1)==0)transformRadix2(real,imag);else transformBluestein(real,imag)}function inverseTransform(real,imag){transform(imag,real)}function transformRadix2(real,imag){if(real.length!=imag.length)throw"Mismatched lengths";var n=real.length;if(n==1)return;var levels=-1;for(var i=0;i<32;i++){if(1<<i==n)levels=i}if(levels==-1)throw"Length is not a power of 2";var cosTable=new Array(n/2);var sinTable=new Array(n/2);for(var i=0;i<n/2;i++){cosTable[i]=Math.cos(2*Math.PI*i/n);sinTable[i]=Math.sin(2*Math.PI*i/n)}for(var i=0;i<n;i++){var j=reverseBits(i,levels);if(j>i){var temp=real[i];real[i]=real[j];real[j]=temp;temp=imag[i];imag[i]=imag[j];imag[j]=temp}}for(var size=2;size<=n;size*=2){var halfsize=size/2;var tablestep=n/size;for(var i=0;i<n;i+=size){for(var j=i,k=0;j<i+halfsize;j++,k+=tablestep){var tpre=real[j+halfsize]*cosTable[k]+imag[j+halfsize]*sinTable[k];var tpim=-real[j+halfsize]*sinTable[k]+imag[j+halfsize]*cosTable[k];real[j+halfsize]=real[j]-tpre;imag[j+halfsize]=imag[j]-tpim;real[j]+=tpre;imag[j]+=tpim}}}function reverseBits(x,bits){var y=0;for(var i=0;i<bits;i++){y=y<<1|x&1;x>>>=1}return y}}function transformBluestein(real,imag){if(real.length!=imag.length)throw"Mismatched lengths";var n=real.length;var m=1;while(m<n*2+1)m*=2;var cosTable=new Array(n);var sinTable=new Array(n);for(var i=0;i<n;i++){var j=i*i%(n*2);cosTable[i]=Math.cos(Math.PI*j/n);sinTable[i]=Math.sin(Math.PI*j/n)}var areal=new Array(m);var aimag=new Array(m);for(var i=0;i<n;i++){areal[i]=real[i]*cosTable[i]+imag[i]*sinTable[i];aimag[i]=-real[i]*sinTable[i]+imag[i]*cosTable[i]}for(var i=n;i<m;i++)areal[i]=aimag[i]=0;var breal=new Array(m);var bimag=new Array(m);breal[0]=cosTable[0];bimag[0]=sinTable[0];for(var i=1;i<n;i++){breal[i]=breal[m-i]=cosTable[i];bimag[i]=bimag[m-i]=sinTable[i]}for(var i=n;i<=m-n;i++)breal[i]=bimag[i]=0;var creal=new Array(m);var cimag=new Array(m);convolveComplex(areal,aimag,breal,bimag,creal,cimag);for(var i=0;i<n;i++){real[i]=creal[i]*cosTable[i]+cimag[i]*sinTable[i];imag[i]=-creal[i]*sinTable[i]+cimag[i]*cosTable[i]}}function convolveReal(x,y,out){if(x.length!=y.length||x.length!=out.length)throw"Mismatched lengths";var zeros=new Array(x.length);for(var i=0;i<zeros.length;i++)zeros[i]=0;convolveComplex(x,zeros,y,zeros.slice(),out,zeros.slice())}function convolveComplex(xreal,ximag,yreal,yimag,outreal,outimag){if(xreal.length!=ximag.length||xreal.length!=yreal.length||yreal.length!=yimag.length||xreal.length!=outreal.length||outreal.length!=outimag.length)throw"Mismatched lengths";var n=xreal.length;xreal=xreal.slice();ximag=ximag.slice();yreal=yreal.slice();yimag=yimag.slice();transform(xreal,ximag);transform(yreal,yimag);for(var i=0;i<n;i++){var temp=xreal[i]*yreal[i]-ximag[i]*yimag[i];ximag[i]=ximag[i]*yreal[i]+xreal[i]*yimag[i];xreal[i]=temp}inverseTransform(xreal,ximag);for(var i=0;i<n;i++){outreal[i]=xreal[i]/n;outimag[i]=ximag[i]/n}}function binarySearch(head,tail,data,minObj,originalKurt,windowSize){while(head<=tail){var w=Math.round((head+tail)/2);var smoothed=SMA(data,w,1);var metrics=new Metrics(smoothed);if(metrics.kurtosis()>=originalKurt){var roughness=metrics.roughness();if(roughness<minObj){windowSize=w;minObj=roughness}head=w+1}else{tail=w-1}}return windowSize}function smooth(data,resolution){if(isNaN(data[data.length-1])){data=data.slice(0,-1)}if(data.length>=2*resolution){data=SMA(data,Math.trunc(data.length/resolution),Math.trunc(data.length/resolution))}var acf=new ACF(data,Math.round(data.length/10));var peaks=acf.findPeaks();var metrics=new Metrics(data);var originalKurt=metrics.kurtosis();var minObj=metrics.roughness();var windowSize=1;var lb=1;var largestFeasible=-1;var tail=data.length/10;for(var i=peaks.length-1;i>=0;i-=1){var w=peaks[i];if(w<lb||w==1){break}else if(Math.sqrt(1-acf.correlations[w])*windowSize>Math.sqrt(1-acf.correlations[windowSize])*w){continue}var smoothed=SMA(data,w,1);metrics=new Metrics(smoothed);var roughness=metrics.roughness();if(metrics.kurtosis()>=originalKurt){if(roughness<minObj){minObj=roughness;windowSize=w}lb=Math.round(Math.max(w*Math.sqrt((acf.maxACF-1)/(acf.correlations[w]-1)),lb));if(largestFeasible<0){largestFeasible=i}}}if(largestFeasible>0){if(largestFeasible<peaks.length-2){tail=peaks[largestFeasible+1]}lb=Math.max(lb,peaks[largestFeasible]+1)}windowSize=binarySearch(lb,tail,data,minObj,originalKurt,windowSize);return SMA(data,windowSize,1)}function SMA(data,range,slide){var windowStart=0;var sum=0;var count=0;var values=[];for(var i=0;i<data.length;i++){if(isNaN(data[i])){data[i]=0}if(i-windowStart>=range){values.push(sum/count);var oldStart=windowStart;while(windowStart<data.length&&windowStart-oldStart<slide){sum-=data[windowStart];count-=1;windowStart+=1}}sum+=data[i];count+=1}if(count==range){values.push(sum/count)}return values}function ACF(values,maxLag){this.mean=Metrics.mean(values);this.values=values;this.correlations=new Array(maxLag);this.CORR_THRESH=.2;this.maxACF=0;this.calculate()}ACF.prototype.calculate=function(){var len=Math.pow(2,Math.trunc(Math.log2(this.values.length))+1);var fftreal=new Array(len).fill(0);var fftimg=new Array(len).fill(0);for(var i=0;i<this.values.length;i+=1){fftreal[i]=this.values[i]-this.mean}transform(fftreal,fftimg);for(var i=0;i<fftreal.length;i+=1){fftreal[i]=Math.pow(fftreal[i],2)+Math.pow(fftimg[i],2);fftimg[i]=0}inverseTransform(fftreal,fftimg);for(var i=1;i<this.correlations.length;i+=1){this.correlations[i]=fftreal[i]/fftreal[0]}};ACF.prototype.findPeaks=function(){var peakIndices=[];if(this.correlations.length>1){var positive=this.correlations[1]>this.correlations[0];var max=1;for(var i=2;i<this.correlations.length;i+=1){if(!positive&&this.correlations[i]>this.correlations[i-1]){max=i;positive=!positive}else if(positive&&this.correlations[i]>this.correlations[max]){max=i}else if(positive&&this.correlations[i]<this.correlations[i-1]){if(max>1&&this.correlations[max]>this.CORR_THRESH){peakIndices.push(max);if(this.correlations[max]>this.maxACF){this.maxACF=this.correlations[max]}}positive=!positive}}}if(peakIndices.length<=1){for(var i=2;i<this.correlations.length;i+=1){peakIndices.push(i)}}return peakIndices};function Metrics(values){this.len=values.length;this.values=values;this.m=Metrics.mean(values)}Metrics.mean=function(values){var m=0;for(var i=0;i<values.length;i+=1){m+=values[i]}return m/values.length};Metrics.std=function(values){var m=Metrics.mean(values);var std=0;for(var i=0;i<values.length;i+=1){std+=Math.pow(values[i]-m,2)}return Math.sqrt(std/values.length)};Metrics.prototype.kurtosis=function(){var u4=0,variance=0;for(var i=0;i<this.len;i++){u4+=Math.pow(this.values[i]-this.m,4);variance+=Math.pow(this.values[i]-this.m,2)}return this.len*u4/Math.pow(variance,2)};Metrics.prototype.roughness=function(){return Metrics.std(this.diffs())};Metrics.prototype.diffs=function(){var diff=new Array(this.len-1);for(var i=1;i<this.len;i+=1){diff[i-1]=this.values[i]-this.values[i-1]}return diff};"use strict";function intoSequence(n){return Array.from(Array(n).keys())}var _math={};_math.takeField=function takeField(arr,field){return arr.map(function(x){return field?x[field]:x})};_math.takeLast=function takeLast(arr,n,field){return _math.takeField(arr.slice(n>arr.length?0:arr.length-n,arr.length),field)};_math.sum=function sum(data){return data.reduce(function(acc,x){return acc+x})};_math.weightingMultiplier=function weightingMultiplier(periods){return 2/(periods+1)};_math.mean=function mean(data){return data.reduce(function(a,b){return a+b})/data.length};_math.stddev=function stddev(data){var dataMean=_math.mean(data);var sqDiff=data.map(function(n){return Math.pow(n-dataMean,2)});var avgSqDiff=_math.mean(sqDiff);return Math.sqrt(avgSqDiff)};function bollingerBands(data,config){var _config$periods=config.periods,periods=_config$periods===undefined?20:_config$periods,field=config.field,_config$stdDevUp=config.stdDevUp,stdDevUp=_config$stdDevUp===undefined?2:_config$stdDevUp,_config$stdDevDown=config.stdDevDown,stdDevDown=_config$stdDevDown===undefined?2:_config$stdDevDown,_config$pipSize=config.pipSize,pipSize=_config$pipSize===undefined?2:_config$pipSize;var vals=(0,_math.takeLast)(data,periods,field);var middle=(0,simpleMovingAverage)(vals,{periods:periods});var stdDev=(0,_math.stddev)(vals);var upper=middle+stdDev*stdDevUp;var lower=middle-stdDev*stdDevDown;return[+middle.toFixed(pipSize),+upper.toFixed(pipSize),+lower.toFixed(pipSize)]}function bollingerBandsArray(data,config){var periods=config.periods;return(0,intoSequence)(data.length-periods+1).map(function(x,i){return bollingerBands(data.slice(i,i+periods),config)})}function ema(vals,periods){if(vals.length===1){return vals[0]}var prev=ema(vals.slice(0,vals.length-1),periods);return(vals.slice(-1)[0]-prev)*(0,_math.weightingMultiplier)(periods)+prev}function exponentialMovingAverage(data,config){var periods=config.periods,field=config.field;if(data.length<periods){throw new Error("Periods longer than data length")}var vals=(0,_math.takeLast)(data,periods,field);return ema(vals,periods)}function exponentialMovingAverageArray(data,config){var periods=config.periods,_config$pipSize=config.pipSize,pipSize=_config$pipSize===undefined?2:_config$pipSize;return(0,intoSequence)(data.length-periods+1).map(function(x,i){return+exponentialMovingAverage(data.slice(i,i+periods),config).toFixed(pipSize)})}function calcGain(q1,q2){return q2>q1?q2-q1:0}function calcLoss(q1,q2){return q2<q1?q1-q2:0}function calcFirstAvgDiff(vals,comp,periods){var prev=void 0;return vals.reduce(function(r,q,i){if(i===1){prev=r}var diff=comp(prev,q);prev=q;return diff+(i===1?0:r)})/periods}function calcSecondAvgDiff(vals,comp,periods,initAvg){var prev=void 0;if(vals.length===1){return initAvg}return vals.reduce(function(r,q,i){if(i===1){prev=r}var diff=comp(prev,q);prev=q;var prevAvg=i===1?initAvg:r;return(prevAvg*(periods-1)+diff)/periods})}function relativeStrengthIndex(data,config){var memoizedDiff=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var periods=config.periods,field=config.field;if(data.length<periods){throw new Error("Periods longer than data length")}if(data.length===periods){return 0}var vals=(0,_math.takeField)(data.slice(0,periods+1),field);var restSeq=void 0;var initAvgGain=void 0;var initAvgLoss=void 0;if(memoizedDiff&&"gain"in memoizedDiff){restSeq=(0,_math.takeField)(data.slice(-2),field);initAvgGain=memoizedDiff.gain;initAvgLoss=memoizedDiff.loss}else{restSeq=(0,_math.takeField)(data.slice(periods,data.length),field);initAvgGain=calcFirstAvgDiff(vals,calcGain,periods);initAvgLoss=calcFirstAvgDiff(vals,calcLoss,periods)}var avgGain=calcSecondAvgDiff(restSeq,calcGain,periods,initAvgGain);var avgLoss=calcSecondAvgDiff(restSeq,calcLoss,periods,initAvgLoss);if(memoizedDiff){memoizedDiff.gain=avgGain;memoizedDiff.loss=avgLoss}if(avgGain===0){return 0}else if(avgLoss===0){return 100}var RS=avgGain/avgLoss;return 100-100/(1+RS)}function relativeStrengthIndexArray(data,config){var periods=config.periods,_config$pipSize=config.pipSize,pipSize=_config$pipSize===undefined?2:_config$pipSize;var memoizedDiff={};return(0,intoSequence)(data.length-periods).map(function(x,i){return+relativeStrengthIndex(data.slice(0,i+periods+1),config,memoizedDiff).toFixed(pipSize)})}function simpleMovingAverage(data,config){var periods=config.periods,field=config.field;if(data.length<periods){throw new Error("Periods longer than data length")}var vals=(0,_math.takeLast)(data,periods,field);return(0,_math.sum)(vals)/periods}function simpleMovingAverageArray(data,config){var periods=config.periods,_config$pipSize=config.pipSize,pipSize=_config$pipSize===undefined?2:_config$pipSize;return(0,intoSequence)(data.length-periods+1).map(function(x,i){return+simpleMovingAverage(data.slice(i,i+periods),config).toFixed(pipSize)})}
ntopng-3.8.1+dfsg1/httpdocs/js/deps.min.js-2-//# sourceMappingURL=deps.min.js.map
##############################################
ntopng-3.8.1+dfsg1/httpdocs/js/jquery_bootstrap.min.js:1:(function(global,factory){"use strict";if(typeof module==="object"&&typeof module.exports==="object"){module.exports=global.document?factory(global,true):function(w){if(!w.document){throw new Error("jQuery requires a window with a document")}return factory(w)}}else{factory(global)}})(typeof window!=="undefined"?window:this,function(window,noGlobal){"use strict";var arr=[];var document=window.document;var getProto=Object.getPrototypeOf;var slice=arr.slice;var concat=arr.concat;var push=arr.push;var indexOf=arr.indexOf;var class2type={};var toString=class2type.toString;var hasOwn=class2type.hasOwnProperty;var fnToString=hasOwn.toString;var ObjectFunctionString=fnToString.call(Object);var support={};function DOMEval(code,doc){doc=doc||document;var script=doc.createElement("script");script.text=code;doc.head.appendChild(script).parentNode.removeChild(script)}var version="3.2.1",jQuery=function(selector,context){return new jQuery.fn.init(selector,context)},rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([a-z])/g,fcamelCase=function(all,letter){return letter.toUpperCase()};jQuery.fn=jQuery.prototype={jquery:version,constructor:jQuery,length:0,toArray:function(){return slice.call(this)},get:function(num){if(num==null){return slice.call(this)}return num<0?this[num+this.length]:this[num]},pushStack:function(elems){var ret=jQuery.merge(this.constructor(),elems);ret.prevObject=this;return ret},each:function(callback){return jQuery.each(this,callback)},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},slice:function(){return this.pushStack(slice.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(i){var len=this.length,j=+i+(i<0?len:0);return this.pushStack(j>=0&&j<len?[this[j]]:[])},end:function(){return this.prevObject||this.constructor()},push:push,sort:arr.sort,splice:arr.splice};jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[i]||{};i++}if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}}if(i===length){target=this;i--}for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue}if(deep&&copy&&(jQuery.isPlainObject(copy)||(copyIsArray=Array.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&Array.isArray(src)?src:[]}else{clone=src&&jQuery.isPlainObject(src)?src:{}}target[name]=jQuery.extend(deep,clone,copy)}else if(copy!==undefined){target[name]=copy}}}}return target};jQuery.extend({expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),isReady:true,error:function(msg){throw new Error(msg)},noop:function(){},isFunction:function(obj){return jQuery.type(obj)==="function"},isWindow:function(obj){return obj!=null&&obj===obj.window},isNumeric:function(obj){var type=jQuery.type(obj);return(type==="number"||type==="string")&&!isNaN(obj-parseFloat(obj))},isPlainObject:function(obj){var proto,Ctor;if(!obj||toString.call(obj)!=="[object Object]"){return false}proto=getProto(obj);if(!proto){return true}Ctor=hasOwn.call(proto,"constructor")&&proto.constructor;return typeof Ctor==="function"&&fnToString.call(Ctor)===ObjectFunctionString},isEmptyObject:function(obj){var name;for(name in obj){return false}return true},type:function(obj){if(obj==null){return obj+""}return typeof obj==="object"||typeof obj==="function"?class2type[toString.call(obj)]||"object":typeof obj},globalEval:function(code){DOMEval(code)},camelCase:function(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},each:function(obj,callback){var length,i=0;if(isArrayLike(obj)){length=obj.length;for(;i<length;i++){if(callback.call(obj[i],i,obj[i])===false){break}}}else{for(i in obj){if(callback.call(obj[i],i,obj[i])===false){break}}}return obj},trim:function(text){return text==null?"":(text+"").replace(rtrim,"")},makeArray:function(arr,results){var ret=results||[];if(arr!=null){if(isArrayLike(Object(arr))){jQuery.merge(ret,typeof arr==="string"?[arr]:arr)}else{push.call(ret,arr)}}return ret},inArray:function(elem,arr,i){return arr==null?-1:indexOf.call(arr,elem,i)},merge:function(first,second){var len=+second.length,j=0,i=first.length;for(;j<len;j++){first[i++]=second[j]}first.length=i;return first},grep:function(elems,callback,invert){var callbackInverse,matches=[],i=0,length=elems.length,callbackExpect=!invert;for(;i<length;i++){callbackInverse=!callback(elems[i],i);if(callbackInverse!==callbackExpect){matches.push(elems[i])}}return matches},map:function(elems,callback,arg){var length,value,i=0,ret=[];if(isArrayLike(elems)){length=elems.length;for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret.push(value)}}}else{for(i in elems){value=callback(elems[i],i,arg);if(value!=null){ret.push(value)}}}return concat.apply([],ret)},guid:1,proxy:function(fn,context){var tmp,args,proxy;if(typeof context==="string"){tmp=fn[context];context=fn;fn=tmp}if(!jQuery.isFunction(fn)){return undefined}args=slice.call(arguments,2);proxy=function(){return fn.apply(context||this,args.concat(slice.call(arguments)))};proxy.guid=fn.guid=fn.guid||jQuery.guid++;return proxy},now:Date.now,support:support});if(typeof Symbol==="function"){jQuery.fn[Symbol.iterator]=arr[Symbol.iterator]}jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(i,name){class2type["[object "+name+"]"]=name.toLowerCase()});function isArrayLike(obj){var length=!!obj&&"length"in obj&&obj.length,type=jQuery.type(obj);if(type==="function"||jQuery.isWindow(obj)){return false}return type==="array"||length===0||typeof length==="number"&&length>0&&length-1 in obj}var Sizzle=function(window){var i,support,Expr,getText,isXML,tokenize,compile,select,outermostContext,sortInput,hasDuplicate,setDocument,document,docElem,documentIsHTML,rbuggyQSA,rbuggyMatches,matches,contains,expando="sizzle"+1*new Date,preferredDoc=window.document,dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),sortOrder=function(a,b){if(a===b){hasDuplicate=true}return 0},hasOwn={}.hasOwnProperty,arr=[],pop=arr.pop,push_native=arr.push,push=arr.push,slice=arr.slice,indexOf=function(list,elem){var i=0,len=list.length;for(;i<len;i++){if(list[i]===elem){return i}}return-1},booleans="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",whitespace="[\\x20\\t\\r\\n\\f]",identifier="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",attributes="\\["+whitespace+"*("+identifier+")(?:"+whitespace+"*([*^$|!~]?=)"+whitespace+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+identifier+"))|)"+whitespace+"*\\]",pseudos=":("+identifier+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+attributes+")*)|"+".*"+")\\)|)",rwhitespace=new RegExp(whitespace+"+","g"),rtrim=new RegExp("^"+whitespace+"+|((?:^|[^\\\\])(?:\\\\.)*)"+whitespace+"+$","g"),rcomma=new RegExp("^"+whitespace+"*,"+whitespace+"*"),rcombinators=new RegExp("^"+whitespace+"*([>+~]|"+whitespace+")"+whitespace+"*"),rattributeQuotes=new RegExp("="+whitespace+"*([^\\]'\"]*?)"+whitespace+"*\\]","g"),rpseudo=new RegExp(pseudos),ridentifier=new RegExp("^"+identifier+"$"),matchExpr={ID:new RegExp("^#("+identifier+")"),CLASS:new RegExp("^\\.("+identifier+")"),TAG:new RegExp("^("+identifier+"|[*])"),ATTR:new RegExp("^"+attributes),PSEUDO:new RegExp("^"+pseudos),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+whitespace+"*(even|odd|(([+-]|)(\\d*)n|)"+whitespace+"*(?:([+-]|)"+whitespace+"*(\\d+)|))"+whitespace+"*\\)|)","i"),bool:new RegExp("^(?:"+booleans+")$","i"),needsContext:new RegExp("^"+whitespace+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+whitespace+"*((?:-\\d)?\\d*)"+whitespace+"*\\)|)(?=[^-]|$)","i")},rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rnative=/^[^{]+\{\s*\[native \w/,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,runescape=new RegExp("\\\\([\\da-f]{1,6}"+whitespace+"?|("+whitespace+")|.)","ig"),funescape=function(_,escaped,escapedWhitespace){var high="0x"+escaped-65536;return high!==high||escapedWhitespace?escaped:high<0?String.fromCharCode(high+65536):String.fromCharCode(high>>10|55296,high&1023|56320)},rcssescape=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,fcssescape=function(ch,asCodePoint){if(asCodePoint){if(ch==="\0"){return"�"}return ch.slice(0,-1)+"\\"+ch.charCodeAt(ch.length-1).toString(16)+" "}return"\\"+ch},unloadHandler=function(){setDocument()},disabledAncestor=addCombinator(function(elem){return elem.disabled===true&&("form"in elem||"label"in elem)},{dir:"parentNode",next:"legend"});try{push.apply(arr=slice.call(preferredDoc.childNodes),preferredDoc.childNodes);arr[preferredDoc.childNodes.length].nodeType}catch(e){push={apply:arr.length?function(target,els){push_native.apply(target,slice.call(els))}:function(target,els){var j=target.length,i=0;while(target[j++]=els[i++]){}target.length=j-1}}}function Sizzle(selector,context,results,seed){var m,i,elem,nid,match,groups,newSelector,newContext=context&&context.ownerDocument,nodeType=context?context.nodeType:9;results=results||[];if(typeof selector!=="string"||!selector||nodeType!==1&&nodeType!==9&&nodeType!==11){return results}if(!seed){if((context?context.ownerDocument||context:preferredDoc)!==document){setDocument(context)}context=context||document;if(documentIsHTML){if(nodeType!==11&&(match=rquickExpr.exec(selector))){if(m=match[1]){if(nodeType===9){if(elem=context.getElementById(m)){if(elem.id===m){results.push(elem);return results}}else{return results}}else{if(newContext&&(elem=newContext.getElementById(m))&&contains(context,elem)&&elem.id===m){results.push(elem);return results}}}else if(match[2]){push.apply(results,context.getElementsByTagName(selector));return results}else if((m=match[3])&&support.getElementsByClassName&&context.getElementsByClassName){push.apply(results,context.getElementsByClassName(m));return results}}if(support.qsa&&!compilerCache[selector+" "]&&(!rbuggyQSA||!rbuggyQSA.test(selector))){if(nodeType!==1){newContext=context;newSelector=selector}else if(context.nodeName.toLowerCase()!=="object"){if(nid=context.getAttribute("id")){nid=nid.replace(rcssescape,fcssescape)}else{context.setAttribute("id",nid=expando)}groups=tokenize(selector);i=groups.length;while(i--){groups[i]="#"+nid+" "+toSelector(groups[i])}newSelector=groups.join(",");newContext=rsibling.test(selector)&&testContext(context.parentNode)||context}if(newSelector){try{push.apply(results,newContext.querySelectorAll(newSelector));return results}catch(qsaError){}finally{if(nid===expando){context.removeAttribute("id")}}}}}}return select(selector.replace(rtrim,"$1"),context,results,seed)}function createCache(){var keys=[];function cache(key,value){if(keys.push(key+" ")>Expr.cacheLength){delete cache[keys.shift()]}return cache[key+" "]=value}return cache}function markFunction(fn){fn[expando]=true;return fn}function assert(fn){var el=document.createElement("fieldset");try{return!!fn(el)}catch(e){return false}finally{if(el.parentNode){el.parentNode.removeChild(el)}el=null}}function addHandle(attrs,handler){var arr=attrs.split("|"),i=arr.length;while(i--){Expr.attrHandle[arr[i]]=handler}}function siblingCheck(a,b){var cur=b&&a,diff=cur&&a.nodeType===1&&b.nodeType===1&&a.sourceIndex-b.sourceIndex;if(diff){return diff}if(cur){while(cur=cur.nextSibling){if(cur===b){return-1}}}return a?1:-1}function createInputPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type===type}}function createButtonPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&elem.type===type}}function createDisabledPseudo(disabled){return function(elem){if("form"in elem){if(elem.parentNode&&elem.disabled===false){if("label"in elem){if("label"in elem.parentNode){return elem.parentNode.disabled===disabled}else{return elem.disabled===disabled}}return elem.isDisabled===disabled||elem.isDisabled!==!disabled&&disabledAncestor(elem)===disabled}return elem.disabled===disabled}else if("label"in elem){return elem.disabled===disabled}return false}}function createPositionalPseudo(fn){return markFunction(function(argument){argument=+argument;return markFunction(function(seed,matches){var j,matchIndexes=fn([],seed.length,argument),i=matchIndexes.length;while(i--){if(seed[j=matchIndexes[i]]){seed[j]=!(matches[j]=seed[j])}}})})}function testContext(context){return context&&typeof context.getElementsByTagName!=="undefined"&&context}support=Sizzle.support={};isXML=Sizzle.isXML=function(elem){var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return documentElement?documentElement.nodeName!=="HTML":false};setDocument=Sizzle.setDocument=function(node){var hasCompare,subWindow,doc=node?node.ownerDocument||node:preferredDoc;if(doc===document||doc.nodeType!==9||!doc.documentElement){return document}document=doc;docElem=document.documentElement;documentIsHTML=!isXML(document);if(preferredDoc!==document&&(subWindow=document.defaultView)&&subWindow.top!==subWindow){if(subWindow.addEventListener){subWindow.addEventListener("unload",unloadHandler,false)}else if(subWindow.attachEvent){subWindow.attachEvent("onunload",unloadHandler)}}support.attributes=assert(function(el){el.className="i";return!el.getAttribute("className")});support.getElementsByTagName=assert(function(el){el.appendChild(document.createComment(""));return!el.getElementsByTagName("*").length});support.getElementsByClassName=rnative.test(document.getElementsByClassName);support.getById=assert(function(el){docElem.appendChild(el).id=expando;return!document.getElementsByName||!document.getElementsByName(expando).length});if(support.getById){Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId}};Expr.find["ID"]=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var elem=context.getElementById(id);return elem?[elem]:[]}}}else{Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return node&&node.value===attrId}};Expr.find["ID"]=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var node,i,elems,elem=context.getElementById(id);if(elem){node=elem.getAttributeNode("id");if(node&&node.value===id){return[elem]}elems=context.getElementsByName(id);i=0;while(elem=elems[i++]){node=elem.getAttributeNode("id");if(node&&node.value===id){return[elem]}}}return[]}}}Expr.find["TAG"]=support.getElementsByTagName?function(tag,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(tag)}else if(support.qsa){return context.querySelectorAll(tag)}}:function(tag,context){var elem,tmp=[],i=0,results=context.getElementsByTagName(tag);if(tag==="*"){while(elem=results[i++]){if(elem.nodeType===1){tmp.push(elem)}}return tmp}return results};Expr.find["CLASS"]=support.getElementsByClassName&&function(className,context){if(typeof context.getElementsByClassName!=="undefined"&&documentIsHTML){return context.getElementsByClassName(className)}};rbuggyMatches=[];rbuggyQSA=[];if(support.qsa=rnative.test(document.querySelectorAll)){assert(function(el){docElem.appendChild(el).innerHTML="<a id='"+expando+"'></a>"+"<select id='"+expando+"-\r\\' msallowcapture=''>"+"<option selected=''></option></select>";if(el.querySelectorAll("[msallowcapture^='']").length){rbuggyQSA.push("[*^$]="+whitespace+"*(?:''|\"\")")}if(!el.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:value|"+booleans+")")}if(!el.querySelectorAll("[id~="+expando+"-]").length){rbuggyQSA.push("~=")}if(!el.querySelectorAll(":checked").length){rbuggyQSA.push(":checked")}if(!el.querySelectorAll("a#"+expando+"+*").length){rbuggyQSA.push(".#.+[+~]")}});assert(function(el){el.innerHTML="<a href='' disabled='disabled'></a>"+"<select disabled='disabled'><option/></select>";var input=document.createElement("input");input.setAttribute("type","hidden");el.appendChild(input).setAttribute("name","D");if(el.querySelectorAll("[name=d]").length){rbuggyQSA.push("name"+whitespace+"*[*^$|!~]?=")}if(el.querySelectorAll(":enabled").length!==2){rbuggyQSA.push(":enabled",":disabled")}docElem.appendChild(el).disabled=true;if(el.querySelectorAll(":disabled").length!==2){rbuggyQSA.push(":enabled",":disabled")}el.querySelectorAll("*,:x");rbuggyQSA.push(",.*:")})}if(support.matchesSelector=rnative.test(matches=docElem.matches||docElem.webkitMatchesSelector||docElem.mozMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector)){assert(function(el){support.disconnectedMatch=matches.call(el,"*");matches.call(el,"[s!='']:x");rbuggyMatches.push("!=",pseudos)})}rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));rbuggyMatches=rbuggyMatches.length&&new RegExp(rbuggyMatches.join("|"));hasCompare=rnative.test(docElem.compareDocumentPosition);contains=hasCompare||rnative.test(docElem.contains)?function(a,b){var adown=a.nodeType===9?a.documentElement:a,bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&(adown.contains?adown.contains(bup):a.compareDocumentPosition&&a.compareDocumentPosition(bup)&16))}:function(a,b){if(b){while(b=b.parentNode){if(b===a){return true}}}return false};sortOrder=hasCompare?function(a,b){if(a===b){hasDuplicate=true;return 0}var compare=!a.compareDocumentPosition-!b.compareDocumentPosition;if(compare){return compare}compare=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1;if(compare&1||!support.sortDetached&&b.compareDocumentPosition(a)===compare){if(a===document||a.ownerDocument===preferredDoc&&contains(preferredDoc,a)){return-1}if(b===document||b.ownerDocument===preferredDoc&&contains(preferredDoc,b)){return 1}return sortInput?indexOf(sortInput,a)-indexOf(sortInput,b):0}return compare&4?-1:1}:function(a,b){if(a===b){hasDuplicate=true;return 0}var cur,i=0,aup=a.parentNode,bup=b.parentNode,ap=[a],bp=[b];if(!aup||!bup){return a===document?-1:b===document?1:aup?-1:bup?1:sortInput?indexOf(sortInput,a)-indexOf(sortInput,b):0}else if(aup===bup){return siblingCheck(a,b)}cur=a;while(cur=cur.parentNode){ap.unshift(cur)}cur=b;while(cur=cur.parentNode){bp.unshift(cur)}while(ap[i]===bp[i]){i++}return i?siblingCheck(ap[i],bp[i]):ap[i]===preferredDoc?-1:bp[i]===preferredDoc?1:0};return document};Sizzle.matches=function(expr,elements){return Sizzle(expr,null,null,elements)};Sizzle.matchesSelector=function(elem,expr){if((elem.ownerDocument||elem)!==document){setDocument(elem)}expr=expr.replace(rattributeQuotes,"='$1']");if(support.matchesSelector&&documentIsHTML&&!compilerCache[expr+" "]&&(!rbuggyMatches||!rbuggyMatches.test(expr))&&(!rbuggyQSA||!rbuggyQSA.test(expr))){try{var ret=matches.call(elem,expr);if(ret||support.disconnectedMatch||elem.document&&elem.document.nodeType!==11){return ret}}catch(e){}}return Sizzle(expr,document,null,[elem]).length>0};Sizzle.contains=function(context,elem){if((context.ownerDocument||context)!==document){setDocument(context)}return contains(context,elem)};Sizzle.attr=function(elem,name){if((elem.ownerDocument||elem)!==document){setDocument(elem)}var fn=Expr.attrHandle[name.toLowerCase()],val=fn&&hasOwn.call(Expr.attrHandle,name.toLowerCase())?fn(elem,name,!documentIsHTML):undefined;return val!==undefined?val:support.attributes||!documentIsHTML?elem.getAttribute(name):(val=elem.getAttributeNode(name))&&val.specified?val.value:null};Sizzle.escape=function(sel){return(sel+"").replace(rcssescape,fcssescape)};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg)};Sizzle.uniqueSort=function(results){var elem,duplicates=[],j=0,i=0;hasDuplicate=!support.detectDuplicates;sortInput=!support.sortStable&&results.slice(0);results.sort(sortOrder);if(hasDuplicate){while(elem=results[i++]){if(elem===results[i]){j=duplicates.push(i)}}while(j--){results.splice(duplicates[j],1)}}sortInput=null;return results};getText=Sizzle.getText=function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){while(node=elem[i++]){ret+=getText(node)}}else if(nodeType===1||nodeType===9||nodeType===11){if(typeof elem.textContent==="string"){return elem.textContent}else{for(elem=elem.firstChild;elem;elem=elem.nextSibling){ret+=getText(elem)}}}else if(nodeType===3||nodeType===4){return elem.nodeValue}return ret};Expr=Sizzle.selectors={cacheLength:50,createPseudo:markFunction,match:matchExpr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(match){match[1]=match[1].replace(runescape,funescape);match[3]=(match[3]||match[4]||match[5]||"").replace(runescape,funescape);if(match[2]==="~="){match[3]=" "+match[3]+" "}return match.slice(0,4)},CHILD:function(match){match[1]=match[1].toLowerCase();if(match[1].slice(0,3)==="nth"){if(!match[3]){Sizzle.error(match[0])}match[4]=+(match[4]?match[5]+(match[6]||1):2*(match[3]==="even"||match[3]==="odd"));match[5]=+(match[7]+match[8]||match[3]==="odd")}else if(match[3]){Sizzle.error(match[0])}return match},PSEUDO:function(match){var excess,unquoted=!match[6]&&match[2];if(matchExpr["CHILD"].test(match[0])){return null}if(match[3]){match[2]=match[4]||match[5]||""}else if(unquoted&&rpseudo.test(unquoted)&&(excess=tokenize(unquoted,true))&&(excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)){match[0]=match[0].slice(0,excess);match[2]=unquoted.slice(0,excess)}return match.slice(0,3)}},filter:{TAG:function(nodeNameSelector){var nodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return nodeNameSelector==="*"?function(){return true}:function(elem){return elem.nodeName&&elem.nodeName.toLowerCase()===nodeName}},CLASS:function(className){var pattern=classCache[className+" "];return pattern||(pattern=new RegExp("(^|"+whitespace+")"+className+"("+whitespace+"|$)"))&&classCache(className,function(elem){return pattern.test(typeof elem.className==="string"&&elem.className||typeof elem.getAttribute!=="undefined"&&elem.getAttribute("class")||"")})},ATTR:function(name,operator,check){return function(elem){var result=Sizzle.attr(elem,name);if(result==null){return operator==="!="}if(!operator){return true}result+="";return operator==="="?result===check:operator==="!="?result!==check:operator==="^="?check&&result.indexOf(check)===0:operator==="*="?check&&result.indexOf(check)>-1:operator==="$="?check&&result.slice(-check.length)===check:operator==="~="?(" "+result.replace(rwhitespace," ")+" ").indexOf(check)>-1:operator==="|="?result===check||result.slice(0,check.length+1)===check+"-":false}},CHILD:function(type,what,argument,first,last){var simple=type.slice(0,3)!=="nth",forward=type.slice(-4)!=="last",ofType=what==="of-type";return first===1&&last===0?function(elem){return!!elem.parentNode}:function(elem,context,xml){var cache,uniqueCache,outerCache,node,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType,diff=false;if(parent){if(simple){while(dir){node=elem;while(node=node[dir]){if(ofType?node.nodeName.toLowerCase()===name:node.nodeType===1){return false}}start=dir=type==="only"&&!start&&"nextSibling"}return true}start=[forward?parent.firstChild:parent.lastChild];if(forward&&useCache){node=parent;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex&&cache[2];node=nodeIndex&&parent.childNodes[nodeIndex];while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){if(node.nodeType===1&&++diff&&node===elem){uniqueCache[type]=[dirruns,nodeIndex,diff];break}}}else{if(useCache){node=elem;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex}if(diff===false){while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){if((ofType?node.nodeName.toLowerCase()===name:node.nodeType===1)&&++diff){if(useCache){outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});uniqueCache[type]=[dirruns,diff]}if(node===elem){break}}}}}diff-=last;return diff===first||diff%first===0&&diff/first>=0}}},PSEUDO:function(pseudo,argument){var args,fn=Expr.pseudos[pseudo]||Expr.setFilters[pseudo.toLowerCase()]||Sizzle.error("unsupported pseudo: "+pseudo);if(fn[expando]){return fn(argument)}if(fn.length>1){args=[pseudo,pseudo,"",argument];return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase())?markFunction(function(seed,matches){var idx,matched=fn(seed,argument),i=matched.length;while(i--){idx=indexOf(seed,matched[i]);seed[idx]=!(matches[idx]=matched[i])}}):function(elem){return fn(elem,0,args)}}return fn}},pseudos:{not:markFunction(function(selector){var input=[],results=[],matcher=compile(selector.replace(rtrim,"$1"));return matcher[expando]?markFunction(function(seed,matches,context,xml){var elem,unmatched=matcher(seed,null,xml,[]),i=seed.length;while(i--){if(elem=unmatched[i]){seed[i]=!(matches[i]=elem)}}}):function(elem,context,xml){input[0]=elem;matcher(input,null,xml,results);input[0]=null;return!results.pop()}}),has:markFunction(function(selector){return function(elem){return Sizzle(selector,elem).length>0}}),contains:markFunction(function(text){text=text.replace(runescape,funescape);return function(elem){return(elem.textContent||elem.innerText||getText(elem)).indexOf(text)>-1}}),lang:markFunction(function(lang){if(!ridentifier.test(lang||"")){Sizzle.error("unsupported lang: "+lang)}lang=lang.replace(runescape,funescape).toLowerCase();return function(elem){var elemLang;do{if(elemLang=documentIsHTML?elem.lang:elem.getAttribute("xml:lang")||elem.getAttribute("lang")){elemLang=elemLang.toLowerCase();return elemLang===lang||elemLang.indexOf(lang+"-")===0}}while((elem=elem.parentNode)&&elem.nodeType===1);return false}}),target:function(elem){var hash=window.location&&window.location.hash;return hash&&hash.slice(1)===elem.id},root:function(elem){return elem===docElem},focus:function(elem){return elem===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(elem.type||elem.href||~elem.tabIndex)},enabled:createDisabledPseudo(false),disabled:createDisabledPseudo(true),checked:function(elem){var nodeName=elem.nodeName.toLowerCase();return nodeName==="input"&&!!elem.checked||nodeName==="option"&&!!elem.selected},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex}return elem.selected===true},empty:function(elem){for(elem=elem.firstChild;elem;elem=elem.nextSibling){if(elem.nodeType<6){return false}}return true},parent:function(elem){return!Expr.pseudos["empty"](elem)},header:function(elem){return rheader.test(elem.nodeName)},input:function(elem){return rinputs.test(elem.nodeName)},button:function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type==="button"||name==="button"},text:function(elem){var attr;return elem.nodeName.toLowerCase()==="input"&&elem.type==="text"&&((attr=elem.getAttribute("type"))==null||attr.toLowerCase()==="text")},first:createPositionalPseudo(function(){return[0]}),last:createPositionalPseudo(function(matchIndexes,length){return[length-1]}),eq:createPositionalPseudo(function(matchIndexes,length,argument){return[argument<0?argument+length:argument]}),even:createPositionalPseudo(function(matchIndexes,length){var i=0;for(;i<length;i+=2){matchIndexes.push(i)}return matchIndexes}),odd:createPositionalPseudo(function(matchIndexes,length){var i=1;for(;i<length;i+=2){matchIndexes.push(i)}return matchIndexes}),lt:createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;--i>=0;){matchIndexes.push(i)}return matchIndexes}),gt:createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;++i<length;){matchIndexes.push(i)}return matchIndexes})}};Expr.pseudos["nth"]=Expr.pseudos["eq"];for(i in{radio:true,checkbox:true,file:true,password:true,image:true}){Expr.pseudos[i]=createInputPseudo(i)}for(i in{submit:true,reset:true}){Expr.pseudos[i]=createButtonPseudo(i)}function setFilters(){}setFilters.prototype=Expr.filters=Expr.pseudos;Expr.setFilters=new setFilters;tokenize=Sizzle.tokenize=function(selector,parseOnly){var matched,match,tokens,type,soFar,groups,preFilters,cached=tokenCache[selector+" "];if(cached){return parseOnly?0:cached.slice(0)}soFar=selector;groups=[];preFilters=Expr.preFilter;while(soFar){if(!matched||(match=rcomma.exec(soFar))){if(match){soFar=soFar.slice(match[0].length)||soFar}groups.push(tokens=[])}matched=false;if(match=rcombinators.exec(soFar)){matched=match.shift();tokens.push({value:matched,type:match[0].replace(rtrim," ")});soFar=soFar.slice(matched.length)}for(type in Expr.filter){if((match=matchExpr[type].exec(soFar))&&(!preFilters[type]||(match=preFilters[type](match)))){matched=match.shift();tokens.push({value:matched,type:type,matches:match});soFar=soFar.slice(matched.length)}}if(!matched){break}}return parseOnly?soFar.length:soFar?Sizzle.error(selector):tokenCache(selector,groups).slice(0)};function toSelector(tokens){var i=0,len=tokens.length,selector="";for(;i<len;i++){selector+=tokens[i].value}return selector}function addCombinator(matcher,combinator,base){var dir=combinator.dir,skip=combinator.next,key=skip||dir,checkNonElements=base&&key==="parentNode",doneName=done++;return combinator.first?function(elem,context,xml){while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){return matcher(elem,context,xml)}}return false}:function(elem,context,xml){var oldCache,uniqueCache,outerCache,newCache=[dirruns,doneName];if(xml){while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){if(matcher(elem,context,xml)){return true}}}}else{while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){outerCache=elem[expando]||(elem[expando]={});uniqueCache=outerCache[elem.uniqueID]||(outerCache[elem.uniqueID]={});if(skip&&skip===elem.nodeName.toLowerCase()){elem=elem[dir]||elem}else if((oldCache=uniqueCache[key])&&oldCache[0]===dirruns&&oldCache[1]===doneName){return newCache[2]=oldCache[2]}else{uniqueCache[key]=newCache;if(newCache[2]=matcher(elem,context,xml)){return true}}}}}return false}}function elementMatcher(matchers){return matchers.length>1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return false}}return true}:matchers[0]}function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i<len;i++){Sizzle(selector,contexts[i],results)}return results}function condense(unmatched,map,filter,context,xml){var elem,newUnmatched=[],i=0,len=unmatched.length,mapped=map!=null;for(;i<len;i++){if(elem=unmatched[i]){if(!filter||filter(elem,context,xml)){newUnmatched.push(elem);if(mapped){map.push(i)}}}}return newUnmatched}function setMatcher(preFilter,selector,matcher,postFilter,postFinder,postSelector){if(postFilter&&!postFilter[expando]){postFilter=setMatcher(postFilter)}if(postFinder&&!postFinder[expando]){postFinder=setMatcher(postFinder,postSelector)}return markFunction(function(seed,results,context,xml){var temp,i,elem,preMap=[],postMap=[],preexisting=results.length,elems=seed||multipleContexts(selector||"*",context.nodeType?[context]:context,[]),matcherIn=preFilter&&(seed||!selector)?condense(elems,preMap,preFilter,context,xml):elems,matcherOut=matcher?postFinder||(seed?preFilter:preexisting||postFilter)?[]:results:matcherIn;if(matcher){matcher(matcherIn,matcherOut,context,xml)}if(postFilter){temp=condense(matcherOut,postMap);postFilter(temp,[],context,xml);i=temp.length;while(i--){if(elem=temp[i]){matcherOut[postMap[i]]=!(matcherIn[postMap[i]]=elem)}}}if(seed){if(postFinder||preFilter){if(postFinder){temp=[];i=matcherOut.length;while(i--){if(elem=matcherOut[i]){temp.push(matcherIn[i]=elem)}}postFinder(null,matcherOut=[],temp,xml)}i=matcherOut.length;while(i--){if((elem=matcherOut[i])&&(temp=postFinder?indexOf(seed,elem):preMap[i])>-1){seed[temp]=!(results[temp]=elem)}}}}else{matcherOut=condense(matcherOut===results?matcherOut.splice(preexisting,matcherOut.length):matcherOut);if(postFinder){postFinder(null,results,matcherOut,xml)}else{push.apply(results,matcherOut)}}})}function matcherFromTokens(tokens){var checkContext,matcher,j,len=tokens.length,leadingRelative=Expr.relative[tokens[0].type],implicitRelative=leadingRelative||Expr.relative[" "],i=leadingRelative?1:0,matchContext=addCombinator(function(elem){return elem===checkContext},implicitRelative,true),matchAnyContext=addCombinator(function(elem){return indexOf(checkContext,elem)>-1},implicitRelative,true),matchers=[function(elem,context,xml){var ret=!leadingRelative&&(xml||context!==outermostContext)||((checkContext=context).nodeType?matchContext(elem,context,xml):matchAnyContext(elem,context,xml));checkContext=null;return ret}];for(;i<len;i++){if(matcher=Expr.relative[tokens[i].type]){matchers=[addCombinator(elementMatcher(matchers),matcher)]}else{matcher=Expr.filter[tokens[i].type].apply(null,tokens[i].matches);if(matcher[expando]){j=++i;for(;j<len;j++){if(Expr.relative[tokens[j].type]){break}}return setMatcher(i>1&&elementMatcher(matchers),i>1&&toSelector(tokens.slice(0,i-1).concat({value:tokens[i-2].type===" "?"*":""})).replace(rtrim,"$1"),matcher,i<j&&matcherFromTokens(tokens.slice(i,j)),j<len&&matcherFromTokens(tokens=tokens.slice(j)),j<len&&toSelector(tokens))}matchers.push(matcher)}}return elementMatcher(matchers)}function matcherFromGroupMatchers(elementMatchers,setMatchers){var bySet=setMatchers.length>0,byElement=elementMatchers.length>0,superMatcher=function(seed,context,xml,results,outermost){var elem,j,matcher,matchedCount=0,i="0",unmatched=seed&&[],setMatched=[],contextBackup=outermostContext,elems=seed||byElement&&Expr.find["TAG"]("*",outermost),dirrunsUnique=dirruns+=contextBackup==null?1:Math.random()||.1,len=elems.length;if(outermost){outermostContext=context===document||context||outermost}for(;i!==len&&(elem=elems[i])!=null;i++){if(byElement&&elem){j=0;if(!context&&elem.ownerDocument!==document){setDocument(elem);xml=!documentIsHTML}while(matcher=elementMatchers[j++]){if(matcher(elem,context||document,xml)){results.push(elem);break}}if(outermost){dirruns=dirrunsUnique}}if(bySet){if(elem=!matcher&&elem){matchedCount--}if(seed){unmatched.push(elem)}}}matchedCount+=i;if(bySet&&i!==matchedCount){j=0;while(matcher=setMatchers[j++]){matcher(unmatched,setMatched,context,xml)}if(seed){if(matchedCount>0){while(i--){if(!(unmatched[i]||setMatched[i])){setMatched[i]=pop.call(results)}}}setMatched=condense(setMatched)}push.apply(results,setMatched);if(outermost&&!seed&&setMatched.length>0&&matchedCount+setMatchers.length>1){Sizzle.uniqueSort(results)}}if(outermost){dirruns=dirrunsUnique;outermostContext=contextBackup}return unmatched};return bySet?markFunction(superMatcher):superMatcher}compile=Sizzle.compile=function(selector,match){var i,setMatchers=[],elementMatchers=[],cached=compilerCache[selector+" "];if(!cached){if(!match){match=tokenize(selector)}i=match.length;while(i--){cached=matcherFromTokens(match[i]);if(cached[expando]){setMatchers.push(cached)}else{elementMatchers.push(cached)}}cached=compilerCache(selector,matcherFromGroupMatchers(elementMatchers,setMatchers));cached.selector=selector}return cached};select=Sizzle.select=function(selector,context,results,seed){var i,tokens,token,type,find,compiled=typeof selector==="function"&&selector,match=!seed&&tokenize(selector=compiled.selector||selector);results=results||[];if(match.length===1){tokens=match[0]=match[0].slice(0);if(tokens.length>2&&(token=tokens[0]).type==="ID"&&context.nodeType===9&&documentIsHTML&&Expr.relative[tokens[1].type]){context=(Expr.find["ID"](token.matches[0].replace(runescape,funescape),context)||[])[0];if(!context){return results}else if(compiled){context=context.parentNode}selector=selector.slice(tokens.shift().value.length)}i=matchExpr["needsContext"].test(selector)?0:tokens.length;while(i--){token=tokens[i];if(Expr.relative[type=token.type]){break}if(find=Expr.find[type]){if(seed=find(token.matches[0].replace(runescape,funescape),rsibling.test(tokens[0].type)&&testContext(context.parentNode)||context)){tokens.splice(i,1);selector=seed.length&&toSelector(tokens);if(!selector){push.apply(results,seed);return results}break}}}}(compiled||compile(selector,match))(seed,context,!documentIsHTML,results,!context||rsibling.test(selector)&&testContext(context.parentNode)||context);return results};support.sortStable=expando.split("").sort(sortOrder).join("")===expando;support.detectDuplicates=!!hasDuplicate;setDocument();support.sortDetached=assert(function(el){return el.compareDocumentPosition(document.createElement("fieldset"))&1});if(!assert(function(el){el.innerHTML="<a href='#'></a>";return el.firstChild.getAttribute("href")==="#"})){addHandle("type|href|height|width",function(elem,name,isXML){if(!isXML){return elem.getAttribute(name,name.toLowerCase()==="type"?1:2)}})}if(!support.attributes||!assert(function(el){el.innerHTML="<input/>";el.firstChild.setAttribute("value","");return el.firstChild.getAttribute("value")===""})){addHandle("value",function(elem,name,isXML){if(!isXML&&elem.nodeName.toLowerCase()==="input"){return elem.defaultValue}})}if(!assert(function(el){return el.getAttribute("disabled")==null})){addHandle(booleans,function(elem,name,isXML){var val;if(!isXML){return elem[name]===true?name.toLowerCase():(val=elem.getAttributeNode(name))&&val.specified?val.value:null}})}return Sizzle}(window);jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.uniqueSort=jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;jQuery.escapeSelector=Sizzle.escape;var dir=function(elem,dir,until){var matched=[],truncate=until!==undefined;while((elem=elem[dir])&&elem.nodeType!==9){if(elem.nodeType===1){if(truncate&&jQuery(elem).is(until)){break}matched.push(elem)}}return matched};var siblings=function(n,elem){var matched=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){matched.push(n)}}return matched};var rneedsContext=jQuery.expr.match.needsContext;function nodeName(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase()}var rsingleTag=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;var risSimple=/^.[^:#\[\.,]*$/;function winnow(elements,qualifier,not){if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){return!!qualifier.call(elem,i,elem)!==not})}if(qualifier.nodeType){return jQuery.grep(elements,function(elem){return elem===qualifier!==not})}if(typeof qualifier!=="string"){return jQuery.grep(elements,function(elem){return indexOf.call(qualifier,elem)>-1!==not})}if(risSimple.test(qualifier)){return jQuery.filter(qualifier,elements,not)}qualifier=jQuery.filter(qualifier,elements);return jQuery.grep(elements,function(elem){return indexOf.call(qualifier,elem)>-1!==not&&elem.nodeType===1})}jQuery.filter=function(expr,elems,not){var elem=elems[0];if(not){expr=":not("+expr+")"}if(elems.length===1&&elem.nodeType===1){return jQuery.find.matchesSelector(elem,expr)?[elem]:[]}return jQuery.find.matches(expr,jQuery.grep(elems,function(elem){return elem.nodeType===1}))};jQuery.fn.extend({find:function(selector){var i,ret,len=this.length,self=this;if(typeof selector!=="string"){return this.pushStack(jQuery(selector).filter(function(){for(i=0;i<len;i++){if(jQuery.contains(self[i],this)){return true}}}))}ret=this.pushStack([]);for(i=0;i<len;i++){jQuery.find(selector,self[i],ret)}return len>1?jQuery.uniqueSort(ret):ret},filter:function(selector){return this.pushStack(winnow(this,selector||[],false))},not:function(selector){return this.pushStack(winnow(this,selector||[],true))},is:function(selector){return!!winnow(this,typeof selector==="string"&&rneedsContext.test(selector)?jQuery(selector):selector||[],false).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,init=jQuery.fn.init=function(selector,context,root){var match,elem;if(!selector){return this}root=root||rootjQuery;if(typeof selector==="string"){if(selector[0]==="<"&&selector[selector.length-1]===">"&&selector.length>=3){match=[null,selector,null]}else{match=rquickExpr.exec(selector)}if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){if(jQuery.isFunction(this[match])){this[match](context[match])}else{this.attr(match,context[match])}}}return this}else{elem=document.getElementById(match[2]);if(elem){this[0]=elem;this.length=1}return this}}else if(!context||context.jquery){return(context||root).find(selector)}else{return this.constructor(context).find(selector)}}else if(selector.nodeType){this[0]=selector;this.length=1;return this}else if(jQuery.isFunction(selector)){return root.ready!==undefined?root.ready(selector):selector(jQuery)}return jQuery.makeArray(selector,this)};init.prototype=jQuery.fn;rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({has:function(target){var targets=jQuery(target,this),l=targets.length;return this.filter(function(){var i=0;for(;i<l;i++){if(jQuery.contains(this,targets[i])){return true}}})},closest:function(selectors,context){var cur,i=0,l=this.length,matched=[],targets=typeof selectors!=="string"&&jQuery(selectors);if(!rneedsContext.test(selectors)){for(;i<l;i++){for(cur=this[i];cur&&cur!==context;cur=cur.parentNode){if(cur.nodeType<11&&(targets?targets.index(cur)>-1:cur.nodeType===1&&jQuery.find.matchesSelector(cur,selectors))){matched.push(cur);break}}}}return this.pushStack(matched.length>1?jQuery.uniqueSort(matched):matched)},index:function(elem){if(!elem){return this[0]&&this[0].parentNode?this.first().prevAll().length:-1}if(typeof elem==="string"){return indexOf.call(jQuery(elem),this[0])}return indexOf.call(this,elem.jquery?elem[0]:elem)},add:function(selector,context){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(selector,context))))},addBack:function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}});function sibling(cur,dir){while((cur=cur[dir])&&cur.nodeType!==1){}return cur}jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null},parents:function(elem){return dir(elem,"parentNode")},parentsUntil:function(elem,i,until){return dir(elem,"parentNode",until)},next:function(elem){return sibling(elem,"nextSibling")},prev:function(elem){return sibling(elem,"previousSibling")},nextAll:function(elem){return dir(elem,"nextSibling")},prevAll:function(elem){return dir(elem,"previousSibling")},nextUntil:function(elem,i,until){return dir(elem,"nextSibling",until)},prevUntil:function(elem,i,until){return dir(elem,"previousSibling",until)},siblings:function(elem){return siblings((elem.parentNode||{}).firstChild,elem)},children:function(elem){return siblings(elem.firstChild)},contents:function(elem){if(nodeName(elem,"iframe")){return elem.contentDocument}if(nodeName(elem,"template")){elem=elem.content||elem}return jQuery.merge([],elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(until,selector){var matched=jQuery.map(this,fn,until);if(name.slice(-5)!=="Until"){selector=until}if(selector&&typeof selector==="string"){matched=jQuery.filter(selector,matched)}if(this.length>1){if(!guaranteedUnique[name]){jQuery.uniqueSort(matched)}if(rparentsprev.test(name)){matched.reverse()}}return this.pushStack(matched)}});var rnothtmlwhite=/[^\x20\t\r\n\f]+/g;function createOptions(options){var object={};jQuery.each(options.match(rnothtmlwhite)||[],function(_,flag){object[flag]=true});return object}jQuery.Callbacks=function(options){options=typeof options==="string"?createOptions(options):jQuery.extend({},options);var firing,memory,fired,locked,list=[],queue=[],firingIndex=-1,fire=function(){locked=locked||options.once;fired=firing=true;for(;queue.length;firingIndex=-1){memory=queue.shift();while(++firingIndex<list.length){if(list[firingIndex].apply(memory[0],memory[1])===false&&options.stopOnFalse){firingIndex=list.length;memory=false}}}if(!options.memory){memory=false}firing=false;if(locked){if(memory){list=[]}else{list=""}}},self={add:function(){if(list){if(memory&&!firing){firingIndex=list.length-1;queue.push(memory)}(function add(args){jQuery.each(args,function(_,arg){if(jQuery.isFunction(arg)){if(!options.unique||!self.has(arg)){list.push(arg)}}else if(arg&&arg.length&&jQuery.type(arg)!=="string"){add(arg)}})})(arguments);if(memory&&!firing){fire()}}return this},remove:function(){jQuery.each(arguments,function(_,arg){var index;while((index=jQuery.inArray(arg,list,index))>-1){list.splice(index,1);if(index<=firingIndex){firingIndex--}}});return this},has:function(fn){return fn?jQuery.inArray(fn,list)>-1:list.length>0},empty:function(){if(list){list=[]}return this},disable:function(){locked=queue=[];list=memory="";return this},disabled:function(){return!list},lock:function(){locked=queue=[];if(!memory&&!firing){list=memory=""}return this},locked:function(){return!!locked},fireWith:function(context,args){if(!locked){args=args||[];args=[context,args.slice?args.slice():args];queue.push(args);if(!firing){fire()}}return this},fire:function(){self.fireWith(this,arguments);return this},fired:function(){return!!fired}};return self};function Identity(v){return v}function Thrower(ex){throw ex}function adoptValue(value,resolve,reject,noValue){var method;try{if(value&&jQuery.isFunction(method=value.promise)){method.call(value).done(resolve).fail(reject)}else if(value&&jQuery.isFunction(method=value.then)){method.call(value,resolve,reject)}else{resolve.apply(undefined,[value].slice(noValue))}}catch(value){reject.apply(undefined,[value])}}jQuery.extend({Deferred:function(func){var tuples=[["notify","progress",jQuery.Callbacks("memory"),jQuery.Callbacks("memory"),2],["resolve","done",jQuery.Callbacks("once memory"),jQuery.Callbacks("once memory"),0,"resolved"],["reject","fail",jQuery.Callbacks("once memory"),jQuery.Callbacks("once memory"),1,"rejected"]],state="pending",promise={state:function(){return state},always:function(){deferred.done(arguments).fail(arguments);return this},catch:function(fn){return promise.then(null,fn)},pipe:function(){var fns=arguments;return jQuery.Deferred(function(newDefer){jQuery.each(tuples,function(i,tuple){var fn=jQuery.isFunction(fns[tuple[4]])&&fns[tuple[4]];deferred[tuple[1]](function(){var returned=fn&&fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject)}else{newDefer[tuple[0]+"With"](this,fn?[returned]:arguments)}})});fns=null}).promise()},then:function(onFulfilled,onRejected,onProgress){var maxDepth=0;function resolve(depth,deferred,handler,special){return function(){var that=this,args=arguments,mightThrow=function(){var returned,then;if(depth<maxDepth){return}returned=handler.apply(that,args);if(returned===deferred.promise()){throw new TypeError("Thenable self-resolution")}then=returned&&(typeof returned==="object"||typeof returned==="function")&&returned.then;if(jQuery.isFunction(then)){if(special){then.call(returned,resolve(maxDepth,deferred,Identity,special),resolve(maxDepth,deferred,Thrower,special))}else{maxDepth++;then.call(returned,resolve(maxDepth,deferred,Identity,special),resolve(maxDepth,deferred,Thrower,special),resolve(maxDepth,deferred,Identity,deferred.notifyWith))}}else{if(handler!==Identity){that=undefined;args=[returned]}(special||deferred.resolveWith)(that,args)}},process=special?mightThrow:function(){try{mightThrow()}catch(e){if(jQuery.Deferred.exceptionHook){jQuery.Deferred.exceptionHook(e,process.stackTrace)}if(depth+1>=maxDepth){if(handler!==Thrower){that=undefined;args=[e]}deferred.rejectWith(that,args)}}};if(depth){process()}else{if(jQuery.Deferred.getStackHook){process.stackTrace=jQuery.Deferred.getStackHook()}window.setTimeout(process)}}}return jQuery.Deferred(function(newDefer){tuples[0][3].add(resolve(0,newDefer,jQuery.isFunction(onProgress)?onProgress:Identity,newDefer.notifyWith));tuples[1][3].add(resolve(0,newDefer,jQuery.isFunction(onFulfilled)?onFulfilled:Identity));tuples[2][3].add(resolve(0,newDefer,jQuery.isFunction(onRejected)?onRejected:Thrower))}).promise()},promise:function(obj){return obj!=null?jQuery.extend(obj,promise):promise}},deferred={};jQuery.each(tuples,function(i,tuple){var list=tuple[2],stateString=tuple[5];promise[tuple[1]]=list.add;if(stateString){list.add(function(){state=stateString},tuples[3-i][2].disable,tuples[0][2].lock)}list.add(tuple[3].fire);deferred[tuple[0]]=function(){deferred[tuple[0]+"With"](this===deferred?undefined:this,arguments);return this};deferred[tuple[0]+"With"]=list.fireWith});promise.promise(deferred);if(func){func.call(deferred,deferred)}return deferred},when:function(singleValue){var remaining=arguments.length,i=remaining,resolveContexts=Array(i),resolveValues=slice.call(arguments),master=jQuery.Deferred(),updateFunc=function(i){return function(value){resolveContexts[i]=this;resolveValues[i]=arguments.length>1?slice.call(arguments):value;if(!--remaining){master.resolveWith(resolveContexts,resolveValues)}}};if(remaining<=1){adoptValue(singleValue,master.done(updateFunc(i)).resolve,master.reject,!remaining);if(master.state()==="pending"||jQuery.isFunction(resolveValues[i]&&resolveValues[i].then)){return master.then()}}while(i--){adoptValue(resolveValues[i],updateFunc(i),master.reject)}return master.promise()}});var rerrorNames=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;jQuery.Deferred.exceptionHook=function(error,stack){if(window.console&&window.console.warn&&error&&rerrorNames.test(error.name)){window.console.warn("jQuery.Deferred exception: "+error.message,error.stack,stack)}};jQuery.readyException=function(error){window.setTimeout(function(){throw error})};var readyList=jQuery.Deferred();jQuery.fn.ready=function(fn){readyList.then(fn).catch(function(error){jQuery.readyException(error)});return this};jQuery.extend({isReady:false,readyWait:1,ready:function(wait){if(wait===true?--jQuery.readyWait:jQuery.isReady){return}jQuery.isReady=true;if(wait!==true&&--jQuery.readyWait>0){return}readyList.resolveWith(document,[jQuery])}});jQuery.ready.then=readyList.then;function completed(){document.removeEventListener("DOMContentLoaded",completed);window.removeEventListener("load",completed);jQuery.ready()}if(document.readyState==="complete"||document.readyState!=="loading"&&!document.documentElement.doScroll){window.setTimeout(jQuery.ready)}else{document.addEventListener("DOMContentLoaded",completed);window.addEventListener("load",completed)}var access=function(elems,fn,key,value,chainable,emptyGet,raw){var i=0,len=elems.length,bulk=key==null;if(jQuery.type(key)==="object"){chainable=true;for(i in key){access(elems,fn,i,key[i],true,emptyGet,raw)}}else if(value!==undefined){chainable=true;if(!jQuery.isFunction(value)){raw=true}if(bulk){if(raw){fn.call(elems,value);fn=null}else{bulk=fn;fn=function(elem,key,value){return bulk.call(jQuery(elem),value)}}}if(fn){for(;i<len;i++){fn(elems[i],key,raw?value:value.call(elems[i],i,fn(elems[i],key)))}}}if(chainable){return elems}if(bulk){return fn.call(elems)}return len?fn(elems[0],key):emptyGet};var acceptData=function(owner){return owner.nodeType===1||owner.nodeType===9||!+owner.nodeType};function Data(){this.expando=jQuery.expando+Data.uid++}Data.uid=1;Data.prototype={cache:function(owner){var value=owner[this.expando];if(!value){value={};if(acceptData(owner)){if(owner.nodeType){owner[this.expando]=value}else{Object.defineProperty(owner,this.expando,{value:value,configurable:true})}}}return value},set:function(owner,data,value){var prop,cache=this.cache(owner);if(typeof data==="string"){cache[jQuery.camelCase(data)]=value}else{for(prop in data){cache[jQuery.camelCase(prop)]=data[prop]}}return cache},get:function(owner,key){return key===undefined?this.cache(owner):owner[this.expando]&&owner[this.expando][jQuery.camelCase(key)]},access:function(owner,key,value){if(key===undefined||key&&typeof key==="string"&&value===undefined){return this.get(owner,key)}this.set(owner,key,value);return value!==undefined?value:key},remove:function(owner,key){var i,cache=owner[this.expando];if(cache===undefined){return}if(key!==undefined){if(Array.isArray(key)){key=key.map(jQuery.camelCase)}else{key=jQuery.camelCase(key);key=key in cache?[key]:key.match(rnothtmlwhite)||[]}i=key.length;while(i--){delete cache[key[i]]}}if(key===undefined||jQuery.isEmptyObject(cache)){if(owner.nodeType){owner[this.expando]=undefined}else{delete owner[this.expando]}}},hasData:function(owner){var cache=owner[this.expando];return cache!==undefined&&!jQuery.isEmptyObject(cache)}};var dataPriv=new Data;var dataUser=new Data;var rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/[A-Z]/g;function getData(data){if(data==="true"){return true}if(data==="false"){return false}if(data==="null"){return null}if(data===+data+""){return+data}if(rbrace.test(data)){return JSON.parse(data)}return data}function dataAttr(elem,key,data){var name;if(data===undefined&&elem.nodeType===1){name="data-"+key.replace(rmultiDash,"-$&").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=getData(data)}catch(e){}dataUser.set(elem,key,data)}else{data=undefined}}return data}jQuery.extend({hasData:function(elem){return dataUser.hasData(elem)||dataPriv.hasData(elem)},data:function(elem,name,data){return dataUser.access(elem,name,data)},removeData:function(elem,name){dataUser.remove(elem,name)},_data:function(elem,name,data){return dataPriv.access(elem,name,data)},_removeData:function(elem,name){dataPriv.remove(elem,name)}});jQuery.fn.extend({data:function(key,value){var i,name,data,elem=this[0],attrs=elem&&elem.attributes;if(key===undefined){if(this.length){data=dataUser.get(elem);if(elem.nodeType===1&&!dataPriv.get(elem,"hasDataAttrs")){i=attrs.length;while(i--){if(attrs[i]){name=attrs[i].name;if(name.indexOf("data-")===0){name=jQuery.camelCase(name.slice(5));dataAttr(elem,name,data[name])}}}dataPriv.set(elem,"hasDataAttrs",true)}}return data}if(typeof key==="object"){return this.each(function(){dataUser.set(this,key)})}return access(this,function(value){var data;if(elem&&value===undefined){data=dataUser.get(elem,key);if(data!==undefined){return data}data=dataAttr(elem,key);if(data!==undefined){return data}return}this.each(function(){dataUser.set(this,key,value)})},null,value,arguments.length>1,null,true)},removeData:function(key){return this.each(function(){dataUser.remove(this,key)})}});jQuery.extend({queue:function(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=dataPriv.get(elem,type);if(data){if(!queue||Array.isArray(data)){queue=dataPriv.access(elem,type,jQuery.makeArray(data))}else{queue.push(data)}}return queue||[]}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),startLength=queue.length,fn=queue.shift(),hooks=jQuery._queueHooks(elem,type),next=function(){jQuery.dequeue(elem,type)};if(fn==="inprogress"){fn=queue.shift();startLength--}if(fn){if(type==="fx"){queue.unshift("inprogress")}delete hooks.stop;fn.call(elem,next,hooks)}if(!startLength&&hooks){hooks.empty.fire()}},_queueHooks:function(elem,type){var key=type+"queueHooks";return dataPriv.get(elem,key)||dataPriv.access(elem,key,{empty:jQuery.Callbacks("once memory").add(function(){dataPriv.remove(elem,[type+"queue",key])})})}});jQuery.fn.extend({queue:function(type,data){var setter=2;if(typeof type!=="string"){data=type;type="fx";setter--}if(arguments.length<setter){return jQuery.queue(this[0],type)}return data===undefined?this:this.each(function(){var queue=jQuery.queue(this,type,data);jQuery._queueHooks(this,type);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type)}})},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)})},clearQueue:function(type){return this.queue(type||"fx",[])},promise:function(type,obj){var tmp,count=1,defer=jQuery.Deferred(),elements=this,i=this.length,resolve=function(){if(!--count){defer.resolveWith(elements,[elements])}};if(typeof type!=="string"){obj=type;type=undefined}type=type||"fx";while(i--){tmp=dataPriv.get(elements[i],type+"queueHooks");if(tmp&&tmp.empty){count++;tmp.empty.add(resolve)}}resolve();return defer.promise(obj)}});var pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;var rcssNum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i");var cssExpand=["Top","Right","Bottom","Left"];var isHiddenWithinTree=function(elem,el){elem=el||elem;return elem.style.display==="none"||elem.style.display===""&&jQuery.contains(elem.ownerDocument,elem)&&jQuery.css(elem,"display")==="none"};var swap=function(elem,options,callback,args){var ret,name,old={};for(name in options){old[name]=elem.style[name];elem.style[name]=options[name]}ret=callback.apply(elem,args||[]);for(name in options){elem.style[name]=old[name]}return ret};function adjustCSS(elem,prop,valueParts,tween){var adjusted,scale=1,maxIterations=20,currentValue=tween?function(){return tween.cur()}:function(){return jQuery.css(elem,prop,"")},initial=currentValue(),unit=valueParts&&valueParts[3]||(jQuery.cssNumber[prop]?"":"px"),initialInUnit=(jQuery.cssNumber[prop]||unit!=="px"&&+initial)&&rcssNum.exec(jQuery.css(elem,prop));if(initialInUnit&&initialInUnit[3]!==unit){unit=unit||initialInUnit[3];valueParts=valueParts||[];initialInUnit=+initial||1;do{scale=scale||".5";initialInUnit=initialInUnit/scale;jQuery.style(elem,prop,initialInUnit+unit)}while(scale!==(scale=currentValue()/initial)&&scale!==1&&--maxIterations)}if(valueParts){initialInUnit=+initialInUnit||+initial||0;adjusted=valueParts[1]?initialInUnit+(valueParts[1]+1)*valueParts[2]:+valueParts[2];if(tween){tween.unit=unit;tween.start=initialInUnit;tween.end=adjusted}}return adjusted}var defaultDisplayMap={};function getDefaultDisplay(elem){var temp,doc=elem.ownerDocument,nodeName=elem.nodeName,display=defaultDisplayMap[nodeName];if(display){return display}temp=doc.body.appendChild(doc.createElement(nodeName));display=jQuery.css(temp,"display");temp.parentNode.removeChild(temp);if(display==="none"){display="block"}defaultDisplayMap[nodeName]=display;return display}function showHide(elements,show){var display,elem,values=[],index=0,length=elements.length;for(;index<length;index++){elem=elements[index];if(!elem.style){continue}display=elem.style.display;if(show){if(display==="none"){values[index]=dataPriv.get(elem,"display")||null;if(!values[index]){elem.style.display=""}}if(elem.style.display===""&&isHiddenWithinTree(elem)){values[index]=getDefaultDisplay(elem)}}else{if(display!=="none"){values[index]="none";dataPriv.set(elem,"display",display)}}}for(index=0;index<length;index++){if(values[index]!=null){elements[index].style.display=values[index]}}return elements}jQuery.fn.extend({show:function(){return showHide(this,true)},hide:function(){return showHide(this)},toggle:function(state){if(typeof state==="boolean"){return state?this.show():this.hide()}return this.each(function(){if(isHiddenWithinTree(this)){jQuery(this).show()}else{jQuery(this).hide()}})}});var rcheckableType=/^(?:checkbox|radio)$/i;var rtagName=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i;var rscriptType=/^$|\/(?:java|ecma)script/i;var wrapMap={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;function getAll(context,tag){var ret;if(typeof context.getElementsByTagName!=="undefined"){ret=context.getElementsByTagName(tag||"*")}else if(typeof context.querySelectorAll!=="undefined"){ret=context.querySelectorAll(tag||"*")}else{ret=[]}if(tag===undefined||tag&&nodeName(context,tag)){return jQuery.merge([context],ret)}return ret}function setGlobalEval(elems,refElements){var i=0,l=elems.length;for(;i<l;i++){dataPriv.set(elems[i],"globalEval",!refElements||dataPriv.get(refElements[i],"globalEval"))}}var rhtml=/<|&#?\w+;/;function buildFragment(elems,context,scripts,selection,ignored){var elem,tmp,tag,wrap,contains,j,fragment=context.createDocumentFragment(),nodes=[],i=0,l=elems.length;for(;i<l;i++){elem=elems[i];if(elem||elem===0){if(jQuery.type(elem)==="object"){jQuery.merge(nodes,elem.nodeType?[elem]:elem)}else if(!rhtml.test(elem)){nodes.push(context.createTextNode(elem))}else{tmp=tmp||fragment.appendChild(context.createElement("div"));tag=(rtagName.exec(elem)||["",""])[1].toLowerCase();wrap=wrapMap[tag]||wrapMap._default;tmp.innerHTML=wrap[1]+jQuery.htmlPrefilter(elem)+wrap[2];j=wrap[0];while(j--){tmp=tmp.lastChild}jQuery.merge(nodes,tmp.childNodes);tmp=fragment.firstChild;tmp.textContent=""}}}fragment.textContent="";i=0;while(elem=nodes[i++]){if(selection&&jQuery.inArray(elem,selection)>-1){if(ignored){ignored.push(elem)}continue}contains=jQuery.contains(elem.ownerDocument,elem);tmp=getAll(fragment.appendChild(elem),"script");if(contains){setGlobalEval(tmp)}if(scripts){j=0;while(elem=tmp[j++]){if(rscriptType.test(elem.type||"")){scripts.push(elem)}}}}return fragment}(function(){var fragment=document.createDocumentFragment(),div=fragment.appendChild(document.createElement("div")),input=document.createElement("input");input.setAttribute("type","radio");input.setAttribute("checked","checked");input.setAttribute("name","t");div.appendChild(input);support.checkClone=div.cloneNode(true).cloneNode(true).lastChild.checked;div.innerHTML="<textarea>x</textarea>";support.noCloneChecked=!!div.cloneNode(true).lastChild.defaultValue})();var documentElement=document.documentElement;var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return true}function returnFalse(){return false}function safeActiveElement(){try{return document.activeElement}catch(err){}}function on(elem,types,selector,data,fn,one){var origFn,type;if(typeof types==="object"){if(typeof selector!=="string"){data=data||selector;selector=undefined}for(type in types){on(elem,type,selector,data,types[type],one)}return elem}if(data==null&&fn==null){fn=selector;data=selector=undefined}else if(fn==null){if(typeof selector==="string"){fn=data;data=undefined}else{fn=data;data=selector;selector=undefined}}if(fn===false){fn=returnFalse}else if(!fn){return elem}if(one===1){origFn=fn;fn=function(event){jQuery().off(event);return origFn.apply(this,arguments)};fn.guid=origFn.guid||(origFn.guid=jQuery.guid++)}return elem.each(function(){jQuery.event.add(this,types,fn,data,selector)})}jQuery.event={global:{},add:function(elem,types,handler,data,selector){var handleObjIn,eventHandle,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.get(elem);if(!elemData){return}if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.selector}if(selector){jQuery.find.matchesSelector(documentElement,selector)}if(!handler.guid){handler.guid=jQuery.guid++}if(!(events=elemData.events)){events=elemData.events={}}if(!(eventHandle=elemData.handle)){eventHandle=elemData.handle=function(e){return typeof jQuery!=="undefined"&&jQuery.event.triggered!==e.type?jQuery.event.dispatch.apply(elem,arguments):undefined}}types=(types||"").match(rnothtmlwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;special=jQuery.event.special[type]||{};handleObj=jQuery.extend({type:type,origType:origType,data:data,handler:handler,guid:handler.guid,selector:selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn);if(!(handlers=events[type])){handlers=events[type]=[];handlers.delegateCount=0;if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle)}}}if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid}}if(selector){handlers.splice(handlers.delegateCount++,0,handleObj)}else{handlers.push(handleObj)}jQuery.event.global[type]=true}},remove:function(elem,types,handler,selector,mappedTypes){var j,origCount,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.hasData(elem)&&dataPriv.get(elem);if(!elemData||!(events=elemData.events)){return}types=(types||"").match(rnothtmlwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true)}continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;handlers=events[type]||[];tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)");origCount=j=handlers.length;while(j--){handleObj=handlers[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!tmp||tmp.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){handlers.splice(j,1);if(handleObj.selector){handlers.delegateCount--}if(special.remove){special.remove.call(elem,handleObj)}}}if(origCount&&!handlers.length){if(!special.teardown||special.teardown.call(elem,namespaces,elemData.handle)===false){jQuery.removeEvent(elem,type,elemData.handle)}delete events[type]}}if(jQuery.isEmptyObject(events)){dataPriv.remove(elem,"handle events")}},dispatch:function(nativeEvent){var event=jQuery.event.fix(nativeEvent);var i,j,ret,matched,handleObj,handlerQueue,args=new Array(arguments.length),handlers=(dataPriv.get(this,"events")||{})[event.type]||[],special=jQuery.event.special[event.type]||{};args[0]=event;for(i=1;i<arguments.length;i++){args[i]=arguments[i]}event.delegateTarget=this;if(special.preDispatch&&special.preDispatch.call(this,event)===false){return}handlerQueue=jQuery.event.handlers.call(this,event,handlers);i=0;while((matched=handlerQueue[i++])&&!event.isPropagationStopped()){event.currentTarget=matched.elem;j=0;while((handleObj=matched.handlers[j++])&&!event.isImmediatePropagationStopped()){if(!event.rnamespace||event.rnamespace.test(handleObj.namespace)){event.handleObj=handleObj;event.data=handleObj.data;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){if((event.result=ret)===false){event.preventDefault();event.stopPropagation()}}}}}if(special.postDispatch){special.postDispatch.call(this,event)}return event.result},handlers:function(event,handlers){var i,handleObj,sel,matchedHandlers,matchedSelectors,handlerQueue=[],delegateCount=handlers.delegateCount,cur=event.target;if(delegateCount&&cur.nodeType&&!(event.type==="click"&&event.button>=1)){for(;cur!==this;cur=cur.parentNode||this){if(cur.nodeType===1&&!(event.type==="click"&&cur.disabled===true)){matchedHandlers=[];matchedSelectors={};for(i=0;i<delegateCount;i++){handleObj=handlers[i];sel=handleObj.selector+" ";if(matchedSelectors[sel]===undefined){matchedSelectors[sel]=handleObj.needsContext?jQuery(sel,this).index(cur)>-1:jQuery.find(sel,this,null,[cur]).length}if(matchedSelectors[sel]){matchedHandlers.push(handleObj)}}if(matchedHandlers.length){handlerQueue.push({elem:cur,handlers:matchedHandlers})}}}}cur=this;if(delegateCount<handlers.length){handlerQueue.push({elem:cur,handlers:handlers.slice(delegateCount)})}return handlerQueue},addProp:function(name,hook){Object.defineProperty(jQuery.Event.prototype,name,{enumerable:true,configurable:true,get:jQuery.isFunction(hook)?function(){if(this.originalEvent){return hook(this.originalEvent)}}:function(){if(this.originalEvent){return this.originalEvent[name]}},set:function(value){Object.defineProperty(this,name,{enumerable:true,configurable:true,writable:true,value:value})}})},fix:function(originalEvent){return originalEvent[jQuery.expando]?originalEvent:new jQuery.Event(originalEvent)},special:{load:{noBubble:true},focus:{trigger:function(){if(this!==safeActiveElement()&&this.focus){this.focus();return false}},delegateType:"focusin"},blur:{trigger:function(){if(this===safeActiveElement()&&this.blur){this.blur();return false}},delegateType:"focusout"},click:{trigger:function(){if(this.type==="checkbox"&&this.click&&nodeName(this,"input")){this.click();return false}},_default:function(event){return nodeName(event.target,"a")}},beforeunload:{postDispatch:function(event){if(event.result!==undefined&&event.originalEvent){event.originalEvent.returnValue=event.result}}}}};jQuery.removeEvent=function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle)}};jQuery.Event=function(src,props){if(!(this instanceof jQuery.Event)){return new jQuery.Event(src,props)}if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=src.defaultPrevented||src.defaultPrevented===undefined&&src.returnValue===false?returnTrue:returnFalse;this.target=src.target&&src.target.nodeType===3?src.target.parentNode:src.target;this.currentTarget=src.currentTarget;this.relatedTarget=src.relatedTarget}else{this.type=src}if(props){jQuery.extend(this,props)}this.timeStamp=src&&src.timeStamp||jQuery.now();this[jQuery.expando]=true};jQuery.Event.prototype={constructor:jQuery.Event,isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,isSimulated:false,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue;if(e&&!this.isSimulated){e.preventDefault()}},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue;if(e&&!this.isSimulated){e.stopPropagation()}},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue;if(e&&!this.isSimulated){e.stopImmediatePropagation()}this.stopPropagation()}};jQuery.each({altKey:true,bubbles:true,cancelable:true,changedTouches:true,ctrlKey:true,detail:true,eventPhase:true,metaKey:true,pageX:true,pageY:true,shiftKey:true,view:true,char:true,charCode:true,key:true,keyCode:true,button:true,buttons:true,clientX:true,clientY:true,offsetX:true,offsetY:true,pointerId:true,pointerType:true,screenX:true,screenY:true,targetTouches:true,toElement:true,touches:true,which:function(event){var button=event.button;if(event.which==null&&rkeyEvent.test(event.type)){return event.charCode!=null?event.charCode:event.keyCode}if(!event.which&&button!==undefined&&rmouseEvent.test(event.type)){if(button&1){return 1}if(button&2){return 3}if(button&4){return 2}return 0}return event.which}},jQuery.event.addProp);jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(orig,fix){jQuery.event.special[orig]={delegateType:fix,bindType:fix,handle:function(event){var ret,target=this,related=event.relatedTarget,handleObj=event.handleObj;if(!related||related!==target&&!jQuery.contains(target,related)){event.type=handleObj.origType;ret=handleObj.handler.apply(this,arguments);event.type=fix}return ret}}});jQuery.fn.extend({on:function(types,selector,data,fn){return on(this,types,selector,data,fn)},one:function(types,selector,data,fn){return on(this,types,selector,data,fn,1)},off:function(types,selector,fn){var handleObj,type;if(types&&types.preventDefault&&types.handleObj){handleObj=types.handleObj;jQuery(types.delegateTarget).off(handleObj.namespace?handleObj.origType+"."+handleObj.namespace:handleObj.origType,handleObj.selector,handleObj.handler);return this}if(typeof types==="object"){for(type in types){this.off(type,selector,types[type])}return this}if(selector===false||typeof selector==="function"){fn=selector;selector=undefined}if(fn===false){fn=returnFalse}return this.each(function(){jQuery.event.remove(this,types,fn,selector)})}});var rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,rnoInnerhtml=/<script|<style|<link/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function manipulationTarget(elem,content){if(nodeName(elem,"table")&&nodeName(content.nodeType!==11?content:content.firstChild,"tr")){return jQuery(">tbody",elem)[0]||elem}return elem}function disableScript(elem){elem.type=(elem.getAttribute("type")!==null)+"/"+elem.type;return elem}function restoreScript(elem){var match=rscriptTypeMasked.exec(elem.type);if(match){elem.type=match[1]}else{elem.removeAttribute("type")}return elem}function cloneCopyEvent(src,dest){var i,l,type,pdataOld,pdataCur,udataOld,udataCur,events;if(dest.nodeType!==1){return}if(dataPriv.hasData(src)){pdataOld=dataPriv.access(src);pdataCur=dataPriv.set(dest,pdataOld);events=pdataOld.events;if(events){delete pdataCur.handle;pdataCur.events={};for(type in events){for(i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type,events[type][i])}}}}if(dataUser.hasData(src)){udataOld=dataUser.access(src);udataCur=jQuery.extend({},udataOld);dataUser.set(dest,udataCur)}}function fixInput(src,dest){var nodeName=dest.nodeName.toLowerCase();if(nodeName==="input"&&rcheckableType.test(src.type)){dest.checked=src.checked}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue}}function domManip(collection,args,callback,ignored){args=concat.apply([],args);var fragment,first,scripts,hasScripts,node,doc,i=0,l=collection.length,iNoClone=l-1,value=args[0],isFunction=jQuery.isFunction(value);if(isFunction||l>1&&typeof value==="string"&&!support.checkClone&&rchecked.test(value)){return collection.each(function(index){var self=collection.eq(index);if(isFunction){args[0]=value.call(this,index,self.html())}domManip(self,args,callback,ignored)})}if(l){fragment=buildFragment(args,collection[0].ownerDocument,false,collection,ignored);first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first}if(first||ignored){scripts=jQuery.map(getAll(fragment,"script"),disableScript);hasScripts=scripts.length;for(;i<l;i++){node=fragment;if(i!==iNoClone){node=jQuery.clone(node,true,true);if(hasScripts){jQuery.merge(scripts,getAll(node,"script"))}}callback.call(collection[i],node,i)}if(hasScripts){doc=scripts[scripts.length-1].ownerDocument;jQuery.map(scripts,restoreScript);for(i=0;i<hasScripts;i++){node=scripts[i];if(rscriptType.test(node.type||"")&&!dataPriv.access(node,"globalEval")&&jQuery.contains(doc,node)){if(node.src){if(jQuery._evalUrl){jQuery._evalUrl(node.src)}}else{DOMEval(node.textContent.replace(rcleanScript,""),doc)}}}}}}return collection}function remove(elem,selector,keepData){var node,nodes=selector?jQuery.filter(selector,elem):elem,i=0;for(;(node=nodes[i])!=null;i++){if(!keepData&&node.nodeType===1){jQuery.cleanData(getAll(node))}if(node.parentNode){if(keepData&&jQuery.contains(node.ownerDocument,node)){setGlobalEval(getAll(node,"script"))}node.parentNode.removeChild(node)}}return elem}jQuery.extend({htmlPrefilter:function(html){return html.replace(rxhtmlTag,"<$1></$2>")},clone:function(elem,dataAndEvents,deepDataAndEvents){var i,l,srcElements,destElements,clone=elem.cloneNode(true),inPage=jQuery.contains(elem.ownerDocument,elem);if(!support.noCloneChecked&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){destElements=getAll(clone);srcElements=getAll(elem);for(i=0,l=srcElements.length;i<l;i++){fixInput(srcElements[i],destElements[i])}}if(dataAndEvents){if(deepDataAndEvents){srcElements=srcElements||getAll(elem);destElements=destElements||getAll(clone);for(i=0,l=srcElements.length;i<l;i++){cloneCopyEvent(srcElements[i],destElements[i])}}else{cloneCopyEvent(elem,clone)}}destElements=getAll(clone,"script");if(destElements.length>0){setGlobalEval(destElements,!inPage&&getAll(elem,"script"))}return clone},cleanData:function(elems){var data,elem,type,special=jQuery.event.special,i=0;for(;(elem=elems[i])!==undefined;i++){if(acceptData(elem)){if(data=elem[dataPriv.expando]){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type)}else{jQuery.removeEvent(elem,type,data.handle)}}}elem[dataPriv.expando]=undefined}if(elem[dataUser.expando]){elem[dataUser.expando]=undefined}}}}});jQuery.fn.extend({detach:function(selector){return remove(this,selector,true)},remove:function(selector){return remove(this,selector)},text:function(value){return access(this,function(value){return value===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){this.textContent=value}})},null,value,arguments.length)},append:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.appendChild(elem)}})},prepend:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.insertBefore(elem,target.firstChild)}})},before:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this)}})},after:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this.nextSibling)}})},empty:function(){var elem,i=0;for(;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.textContent=""}}return this},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents)})},html:function(value){return access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined&&elem.nodeType===1){return elem.innerHTML}if(typeof value==="string"&&!rnoInnerhtml.test(value)&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=jQuery.htmlPrefilter(value);try{for(;i<l;i++){elem=this[i]||{};if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.innerHTML=value}}elem=0}catch(e){}}if(elem){this.empty().append(value)}},null,value,arguments.length)},replaceWith:function(){var ignored=[];return domManip(this,arguments,function(elem){var parent=this.parentNode;if(jQuery.inArray(this,ignored)<0){jQuery.cleanData(getAll(this));if(parent){parent.replaceChild(elem,this)}}},ignored)}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var elems,ret=[],insert=jQuery(selector),last=insert.length-1,i=0;for(;i<=last;i++){elems=i===last?this:this.clone(true);jQuery(insert[i])[original](elems);push.apply(ret,elems.get())}return this.pushStack(ret)}});var rmargin=/^margin/;var rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i");var getStyles=function(elem){var view=elem.ownerDocument.defaultView;if(!view||!view.opener){view=window}return view.getComputedStyle(elem)};(function(){function computeStyleTests(){if(!div){return}div.style.cssText="box-sizing:border-box;"+"position:relative;display:block;"+"margin:auto;border:1px;padding:1px;"+"top:1%;width:50%";div.innerHTML="";documentElement.appendChild(container);var divStyle=window.getComputedStyle(div);pixelPositionVal=divStyle.top!=="1%";reliableMarginLeftVal=divStyle.marginLeft==="2px";boxSizingReliableVal=divStyle.width==="4px";div.style.marginRight="50%";pixelMarginRightVal=divStyle.marginRight==="4px";documentElement.removeChild(container);div=null}var pixelPositionVal,boxSizingReliableVal,pixelMarginRightVal,reliableMarginLeftVal,container=document.createElement("div"),div=document.createElement("div");if(!div.style){return}div.style.backgroundClip="content-box";div.cloneNode(true).style.backgroundClip="";support.clearCloneStyle=div.style.backgroundClip==="content-box";container.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;"+"padding:0;margin-top:1px;position:absolute";container.appendChild(div);jQuery.extend(support,{pixelPosition:function(){computeStyleTests();return pixelPositionVal},boxSizingReliable:function(){computeStyleTests();return boxSizingReliableVal},pixelMarginRight:function(){computeStyleTests();return pixelMarginRightVal},reliableMarginLeft:function(){computeStyleTests();return reliableMarginLeftVal}})})();function curCSS(elem,name,computed){var width,minWidth,maxWidth,ret,style=elem.style;computed=computed||getStyles(elem);if(computed){ret=computed.getPropertyValue(name)||computed[name];if(ret===""&&!jQuery.contains(elem.ownerDocument,elem)){ret=jQuery.style(elem,name)}if(!support.pixelMarginRight()&&rnumnonpx.test(ret)&&rmargin.test(name)){width=style.width;minWidth=style.minWidth;maxWidth=style.maxWidth;style.minWidth=style.maxWidth=style.width=ret;ret=computed.width;style.width=width;style.minWidth=minWidth;style.maxWidth=maxWidth}}return ret!==undefined?ret+"":ret}function addGetHookIf(conditionFn,hookFn){return{get:function(){if(conditionFn()){delete this.get;return}return(this.get=hookFn).apply(this,arguments)}}}var rdisplayswap=/^(none|table(?!-c[ea]).+)/,rcustomProp=/^--/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","Moz","ms"],emptyStyle=document.createElement("div").style;function vendorPropName(name){if(name in emptyStyle){return name}var capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name}}}function finalPropName(name){var ret=jQuery.cssProps[name];if(!ret){ret=jQuery.cssProps[name]=vendorPropName(name)||name}return ret}function setPositiveNumber(elem,value,subtract){var matches=rcssNum.exec(value);return matches?Math.max(0,matches[2]-(subtract||0))+(matches[3]||"px"):value}function augmentWidthOrHeight(elem,name,extra,isBorderBox,styles){var i,val=0;if(extra===(isBorderBox?"border":"content")){i=4}else{i=name==="width"?1:0}for(;i<4;i+=2){if(extra==="margin"){val+=jQuery.css(elem,extra+cssExpand[i],true,styles)}if(isBorderBox){if(extra==="content"){val-=jQuery.css(elem,"padding"+cssExpand[i],true,styles)}if(extra!=="margin"){val-=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}}else{val+=jQuery.css(elem,"padding"+cssExpand[i],true,styles);if(extra!=="padding"){val+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}}}return val}function getWidthOrHeight(elem,name,extra){var valueIsBorderBox,styles=getStyles(elem),val=curCSS(elem,name,styles),isBorderBox=jQuery.css(elem,"boxSizing",false,styles)==="border-box";if(rnumnonpx.test(val)){return val}valueIsBorderBox=isBorderBox&&(support.boxSizingReliable()||val===elem.style[name]);if(val==="auto"){val=elem["offset"+name[0].toUpperCase()+name.slice(1)]}val=parseFloat(val)||0;return val+augmentWidthOrHeight(elem,name,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles)+"px"}jQuery.extend({cssHooks:{opacity:{get:function(elem,computed){if(computed){var ret=curCSS(elem,"opacity");return ret===""?"1":ret}}}},cssNumber:{animationIterationCount:true,columnCount:true,fillOpacity:true,flexGrow:true,flexShrink:true,fontWeight:true,lineHeight:true,opacity:true,order:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{float:"cssFloat"},style:function(elem,name,value,extra){if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return}var ret,type,hooks,origName=jQuery.camelCase(name),isCustomProp=rcustomProp.test(name),style=elem.style;if(!isCustomProp){name=finalPropName(origName)}hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(value!==undefined){type=typeof value;if(type==="string"&&(ret=rcssNum.exec(value))&&ret[1]){value=adjustCSS(elem,name,ret);type="number"}if(value==null||value!==value){return}if(type==="number"){value+=ret&&ret[3]||(jQuery.cssNumber[origName]?"":"px")}if(!support.clearCloneStyle&&value===""&&name.indexOf("background")===0){style[name]="inherit"}if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value,extra))!==undefined){if(isCustomProp){style.setProperty(name,value)}else{style[name]=value}}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret}return style[name]}},css:function(elem,name,extra,styles){var val,num,hooks,origName=jQuery.camelCase(name),isCustomProp=rcustomProp.test(name);if(!isCustomProp){name=finalPropName(origName)}hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(hooks&&"get"in hooks){val=hooks.get(elem,true,extra)}if(val===undefined){val=curCSS(elem,name,styles)}if(val==="normal"&&name in cssNormalTransform){val=cssNormalTransform[name]}if(extra===""||extra){num=parseFloat(val);return extra===true||isFinite(num)?num||0:val}return val}});jQuery.each(["height","width"],function(i,name){jQuery.cssHooks[name]={get:function(elem,computed,extra){if(computed){return rdisplayswap.test(jQuery.css(elem,"display"))&&(!elem.getClientRects().length||!elem.getBoundingClientRect().width)?swap(elem,cssShow,function(){return getWidthOrHeight(elem,name,extra)}):getWidthOrHeight(elem,name,extra)}},set:function(elem,value,extra){var matches,styles=extra&&getStyles(elem),subtract=extra&&augmentWidthOrHeight(elem,name,extra,jQuery.css(elem,"boxSizing",false,styles)==="border-box",styles);if(subtract&&(matches=rcssNum.exec(value))&&(matches[3]||"px")!=="px"){elem.style[name]=value;value=jQuery.css(elem,name)}return setPositiveNumber(elem,value,subtract)}}});jQuery.cssHooks.marginLeft=addGetHookIf(support.reliableMarginLeft,function(elem,computed){if(computed){return(parseFloat(curCSS(elem,"marginLeft"))||elem.getBoundingClientRect().left-swap(elem,{marginLeft:0},function(){return elem.getBoundingClientRect().left}))+"px"}});jQuery.each({margin:"",padding:"",border:"Width"},function(prefix,suffix){jQuery.cssHooks[prefix+suffix]={expand:function(value){var i=0,expanded={},parts=typeof value==="string"?value.split(" "):[value];for(;i<4;i++){expanded[prefix+cssExpand[i]+suffix]=parts[i]||parts[i-2]||parts[0]}return expanded}};if(!rmargin.test(prefix)){jQuery.cssHooks[prefix+suffix].set=setPositiveNumber}});jQuery.fn.extend({css:function(name,value){return access(this,function(elem,name,value){var styles,len,map={},i=0;if(Array.isArray(name)){styles=getStyles(elem);len=name.length;for(;i<len;i++){map[name[i]]=jQuery.css(elem,name[i],false,styles)}return map}return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name)},name,value,arguments.length>1)}});function Tween(elem,options,prop,end,easing){return new Tween.prototype.init(elem,options,prop,end,easing)}jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function(elem,options,prop,end,easing,unit){this.elem=elem;this.prop=prop;this.easing=easing||jQuery.easing._default;this.options=options;this.start=this.now=this.cur();this.end=end;this.unit=unit||(jQuery.cssNumber[prop]?"":"px")},cur:function(){var hooks=Tween.propHooks[this.prop];return hooks&&hooks.get?hooks.get(this):Tween.propHooks._default.get(this)},run:function(percent){var eased,hooks=Tween.propHooks[this.prop];if(this.options.duration){this.pos=eased=jQuery.easing[this.easing](percent,this.options.duration*percent,0,1,this.options.duration)}else{this.pos=eased=percent}this.now=(this.end-this.start)*eased+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this)}if(hooks&&hooks.set){hooks.set(this)}else{Tween.propHooks._default.set(this)}return this}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function(tween){var result;if(tween.elem.nodeType!==1||tween.elem[tween.prop]!=null&&tween.elem.style[tween.prop]==null){return tween.elem[tween.prop]}result=jQuery.css(tween.elem,tween.prop,"");return!result||result==="auto"?0:result},set:function(tween){if(jQuery.fx.step[tween.prop]){jQuery.fx.step[tween.prop](tween)}else if(tween.elem.nodeType===1&&(tween.elem.style[jQuery.cssProps[tween.prop]]!=null||jQuery.cssHooks[tween.prop])){jQuery.style(tween.elem,tween.prop,tween.now+tween.unit)}else{tween.elem[tween.prop]=tween.now}}}};Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(tween){if(tween.elem.nodeType&&tween.elem.parentNode){tween.elem[tween.prop]=tween.now}}};jQuery.easing={linear:function(p){return p},swing:function(p){return.5-Math.cos(p*Math.PI)/2},_default:"swing"};jQuery.fx=Tween.prototype.init;jQuery.fx.step={};var fxNow,inProgress,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;function schedule(){if(inProgress){if(document.hidden===false&&window.requestAnimationFrame){window.requestAnimationFrame(schedule)}else{window.setTimeout(schedule,jQuery.fx.interval)}jQuery.fx.tick()}}function createFxNow(){window.setTimeout(function(){fxNow=undefined});return fxNow=jQuery.now()}function genFx(type,includeWidth){var which,i=0,attrs={height:type};includeWidth=includeWidth?1:0;for(;i<4;i+=2-includeWidth){which=cssExpand[i];attrs["margin"+which]=attrs["padding"+which]=type}if(includeWidth){attrs.opacity=attrs.width=type}return attrs}function createTween(value,prop,animation){var tween,collection=(Animation.tweeners[prop]||[]).concat(Animation.tweeners["*"]),index=0,length=collection.length;for(;index<length;index++){if(tween=collection[index].call(animation,prop,value)){return tween}}}function defaultPrefilter(elem,props,opts){var prop,value,toggle,hooks,oldfire,propTween,restoreDisplay,display,isBox="width"in props||"height"in props,anim=this,orig={},style=elem.style,hidden=elem.nodeType&&isHiddenWithinTree(elem),dataShow=dataPriv.get(elem,"fxshow");if(!opts.queue){hooks=jQuery._queueHooks(elem,"fx");if(hooks.unqueued==null){hooks.unqueued=0;oldfire=hooks.empty.fire;hooks.empty.fire=function(){if(!hooks.unqueued){oldfire()}}}hooks.unqueued++;anim.always(function(){anim.always(function(){hooks.unqueued--;if(!jQuery.queue(elem,"fx").length){hooks.empty.fire()}})})}for(prop in props){value=props[prop];if(rfxtypes.test(value)){delete props[prop];toggle=toggle||value==="toggle";if(value===(hidden?"hide":"show")){if(value==="show"&&dataShow&&dataShow[prop]!==undefined){hidden=true}else{continue}}orig[prop]=dataShow&&dataShow[prop]||jQuery.style(elem,prop)}}propTween=!jQuery.isEmptyObject(props);if(!propTween&&jQuery.isEmptyObject(orig)){return}if(isBox&&elem.nodeType===1){opts.overflow=[style.overflow,style.overflowX,style.overflowY];restoreDisplay=dataShow&&dataShow.display;if(restoreDisplay==null){restoreDisplay=dataPriv.get(elem,"display")}display=jQuery.css(elem,"display");if(display==="none"){if(restoreDisplay){display=restoreDisplay}else{showHide([elem],true);restoreDisplay=elem.style.display||restoreDisplay;display=jQuery.css(elem,"display");showHide([elem])}}if(display==="inline"||display==="inline-block"&&restoreDisplay!=null){if(jQuery.css(elem,"float")==="none"){if(!propTween){anim.done(function(){style.display=restoreDisplay});if(restoreDisplay==null){display=style.display;restoreDisplay=display==="none"?"":display}}style.display="inline-block"}}}if(opts.overflow){style.overflow="hidden";anim.always(function(){style.overflow=opts.overflow[0];style.overflowX=opts.overflow[1];style.overflowY=opts.overflow[2]})}propTween=false;for(prop in orig){if(!propTween){if(dataShow){if("hidden"in dataShow){hidden=dataShow.hidden}}else{dataShow=dataPriv.access(elem,"fxshow",{display:restoreDisplay})}if(toggle){dataShow.hidden=!hidden}if(hidden){showHide([elem],true)}anim.done(function(){if(!hidden){showHide([elem])}dataPriv.remove(elem,"fxshow");for(prop in orig){jQuery.style(elem,prop,orig[prop])}})}propTween=createTween(hidden?dataShow[prop]:0,prop,anim);if(!(prop in dataShow)){dataShow[prop]=propTween.start;if(hidden){propTween.end=propTween.start;propTween.start=0}}}}function propFilter(props,specialEasing){var index,name,easing,value,hooks;for(index in props){name=jQuery.camelCase(index);easing=specialEasing[name];value=props[index];if(Array.isArray(value)){easing=value[1];value=props[index]=value[0]}if(index!==name){props[name]=value;delete props[index]}hooks=jQuery.cssHooks[name];if(hooks&&"expand"in hooks){value=hooks.expand(value);delete props[name];for(index in value){if(!(index in props)){props[index]=value[index];specialEasing[index]=easing}}}else{specialEasing[name]=easing}}}function Animation(elem,properties,options){var result,stopped,index=0,length=Animation.prefilters.length,deferred=jQuery.Deferred().always(function(){delete tick.elem}),tick=function(){if(stopped){return false}var currentTime=fxNow||createFxNow(),remaining=Math.max(0,animation.startTime+animation.duration-currentTime),temp=remaining/animation.duration||0,percent=1-temp,index=0,length=animation.tweens.length;for(;index<length;index++){animation.tweens[index].run(percent)}deferred.notifyWith(elem,[animation,percent,remaining]);if(percent<1&&length){return remaining}if(!length){deferred.notifyWith(elem,[animation,1,0])}deferred.resolveWith(elem,[animation]);return false},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(true,{specialEasing:{},easing:jQuery.easing._default},options),originalProperties:properties,originalOptions:options,startTime:fxNow||createFxNow(),duration:options.duration,tweens:[],createTween:function(prop,end){var tween=jQuery.Tween(elem,animation.opts,prop,end,animation.opts.specialEasing[prop]||animation.opts.easing);animation.tweens.push(tween);return tween},stop:function(gotoEnd){var index=0,length=gotoEnd?animation.tweens.length:0;if(stopped){return this}stopped=true;for(;index<length;index++){animation.tweens[index].run(1)}if(gotoEnd){deferred.notifyWith(elem,[animation,1,0]);deferred.resolveWith(elem,[animation,gotoEnd])}else{deferred.rejectWith(elem,[animation,gotoEnd])}return this}}),props=animation.props;propFilter(props,animation.opts.specialEasing);for(;index<length;index++){result=Animation.prefilters[index].call(animation,elem,props,animation.opts);if(result){if(jQuery.isFunction(result.stop)){jQuery._queueHooks(animation.elem,animation.opts.queue).stop=jQuery.proxy(result.stop,result)}return result}}jQuery.map(props,createTween,animation);if(jQuery.isFunction(animation.opts.start)){animation.opts.start.call(elem,animation)}animation.progress(animation.opts.progress).done(animation.opts.done,animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);jQuery.fx.timer(jQuery.extend(tick,{elem:elem,anim:animation,queue:animation.opts.queue}));return animation}jQuery.Animation=jQuery.extend(Animation,{tweeners:{"*":[function(prop,value){var tween=this.createTween(prop,value);adjustCSS(tween.elem,prop,rcssNum.exec(value),tween);return tween}]},tweener:function(props,callback){if(jQuery.isFunction(props)){callback=props;props=["*"]}else{props=props.match(rnothtmlwhite)}var prop,index=0,length=props.length;for(;index<length;index++){prop=props[index];Animation.tweeners[prop]=Animation.tweeners[prop]||[];Animation.tweeners[prop].unshift(callback)}},prefilters:[defaultPrefilter],prefilter:function(callback,prepend){if(prepend){Animation.prefilters.unshift(callback)}else{Animation.prefilters.push(callback)}}});jQuery.speed=function(speed,easing,fn){var opt=speed&&typeof speed==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};if(jQuery.fx.off){opt.duration=0}else{if(typeof opt.duration!=="number"){if(opt.duration in jQuery.fx.speeds){opt.duration=jQuery.fx.speeds[opt.duration]}else{opt.duration=jQuery.fx.speeds._default}}}if(opt.queue==null||opt.queue===true){opt.queue="fx"}opt.old=opt.complete;opt.complete=function(){if(jQuery.isFunction(opt.old)){opt.old.call(this)}if(opt.queue){jQuery.dequeue(this,opt.queue)}};return opt};jQuery.fn.extend({fadeTo:function(speed,to,easing,callback){return this.filter(isHiddenWithinTree).css("opacity",0).show().end().animate({opacity:to},speed,easing,callback)},animate:function(prop,speed,easing,callback){var empty=jQuery.isEmptyObject(prop),optall=jQuery.speed(speed,easing,callback),doAnimation=function(){var anim=Animation(this,jQuery.extend({},prop),optall);if(empty||dataPriv.get(this,"finish")){anim.stop(true)}};doAnimation.finish=doAnimation;return empty||optall.queue===false?this.each(doAnimation):this.queue(optall.queue,doAnimation)},stop:function(type,clearQueue,gotoEnd){var stopQueue=function(hooks){var stop=hooks.stop;delete hooks.stop;stop(gotoEnd)};if(typeof type!=="string"){gotoEnd=clearQueue;clearQueue=type;type=undefined}if(clearQueue&&type!==false){this.queue(type||"fx",[])}return this.each(function(){var dequeue=true,index=type!=null&&type+"queueHooks",timers=jQuery.timers,data=dataPriv.get(this);if(index){if(data[index]&&data[index].stop){stopQueue(data[index])}}else{for(index in data){if(data[index]&&data[index].stop&&rrun.test(index)){stopQueue(data[index])}}}for(index=timers.length;index--;){if(timers[index].elem===this&&(type==null||timers[index].queue===type)){timers[index].anim.stop(gotoEnd);dequeue=false;timers.splice(index,1)}}if(dequeue||!gotoEnd){jQuery.dequeue(this,type)}})},finish:function(type){if(type!==false){type=type||"fx"}return this.each(function(){var index,data=dataPriv.get(this),queue=data[type+"queue"],hooks=data[type+"queueHooks"],timers=jQuery.timers,length=queue?queue.length:0;data.finish=true;jQuery.queue(this,type,[]);if(hooks&&hooks.stop){hooks.stop.call(this,true)}for(index=timers.length;index--;){if(timers[index].elem===this&&timers[index].queue===type){timers[index].anim.stop(true);timers.splice(index,1)}}for(index=0;index<length;index++){if(queue[index]&&queue[index].finish){queue[index].finish.call(this)}}delete data.finish})}});jQuery.each(["toggle","show","hide"],function(i,name){var cssFn=jQuery.fn[name];jQuery.fn[name]=function(speed,easing,callback){return speed==null||typeof speed==="boolean"?cssFn.apply(this,arguments):this.animate(genFx(name,true),speed,easing,callback)}});jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback)}});jQuery.timers=[];jQuery.fx.tick=function(){var timer,i=0,timers=jQuery.timers;fxNow=jQuery.now();for(;i<timers.length;i++){timer=timers[i];if(!timer()&&timers[i]===timer){timers.splice(i--,1)}}if(!timers.length){jQuery.fx.stop()}fxNow=undefined};jQuery.fx.timer=function(timer){jQuery.timers.push(timer);jQuery.fx.start()};jQuery.fx.interval=13;jQuery.fx.start=function(){if(inProgress){return}inProgress=true;schedule()};jQuery.fx.stop=function(){inProgress=null};jQuery.fx.speeds={slow:600,fast:200,_default:400};jQuery.fn.delay=function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(next,hooks){var timeout=window.setTimeout(next,time);hooks.stop=function(){window.clearTimeout(timeout)}})};(function(){var input=document.createElement("input"),select=document.createElement("select"),opt=select.appendChild(document.createElement("option"));input.type="checkbox";support.checkOn=input.value!=="";support.optSelected=opt.selected;input=document.createElement("input");input.value="t";input.type="radio";support.radioValue=input.value==="t"})();var boolHook,attrHandle=jQuery.expr.attrHandle;jQuery.fn.extend({attr:function(name,value){return access(this,jQuery.attr,name,value,arguments.length>1)},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name)})}});jQuery.extend({attr:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return}if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value)}if(nType!==1||!jQuery.isXMLDoc(elem)){hooks=jQuery.attrHooks[name.toLowerCase()]||(jQuery.expr.match.bool.test(name)?boolHook:undefined)}if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return}if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}elem.setAttribute(name,value+"");return value}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}ret=jQuery.find.attr(elem,name);return ret==null?undefined:ret},attrHooks:{type:{set:function(elem,value){if(!support.radioValue&&value==="radio"&&nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val}return value}}}},removeAttr:function(elem,value){var name,i=0,attrNames=value&&value.match(rnothtmlwhite);if(attrNames&&elem.nodeType===1){while(name=attrNames[i++]){elem.removeAttribute(name)}}}});boolHook={set:function(elem,value,name){if(value===false){jQuery.removeAttr(elem,name)}else{elem.setAttribute(name,name)}return name}};jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(i,name){var getter=attrHandle[name]||jQuery.find.attr;attrHandle[name]=function(elem,name,isXML){var ret,handle,lowercaseName=name.toLowerCase();if(!isXML){handle=attrHandle[lowercaseName];attrHandle[lowercaseName]=ret;ret=getter(elem,name,isXML)!=null?lowercaseName:null;attrHandle[lowercaseName]=handle}return ret}});var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(name,value){return access(this,jQuery.prop,name,value,arguments.length>1)},removeProp:function(name){return this.each(function(){delete this[jQuery.propFix[name]||name]})}});jQuery.extend({prop:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return}if(nType!==1||!jQuery.isXMLDoc(elem)){name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name]}if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}return elem[name]=value}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}return elem[name]},propHooks:{tabIndex:{get:function(elem){var tabindex=jQuery.find.attr(elem,"tabindex");if(tabindex){return parseInt(tabindex,10)}if(rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href){return 0}return-1}}},propFix:{for:"htmlFor",class:"className"}});if(!support.optSelected){jQuery.propHooks.selected={get:function(elem){var parent=elem.parentNode;if(parent&&parent.parentNode){parent.parentNode.selectedIndex}return null},set:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex}}}}}jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this});function stripAndCollapse(value){var tokens=value.match(rnothtmlwhite)||[];return tokens.join(" ")}function getClass(elem){return elem.getAttribute&&elem.getAttribute("class")||""}jQuery.fn.extend({addClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,getClass(this)))})}if(typeof value==="string"&&value){classes=value.match(rnothtmlwhite)||[];while(elem=this[i++]){curValue=getClass(elem);cur=elem.nodeType===1&&" "+stripAndCollapse(curValue)+" ";if(cur){j=0;while(clazz=classes[j++]){if(cur.indexOf(" "+clazz+" ")<0){cur+=clazz+" "}}finalValue=stripAndCollapse(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue)}}}}return this},removeClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,getClass(this)))})}if(!arguments.length){return this.attr("class","")}if(typeof value==="string"&&value){classes=value.match(rnothtmlwhite)||[];while(elem=this[i++]){curValue=getClass(elem);cur=elem.nodeType===1&&" "+stripAndCollapse(curValue)+" ";if(cur){j=0;while(clazz=classes[j++]){while(cur.indexOf(" "+clazz+" ")>-1){cur=cur.replace(" "+clazz+" "," ")}}finalValue=stripAndCollapse(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue)}}}}return this},toggleClass:function(value,stateVal){var type=typeof value;if(typeof stateVal==="boolean"&&type==="string"){return stateVal?this.addClass(value):this.removeClass(value)}if(jQuery.isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,getClass(this),stateVal),stateVal)})}return this.each(function(){var className,i,self,classNames;if(type==="string"){i=0;self=jQuery(this);classNames=value.match(rnothtmlwhite)||[];while(className=classNames[i++]){if(self.hasClass(className)){self.removeClass(className)}else{self.addClass(className)}}}else if(value===undefined||type==="boolean"){className=getClass(this);if(className){dataPriv.set(this,"__className__",className)}if(this.setAttribute){this.setAttribute("class",className||value===false?"":dataPriv.get(this,"__className__")||"")}}})},hasClass:function(selector){var className,elem,i=0;className=" "+selector+" ";while(elem=this[i++]){if(elem.nodeType===1&&(" "+stripAndCollapse(getClass(elem))+" ").indexOf(className)>-1){return true}}return false}});var rreturn=/\r/g;jQuery.fn.extend({val:function(value){var hooks,ret,isFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.type]||jQuery.valHooks[elem.nodeName.toLowerCase()];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret}ret=elem.value;if(typeof ret==="string"){return ret.replace(rreturn,"")}return ret==null?"":ret}return}isFunction=jQuery.isFunction(value);return this.each(function(i){var val;if(this.nodeType!==1){return}if(isFunction){val=value.call(this,i,jQuery(this).val())}else{val=value}if(val==null){val=""}else if(typeof val==="number"){val+=""}else if(Array.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+""})}hooks=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val}})}});jQuery.extend({valHooks:{option:{get:function(elem){var val=jQuery.find.attr(elem,"value");return val!=null?val:stripAndCollapse(jQuery.text(elem))}},select:{get:function(elem){var value,option,i,options=elem.options,index=elem.selectedIndex,one=elem.type==="select-one",values=one?null:[],max=one?index+1:options.length;if(index<0){i=max}else{i=one?index:0}for(;i<max;i++){option=options[i];if((option.selected||i===index)&&!option.disabled&&(!option.parentNode.disabled||!nodeName(option.parentNode,"optgroup"))){value=jQuery(option).val();if(one){return value}values.push(value)}}return values},set:function(elem,value){var optionSet,option,options=elem.options,values=jQuery.makeArray(value),i=options.length;while(i--){option=options[i];if(option.selected=jQuery.inArray(jQuery.valHooks.option.get(option),values)>-1){optionSet=true}}if(!optionSet){elem.selectedIndex=-1}return values}}}});jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(elem,value){if(Array.isArray(value)){return elem.checked=jQuery.inArray(jQuery(elem).val(),value)>-1}}};if(!support.checkOn){jQuery.valHooks[this].get=function(elem){return elem.getAttribute("value")===null?"on":elem.value}}});var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/;jQuery.extend(jQuery.event,{trigger:function(event,data,elem,onlyHandlers){var i,cur,tmp,bubbleType,ontype,handle,special,eventPath=[elem||document],type=hasOwn.call(event,"type")?event.type:event,namespaces=hasOwn.call(event,"namespace")?event.namespace.split("."):[];cur=tmp=elem=elem||document;if(elem.nodeType===3||elem.nodeType===8){return}if(rfocusMorph.test(type+jQuery.event.triggered)){return}if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();namespaces.sort()}ontype=type.indexOf(":")<0&&"on"+type;event=event[jQuery.expando]?event:new jQuery.Event(type,typeof event==="object"&&event);event.isTrigger=onlyHandlers?2:3;event.namespace=namespaces.join(".");event.rnamespace=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;event.result=undefined;if(!event.target){event.target=elem}data=data==null?[event]:jQuery.makeArray(data,[event]);special=jQuery.event.special[type]||{};if(!onlyHandlers&&special.trigger&&special.trigger.apply(elem,data)===false){return}if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){bubbleType=special.delegateType||type;if(!rfocusMorph.test(bubbleType+type)){cur=cur.parentNode}for(;cur;cur=cur.parentNode){eventPath.push(cur);tmp=cur}if(tmp===(elem.ownerDocument||document)){eventPath.push(tmp.defaultView||tmp.parentWindow||window)}}i=0;while((cur=eventPath[i++])&&!event.isPropagationStopped()){event.type=i>1?bubbleType:special.bindType||type;handle=(dataPriv.get(cur,"events")||{})[event.type]&&dataPriv.get(cur,"handle");if(handle){handle.apply(cur,data)}handle=ontype&&cur[ontype];if(handle&&handle.apply&&acceptData(cur)){event.result=handle.apply(cur,data);if(event.result===false){event.preventDefault()}}}event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(eventPath.pop(),data)===false)&&acceptData(elem)){if(ontype&&jQuery.isFunction(elem[type])&&!jQuery.isWindow(elem)){tmp=elem[ontype];if(tmp){elem[ontype]=null}jQuery.event.triggered=type;elem[type]();jQuery.event.triggered=undefined;if(tmp){elem[ontype]=tmp}}}}return event.result},simulate:function(type,elem,event){var e=jQuery.extend(new jQuery.Event,event,{type:type,isSimulated:true});jQuery.event.trigger(e,null,elem)}});jQuery.fn.extend({trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this)})},triggerHandler:function(type,data){var elem=this[0];if(elem){return jQuery.event.trigger(type,data,elem,true)}}});jQuery.each(("blur focus focusin focusout resize scroll click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup contextmenu").split(" "),function(i,name){jQuery.fn[name]=function(data,fn){return arguments.length>0?this.on(name,null,data,fn):this.trigger(name)}});jQuery.fn.extend({hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver)}});support.focusin="onfocusin"in window;if(!support.focusin){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var handler=function(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event))};jQuery.event.special[fix]={setup:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix);if(!attaches){doc.addEventListener(orig,handler,true)}dataPriv.access(doc,fix,(attaches||0)+1)},teardown:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix)-1;if(!attaches){doc.removeEventListener(orig,handler,true);dataPriv.remove(doc,fix)}else{dataPriv.access(doc,fix,attaches)}}}})}var location=window.location;var nonce=jQuery.now();var rquery=/\?/;jQuery.parseXML=function(data){var xml;if(!data||typeof data!=="string"){return null}try{xml=(new window.DOMParser).parseFromString(data,"text/xml")}catch(e){xml=undefined}if(!xml||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data)}return xml};var rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;function buildParams(prefix,obj,traditional,add){var name;if(Array.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v)}else{buildParams(prefix+"["+(typeof v==="object"&&v!=null?i:"")+"]",v,traditional,add)}})}else if(!traditional&&jQuery.type(obj)==="object"){for(name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add)}}else{add(prefix,obj)}}jQuery.param=function(a,traditional){var prefix,s=[],add=function(key,valueOrFunction){var value=jQuery.isFunction(valueOrFunction)?valueOrFunction():valueOrFunction;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value==null?"":value)};if(Array.isArray(a)||a.jquery&&!jQuery.isPlainObject(a)){jQuery.each(a,function(){add(this.name,this.value)})}else{for(prefix in a){buildParams(prefix,a[prefix],traditional,add)}}return s.join("&")};jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var elements=jQuery.prop(this,"elements");return elements?jQuery.makeArray(elements):this}).filter(function(){var type=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(type)&&(this.checked||!rcheckableType.test(type))}).map(function(i,elem){var val=jQuery(this).val();if(val==null){return null}if(Array.isArray(val)){return jQuery.map(val,function(val){return{name:elem.name,value:val.replace(rCRLF,"\r\n")}})}return{name:elem.name,value:val.replace(rCRLF,"\r\n")}}).get()}});var r20=/%20/g,rhash=/#.*$/,rantiCache=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/gm,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href;function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*"}var dataType,i=0,dataTypes=dataTypeExpression.toLowerCase().match(rnothtmlwhite)||[];if(jQuery.isFunction(func)){while(dataType=dataTypes[i++]){if(dataType[0]==="+"){dataType=dataType.slice(1)||"*";(structure[dataType]=structure[dataType]||[]).unshift(func)}else{(structure[dataType]=structure[dataType]||[]).push(func)}}}}}function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR){var inspected={},seekingTransport=structure===transports;function inspect(dataType){var selected;inspected[dataType]=true;jQuery.each(structure[dataType]||[],function(_,prefilterOrFactory){var dataTypeOrTransport=prefilterOrFactory(options,originalOptions,jqXHR);if(typeof dataTypeOrTransport==="string"&&!seekingTransport&&!inspected[dataTypeOrTransport]){options.dataTypes.unshift(dataTypeOrTransport);inspect(dataTypeOrTransport);return false}else if(seekingTransport){return!(selected=dataTypeOrTransport)}});return selected}return inspect(options.dataTypes[0])||!inspected["*"]&&inspect("*")}function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key]}}if(deep){jQuery.extend(true,target,deep)}return target}function ajaxHandleResponses(s,jqXHR,responses){var ct,type,finalDataType,firstDataType,contents=s.contents,dataTypes=s.dataTypes;while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("Content-Type")}}if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break}}}if(dataTypes[0]in responses){finalDataType=dataTypes[0]}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break}if(!firstDataType){firstDataType=type}}finalDataType=finalDataType||firstDataType}if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType)}return responses[finalDataType]}}function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={},dataTypes=s.dataTypes.slice();if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv]}}current=dataTypes.shift();while(current){if(s.responseFields[current]){jqXHR[s.responseFields[current]]=response}if(!prev&&isSuccess&&s.dataFilter){response=s.dataFilter(response,s.dataType)}prev=current;current=dataTypes.shift();if(current){if(current==="*"){current=prev}else if(prev!=="*"&&prev!==current){conv=converters[prev+" "+current]||converters["* "+current];if(!conv){for(conv2 in converters){tmp=conv2.split(" ");if(tmp[1]===current){conv=converters[prev+" "+tmp[0]]||converters["* "+tmp[0]];if(conv){if(conv===true){conv=converters[conv2]}else if(converters[conv2]!==true){current=tmp[0];dataTypes.unshift(tmp[1])}break}}}}if(conv!==true){if(conv&&s.throws){response=conv(response)}else{try{response=conv(response)}catch(e){return{state:"parsererror",error:conv?e:"No conversion from "+prev+" to "+current}}}}}}}return{state:"success",data:response}}jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":JSON.parse,"text xml":jQuery.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(target,settings){return settings?ajaxExtend(ajaxExtend(target,jQuery.ajaxSettings),settings):ajaxExtend(jQuery.ajaxSettings,target)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined}options=options||{};var transport,cacheURL,responseHeadersString,responseHeaders,timeoutTimer,urlAnchor,completed,fireGlobals,i,uncached,s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=s.context&&(callbackContext.nodeType||callbackContext.jquery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),statusCode=s.statusCode||{},requestHeaders={},requestHeadersNames={},strAbort="canceled",jqXHR={readyState:0,getResponseHeader:function(key){var match;if(completed){if(!responseHeaders){responseHeaders={};while(match=rheaders.exec(responseHeadersString)){responseHeaders[match[1].toLowerCase()]=match[2]}}match=responseHeaders[key.toLowerCase()]}return match==null?null:match},getAllResponseHeaders:function(){return completed?responseHeadersString:null},setRequestHeader:function(name,value){if(completed==null){name=requestHeadersNames[name.toLowerCase()]=requestHeadersNames[name.toLowerCase()]||name;requestHeaders[name]=value}return this},overrideMimeType:function(type){if(completed==null){s.mimeType=type}return this},statusCode:function(map){var code;if(map){if(completed){jqXHR.always(map[jqXHR.status])}else{for(code in map){statusCode[code]=[statusCode[code],map[code]]}}}return this},abort:function(statusText){var finalText=statusText||strAbort;if(transport){transport.abort(finalText)}done(0,finalText);return this}};deferred.promise(jqXHR);s.url=((url||s.url||location.href)+"").replace(rprotocol,location.protocol+"//");s.type=options.method||options.type||s.method||s.type;s.dataTypes=(s.dataType||"*").toLowerCase().match(rnothtmlwhite)||[""];if(s.crossDomain==null){urlAnchor=document.createElement("a");try{urlAnchor.href=s.url;urlAnchor.href=urlAnchor.href;s.crossDomain=originAnchor.protocol+"//"+originAnchor.host!==urlAnchor.protocol+"//"+urlAnchor.host}catch(e){s.crossDomain=true}}if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional)}inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(completed){return jqXHR}fireGlobals=jQuery.event&&s.global;if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart")}s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);cacheURL=s.url.replace(rhash,"");if(!s.hasContent){uncached=s.url.slice(cacheURL.length);if(s.data){cacheURL+=(rquery.test(cacheURL)?"&":"?")+s.data;delete s.data}if(s.cache===false){cacheURL=cacheURL.replace(rantiCache,"$1");uncached=(rquery.test(cacheURL)?"&":"?")+"_="+nonce+++uncached}s.url=cacheURL+uncached}else if(s.data&&s.processData&&(s.contentType||"").indexOf("application/x-www-form-urlencoded")===0){s.data=s.data.replace(r20,"+")}if(s.ifModified){if(jQuery.lastModified[cacheURL]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[cacheURL])}if(jQuery.etag[cacheURL]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[cacheURL])}}if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType)}jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i])}if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||completed)){return jqXHR.abort()}strAbort="abort";completeDeferred.add(s.complete);jqXHR.done(s.success);jqXHR.fail(s.error);transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport")}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s])}if(completed){return jqXHR}if(s.async&&s.timeout>0){timeoutTimer=window.setTimeout(function(){jqXHR.abort("timeout")},s.timeout)}try{completed=false;transport.send(requestHeaders,done)}catch(e){if(completed){throw e}done(-1,e)}}function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;if(completed){return}completed=true;if(timeoutTimer){window.clearTimeout(timeoutTimer)}transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;isSuccess=status>=200&&status<300||status===304;if(responses){response=ajaxHandleResponses(s,jqXHR,responses)}response=ajaxConvert(s,response,jqXHR,isSuccess);if(isSuccess){if(s.ifModified){modified=jqXHR.getResponseHeader("Last-Modified");if(modified){jQuery.lastModified[cacheURL]=modified}modified=jqXHR.getResponseHeader("etag");if(modified){jQuery.etag[cacheURL]=modified}}if(status===204||s.type==="HEAD"){statusText="nocontent"}else if(status===304){statusText="notmodified"}else{statusText=response.state;success=response.data;error=response.error;isSuccess=!error}}else{error=statusText;if(status||!statusText){statusText="error";if(status<0){status=0}}}jqXHR.status=status;jqXHR.statusText=(nativeStatusText||statusText)+"";if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR])}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error])}jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger(isSuccess?"ajaxSuccess":"ajaxError",[jqXHR,s,isSuccess?success:error])}completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!--jQuery.active){jQuery.event.trigger("ajaxStop")}}}return jqXHR},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script")}});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined}return jQuery.ajax(jQuery.extend({url:url,type:method,dataType:type,data:data,success:callback},jQuery.isPlainObject(url)&&url))}});jQuery._evalUrl=function(url){return jQuery.ajax({url:url,type:"GET",dataType:"script",cache:true,async:false,global:false,throws:true})};jQuery.fn.extend({wrapAll:function(html){var wrap;if(this[0]){if(jQuery.isFunction(html)){html=html.call(this[0])}wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0])}wrap.map(function(){var elem=this;while(elem.firstElementChild){elem=elem.firstElementChild}return elem}).append(this)}return this},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i))})}return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html)}else{self.append(html)}})},wrap:function(html){var isFunction=jQuery.isFunction(html);return this.each(function(i){jQuery(this).wrapAll(isFunction?html.call(this,i):html)})},unwrap:function(selector){this.parent(selector).not("body").each(function(){jQuery(this).replaceWith(this.childNodes)});return this}});jQuery.expr.pseudos.hidden=function(elem){return!jQuery.expr.pseudos.visible(elem)};jQuery.expr.pseudos.visible=function(elem){return!!(elem.offsetWidth||elem.offsetHeight||elem.getClientRects().length)};jQuery.ajaxSettings.xhr=function(){try{return new window.XMLHttpRequest}catch(e){}};var xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();support.cors=!!xhrSupported&&"withCredentials"in xhrSupported;support.ajax=xhrSupported=!!xhrSupported;jQuery.ajaxTransport(function(options){var callback,errorCallback;if(support.cors||xhrSupported&&!options.crossDomain){return{send:function(headers,complete){var i,xhr=options.xhr();xhr.open(options.type,options.url,options.async,options.username,options.password);if(options.xhrFields){for(i in options.xhrFields){xhr[i]=options.xhrFields[i]}}if(options.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(options.mimeType)}if(!options.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest"}for(i in headers){xhr.setRequestHeader(i,headers[i])}callback=function(type){return function(){if(callback){callback=errorCallback=xhr.onload=xhr.onerror=xhr.onabort=xhr.onreadystatechange=null;if(type==="abort"){xhr.abort()}else if(type==="error"){if(typeof xhr.status!=="number"){complete(0,"error")}else{complete(xhr.status,xhr.statusText)}}else{complete(xhrSuccessStatus[xhr.status]||xhr.status,xhr.statusText,(xhr.responseType||"text")!=="text"||typeof xhr.responseText!=="string"?{binary:xhr.response}:{text:xhr.responseText},xhr.getAllResponseHeaders())}}}};xhr.onload=callback();errorCallback=xhr.onerror=callback("error");if(xhr.onabort!==undefined){xhr.onabort=errorCallback}else{xhr.onreadystatechange=function(){if(xhr.readyState===4){window.setTimeout(function(){if(callback){errorCallback()}})}}}callback=callback("abort");try{xhr.send(options.hasContent&&options.data||null)}catch(e){if(callback){throw e}}},abort:function(){if(callback){callback()}}}}});jQuery.ajaxPrefilter(function(s){if(s.crossDomain){s.contents.script=false}});jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, "+"application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(text){jQuery.globalEval(text);return text}}});jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false}if(s.crossDomain){s.type="GET"}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,callback;return{send:function(_,complete){script=jQuery("<script>").prop({charset:s.scriptCharset,src:s.url}).on("load error",callback=function(evt){script.remove();callback=null;if(evt){complete(evt.type==="error"?404:200,evt.type)}});document.head.appendChild(script[0])},abort:function(){if(callback){callback()}}}}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var callback=oldCallbacks.pop()||jQuery.expando+"_"+nonce++;this[callback]=true;return callback}});jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var callbackName,overwritten,responseContainer,jsonProp=s.jsonp!==false&&(rjsonp.test(s.url)?"url":typeof s.data==="string"&&(s.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&rjsonp.test(s.data)&&"data");if(jsonProp||s.dataTypes[0]==="jsonp"){callbackName=s.jsonpCallback=jQuery.isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback;if(jsonProp){s[jsonProp]=s[jsonProp].replace(rjsonp,"$1"+callbackName)}else if(s.jsonp!==false){s.url+=(rquery.test(s.url)?"&":"?")+s.jsonp+"="+callbackName}s.converters["script json"]=function(){if(!responseContainer){jQuery.error(callbackName+" was not called")}return responseContainer[0]};s.dataTypes[0]="json";overwritten=window[callbackName];window[callbackName]=function(){responseContainer=arguments};jqXHR.always(function(){if(overwritten===undefined){jQuery(window).removeProp(callbackName)}else{window[callbackName]=overwritten}if(s[callbackName]){s.jsonpCallback=originalSettings.jsonpCallback;oldCallbacks.push(callbackName)}if(responseContainer&&jQuery.isFunction(overwritten)){overwritten(responseContainer[0])}responseContainer=overwritten=undefined});return"script"}});support.createHTMLDocument=function(){var body=document.implementation.createHTMLDocument("").body;body.innerHTML="<form></form><form></form>";return body.childNodes.length===2}();jQuery.parseHTML=function(data,context,keepScripts){if(typeof data!=="string"){return[]}if(typeof context==="boolean"){keepScripts=context;context=false}var base,parsed,scripts;if(!context){if(support.createHTMLDocument){context=document.implementation.createHTMLDocument("");base=context.createElement("base");base.href=document.location.href;context.head.appendChild(base)}else{context=document}}parsed=rsingleTag.exec(data);scripts=!keepScripts&&[];if(parsed){return[context.createElement(parsed[1])]}parsed=buildFragment([data],context,scripts);if(scripts&&scripts.length){jQuery(scripts).remove()}return jQuery.merge([],parsed.childNodes)};jQuery.fn.load=function(url,params,callback){var selector,type,response,self=this,off=url.indexOf(" ");if(off>-1){selector=stripAndCollapse(url.slice(off));url=url.slice(0,off)}if(jQuery.isFunction(params)){callback=params;params=undefined}else if(params&&typeof params==="object"){type="POST"}if(self.length>0){jQuery.ajax({url:url,type:type||"GET",dataType:"html",data:params}).done(function(responseText){response=arguments;self.html(selector?jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector):responseText)}).always(callback&&function(jqXHR,status){self.each(function(){callback.apply(this,response||[jqXHR.responseText,status,jqXHR])})})}return this};jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(i,type){jQuery.fn[type]=function(fn){return this.on(type,fn)}});jQuery.expr.pseudos.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem}).length};jQuery.offset={setOffset:function(elem,options,i){var curPosition,curLeft,curCSSTop,curTop,curOffset,curCSSLeft,calculatePosition,position=jQuery.css(elem,"position"),curElem=jQuery(elem),props={};if(position==="static"){elem.style.position="relative"}curOffset=curElem.offset();curCSSTop=jQuery.css(elem,"top");curCSSLeft=jQuery.css(elem,"left");calculatePosition=(position==="absolute"||position==="fixed")&&(curCSSTop+curCSSLeft).indexOf("auto")>-1;if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0}if(jQuery.isFunction(options)){options=options.call(elem,i,jQuery.extend({},curOffset))}if(options.top!=null){props.top=options.top-curOffset.top+curTop}if(options.left!=null){props.left=options.left-curOffset.left+curLeft}if("using"in options){options.using.call(elem,props)}else{curElem.css(props)}}};jQuery.fn.extend({offset:function(options){if(arguments.length){return options===undefined?this:this.each(function(i){jQuery.offset.setOffset(this,options,i)})}var doc,docElem,rect,win,elem=this[0];if(!elem){return}if(!elem.getClientRects().length){return{top:0,left:0}}rect=elem.getBoundingClientRect();doc=elem.ownerDocument;docElem=doc.documentElement;win=doc.defaultView;return{top:rect.top+win.pageYOffset-docElem.clientTop,left:rect.left+win.pageXOffset-docElem.clientLeft}},position:function(){if(!this[0]){return}var offsetParent,offset,elem=this[0],parentOffset={top:0,left:0};if(jQuery.css(elem,"position")==="fixed"){offset=elem.getBoundingClientRect()}else{offsetParent=this.offsetParent();offset=this.offset();if(!nodeName(offsetParent[0],"html")){parentOffset=offsetParent.offset()}parentOffset={top:parentOffset.top+jQuery.css(offsetParent[0],"borderTopWidth",true),left:parentOffset.left+jQuery.css(offsetParent[0],"borderLeftWidth",true)}}return{top:offset.top-parentOffset.top-jQuery.css(elem,"marginTop",true),left:offset.left-parentOffset.left-jQuery.css(elem,"marginLeft",true)}},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent;while(offsetParent&&jQuery.css(offsetParent,"position")==="static"){offsetParent=offsetParent.offsetParent}return offsetParent||documentElement})}});jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(method,prop){var top="pageYOffset"===prop;jQuery.fn[method]=function(val){return access(this,function(elem,method,val){var win;if(jQuery.isWindow(elem)){win=elem}else if(elem.nodeType===9){win=elem.defaultView}if(val===undefined){return win?win[prop]:elem[method]}if(win){win.scrollTo(!top?val:win.pageXOffset,top?val:win.pageYOffset)}else{elem[method]=val}},method,val,arguments.length)}});jQuery.each(["top","left"],function(i,prop){jQuery.cssHooks[prop]=addGetHookIf(support.pixelPosition,function(elem,computed){if(computed){computed=curCSS(elem,prop);return rnumnonpx.test(computed)?jQuery(elem).position()[prop]+"px":computed}})});jQuery.each({Height:"height",Width:"width"},function(name,type){jQuery.each({padding:"inner"+name,content:type,"":"outer"+name},function(defaultExtra,funcName){jQuery.fn[funcName]=function(margin,value){var chainable=arguments.length&&(defaultExtra||typeof margin!=="boolean"),extra=defaultExtra||(margin===true||value===true?"margin":"border");return access(this,function(elem,type,value){var doc;if(jQuery.isWindow(elem)){return funcName.indexOf("outer")===0?elem["inner"+name]:elem.document.documentElement["client"+name]}if(elem.nodeType===9){doc=elem.documentElement;return Math.max(elem.body["scroll"+name],doc["scroll"+name],elem.body["offset"+name],doc["offset"+name],doc["client"+name])}return value===undefined?jQuery.css(elem,type,extra):jQuery.style(elem,type,value,extra)},type,chainable?margin:undefined,chainable)}})});jQuery.fn.extend({bind:function(types,data,fn){return this.on(types,null,data,fn)},unbind:function(types,fn){return this.off(types,null,fn)},delegate:function(selector,types,data,fn){return this.on(types,selector,data,fn)},undelegate:function(selector,types,fn){return arguments.length===1?this.off(selector,"**"):this.off(types,selector||"**",fn)}});jQuery.holdReady=function(hold){if(hold){jQuery.readyWait++}else{jQuery.ready(true)}};jQuery.isArray=Array.isArray;jQuery.parseJSON=JSON.parse;jQuery.nodeName=nodeName;if(typeof define==="function"&&define.amd){define("jquery",[],function(){return jQuery})}var _jQuery=window.jQuery,_$=window.$;jQuery.noConflict=function(deep){if(window.$===jQuery){window.$=_$}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery}return jQuery};if(!noGlobal){window.jQuery=window.$=jQuery}return jQuery});(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery)}})(function($){$.ui=$.ui||{};var version=$.ui.version="1.12.1";var widgetUuid=0;var widgetSlice=Array.prototype.slice;$.cleanData=function(orig){return function(elems){var events,elem,i;for(i=0;(elem=elems[i])!=null;i++){try{events=$._data(elem,"events");if(events&&events.remove){$(elem).triggerHandler("remove")}}catch(e){}}orig(elems)}}($.cleanData);$.widget=function(name,base,prototype){var existingConstructor,constructor,basePrototype;var proxiedPrototype={};var namespace=name.split(".")[0];name=name.split(".")[1];var fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget}if($.isArray(prototype)){prototype=$.extend.apply(null,[{}].concat(prototype))}$.expr[":"][fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName)};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){if(!this._createWidget){return new constructor(options,element)}if(arguments.length){this._createWidget(options,element)}};$.extend(constructor,existingConstructor,{version:prototype.version,_proto:$.extend({},prototype),_childConstructors:[]});basePrototype=new base;basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(!$.isFunction(value)){proxiedPrototype[prop]=value;return}proxiedPrototype[prop]=function(){function _super(){return base.prototype[prop].apply(this,arguments)}function _superApply(args){return base.prototype[prop].apply(this,args)}return function(){var __super=this._super;var __superApply=this._superApply;var returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue}}()});constructor.prototype=$.widget.extend(basePrototype,{widgetEventPrefix:existingConstructor?basePrototype.widgetEventPrefix||name:name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});if(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto)});delete existingConstructor._childConstructors}else{base._childConstructors.push(constructor)}$.widget.bridge(name,constructor);return constructor};$.widget.extend=function(target){var input=widgetSlice.call(arguments,1);var inputIndex=0;var inputLength=input.length;var key;var value;for(;inputIndex<inputLength;inputIndex++){for(key in input[inputIndex]){value=input[inputIndex][key];if(input[inputIndex].hasOwnProperty(key)&&value!==undefined){if($.isPlainObject(value)){target[key]=$.isPlainObject(target[key])?$.widget.extend({},target[key],value):$.widget.extend({},value)}else{target[key]=value}}}}return target};$.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$.fn[name]=function(options){var isMethodCall=typeof options==="string";var args=widgetSlice.call(arguments,1);var returnValue=this;if(isMethodCall){if(!this.length&&options==="instance"){returnValue=undefined}else{this.each(function(){var methodValue;var instance=$.data(this,fullName);if(options==="instance"){returnValue=instance;return false}if(!instance){return $.error("cannot call methods on "+name+" prior to initialization; "+"attempted to call method '"+options+"'")}if(!$.isFunction(instance[options])||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for "+name+" widget instance")}methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return false}})}}else{if(args.length){options=$.widget.extend.apply(null,[options].concat(args))}this.each(function(){var instance=$.data(this,fullName);if(instance){instance.option(options||{});if(instance._init){instance._init()}}else{$.data(this,fullName,new object(options,this))}})}return returnValue}};$.Widget=function(){};$.Widget._childConstructors=[];$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:false,create:null},_createWidget:function(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=widgetUuid++;this.eventNamespace="."+this.widgetName+this.uuid;this.bindings=$();this.hoverable=$();this.focusable=$();this.classesElementLookup={};if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function(event){if(event.target===element){this.destroy()}}});this.document=$(element.style?element.ownerDocument:element.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow)}this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this._create();if(this.options.disabled){this._setOptionDisabled(this.options.disabled)}this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function(){var that=this;this._destroy();$.each(this.classesElementLookup,function(key,value){that._removeClass(value,key)});this.element.off(this.eventNamespace).removeData(this.widgetFullName);this.widget().off(this.eventNamespace).removeAttr("aria-disabled");this.bindings.off(this.eventNamespace)},_destroy:$.noop,widget:function(){return this.element},option:function(key,value){var options=key;var parts;var curOption;var i;if(arguments.length===0){return $.widget.extend({},this.options)}if(typeof key==="string"){options={};parts=key.split(".");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i<parts.length-1;i++){curOption[parts[i]]=curOption[parts[i]]||{};curOption=curOption[parts[i]]}key=parts.pop();if(arguments.length===1){return curOption[key]===undefined?null:curOption[key]}curOption[key]=value}else{if(arguments.length===1){return this.options[key]===undefined?null:this.options[key]}options[key]=value}}this._setOptions(options);return this},_setOptions:function(options){var key;for(key in options){this._setOption(key,options[key])}return this},_setOption:function(key,value){if(key==="classes"){this._setOptionClasses(value)}this.options[key]=value;if(key==="disabled"){this._setOptionDisabled(value)}return this},_setOptionClasses:function(value){var classKey,elements,currentElements;for(classKey in value){currentElements=this.classesElementLookup[classKey];if(value[classKey]===this.options.classes[classKey]||!currentElements||!currentElements.length){continue}elements=$(currentElements.get());this._removeClass(currentElements,classKey);elements.addClass(this._classes({element:elements,keys:classKey,classes:value,add:true}))}},_setOptionDisabled:function(value){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!value);if(value){this._removeClass(this.hoverable,null,"ui-state-hover");this._removeClass(this.focusable,null,"ui-state-focus")}},enable:function(){return this._setOptions({disabled:false})},disable:function(){return this._setOptions({disabled:true})},_classes:function(options){var full=[];var that=this;options=$.extend({element:this.element,classes:this.options.classes||{}},options);function processClassString(classes,checkOption){var current,i;for(i=0;i<classes.length;i++){current=that.classesElementLookup[classes[i]]||$();if(options.add){current=$($.unique(current.get().concat(options.element.get())))}else{current=$(current.not(options.element).get())}that.classesElementLookup[classes[i]]=current;full.push(classes[i]);if(checkOption&&options.classes[classes[i]]){full.push(options.classes[classes[i]])}}}this._on(options.element,{remove:"_untrackClassesElement"});if(options.keys){processClassString(options.keys.match(/\S+/g)||[],true)}if(options.extra){processClassString(options.extra.match(/\S+/g)||[])}return full.join(" ")},_untrackClassesElement:function(event){var that=this;$.each(that.classesElementLookup,function(key,value){if($.inArray(event.target,value)!==-1){that.classesElementLookup[key]=$(value.not(event.target).get())}})},_removeClass:function(element,keys,extra){return this._toggleClass(element,keys,extra,false)},_addClass:function(element,keys,extra){return this._toggleClass(element,keys,extra,true)},_toggleClass:function(element,keys,extra,add){add=typeof add==="boolean"?add:extra;var shift=typeof element==="string"||element===null,options={extra:shift?keys:extra,keys:shift?element:keys,element:shift?this.element:element,add:add};options.element.toggleClass(this._classes(options),add);return this},_on:function(suppressDisabledCheck,element,handlers){var delegateElement;var instance=this;if(typeof suppressDisabledCheck!=="boolean"){handlers=element;element=suppressDisabledCheck;suppressDisabledCheck=false}if(!handlers){handlers=element;element=this.element;delegateElement=this.widget()}else{element=delegateElement=$(element);this.bindings=this.bindings.add(element)}$.each(handlers,function(event,handler){function handlerProxy(){if(!suppressDisabledCheck&&(instance.options.disabled===true||$(this).hasClass("ui-state-disabled"))){return}return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}if(typeof handler!=="string"){handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$.guid++}var match=event.match(/^([\w:-]*)\s*(.*)$/);var eventName=match[1]+instance.eventNamespace;var selector=match[2];if(selector){delegateElement.on(eventName,selector,handlerProxy)}else{element.on(eventName,handlerProxy)}})},_off:function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;element.off(eventName).off(eventName);this.bindings=$(this.bindings.not(element).get());this.focusable=$(this.focusable.not(element).get());this.hoverable=$(this.hoverable.not(element).get())},_delay:function(handler,delay){function handlerProxy(){return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}var instance=this;return setTimeout(handlerProxy,delay||0)},_hoverable:function(element){this.hoverable=this.hoverable.add(element);this._on(element,{mouseenter:function(event){this._addClass($(event.currentTarget),null,"ui-state-hover")},mouseleave:function(event){this._removeClass($(event.currentTarget),null,"ui-state-hover")}})},_focusable:function(element){this.focusable=this.focusable.add(element);this._on(element,{focusin:function(event){this._addClass($(event.currentTarget),null,"ui-state-focus")},focusout:function(event){this._removeClass($(event.currentTarget),null,"ui-state-focus")}})},_trigger:function(type,event,data){var prop,orig;var callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();event.target=this.element[0];orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop]}}}this.element.trigger(event,data);return!($.isFunction(callback)&&callback.apply(this.element[0],[event].concat(data))===false||event.isDefaultPrevented())}};$.each({show:"fadeIn",hide:"fadeOut"},function(method,defaultEffect){$.Widget.prototype["_"+method]=function(element,options,callback){if(typeof options==="string"){options={effect:options}}var hasOptions;var effectName=!options?method:options===true||typeof options==="number"?defaultEffect:options.effect||defaultEffect;options=options||{};if(typeof options==="number"){options={duration:options}}hasOptions=!$.isEmptyObject(options);options.complete=callback;if(options.delay){element.delay(options.delay)}if(hasOptions&&$.effects&&$.effects.effect[effectName]){element[method](options)}else if(effectName!==method&&element[effectName]){element[effectName](options.duration,options.easing,callback)}else{element.queue(function(next){$(this)[method]();if(callback){callback.call(element[0])}next()})}}});var widget=$.widget;(function(){var cachedScrollbarWidth,max=Math.max,abs=Math.abs,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\+\-]\d+(\.[\d]+)?%?/,rposition=/^\w+/,rpercent=/%$/,_position=$.fn.position;function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)]}function parseCss(element,property){return parseInt($.css(element,property),10)||0}function getDimensions(elem){var raw=elem[0];if(raw.nodeType===9){return{width:elem.width(),height:elem.height(),offset:{top:0,left:0}}}if($.isWindow(raw)){return{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}}}if(raw.preventDefault){return{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}}}return{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()}}$.position={scrollbarWidth:function(){if(cachedScrollbarWidth!==undefined){return cachedScrollbarWidth}var w1,w2,div=$("<div "+"style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>"+"<div style='height:100px;width:auto;'></div></div>"),innerDiv=div.children()[0];$("body").append(div);w1=innerDiv.offsetWidth;div.css("overflow","scroll");w2=innerDiv.offsetWidth;if(w1===w2){w2=div[0].clientWidth}div.remove();return cachedScrollbarWidth=w1-w2},getScrollInfo:function(within){var overflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX=overflowX==="scroll"||overflowX==="auto"&&within.width<within.element[0].scrollWidth,hasOverflowY=overflowY==="scroll"||overflowY==="auto"&&within.height<within.element[0].scrollHeight;return{width:hasOverflowY?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0}},getWithinInfo:function(element){var withinElement=$(element||window),isWindow=$.isWindow(withinElement[0]),isDocument=!!withinElement[0]&&withinElement[0].nodeType===9,hasOffset=!isWindow&&!isDocument;return{element:withinElement,isWindow:isWindow,isDocument:isDocument,offset:hasOffset?$(element).offset():{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:withinElement.outerWidth(),height:withinElement.outerHeight()}}};$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments)}options=$.extend({},options);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,dimensions,target=$(options.of),within=$.position.getWithinInfo(options.within),scrollInfo=$.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={};dimensions=getDimensions(target);if(target[0].preventDefault){options.at="left top"}targetWidth=dimensions.width;targetHeight=dimensions.height;targetOffset=dimensions.offset;basePosition=$.extend({},targetOffset);$.each(["my","at"],function(){var pos=(options[this]||"").split(" "),horizontalOffset,verticalOffset;if(pos.length===1){pos=rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"]}pos[0]=rhorizontal.test(pos[0])?pos[0]:"center";pos[1]=rvertical.test(pos[1])?pos[1]:"center";horizontalOffset=roffset.exec(pos[0]);verticalOffset=roffset.exec(pos[1]);offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0];options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]]});if(collision.length===1){collision[1]=collision[0]}if(options.at[0]==="right"){basePosition.left+=targetWidth}else if(options.at[0]==="center"){basePosition.left+=targetWidth/2}if(options.at[1]==="bottom"){basePosition.top+=targetHeight}else if(options.at[1]==="center"){basePosition.top+=targetHeight/2}atOffset=getOffsets(offsets.at,targetWidth,targetHeight);basePosition.left+=atOffset[0];basePosition.top+=atOffset[1];return this.each(function(){var collisionPosition,using,elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+scrollInfo.height,position=$.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());if(options.my[0]==="right"){position.left-=elemWidth}else if(options.my[0]==="center"){position.left-=elemWidth/2}if(options.my[1]==="bottom"){position.top-=elemHeight}else if(options.my[1]==="center"){position.top-=elemHeight/2}position.left+=myOffset[0];position.top+=myOffset[1];collisionPosition={marginLeft:marginLeft,marginTop:marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within:within,elem:elem})}});if(options.using){using=function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":left>0?"right":"center",vertical:bottom<0?"top":top>0?"bottom":"middle"};if(targetWidth<elemWidth&&abs(left+right)<targetWidth){feedback.horizontal="center"}if(targetHeight<elemHeight&&abs(top+bottom)<targetHeight){feedback.vertical="middle"}if(max(abs(left),abs(right))>max(abs(top),abs(bottom))){feedback.important="horizontal"}else{feedback.important="vertical"}options.using.call(this,props,feedback)}}elem.offset($.extend(position,{using:using}))})};$.ui.position={fit:{left:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;if(data.collisionWidth>outerWidth){if(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset;position.left+=overLeft-newOverRight}else if(overRight>0&&overLeft<=0){position.left=withinOffset}else{if(overLeft>overRight){position.left=withinOffset+outerWidth-data.collisionWidth}else{position.left=withinOffset}}}else if(overLeft>0){position.left+=overLeft}else if(overRight>0){position.left-=overRight}else{position.left=max(position.left-collisionPosLeft,position.left)}},top:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;if(data.collisionHeight>outerHeight){if(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset;position.top+=overTop-newOverBottom}else if(overBottom>0&&overTop<=0){position.top=withinOffset}else{if(overTop>overBottom){position.top=withinOffset+outerHeight-data.collisionHeight}else{position.top=withinOffset}}}else if(overTop>0){position.top+=overTop}else if(overBottom>0){position.top-=overBottom}else{position.top=max(position.top-collisionPosTop,position.top)}}},flip:{left:function(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:data.at[0]==="right"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset;if(newOverRight<0||newOverRight<abs(overLeft)){position.left+=myOffset+atOffset+offset}}else if(overRight>0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)<overRight){position.left+=myOffset+atOffset+offset}}},top:function(position,data){var within=data.within,withinOffset=within.offset.top+within.scrollTop,outerHeight=within.height,offsetTop=within.isWindow?within.scrollTop:within.offset.top,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=collisionPosTop-offsetTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop,top=data.my[1]==="top",myOffset=top?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:data.at[1]==="bottom"?-data.targetHeight:0,offset=-2*data.offset[1],newOverTop,newOverBottom;if(overTop<0){newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-withinOffset;if(newOverBottom<0||newOverBottom<abs(overTop)){position.top+=myOffset+atOffset+offset}}else if(overBottom>0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop;if(newOverTop>0||abs(newOverTop)<overBottom){position.top+=myOffset+atOffset+offset}}}},flipfit:{left:function(){$.ui.position.flip.left.apply(this,arguments);$.ui.position.fit.left.apply(this,arguments)},top:function(){$.ui.position.flip.top.apply(this,arguments);$.ui.position.fit.top.apply(this,arguments)}}}})();var position=$.ui.position;var data=$.extend($.expr[":"],{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName)}}):function(elem,i,match){return!!$.data(elem,match[3])}});var disableSelection=$.fn.extend({disableSelection:function(){var eventType="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(eventType+".ui-disableSelection",function(event){event.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var dataSpace="ui-effects-",dataSpaceStyle="ui-effects-style",dataSpaceAnimated="ui-effects-animated",jQuery=$;$.effects={effect:{}};(function(jQuery,undefined){var stepHooks="backgroundColor borderBottomColor borderLeftColor borderRightColor "+"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",rplusequals=/^([\-+])=\s*(\d+\.?\d*)/,stringParsers=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1],execResult[2],execResult[3],execResult[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1]*2.55,execResult[2]*2.55,execResult[3]*2.55,execResult[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(execResult){return[parseInt(execResult[1],16),parseInt(execResult[2],16),parseInt(execResult[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(execResult){return[parseInt(execResult[1]+execResult[1],16),parseInt(execResult[2]+execResult[2],16),parseInt(execResult[3]+execResult[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(execResult){return[execResult[1],execResult[2]/100,execResult[3]/100,execResult[4]]}}],color=jQuery.Color=function(color,green,blue,alpha){return new jQuery.Color.fn.parse(color,green,blue,alpha)},spaces={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},propTypes={byte:{floor:true,max:255},percent:{max:1},degrees:{mod:360,floor:true}},support=color.support={},supportElem=jQuery("<p>")[0],colors,each=jQuery.each;supportElem.style.cssText="background-color:rgba(1,1,1,.5)";support.rgba=supportElem.style.backgroundColor.indexOf("rgba")>-1;each(spaces,function(spaceName,space){space.cache="_"+spaceName;space.props.alpha={idx:3,type:"percent",def:1}});function clamp(value,prop,allowEmpty){var type=propTypes[prop.type]||{};if(value==null){return allowEmpty||!prop.def?null:prop.def}value=type.floor?~~value:parseFloat(value);if(isNaN(value)){return prop.def}if(type.mod){return(value+type.mod)%type.mod}return 0>value?0:type.max<value?type.max:value}function stringParse(string){var inst=color(),rgba=inst._rgba=[];string=string.toLowerCase();each(stringParsers,function(i,parser){var parsed,match=parser.re.exec(string),values=match&&parser.parse(match),spaceName=parser.space||"rgba";if(values){parsed=inst[spaceName](values);inst[spaces[spaceName].cache]=parsed[spaces[spaceName].cache];rgba=inst._rgba=parsed._rgba;return false}});if(rgba.length){if(rgba.join()==="0,0,0,0"){jQuery.extend(rgba,colors.transparent)}return inst}return colors[string]}color.fn=jQuery.extend(color.prototype,{parse:function(red,green,blue,alpha){if(red===undefined){this._rgba=[null,null,null,null];return this}if(red.jquery||red.nodeType){red=jQuery(red).css(green);green=undefined}var inst=this,type=jQuery.type(red),rgba=this._rgba=[];if(green!==undefined){red=[red,green,blue,alpha];type="array"}if(type==="string"){return this.parse(stringParse(red)||colors._default)}if(type==="array"){each(spaces.rgba.props,function(key,prop){rgba[prop.idx]=clamp(red[prop.idx],prop)});return this}if(type==="object"){if(red instanceof color){each(spaces,function(spaceName,space){if(red[space.cache]){inst[space.cache]=red[space.cache].slice()}})}else{each(spaces,function(spaceName,space){var cache=space.cache;each(space.props,function(key,prop){if(!inst[cache]&&space.to){if(key==="alpha"||red[key]==null){return}inst[cache]=space.to(inst._rgba)}inst[cache][prop.idx]=clamp(red[key],prop,true)});if(inst[cache]&&jQuery.inArray(null,inst[cache].slice(0,3))<0){inst[cache][3]=1;if(space.from){inst._rgba=space.from(inst[cache])}}})}return this}},is:function(compare){var is=color(compare),same=true,inst=this;each(spaces,function(_,space){var localCache,isCache=is[space.cache];if(isCache){localCache=inst[space.cache]||space.to&&space.to(inst._rgba)||[];each(space.props,function(_,prop){if(isCache[prop.idx]!=null){same=isCache[prop.idx]===localCache[prop.idx];return same}})}return same});return same},_space:function(){var used=[],inst=this;each(spaces,function(spaceName,space){if(inst[space.cache]){used.push(spaceName)}});return used.pop()},transition:function(other,distance){var end=color(other),spaceName=end._space(),space=spaces[spaceName],startColor=this.alpha()===0?color("transparent"):this,start=startColor[space.cache]||space.to(startColor._rgba),result=start.slice();end=end[space.cache];each(space.props,function(key,prop){var index=prop.idx,startValue=start[index],endValue=end[index],type=propTypes[prop.type]||{};if(endValue===null){return}if(startValue===null){result[index]=endValue}else{if(type.mod){if(endValue-startValue>type.mod/2){startValue+=type.mod}else if(startValue-endValue>type.mod/2){startValue-=type.mod}}result[index]=clamp((endValue-startValue)*distance+startValue,prop)}});return this[spaceName](result)},blend:function(opaque){if(this._rgba[3]===1){return this}var rgb=this._rgba.slice(),a=rgb.pop(),blend=color(opaque)._rgba;return color(jQuery.map(rgb,function(v,i){return(1-a)*blend[i]+a*v}))},toRgbaString:function(){var prefix="rgba(",rgba=jQuery.map(this._rgba,function(v,i){return v==null?i>2?1:0:v});if(rgba[3]===1){rgba.pop();prefix="rgb("}return prefix+rgba.join()+")"},toHslaString:function(){var prefix="hsla(",hsla=jQuery.map(this.hsla(),function(v,i){if(v==null){v=i>2?1:0}if(i&&i<3){v=Math.round(v*100)+"%"}return v});if(hsla[3]===1){hsla.pop();prefix="hsl("}return prefix+hsla.join()+")"},toHexString:function(includeAlpha){var rgba=this._rgba.slice(),alpha=rgba.pop();if(includeAlpha){rgba.push(~~(alpha*255))}return"#"+jQuery.map(rgba,function(v){v=(v||0).toString(16);return v.length===1?"0"+v:v}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}});color.fn.parse.prototype=color.fn;function hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6}if(h*2<1){return q}if(h*3<2){return p+(q-p)*(2/3-h)*6}return p}spaces.hsla.to=function(rgba){if(rgba[0]==null||rgba[1]==null||rgba[2]==null){return[null,null,null,rgba[3]]}var r=rgba[0]/255,g=rgba[1]/255,b=rgba[2]/255,a=rgba[3],max=Math.max(r,g,b),min=Math.min(r,g,b),diff=max-min,add=max+min,l=add*.5,h,s;if(min===max){h=0}else if(r===max){h=60*(g-b)/diff+360}else if(g===max){h=60*(b-r)/diff+120}else{h=60*(r-g)/diff+240}if(diff===0){s=0}else if(l<=.5){s=diff/add}else{s=diff/(2-add)}return[Math.round(h)%360,s,l,a==null?1:a]};spaces.hsla.from=function(hsla){if(hsla[0]==null||hsla[1]==null||hsla[2]==null){return[null,null,null,hsla[3]]}var h=hsla[0]/360,s=hsla[1],l=hsla[2],a=hsla[3],q=l<=.5?l*(1+s):l+s-l*s,p=2*l-q;return[Math.round(hue2rgb(p,q,h+1/3)*255),Math.round(hue2rgb(p,q,h)*255),Math.round(hue2rgb(p,q,h-1/3)*255),a]};each(spaces,function(spaceName,space){var props=space.props,cache=space.cache,to=space.to,from=space.from;color.fn[spaceName]=function(value){if(to&&!this[cache]){this[cache]=to(this._rgba)}if(value===undefined){return this[cache].slice()}var ret,type=jQuery.type(value),arr=type==="array"||type==="object"?value:arguments,local=this[cache].slice();each(props,function(key,prop){var val=arr[type==="object"?key:prop.idx];if(val==null){val=local[prop.idx]}local[prop.idx]=clamp(val,prop)});if(from){ret=color(from(local));ret[cache]=local;return ret}else{return color(local)}};each(props,function(key,prop){if(color.fn[key]){return}color.fn[key]=function(value){var vtype=jQuery.type(value),fn=key==="alpha"?this._hsla?"hsla":"rgba":spaceName,local=this[fn](),cur=local[prop.idx],match;if(vtype==="undefined"){return cur}if(vtype==="function"){value=value.call(this,cur);vtype=jQuery.type(value)}if(value==null&&prop.empty){return this}if(vtype==="string"){match=rplusequals.exec(value);if(match){value=cur+parseFloat(match[2])*(match[1]==="+"?1:-1)}}local[prop.idx]=value;return this[fn](local)}})});color.hook=function(hook){var hooks=hook.split(" ");each(hooks,function(i,hook){jQuery.cssHooks[hook]={set:function(elem,value){var parsed,curElem,backgroundColor="";if(value!=="transparent"&&(jQuery.type(value)!=="string"||(parsed=stringParse(value)))){value=color(parsed||value);if(!support.rgba&&value._rgba[3]!==1){curElem=hook==="backgroundColor"?elem.parentNode:elem;while((backgroundColor===""||backgroundColor==="transparent")&&curElem&&curElem.style){try{backgroundColor=jQuery.css(curElem,"backgroundColor");curElem=curElem.parentNode}catch(e){}}value=value.blend(backgroundColor&&backgroundColor!=="transparent"?backgroundColor:"_default")}value=value.toRgbaString()}try{elem.style[hook]=value}catch(e){}}};jQuery.fx.step[hook]=function(fx){if(!fx.colorInit){fx.start=color(fx.elem,hook);fx.end=color(fx.end);fx.colorInit=true}jQuery.cssHooks[hook].set(fx.elem,fx.start.transition(fx.end,fx.pos))}})};color.hook(stepHooks);jQuery.cssHooks.borderColor={expand:function(value){var expanded={};each(["Top","Right","Bottom","Left"],function(i,part){expanded["border"+part+"Color"]=value});return expanded}};colors=jQuery.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery);(function(){var classAnimationActions=["add","remove","toggle"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};$.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(_,prop){$.fx.step[prop]=function(fx){if(fx.end!=="none"&&!fx.setAttr||fx.pos===1&&!fx.setAttr){jQuery.style(fx.elem,prop,fx.end);fx.setAttr=true}}});function getElementStyles(elem){var key,len,style=elem.ownerDocument.defaultView?elem.ownerDocument.defaultView.getComputedStyle(elem,null):elem.currentStyle,styles={};if(style&&style.length&&style[0]&&style[style[0]]){len=style.length;while(len--){key=style[len];if(typeof style[key]==="string"){styles[$.camelCase(key)]=style[key]}}}else{for(key in style){if(typeof style[key]==="string"){styles[key]=style[key]}}}return styles}function styleDifference(oldStyle,newStyle){var diff={},name,value;for(name in newStyle){value=newStyle[name];if(oldStyle[name]!==value){if(!shorthandStyles[name]){if($.fx.step[name]||!isNaN(parseFloat(value))){diff[name]=value}}}}return diff}if(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}}$.effects.animateClass=function(value,duration,easing,callback){var o=$.speed(duration,easing,callback);return this.queue(function(){var animated=$(this),baseClass=animated.attr("class")||"",applyClassChange,allAnimations=o.children?animated.find("*").addBack():animated;allAnimations=allAnimations.map(function(){var el=$(this);return{el:el,start:getElementStyles(this)}});applyClassChange=function(){$.each(classAnimationActions,function(i,action){if(value[action]){animated[action+"Class"](value[action])}})};applyClassChange();allAnimations=allAnimations.map(function(){this.end=getElementStyles(this.el[0]);this.diff=styleDifference(this.start,this.end);return this});animated.attr("class",baseClass);allAnimations=allAnimations.map(function(){var styleInfo=this,dfd=$.Deferred(),opts=$.extend({},o,{queue:false,complete:function(){dfd.resolve(styleInfo)}});this.el.animate(this.diff,opts);return dfd.promise()});$.when.apply($,allAnimations.get()).done(function(){applyClassChange();$.each(arguments,function(){var el=this.el;$.each(this.diff,function(key){el.css(key,"")})});o.complete.call(animated[0])})})};$.fn.extend({addClass:function(orig){return function(classNames,speed,easing,callback){return speed?$.effects.animateClass.call(this,{add:classNames},speed,easing,callback):orig.apply(this,arguments)}}($.fn.addClass),removeClass:function(orig){return function(classNames,speed,easing,callback){return arguments.length>1?$.effects.animateClass.call(this,{remove:classNames},speed,easing,callback):orig.apply(this,arguments)}}($.fn.removeClass),toggleClass:function(orig){return function(classNames,force,speed,easing,callback){if(typeof force==="boolean"||force===undefined){if(!speed){return orig.apply(this,arguments)}else{return $.effects.animateClass.call(this,force?{add:classNames}:{remove:classNames},speed,easing,callback)}}else{return $.effects.animateClass.call(this,{toggle:classNames},force,speed,easing)}}}($.fn.toggleClass),switchClass:function(remove,add,speed,easing,callback){return $.effects.animateClass.call(this,{add:add,remove:remove},speed,easing,callback)}})})();(function(){if($.expr&&$.expr.filters&&$.expr.filters.animated){$.expr.filters.animated=function(orig){return function(elem){return!!$(elem).data(dataSpaceAnimated)||orig(elem)}}($.expr.filters.animated)}if($.uiBackCompat!==false){$.extend($.effects,{save:function(element,set){var i=0,length=set.length;for(;i<length;i++){if(set[i]!==null){element.data(dataSpace+set[i],element[0].style[set[i]])}}},restore:function(element,set){var val,i=0,length=set.length;for(;i<length;i++){if(set[i]!==null){val=element.data(dataSpace+set[i]);element.css(set[i],val)}}},setMode:function(el,mode){if(mode==="toggle"){mode=el.is(":hidden")?"show":"hide"}return mode},createWrapper:function(element){if(element.parent().is(".ui-effects-wrapper")){return element.parent()}var props={width:element.outerWidth(true),height:element.outerHeight(true),float:element.css("float")},wrapper=$("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),size={width:element.width(),height:element.height()},active=document.activeElement;try{active.id}catch(e){active=document.body}element.wrap(wrapper);if(element[0]===active||$.contains(element[0],active)){$(active).trigger("focus")}wrapper=element.parent();if(element.css("position")==="static"){wrapper.css({position:"relative"});element.css({position:"relative"})}else{$.extend(props,{position:element.css("position"),zIndex:element.css("z-index")});$.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]="auto"}});element.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}element.css(size);return wrapper.css(props).show()},removeWrapper:function(element){var active=document.activeElement;if(element.parent().is(".ui-effects-wrapper")){element.parent().replaceWith(element);if(element[0]===active||$.contains(element[0],active)){$(active).trigger("focus")}}return element}})}$.extend($.effects,{version:"1.12.1",define:function(name,mode,effect){if(!effect){effect=mode;mode="effect"}$.effects.effect[name]=effect;$.effects.effect[name].mode=mode;return effect},scaledDimensions:function(element,percent,direction){if(percent===0){return{height:0,width:0,outerHeight:0,outerWidth:0}}var x=direction!=="horizontal"?(percent||100)/100:1,y=direction!=="vertical"?(percent||100)/100:1;return{height:element.height()*y,width:element.width()*x,outerHeight:element.outerHeight()*y,outerWidth:element.outerWidth()*x}},clipToBox:function(animation){return{width:animation.clip.right-animation.clip.left,height:animation.clip.bottom-animation.clip.top,left:animation.clip.left,top:animation.clip.top}},unshift:function(element,queueLength,count){var queue=element.queue();if(queueLength>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queueLength,count)))}element.dequeue()},saveStyle:function(element){element.data(dataSpaceStyle,element[0].style.cssText)},restoreStyle:function(element){element[0].style.cssText=element.data(dataSpaceStyle)||"";element.removeData(dataSpaceStyle)},mode:function(element,mode){var hidden=element.is(":hidden");if(mode==="toggle"){mode=hidden?"show":"hide"}if(hidden?mode==="hide":mode==="show"){mode="none"}return mode},getBaseline:function(origin,original){var y,x;switch(origin[0]){case"top":y=0;break;case"middle":y=.5;break;case"bottom":y=1;break;default:y=origin[0]/original.height}switch(origin[1]){case"left":x=0;break;case"center":x=.5;break;case"right":x=1;break;default:x=origin[1]/original.width}return{x:x,y:y}},createPlaceholder:function(element){var placeholder,cssPosition=element.css("position"),position=element.position();element.css({marginTop:element.css("marginTop"),marginBottom:element.css("marginBottom"),marginLeft:element.css("marginLeft"),marginRight:element.css("marginRight")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight());if(/^(static|relative)/.test(cssPosition)){cssPosition="absolute";placeholder=$("<"+element[0].nodeName+">").insertAfter(element).css({display:/^(inline|ruby)/.test(element.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:element.css("marginTop"),marginBottom:element.css("marginBottom"),marginLeft:element.css("marginLeft"),marginRight:element.css("marginRight"),float:element.css("float")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight()).addClass("ui-effects-placeholder");element.data(dataSpace+"placeholder",placeholder)}element.css({position:cssPosition,left:position.left,top:position.top});return placeholder},removePlaceholder:function(element){var dataKey=dataSpace+"placeholder",placeholder=element.data(dataKey);if(placeholder){placeholder.remove();element.removeData(dataKey)}},cleanUp:function(element){$.effects.restoreStyle(element);$.effects.removePlaceholder(element)},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){var unit=element.cssUnit(x);if(unit[0]>0){value[x]=unit[0]*factor+unit[1]}});return value}});function _normalizeArguments(effect,options,speed,callback){if($.isPlainObject(effect)){options=effect;effect=effect.effect}effect={effect:effect};if(options==null){options={}}if($.isFunction(options)){callback=options;speed=null;options={}}if(typeof options==="number"||$.fx.speeds[options]){callback=speed;speed=options;options={}}if($.isFunction(speed)){callback=speed;speed=null}if(options){$.extend(effect,options)}speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed==="number"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect}function standardAnimationOption(option){if(!option||typeof option==="number"||$.fx.speeds[option]){return true}if(typeof option==="string"&&!$.effects.effect[option]){return true}if($.isFunction(option)){return true}if(typeof option==="object"&&!option.effect){return true}return false}$.fn.extend({effect:function(){var args=_normalizeArguments.apply(this,arguments),effectMethod=$.effects.effect[args.effect],defaultMode=effectMethod.mode,queue=args.queue,queueName=queue||"fx",complete=args.complete,mode=args.mode,modes=[],prefilter=function(next){var el=$(this),normalizedMode=$.effects.mode(el,mode)||defaultMode;el.data(dataSpaceAnimated,true);modes.push(normalizedMode);if(defaultMode&&(normalizedMode==="show"||normalizedMode===defaultMode&&normalizedMode==="hide")){el.show()}if(!defaultMode||normalizedMode!=="none"){$.effects.saveStyle(el)}if($.isFunction(next)){next()}};if($.fx.off||!effectMethod){if(mode){return this[mode](args.duration,complete)}else{return this.each(function(){if(complete){complete.call(this)}})}}function run(next){var elem=$(this);function cleanup(){elem.removeData(dataSpaceAnimated);$.effects.cleanUp(elem);if(args.mode==="hide"){elem.hide()}done()}function done(){if($.isFunction(complete)){complete.call(elem[0])}if($.isFunction(next)){next()}}args.mode=modes.shift();if($.uiBackCompat!==false&&!defaultMode){if(elem.is(":hidden")?mode==="hide":mode==="show"){elem[mode]();done()}else{effectMethod.call(elem[0],args,done)}}else{if(args.mode==="none"){elem[mode]();done()}else{effectMethod.call(elem[0],args,cleanup)}}}return queue===false?this.each(prefilter).each(run):this.queue(queueName,prefilter).queue(queueName,run)},show:function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="show";return this.effect.call(this,args)}}}($.fn.show),hide:function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="hide";return this.effect.call(this,args)}}}($.fn.hide),toggle:function(orig){return function(option){if(standardAnimationOption(option)||typeof option==="boolean"){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="toggle";return this.effect.call(this,args)}}}($.fn.toggle),cssUnit:function(key){var style=this.css(key),val=[];$.each(["em","px","%","pt"],function(i,unit){if(style.indexOf(unit)>0){val=[parseFloat(style),unit]}});return val},cssClip:function(clipObj){if(clipObj){return this.css("clip","rect("+clipObj.top+"px "+clipObj.right+"px "+clipObj.bottom+"px "+clipObj.left+"px)")}return parseClip(this.css("clip"),this)},transfer:function(options,done){var element=$(this),target=$(options.to),targetFixed=target.css("position")==="fixed",body=$("body"),fixTop=targetFixed?body.scrollTop():0,fixLeft=targetFixed?body.scrollLeft():0,endPosition=target.offset(),animation={top:endPosition.top-fixTop,left:endPosition.left-fixLeft,height:target.innerHeight(),width:target.innerWidth()},startPosition=element.offset(),transfer=$("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(options.className).css({top:startPosition.top-fixTop,left:startPosition.left-fixLeft,height:element.innerHeight(),width:element.innerWidth(),position:targetFixed?"fixed":"absolute"}).animate(animation,options.duration,options.easing,function(){transfer.remove();if($.isFunction(done)){done()}})}});function parseClip(str,element){var outerWidth=element.outerWidth(),outerHeight=element.outerHeight(),clipRegex=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,values=clipRegex.exec(str)||["",0,outerWidth,outerHeight,0];return{top:parseFloat(values[1])||0,right:values[2]==="auto"?outerWidth:parseFloat(values[2]),bottom:values[3]==="auto"?outerHeight:parseFloat(values[3]),left:parseFloat(values[4])||0}}$.fx.step.clip=function(fx){if(!fx.clipInit){fx.start=$(fx.elem).cssClip();if(typeof fx.end==="string"){fx.end=parseClip(fx.end,fx.elem)}fx.clipInit=true}$(fx.elem).cssClip({top:fx.pos*(fx.end.top-fx.start.top)+fx.start.top,right:fx.pos*(fx.end.right-fx.start.right)+fx.start.right,bottom:fx.pos*(fx.end.bottom-fx.start.bottom)+fx.start.bottom,left:fx.pos*(fx.end.left-fx.start.left)+fx.start.left})}})();(function(){var baseEasings={};$.each(["Quad","Cubic","Quart","Quint","Expo"],function(i,name){baseEasings[name]=function(p){return Math.pow(p,i+2)}});$.extend(baseEasings,{Sine:function(p){return 1-Math.cos(p*Math.PI/2)},Circ:function(p){return 1-Math.sqrt(1-p*p)},Elastic:function(p){return p===0||p===1?p:-Math.pow(2,8*(p-1))*Math.sin(((p-1)*80-7.5)*Math.PI/15)},Back:function(p){return p*p*(3*p-2)},Bounce:function(p){var pow2,bounce=4;while(p<((pow2=Math.pow(2,--bounce))-1)/11){}return 1/Math.pow(4,3-bounce)-7.5625*Math.pow((pow2*3-2)/22-p,2)}});$.each(baseEasings,function(name,easeIn){$.easing["easeIn"+name]=easeIn;$.easing["easeOut"+name]=function(p){return 1-easeIn(1-p)};$.easing["easeInOut"+name]=function(p){return p<.5?easeIn(p*2)/2:1-easeIn(p*-2+2)/2}})})();var effect=$.effects;var effectsEffectBlind=$.effects.define("blind","hide",function(options,done){var map={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},element=$(this),direction=options.direction||"up",start=element.cssClip(),animate={clip:$.extend({},start)},placeholder=$.effects.createPlaceholder(element);animate.clip[map[direction][0]]=animate.clip[map[direction][1]];if(options.mode==="show"){element.cssClip(animate.clip);if(placeholder){placeholder.css($.effects.clipToBox(animate))}animate.clip=start}if(placeholder){placeholder.animate($.effects.clipToBox(animate),options.duration,options.easing)}element.animate(animate,{queue:false,duration:options.duration,easing:options.easing,complete:done})});var effectsEffectBounce=$.effects.define("bounce",function(options,done){var upAnim,downAnim,refValue,element=$(this),mode=options.mode,hide=mode==="hide",show=mode==="show",direction=options.direction||"up",distance=options.distance,times=options.times||5,anims=times*2+(show||hide?1:0),speed=options.duration/anims,easing=options.easing,ref=direction==="up"||direction==="down"?"top":"left",motion=direction==="up"||direction==="left",i=0,queuelen=element.queue().length;$.effects.createPlaceholder(element);refValue=element.css(ref);if(!distance){distance=element[ref==="top"?"outerHeight":"outerWidth"]()/3}if(show){downAnim={opacity:1};downAnim[ref]=refValue;element.css("opacity",0).css(ref,motion?-distance*2:distance*2).animate(downAnim,speed,easing)}if(hide){distance=distance/Math.pow(2,times-1)}downAnim={};downAnim[ref]=refValue;for(;i<times;i++){upAnim={};upAnim[ref]=(motion?"-=":"+=")+distance;element.animate(upAnim,speed,easing).animate(downAnim,speed,easing);distance=hide?distance*2:distance/2}if(hide){upAnim={opacity:0};upAnim[ref]=(motion?"-=":"+=")+distance;element.animate(upAnim,speed,easing)}element.queue(done);$.effects.unshift(element,queuelen,anims+1)});var effectsEffectClip=$.effects.define("clip","hide",function(options,done){var start,animate={},element=$(this),direction=options.direction||"vertical",both=direction==="both",horizontal=both||direction==="horizontal",vertical=both||direction==="vertical";start=element.cssClip();animate.clip={top:vertical?(start.bottom-start.top)/2:start.top,right:horizontal?(start.right-start.left)/2:start.right,bottom:vertical?(start.bottom-start.top)/2:start.bottom,left:horizontal?(start.right-start.left)/2:start.left};$.effects.createPlaceholder(element);if(options.mode==="show"){element.cssClip(animate.clip);animate.clip=start}element.animate(animate,{queue:false,duration:options.duration,easing:options.easing,complete:done})});var effectsEffectDrop=$.effects.define("drop","hide",function(options,done){var distance,element=$(this),mode=options.mode,show=mode==="show",direction=options.direction||"left",ref=direction==="up"||direction==="down"?"top":"left",motion=direction==="up"||direction==="left"?"-=":"+=",oppositeMotion=motion==="+="?"-=":"+=",animation={opacity:0};$.effects.createPlaceholder(element);distance=options.distance||element[ref==="top"?"outerHeight":"outerWidth"](true)/2;animation[ref]=motion+distance;if(show){element.css(animation);animation[ref]=oppositeMotion+distance;animation.opacity=1}element.animate(animation,{queue:false,duration:options.duration,easing:options.easing,complete:done})});var effectsEffectExplode=$.effects.define("explode","hide",function(options,done){var i,j,left,top,mx,my,rows=options.pieces?Math.round(Math.sqrt(options.pieces)):3,cells=rows,element=$(this),mode=options.mode,show=mode==="show",offset=element.show().css("visibility","hidden").offset(),width=Math.ceil(element.outerWidth()/cells),height=Math.ceil(element.outerHeight()/rows),pieces=[];function childComplete(){pieces.push(this);if(pieces.length===rows*cells){animComplete()}}for(i=0;i<rows;i++){top=offset.top+i*height;my=i-(rows-1)/2;for(j=0;j<cells;j++){left=offset.left+j*width;mx=j-(cells-1)/2;element.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*width,top:-i*height}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:width,height:height,left:left+(show?mx*width:0),top:top+(show?my*height:0),opacity:show?0:1}).animate({left:left+(show?0:mx*width),top:top+(show?0:my*height),opacity:show?1:0},options.duration||500,options.easing,childComplete)}}function animComplete(){element.css({visibility:"visible"});$(pieces).remove();done()}});var effectsEffectFade=$.effects.define("fade","toggle",function(options,done){var show=options.mode==="show";$(this).css("opacity",show?0:1).animate({opacity:show?1:0},{queue:false,duration:options.duration,easing:options.easing,complete:done})});var effectsEffectFold=$.effects.define("fold","hide",function(options,done){var element=$(this),mode=options.mode,show=mode==="show",hide=mode==="hide",size=options.size||15,percent=/([0-9]+)%/.exec(size),horizFirst=!!options.horizFirst,ref=horizFirst?["right","bottom"]:["bottom","right"],duration=options.duration/2,placeholder=$.effects.createPlaceholder(element),start=element.cssClip(),animation1={clip:$.extend({},start)},animation2={clip:$.extend({},start)},distance=[start[ref[0]],start[ref[1]]],queuelen=element.queue().length;if(percent){size=parseInt(percent[1],10)/100*distance[hide?0:1]}animation1.clip[ref[0]]=size;animation2.clip[ref[0]]=size;animation2.clip[ref[1]]=0;if(show){element.cssClip(animation2.clip);if(placeholder){placeholder.css($.effects.clipToBox(animation2))}animation2.clip=start}element.queue(function(next){if(placeholder){placeholder.animate($.effects.clipToBox(animation1),duration,options.easing).animate($.effects.clipToBox(animation2),duration,options.easing)}next()}).animate(animation1,duration,options.easing).animate(animation2,duration,options.easing).queue(done);$.effects.unshift(element,queuelen,4)});var effectsEffectHighlight=$.effects.define("highlight","show",function(options,done){var element=$(this),animation={backgroundColor:element.css("backgroundColor")};if(options.mode==="hide"){animation.opacity=0}$.effects.saveStyle(element);element.css({backgroundImage:"none",backgroundColor:options.color||"#ffff99"}).animate(animation,{queue:false,duration:options.duration,easing:options.easing,complete:done})});var effectsEffectSize=$.effects.define("size",function(options,done){var baseline,factor,temp,element=$(this),cProps=["fontSize"],vProps=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],hProps=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],mode=options.mode,restore=mode!=="effect",scale=options.scale||"both",origin=options.origin||["middle","center"],position=element.css("position"),pos=element.position(),original=$.effects.scaledDimensions(element),from=options.from||original,to=options.to||$.effects.scaledDimensions(element,0);$.effects.createPlaceholder(element);if(mode==="show"){temp=from;from=to;to=temp}factor={from:{y:from.height/original.height,x:from.width/original.width},to:{y:to.height/original.height,x:to.width/original.width}};if(scale==="box"||scale==="both"){if(factor.from.y!==factor.to.y){from=$.effects.setTransition(element,vProps,factor.from.y,from);to=$.effects.setTransition(element,vProps,factor.to.y,to)}if(factor.from.x!==factor.to.x){from=$.effects.setTransition(element,hProps,factor.from.x,from);to=$.effects.setTransition(element,hProps,factor.to.x,to)}}if(scale==="content"||scale==="both"){if(factor.from.y!==factor.to.y){from=$.effects.setTransition(element,cProps,factor.from.y,from);to=$.effects.setTransition(element,cProps,factor.to.y,to)}}if(origin){baseline=$.effects.getBaseline(origin,original);from.top=(original.outerHeight-from.outerHeight)*baseline.y+pos.top;from.left=(original.outerWidth-from.outerWidth)*baseline.x+pos.left;to.top=(original.outerHeight-to.outerHeight)*baseline.y+pos.top;to.left=(original.outerWidth-to.outerWidth)*baseline.x+pos.left}element.css(from);if(scale==="content"||scale==="both"){vProps=vProps.concat(["marginTop","marginBottom"]).concat(cProps);hProps=hProps.concat(["marginLeft","marginRight"]);element.find("*[width]").each(function(){var child=$(this),childOriginal=$.effects.scaledDimensions(child),childFrom={height:childOriginal.height*factor.from.y,width:childOriginal.width*factor.from.x,outerHeight:childOriginal.outerHeight*factor.from.y,outerWidth:childOriginal.outerWidth*factor.from.x},childTo={height:childOriginal.height*factor.to.y,width:childOriginal.width*factor.to.x,outerHeight:childOriginal.height*factor.to.y,outerWidth:childOriginal.width*factor.to.x};if(factor.from.y!==factor.to.y){childFrom=$.effects.setTransition(child,vProps,factor.from.y,childFrom);childTo=$.effects.setTransition(child,vProps,factor.to.y,childTo)}if(factor.from.x!==factor.to.x){childFrom=$.effects.setTransition(child,hProps,factor.from.x,childFrom);childTo=$.effects.setTransition(child,hProps,factor.to.x,childTo)}if(restore){$.effects.saveStyle(child)}child.css(childFrom);child.animate(childTo,options.duration,options.easing,function(){if(restore){$.effects.restoreStyle(child)}})})}element.animate(to,{queue:false,duration:options.duration,easing:options.easing,complete:function(){var offset=element.offset();if(to.opacity===0){element.css("opacity",from.opacity)}if(!restore){element.css("position",position==="static"?"relative":position).offset(offset);$.effects.saveStyle(element)}done()}})});var effectsEffectScale=$.effects.define("scale",function(options,done){var el=$(this),mode=options.mode,percent=parseInt(options.percent,10)||(parseInt(options.percent,10)===0?0:mode!=="effect"?0:100),newOptions=$.extend(true,{from:$.effects.scaledDimensions(el),to:$.effects.scaledDimensions(el,percent,options.direction||"both"),origin:options.origin||["middle","center"]},options);if(options.fade){newOptions.from.opacity=1;newOptions.to.opacity=0}$.effects.effect.size.call(this,newOptions,done)});var effectsEffectPuff=$.effects.define("puff","hide",function(options,done){var newOptions=$.extend(true,{},options,{fade:true,percent:parseInt(options.percent,10)||150});$.effects.effect.scale.call(this,newOptions,done)});var effectsEffectPulsate=$.effects.define("pulsate","show",function(options,done){var element=$(this),mode=options.mode,show=mode==="show",hide=mode==="hide",showhide=show||hide,anims=(options.times||5)*2+(showhide?1:0),duration=options.duration/anims,animateTo=0,i=1,queuelen=element.queue().length;if(show||!element.is(":visible")){element.css("opacity",0).show();animateTo=1}for(;i<anims;i++){element.animate({opacity:animateTo},duration,options.easing);animateTo=1-animateTo}element.animate({opacity:animateTo},duration,options.easing);element.queue(done);$.effects.unshift(element,queuelen,anims+1)});var effectsEffectShake=$.effects.define("shake",function(options,done){var i=1,element=$(this),direction=options.direction||"left",distance=options.distance||20,times=options.times||3,anims=times*2+1,speed=Math.round(options.duration/anims),ref=direction==="up"||direction==="down"?"top":"left",positiveMotion=direction==="up"||direction==="left",animation={},animation1={},animation2={},queuelen=element.queue().length;$.effects.createPlaceholder(element);animation[ref]=(positiveMotion?"-=":"+=")+distance;animation1[ref]=(positiveMotion?"+=":"-=")+distance*2;animation2[ref]=(positiveMotion?"-=":"+=")+distance*2;element.animate(animation,speed,options.easing);for(;i<times;i++){element.animate(animation1,speed,options.easing).animate(animation2,speed,options.easing)}element.animate(animation1,speed,options.easing).animate(animation,speed/2,options.easing).queue(done);$.effects.unshift(element,queuelen,anims+1)});var effectsEffectSlide=$.effects.define("slide","show",function(options,done){var startClip,startRef,element=$(this),map={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},mode=options.mode,direction=options.direction||"left",ref=direction==="up"||direction==="down"?"top":"left",positiveMotion=direction==="up"||direction==="left",distance=options.distance||element[ref==="top"?"outerHeight":"outerWidth"](true),animation={};$.effects.createPlaceholder(element);startClip=element.cssClip();startRef=element.position()[ref];animation[ref]=(positiveMotion?-1:1)*distance+startRef;animation.clip=element.cssClip();animation.clip[map[direction][1]]=animation.clip[map[direction][0]];if(mode==="show"){element.cssClip(animation.clip);element.css(ref,animation[ref]);animation.clip=startClip;animation[ref]=startRef}element.animate(animation,{queue:false,duration:options.duration,easing:options.easing,complete:done})});var effect;if($.uiBackCompat!==false){effect=$.effects.define("transfer",function(options,done){$(this).transfer(options,done)})}var effectsEffectTransfer=effect;$.ui.focusable=function(element,hasTabindex){var map,mapName,img,focusableIfVisible,fieldset,nodeName=element.nodeName.toLowerCase();if("area"===nodeName){map=element.parentNode;mapName=map.name;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false}img=$("img[usemap='#"+mapName+"']");return img.length>0&&img.is(":visible")}if(/^(input|select|textarea|button|object)$/.test(nodeName)){focusableIfVisible=!element.disabled;if(focusableIfVisible){fieldset=$(element).closest("fieldset")[0];if(fieldset){focusableIfVisible=!fieldset.disabled}}}else if("a"===nodeName){focusableIfVisible=element.href||hasTabindex}else{focusableIfVisible=hasTabindex}return focusableIfVisible&&$(element).is(":visible")&&visible($(element))};function visible(element){var visibility=element.css("visibility");while(visibility==="inherit"){element=element.parent();visibility=element.css("visibility")}return visibility!=="hidden"}$.extend($.expr[":"],{focusable:function(element){return $.ui.focusable(element,$.attr(element,"tabindex")!=null)}});var focusable=$.ui.focusable;var form=$.fn.form=function(){return typeof this[0].form==="string"?this.closest("form"):$(this[0].form)};var formResetMixin=$.ui.formResetMixin={_formResetHandler:function(){var form=$(this);setTimeout(function(){var instances=form.data("ui-form-reset-instances");$.each(instances,function(){this.refresh()})})},_bindFormResetHandler:function(){this.form=this.element.form();if(!this.form.length){return}var instances=this.form.data("ui-form-reset-instances")||[];if(!instances.length){this.form.on("reset.ui-form-reset",this._formResetHandler)}instances.push(this);this.form.data("ui-form-reset-instances",instances)},_unbindFormResetHandler:function(){if(!this.form.length){return}var instances=this.form.data("ui-form-reset-instances");instances.splice($.inArray(this,instances),1);if(instances.length){this.form.data("ui-form-reset-instances",instances)}else{this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}};if($.fn.jquery.substring(0,3)==="1.7"){$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.css(elem,"padding"+this))||0;if(border){size-=parseFloat($.css(elem,"border"+this+"Width"))||0}if(margin){size-=parseFloat($.css(elem,"margin"+this))||0}});return size}$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this)}return this.each(function(){$(this).css(type,reduce(this,size)+"px")})};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size)}return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px")})}});$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}}var keycode=$.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38};var escapeSelector=$.ui.escapeSelector=function(){var selectorEscape=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(selector){return selector.replace(selectorEscape,"\\$1")}}();var labels=$.fn.labels=function(){var ancestor,selector,id,labels,ancestors;if(this[0].labels&&this[0].labels.length){return this.pushStack(this[0].labels)}labels=this.eq(0).parents("label");id=this.attr("id");if(id){ancestor=this.eq(0).parents().last();ancestors=ancestor.add(ancestor.length?ancestor.siblings():this.siblings());selector="label[for='"+$.ui.escapeSelector(id)+"']";labels=labels.add(ancestors.find(selector).addBack(selector))}return this.pushStack(labels)};var scrollParent=$.fn.scrollParent=function(includeHidden){var position=this.css("position"),excludeStaticParent=position==="absolute",overflowRegex=includeHidden?/(auto|scroll|hidden)/:/(auto|scroll)/,scrollParent=this.parents().filter(function(){var parent=$(this);if(excludeStaticParent&&parent.css("position")==="static"){return false}return overflowRegex.test(parent.css("overflow")+parent.css("overflow-y")+parent.css("overflow-x"))}).eq(0);return position==="fixed"||!scrollParent.length?$(this[0].ownerDocument||document):scrollParent};var tabbable=$.extend($.expr[":"],{tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),hasTabindex=tabIndex!=null;return(!hasTabindex||tabIndex>=0)&&$.ui.focusable(element,hasTabindex)}});var uniqueId=$.fn.extend({uniqueId:function(){var uuid=0;return function(){return this.each(function(){if(!this.id){this.id="ui-id-"+ ++uuid}})}}(),removeUniqueId:function(){return this.each(function(){if(/^ui-id-\d+$/.test(this.id)){$(this).removeAttr("id")}})}});var widgetsAccordion=$.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:false,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var options=this.options;this.prevShow=this.prevHide=$();this._addClass("ui-accordion","ui-widget ui-helper-reset");this.element.attr("role","tablist");if(!options.collapsible&&(options.active===false||options.active==null)){options.active=0}this._processPanels();if(options.active<0){options.active+=this.headers.length}this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:!this.active.length?$():this.active.next()}},_createIcons:function(){var icon,children,icons=this.options.icons;if(icons){icon=$("<span>");this._addClass(icon,"ui-accordion-header-icon","ui-icon "+icons.header);icon.prependTo(this.headers);children=this.active.children(".ui-accordion-header-icon");this._removeClass(children,icons.header)._addClass(children,null,icons.activeHeader)._addClass(this.headers,"ui-accordion-icons")}},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons");this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var contents;this.element.removeAttr("role");this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId();this._destroyIcons();contents=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId();if(this.options.heightStyle!=="content"){contents.css("height","")}},_setOption:function(key,value){if(key==="active"){this._activate(value);return}if(key==="event"){if(this.options.event){this._off(this.headers,this.options.event)}this._setupEvents(value)}this._super(key,value);if(key==="collapsible"&&!value&&this.options.active===false){this._activate(0)}if(key==="icons"){this._destroyIcons();if(value){this._createIcons()}}},_setOptionDisabled:function(value){this._super(value);this.element.attr("aria-disabled",value);this._toggleClass(null,"ui-state-disabled",!!value);this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!value)},_keydown:function(event){if(event.altKey||event.ctrlKey){return}var keyCode=$.ui.keyCode,length=this.headers.length,currentIndex=this.headers.index(event.target),toFocus=false;switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:this._eventHandler(event);break;case keyCode.HOME:toFocus=this.headers[0];break;case keyCode.END:toFocus=this.headers[length-1];break}if(toFocus){$(event.target).attr("tabIndex",-1);$(toFocus).attr("tabIndex",0);$(toFocus).trigger("focus");event.preventDefault()}},_panelKeyDown:function(event){if(event.keyCode===$.ui.keyCode.UP&&event.ctrlKey){$(event.currentTarget).prev().trigger("focus")}},refresh:function(){var options=this.options;this._processPanels();if(options.active===false&&options.collapsible===true||!this.headers.length){options.active=false;this.active=$()}else if(options.active===false){this._activate(0)}else if(this.active.length&&!$.contains(this.element[0],this.active[0])){if(this.headers.length===this.headers.find(".ui-state-disabled").length){options.active=false;this.active=$()}else{this._activate(Math.max(0,options.active-1))}}else{options.active=this.headers.index(this.active)}this._destroyIcons();this._refresh()},_processPanels:function(){var prevHeaders=this.headers,prevPanels=this.panels;this.headers=this.element.find(this.options.header);this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default");this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide();this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content");if(prevPanels){this._off(prevHeaders.not(this.headers));this._off(prevPanels.not(this.panels))}},_refresh:function(){var maxHeight,options=this.options,heightStyle=options.heightStyle,parent=this.element.parent();this.active=this._findActive(options.active);this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed");this._addClass(this.active.next(),"ui-accordion-content-active");this.active.next().show();this.headers.attr("role","tab").each(function(){var header=$(this),headerId=header.uniqueId().attr("id"),panel=header.next(),panelId=panel.uniqueId().attr("id");header.attr("aria-controls",panelId);panel.attr("aria-labelledby",headerId)}).next().attr("role","tabpanel");this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex",0)}else{this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"})}this._createIcons();this._setupEvents(options.event);if(heightStyle==="fill"){maxHeight=parent.height();this.element.siblings(":visible").each(function(){var elem=$(this),position=elem.css("position");if(position==="absolute"||position==="fixed"){return}maxHeight-=elem.outerHeight(true)});this.headers.each(function(){maxHeight-=$(this).outerHeight(true)});this.headers.next().each(function(){$(this).height(Math.max(0,maxHeight-$(this).innerHeight()+$(this).height()))}).css("overflow","auto")}else if(heightStyle==="auto"){maxHeight=0;this.headers.next().each(function(){var isVisible=$(this).is(":visible");if(!isVisible){$(this).show()}maxHeight=Math.max(maxHeight,$(this).css("height","").height());if(!isVisible){$(this).hide()}}).height(maxHeight)}},_activate:function(index){var active=this._findActive(index)[0];if(active===this.active[0]){return}active=active||this.active[0];this._eventHandler({target:active,currentTarget:active,preventDefault:$.noop})},_findActive:function(selector){return typeof selector==="number"?this.headers.eq(selector):$()},_setupEvents:function(event){var events={keydown:"_keydown"};if(event){$.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler"})}this._off(this.headers.add(this.headers.next()));this._on(this.headers,events);this._on(this.headers.next(),{keydown:"_panelKeyDown"});this._hoverable(this.headers);this._focusable(this.headers)},_eventHandler:function(event){var activeChildren,clickedChildren,options=this.options,active=this.active,clicked=$(event.currentTarget),clickedIsActive=clicked[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$():clicked.next(),toHide=active.next(),eventData={oldHeader:active,oldPanel:toHide,newHeader:collapsing?$():clicked,newPanel:toShow};event.preventDefault();if(clickedIsActive&&!options.collapsible||this._trigger("beforeActivate",event,eventData)===false){return}options.active=collapsing?false:this.headers.index(clicked);this.active=clickedIsActive?$():clicked;this._toggle(eventData);this._removeClass(active,"ui-accordion-header-active","ui-state-active");if(options.icons){activeChildren=active.children(".ui-accordion-header-icon");this._removeClass(activeChildren,null,options.icons.activeHeader)._addClass(activeChildren,null,options.icons.header)}if(!clickedIsActive){this._removeClass(clicked,"ui-accordion-header-collapsed")._addClass(clicked,"ui-accordion-header-active","ui-state-active");if(options.icons){clickedChildren=clicked.children(".ui-accordion-header-icon");this._removeClass(clickedChildren,null,options.icons.header)._addClass(clickedChildren,null,options.icons.activeHeader)}this._addClass(clicked.next(),"ui-accordion-content-active")}},_toggle:function(data){var toShow=data.newPanel,toHide=this.prevShow.length?this.prevShow:data.oldPanel;this.prevShow.add(this.prevHide).stop(true,true);this.prevShow=toShow;this.prevHide=toHide;if(this.options.animate){this._animate(toShow,toHide,data)}else{toHide.hide();toShow.show();this._toggleComplete(data)}toHide.attr({"aria-hidden":"true"});toHide.prev().attr({"aria-selected":"false","aria-expanded":"false"});if(toShow.length&&toHide.length){toHide.prev().attr({tabIndex:-1,"aria-expanded":"false"})}else if(toShow.length){this.headers.filter(function(){return parseInt($(this).attr("tabIndex"),10)===0}).attr("tabIndex",-1)}toShow.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(toShow,toHide,data){var total,easing,duration,that=this,adjust=0,boxSizing=toShow.css("box-sizing"),down=toShow.length&&(!toHide.length||toShow.index()<toHide.index()),animate=this.options.animate||{},options=down&&animate.down||animate,complete=function(){that._toggleComplete(data)};if(typeof options==="number"){duration=options}if(typeof options==="string"){easing=options}easing=easing||options.easing||animate.easing;duration=duration||options.duration||animate.duration;if(!toHide.length){return toShow.animate(this.showProps,duration,easing,complete)}if(!toShow.length){return toHide.animate(this.hideProps,duration,easing,complete)}total=toShow.show().outerHeight();toHide.animate(this.hideProps,{duration:duration,easing:easing,step:function(now,fx){fx.now=Math.round(now)}});toShow.hide().animate(this.showProps,{duration:duration,easing:easing,complete:complete,step:function(now,fx){fx.now=Math.round(now);if(fx.prop!=="height"){if(boxSizing==="content-box"){adjust+=fx.now}}else if(that.options.heightStyle!=="content"){fx.now=Math.round(total-toHide.outerHeight()-adjust);adjust=0}}})},_toggleComplete:function(data){var toHide=data.oldPanel,prev=toHide.prev();this._removeClass(toHide,"ui-accordion-content-active");this._removeClass(prev,"ui-accordion-header-active")._addClass(prev,"ui-accordion-header-collapsed");if(toHide.length){toHide.parent()[0].className=toHide.parent()[0].className}this._trigger("activate",null,data)}});var safeActiveElement=$.ui.safeActiveElement=function(document){var activeElement;try{activeElement=document.activeElement}catch(error){activeElement=document.body}if(!activeElement){activeElement=document.body}if(!activeElement.nodeName){activeElement=document.body}return activeElement};var widgetsMenu=$.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element;this.mouseHandled=false;this.element.uniqueId().attr({role:this.options.role,tabIndex:0});this._addClass("ui-menu","ui-widget ui-widget-content");this._on({"mousedown .ui-menu-item":function(event){event.preventDefault()},"click .ui-menu-item":function(event){var target=$(event.target);var active=$($.ui.safeActiveElement(this.document[0]));if(!this.mouseHandled&&target.not(".ui-state-disabled").length){this.select(event);if(!event.isPropagationStopped()){this.mouseHandled=true}if(target.has(".ui-menu").length){this.expand(event)}else if(!this.element.is(":focus")&&active.closest(".ui-menu").length){this.element.trigger("focus",[true]);if(this.active&&this.active.parents(".ui-menu").length===1){clearTimeout(this.timer)}}}},"mouseenter .ui-menu-item":function(event){if(this.previousFilter){return}var actualTarget=$(event.target).closest(".ui-menu-item"),target=$(event.currentTarget);if(actualTarget[0]!==target[0]){return}this._removeClass(target.siblings().children(".ui-state-active"),null,"ui-state-active");this.focus(event,target)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(event,keepActiveItem){var item=this.active||this.element.find(this.options.items).eq(0);if(!keepActiveItem){this.focus(event,item)}},blur:function(event){this._delay(function(){var notContained=!$.contains(this.element[0],$.ui.safeActiveElement(this.document[0]));if(notContained){this.collapseAll(event)}})},keydown:"_keydown"});this.refresh();this._on(this.document,{click:function(event){if(this._closeOnDocumentClick(event)){this.collapseAll(event)}this.mouseHandled=false}})},_destroy:function(){var items=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),submenus=items.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled "+"tabIndex").removeUniqueId().show();submenus.children().each(function(){var elem=$(this);if(elem.data("ui-menu-submenu-caret")){elem.remove()}})},_keydown:function(event){var match,prev,character,skip,preventDefault=true;switch(event.keyCode){case $.ui.keyCode.PAGE_UP:this.previousPage(event);break;case $.ui.keyCode.PAGE_DOWN:this.nextPage(event);break;case $.ui.keyCode.HOME:this._move("first","first",event);break;case $.ui.keyCode.END:this._move("last","last",event);break;case $.ui.keyCode.UP:this.previous(event);break;case $.ui.keyCode.DOWN:this.next(event);break;case $.ui.keyCode.LEFT:this.collapse(event);break;case $.ui.keyCode.RIGHT:if(this.active&&!this.active.is(".ui-state-disabled")){this.expand(event)}break;case $.ui.keyCode.ENTER:case $.ui.keyCode.SPACE:this._activate(event);break;case $.ui.keyCode.ESCAPE:this.collapse(event);break;default:preventDefault=false;prev=this.previousFilter||"";skip=false;character=event.keyCode>=96&&event.keyCode<=105?(event.keyCode-96).toString():String.fromCharCode(event.keyCode);clearTimeout(this.filterTimer);if(character===prev){skip=true}else{character=prev+character}match=this._filterMenuItems(character);match=skip&&match.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):match;if(!match.length){character=String.fromCharCode(event.keyCode);match=this._filterMenuItems(character)}if(match.length){this.focus(event,match);this.previousFilter=character;this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)}else{delete this.previousFilter}}if(preventDefault){event.preventDefault()}},_activate:function(event){if(this.active&&!this.active.is(".ui-state-disabled")){if(this.active.children("[aria-haspopup='true']").length){this.expand(event)}else{this.select(event)}}},refresh:function(){var menus,items,newSubmenus,newItems,newWrappers,that=this,icon=this.options.icons.submenu,submenus=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length);newSubmenus=submenus.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var menu=$(this),item=menu.prev(),submenuCaret=$("<span>").data("ui-menu-submenu-caret",true);that._addClass(submenuCaret,"ui-menu-icon","ui-icon "+icon);item.attr("aria-haspopup","true").prepend(submenuCaret);menu.attr("aria-labelledby",item.attr("id"))});this._addClass(newSubmenus,"ui-menu","ui-widget ui-widget-content ui-front");menus=submenus.add(this.element);items=menus.find(this.options.items);items.not(".ui-menu-item").each(function(){var item=$(this);if(that._isDivider(item)){that._addClass(item,"ui-menu-divider","ui-widget-content")}});newItems=items.not(".ui-menu-item, .ui-menu-divider");newWrappers=newItems.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()});this._addClass(newItems,"ui-menu-item")._addClass(newWrappers,"ui-menu-item-wrapper");items.filter(".ui-state-disabled").attr("aria-disabled","true");if(this.active&&!$.contains(this.element[0],this.active[0])){this.blur()}},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(key,value){if(key==="icons"){var icons=this.element.find(".ui-menu-icon");this._removeClass(icons,null,this.options.icons.submenu)._addClass(icons,null,value.submenu)}this._super(key,value)},_setOptionDisabled:function(value){this._super(value);this.element.attr("aria-disabled",String(value));this._toggleClass(null,"ui-state-disabled",!!value)},focus:function(event,item){var nested,focused,activeParent;this.blur(event,event&&event.type==="focus");this._scrollIntoView(item);this.active=item.first();focused=this.active.children(".ui-menu-item-wrapper");this._addClass(focused,null,"ui-state-active");if(this.options.role){this.element.attr("aria-activedescendant",focused.attr("id"))}activeParent=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper");this._addClass(activeParent,null,"ui-state-active");if(event&&event.type==="keydown"){this._close()}else{this.timer=this._delay(function(){this._close()},this.delay)}nested=item.children(".ui-menu");if(nested.length&&event&&/^mouse/.test(event.type)){this._startOpening(nested)}this.activeMenu=item.parent();this._trigger("focus",event,{item:item})},_scrollIntoView:function(item){var borderTop,paddingTop,offset,scroll,elementHeight,itemHeight;if(this._hasScroll()){borderTop=parseFloat($.css(this.activeMenu[0],"borderTopWidth"))||0;paddingTop=parseFloat($.css(this.activeMenu[0],"paddingTop"))||0;offset=item.offset().top-this.activeMenu.offset().top-borderTop-paddingTop;scroll=this.activeMenu.scrollTop();elementHeight=this.activeMenu.height();itemHeight=item.outerHeight();if(offset<0){this.activeMenu.scrollTop(scroll+offset)}else if(offset+itemHeight>elementHeight){this.activeMenu.scrollTop(scroll+offset-elementHeight+itemHeight)}}},blur:function(event,fromFocus){if(!fromFocus){clearTimeout(this.timer)}if(!this.active){return}this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active");this._trigger("blur",event,{item:this.active});this.active=null},_startOpening:function(submenu){clearTimeout(this.timer);if(submenu.attr("aria-hidden")!=="true"){return}this.timer=this._delay(function(){this._close();this._open(submenu)},this.delay)},_open:function(submenu){var position=$.extend({of:this.active},this.options.position);clearTimeout(this.timer);this.element.find(".ui-menu").not(submenu.parents(".ui-menu")).hide().attr("aria-hidden","true");submenu.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(position)},collapseAll:function(event,all){clearTimeout(this.timer);this.timer=this._delay(function(){var currentMenu=all?this.element:$(event&&event.target).closest(this.element.find(".ui-menu"));if(!currentMenu.length){currentMenu=this.element}this._close(currentMenu);this.blur(event);this._removeClass(currentMenu.find(".ui-state-active"),null,"ui-state-active");this.activeMenu=currentMenu},this.delay)},_close:function(startMenu){if(!startMenu){startMenu=this.active?this.active.parent():this.element}startMenu.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(event){return!$(event.target).closest(".ui-menu").length},_isDivider:function(item){return!/[^\-\u2014\u2013\s]/.test(item.text())},collapse:function(event){var newItem=this.active&&this.active.parent().closest(".ui-menu-item",this.element);if(newItem&&newItem.length){this._close();this.focus(event,newItem)}},expand:function(event){var newItem=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();if(newItem&&newItem.length){this._open(newItem.parent());this._delay(function(){this.focus(event,newItem)})}},next:function(event){this._move("next","first",event)},previous:function(event){this._move("prev","last",event)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(direction,filter,event){var next;if(this.active){if(direction==="first"||direction==="last"){next=this.active[direction==="first"?"prevAll":"nextAll"](".ui-menu-item").eq(-1)}else{next=this.active[direction+"All"](".ui-menu-item").eq(0)}}if(!next||!next.length||!this.active){next=this.activeMenu.find(this.options.items)[filter]()}this.focus(event,next)},nextPage:function(event){var item,base,height;if(!this.active){this.next(event);return}if(this.isLastItem()){return}if(this._hasScroll()){base=this.active.offset().top;height=this.element.height();this.active.nextAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base-height<0});this.focus(event,item)}else{this.focus(event,this.activeMenu.find(this.options.items)[!this.active?"first":"last"]())}},previousPage:function(event){var item,base,height;if(!this.active){this.next(event);return}if(this.isFirstItem()){return}if(this._hasScroll()){base=this.active.offset().top;height=this.element.height();this.active.prevAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base+height>0});this.focus(event,item)}else{this.focus(event,this.activeMenu.find(this.options.items).first())}},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(event){this.active=this.active||$(event.target).closest(".ui-menu-item");var ui={item:this.active};if(!this.active.has(".ui-menu").length){this.collapseAll(event,true)}this._trigger("select",event,ui)},_filterMenuItems:function(character){var escapedCharacter=character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),regex=new RegExp("^"+escapedCharacter,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return regex.test($.trim($(this).children(".ui-menu-item-wrapper").text()))})}});$.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var suppressKeyPress,suppressKeyPressRepeat,suppressInput,nodeName=this.element[0].nodeName.toLowerCase(),isTextarea=nodeName==="textarea",isInput=nodeName==="input";this.isMultiLine=isTextarea||!isInput&&this._isContentEditable(this.element);this.valueMethod=this.element[isTextarea||isInput?"val":"text"];this.isNewMenu=true;this._addClass("ui-autocomplete-input");this.element.attr("autocomplete","off");this._on(this.element,{keydown:function(event){if(this.element.prop("readOnly")){suppressKeyPress=true;suppressInput=true;suppressKeyPressRepeat=true;return}suppressKeyPress=false;suppressInput=false;suppressKeyPressRepeat=false;var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:suppressKeyPress=true;this._move("previousPage",event);break;case keyCode.PAGE_DOWN:suppressKeyPress=true;this._move("nextPage",event);break;case keyCode.UP:suppressKeyPress=true;this._keyEvent("previous",event);break;case keyCode.DOWN:suppressKeyPress=true;this._keyEvent("next",event);break;case keyCode.ENTER:if(this.menu.active){suppressKeyPress=true;event.preventDefault();this.menu.select(event)}break;case keyCode.TAB:if(this.menu.active){this.menu.select(event)}break;case keyCode.ESCAPE:if(this.menu.element.is(":visible")){if(!this.isMultiLine){this._value(this.term)}this.close(event);event.preventDefault()}break;default:suppressKeyPressRepeat=true;this._searchTimeout(event);break}},keypress:function(event){if(suppressKeyPress){suppressKeyPress=false;if(!this.isMultiLine||this.menu.element.is(":visible")){event.preventDefault()}return}if(suppressKeyPressRepeat){return}var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:this._move("previousPage",event);break;case keyCode.PAGE_DOWN:this._move("nextPage",event);break;case keyCode.UP:this._keyEvent("previous",event);break;case keyCode.DOWN:this._keyEvent("next",event);break}},input:function(event){if(suppressInput){suppressInput=false;event.preventDefault();return}this._searchTimeout(event)},focus:function(){this.selectedItem=null;this.previous=this._value()},blur:function(event){if(this.cancelBlur){delete this.cancelBlur;return}clearTimeout(this.searching);this.close(event);this._change(event)}});this._initSource();this.menu=$("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance");this._addClass(this.menu.element,"ui-autocomplete","ui-front");this._on(this.menu.element,{mousedown:function(event){event.preventDefault();this.cancelBlur=true;this._delay(function(){delete this.cancelBlur;if(this.element[0]!==$.ui.safeActiveElement(this.document[0])){this.element.trigger("focus")}})},menufocus:function(event,ui){var label,item;if(this.isNewMenu){this.isNewMenu=false;if(event.originalEvent&&/^mouse/.test(event.originalEvent.type)){this.menu.blur();this.document.one("mousemove",function(){$(event.target).trigger(event.originalEvent)});return}}item=ui.item.data("ui-autocomplete-item");if(false!==this._trigger("focus",event,{item:item})){if(event.originalEvent&&/^key/.test(event.originalEvent.type)){this._value(item.value)}}label=ui.item.attr("aria-label")||item.value;if(label&&$.trim(label).length){this.liveRegion.children().hide();$("<div>").text(label).appendTo(this.liveRegion)}},menuselect:function(event,ui){var item=ui.item.data("ui-autocomplete-item"),previous=this.previous;if(this.element[0]!==$.ui.safeActiveElement(this.document[0])){this.element.trigger("focus");this.previous=previous;this._delay(function(){this.previous=previous;this.selectedItem=item})}if(false!==this._trigger("select",event,{item:item})){this._value(item.value)}this.term=this._value();this.close(event);this.selectedItem=item}});this.liveRegion=$("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body);this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible");this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching);this.element.removeAttr("autocomplete");this.menu.element.remove();this.liveRegion.remove()},_setOption:function(key,value){this._super(key,value);if(key==="source"){this._initSource()}if(key==="appendTo"){this.menu.element.appendTo(this._appendTo())}if(key==="disabled"&&value&&this.xhr){this.xhr.abort()}},_isEventTargetInWidget:function(event){var menuElement=this.menu.element[0];return event.target===this.element[0]||event.target===menuElement||$.contains(menuElement,event.target)},_closeOnClickOutside:function(event){if(!this._isEventTargetInWidget(event)){this.close()}},_appendTo:function(){var element=this.options.appendTo;if(element){element=element.jquery||element.nodeType?$(element):this.document.find(element).eq(0)}if(!element||!element[0]){element=this.element.closest(".ui-front, dialog")}if(!element.length){element=this.document[0].body}return element},_initSource:function(){var array,url,that=this;if($.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term))}}else if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){if(that.xhr){that.xhr.abort()}that.xhr=$.ajax({url:url,data:request,dataType:"json",success:function(data){response(data)},error:function(){response([])}})}}else{this.source=this.options.source}},_searchTimeout:function(event){clearTimeout(this.searching);this.searching=this._delay(function(){var equalValues=this.term===this._value(),menuVisible=this.menu.element.is(":visible"),modifierKey=event.altKey||event.ctrlKey||event.metaKey||event.shiftKey;if(!equalValues||equalValues&&!menuVisible&&!modifierKey){this.selectedItem=null;this.search(null,event)}},this.options.delay)},search:function(value,event){value=value!=null?value:this._value();this.term=this._value();if(value.length<this.options.minLength){return this.close(event)}if(this._trigger("search",event)===false){return}return this._search(value)},_search:function(value){this.pending++;this._addClass("ui-autocomplete-loading");this.cancelSearch=false;this.source({term:value},this._response())},_response:function(){var index=++this.requestIndex;return $.proxy(function(content){if(index===this.requestIndex){this.__response(content)}this.pending--;if(!this.pending){this._removeClass("ui-autocomplete-loading")}},this)},__response:function(content){if(content){content=this._normalize(content)}this._trigger("response",null,{content:content});if(!this.options.disabled&&content&&content.length&&!this.cancelSearch){this._suggest(content);this._trigger("open")}else{this._close()}},close:function(event){this.cancelSearch=true;this._close(event)},_close:function(event){this._off(this.document,"mousedown");if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.blur();this.isNewMenu=true;this._trigger("close",event)}},_change:function(event){if(this.previous!==this._value()){this._trigger("change",event,{item:this.selectedItem})}},_normalize:function(items){if(items.length&&items[0].label&&items[0].value){return items}return $.map(items,function(item){if(typeof item==="string"){return{label:item,value:item}}return $.extend({},item,{label:item.label||item.value,value:item.value||item.label})})},_suggest:function(items){var ul=this.menu.element.empty();this._renderMenu(ul,items);this.isNewMenu=true;this.menu.refresh();ul.show();this._resizeMenu();ul.position($.extend({of:this.element},this.options.position));if(this.options.autoFocus){this.menu.next()}this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var ul=this.menu.element;ul.outerWidth(Math.max(ul.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(ul,items){var that=this;$.each(items,function(index,item){that._renderItemData(ul,item)})},_renderItemData:function(ul,item){return this._renderItem(ul,item).data("ui-autocomplete-item",item)},_renderItem:function(ul,item){return $("<li>").append($("<div>").text(item.label)).appendTo(ul)},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return}if(this.menu.isFirstItem()&&/^previous/.test(direction)||this.menu.isLastItem()&&/^next/.test(direction)){if(!this.isMultiLine){this._value(this.term)}this.menu.blur();return}this.menu[direction](event)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(keyEvent,event){if(!this.isMultiLine||this.menu.element.is(":visible")){this._move(keyEvent,event);event.preventDefault()}},_isContentEditable:function(element){if(!element.length){return false}var editable=element.prop("contentEditable");if(editable==="inherit"){return this._isContentEditable(element.parent())}return editable==="true"}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value)})}});$.widget("ui.autocomplete",$.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(amount){return amount+(amount>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(content){var message;this._superApply(arguments);if(this.options.disabled||this.cancelSearch){return}if(content&&content.length){message=this.options.messages.results(content.length)}else{message=this.options.messages.noResults}this.liveRegion.children().hide();$("<div>").text(message).appendTo(this.liveRegion)}});var widgetsAutocomplete=$.ui.autocomplete;var controlgroupCornerRegex=/ui-corner-([a-z]){2,6}/g;var widgetsControlgroup=$.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:true,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar");this.refresh()},_destroy:function(){this._callChildMethod("destroy");this.childWidgets.removeData("ui-controlgroup-data");this.element.removeAttr("role");if(this.options.items.controlgroupLabel){this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()}},_initWidgets:function(){var that=this,childWidgets=[];$.each(this.options.items,function(widget,selector){var labels;var options={};if(!selector){return}if(widget==="controlgroupLabel"){labels=that.element.find(selector);labels.each(function(){var element=$(this);if(element.children(".ui-controlgroup-label-contents").length){return}element.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")});that._addClass(labels,null,"ui-widget ui-widget-content ui-state-default");childWidgets=childWidgets.concat(labels.get());return}if(!$.fn[widget]){return}if(that["_"+widget+"Options"]){options=that["_"+widget+"Options"]("middle")}else{options={classes:{}}}that.element.find(selector).each(function(){var element=$(this);var instance=element[widget]("instance");var instanceOptions=$.widget.extend({},options);if(widget==="button"&&element.parent(".ui-spinner").length){return}if(!instance){instance=element[widget]()[widget]("instance")}if(instance){instanceOptions.classes=that._resolveClassesValues(instanceOptions.classes,instance)}element[widget](instanceOptions);var widgetElement=element[widget]("widget");$.data(widgetElement[0],"ui-controlgroup-data",instance?instance:element[widget]("instance"));childWidgets.push(widgetElement[0])})});this.childWidgets=$($.unique(childWidgets));this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(method){this.childWidgets.each(function(){var element=$(this),data=element.data("ui-controlgroup-data");if(data&&data[method]){data[method]()}})},_updateCornerClass:function(element,position){var remove="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";var add=this._buildSimpleOptions(position,"label").classes.label;this._removeClass(element,null,remove);this._addClass(element,null,add)},_buildSimpleOptions:function(position,key){var direction=this.options.direction==="vertical";var result={classes:{}};result.classes[key]={middle:"",first:"ui-corner-"+(direction?"top":"left"),last:"ui-corner-"+(direction?"bottom":"right"),only:"ui-corner-all"}[position];return result},_spinnerOptions:function(position){var options=this._buildSimpleOptions(position,"ui-spinner");options.classes["ui-spinner-up"]="";options.classes["ui-spinner-down"]="";return options},_buttonOptions:function(position){return this._buildSimpleOptions(position,"ui-button")},_checkboxradioOptions:function(position){return this._buildSimpleOptions(position,"ui-checkboxradio-label")},_selectmenuOptions:function(position){var direction=this.options.direction==="vertical";return{width:direction?"auto":false,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(direction?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(direction?"top":"left")},last:{"ui-selectmenu-button-open":direction?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(direction?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[position]}},_resolveClassesValues:function(classes,instance){var result={};$.each(classes,function(key){var current=instance.options.classes[key]||"";current=$.trim(current.replace(controlgroupCornerRegex,""));result[key]=(current+" "+classes[key]).replace(/\s+/g," ")});return result},_setOption:function(key,value){if(key==="direction"){this._removeClass("ui-controlgroup-"+this.options.direction)}this._super(key,value);if(key==="disabled"){this._callChildMethod(value?"disable":"enable");return}this.refresh()},refresh:function(){var children,that=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction);if(this.options.direction==="horizontal"){this._addClass(null,"ui-helper-clearfix")}this._initWidgets();children=this.childWidgets;if(this.options.onlyVisible){children=children.filter(":visible")}if(children.length){$.each(["first","last"],function(index,value){var instance=children[value]().data("ui-controlgroup-data");if(instance&&that["_"+instance.widgetName+"Options"]){var options=that["_"+instance.widgetName+"Options"](children.length===1?"only":value);options.classes=that._resolveClassesValues(options.classes,instance);instance.element[instance.widgetName](options)}else{that._updateCornerClass(children[value](),value)}});this._callChildMethod("refresh")}}});$.widget("ui.checkboxradio",[$.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:true,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var disabled,labels;var that=this;var options=this._super()||{};this._readType();labels=this.element.labels();this.label=$(labels[labels.length-1]);if(!this.label.length){$.error("No label found for checkboxradio widget")}this.originalLabel="";this.label.contents().not(this.element[0]).each(function(){that.originalLabel+=this.nodeType===3?$(this).text():this.outerHTML});if(this.originalLabel){options.label=this.originalLabel}disabled=this.element[0].disabled;if(disabled!=null){options.disabled=disabled}return options},_create:function(){var checked=this.element[0].checked;this._bindFormResetHandler();if(this.options.disabled==null){this.options.disabled=this.element[0].disabled}this._setOption("disabled",this.options.disabled);this._addClass("ui-checkboxradio","ui-helper-hidden-accessible");this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget");if(this.type==="radio"){this._addClass(this.label,"ui-checkboxradio-radio-label")}if(this.options.label&&this.options.label!==this.originalLabel){this._updateLabel()}else if(this.originalLabel){this.options.label=this.originalLabel}this._enhance();if(checked){this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active");if(this.icon){this._addClass(this.icon,null,"ui-state-hover")}}this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var nodeName=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type;if(nodeName!=="input"||!/radio|checkbox/.test(this.type)){$.error("Can't create checkboxradio on element.nodeName="+nodeName+" and element.type="+this.type)}},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var group;var name=this.element[0].name;var nameSelector="input[name='"+$.ui.escapeSelector(name)+"']";if(!name){return $([])}if(this.form.length){group=$(this.form[0].elements).filter(nameSelector)}else{group=$(nameSelector).filter(function(){return $(this).form().length===0})}return group.not(this.element)},_toggleClasses:function(){var checked=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",checked);if(this.options.icon&&this.type==="checkbox"){this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",checked)._toggleClass(this.icon,null,"ui-icon-blank",!checked)}if(this.type==="radio"){this._getRadioGroup().each(function(){var instance=$(this).checkboxradio("instance");if(instance){instance._removeClass(instance.label,"ui-checkboxradio-checked","ui-state-active")}})}},_destroy:function(){this._unbindFormResetHandler();if(this.icon){this.icon.remove();this.iconSpace.remove()}},_setOption:function(key,value){if(key==="label"&&!value){return}this._super(key,value);if(key==="disabled"){this._toggleClass(this.label,null,"ui-state-disabled",value);this.element[0].disabled=value;return}this.refresh()},_updateIcon:function(checked){var toAdd="ui-icon ui-icon-background ";if(this.options.icon){if(!this.icon){this.icon=$("<span>");this.iconSpace=$("<span> </span>");this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")}if(this.type==="checkbox"){toAdd+=checked?"ui-icon-check ui-state-checked":"ui-icon-blank";this._removeClass(this.icon,null,checked?"ui-icon-blank":"ui-icon-check")}else{toAdd+="ui-icon-blank"}this._addClass(this.icon,"ui-checkboxradio-icon",toAdd);if(!checked){this._removeClass(this.icon,null,"ui-icon-check ui-state-checked")}this.icon.prependTo(this.label).after(this.iconSpace)}else if(this.icon!==undefined){this.icon.remove();this.iconSpace.remove();delete this.icon}},_updateLabel:function(){var contents=this.label.contents().not(this.element[0]);if(this.icon){contents=contents.not(this.icon[0])}if(this.iconSpace){contents=contents.not(this.iconSpace[0])}contents.remove();this.label.append(this.options.label)},refresh:function(){var checked=this.element[0].checked,isDisabled=this.element[0].disabled;this._updateIcon(checked);this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",checked);if(this.options.label!==null){this._updateLabel()}if(isDisabled!==this.options.disabled){this._setOptions({disabled:isDisabled})}}}]);var widgetsCheckboxradio=$.ui.checkboxradio;$.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:true},_getCreateOptions:function(){var disabled,options=this._super()||{};this.isInput=this.element.is("input");disabled=this.element[0].disabled;if(disabled!=null){options.disabled=disabled}this.originalLabel=this.isInput?this.element.val():this.element.html();if(this.originalLabel){options.label=this.originalLabel}return options},_create:function(){if(!this.option.showLabel&!this.options.icon){this.options.showLabel=true}if(this.options.disabled==null){this.options.disabled=this.element[0].disabled||false}this.hasTitle=!!this.element.attr("title");if(this.options.label&&this.options.label!==this.originalLabel){if(this.isInput){this.element.val(this.options.label)}else{this.element.html(this.options.label)}}this._addClass("ui-button","ui-widget");this._setOption("disabled",this.options.disabled);this._enhance();if(this.element.is("a")){this._on({keyup:function(event){if(event.keyCode===$.ui.keyCode.SPACE){event.preventDefault();if(this.element[0].click){this.element[0].click()}else{this.element.trigger("click")}}}})}},_enhance:function(){if(!this.element.is("button")){this.element.attr("role","button")}if(this.options.icon){this._updateIcon("icon",this.options.icon);this._updateTooltip()}},_updateTooltip:function(){this.title=this.element.attr("title");if(!this.options.showLabel&&!this.title){this.element.attr("title",this.options.label)}},_updateIcon:function(option,value){var icon=option!=="iconPosition",position=icon?this.options.iconPosition:value,displayBlock=position==="top"||position==="bottom";if(!this.icon){this.icon=$("<span>");this._addClass(this.icon,"ui-button-icon","ui-icon");if(!this.options.showLabel){this._addClass("ui-button-icon-only")}}else if(icon){this._removeClass(this.icon,null,this.options.icon)}if(icon){this._addClass(this.icon,null,value)}this._attachIcon(position);if(displayBlock){this._addClass(this.icon,null,"ui-widget-icon-block");if(this.iconSpace){this.iconSpace.remove()}}else{if(!this.iconSpace){this.iconSpace=$("<span> </span>");this._addClass(this.iconSpace,"ui-button-icon-space")}this._removeClass(this.icon,null,"ui-wiget-icon-block");this._attachIconSpace(position)}},_destroy:function(){this.element.removeAttr("role");if(this.icon){this.icon.remove()}if(this.iconSpace){this.iconSpace.remove()}if(!this.hasTitle){this.element.removeAttr("title")}},_attachIconSpace:function(iconPosition){this.icon[/^(?:end|bottom)/.test(iconPosition)?"before":"after"](this.iconSpace)},_attachIcon:function(iconPosition){this.element[/^(?:end|bottom)/.test(iconPosition)?"append":"prepend"](this.icon)},_setOptions:function(options){var newShowLabel=options.showLabel===undefined?this.options.showLabel:options.showLabel,newIcon=options.icon===undefined?this.options.icon:options.icon;if(!newShowLabel&&!newIcon){options.showLabel=true}this._super(options)},_setOption:function(key,value){if(key==="icon"){if(value){this._updateIcon(key,value)}else if(this.icon){this.icon.remove();if(this.iconSpace){this.iconSpace.remove()}}}if(key==="iconPosition"){this._updateIcon(key,value)}if(key==="showLabel"){this._toggleClass("ui-button-icon-only",null,!value);this._updateTooltip()}if(key==="label"){if(this.isInput){this.element.val(value)}else{this.element.html(value);if(this.icon){this._attachIcon(this.options.iconPosition);this._attachIconSpace(this.options.iconPosition)}}}this._super(key,value);if(key==="disabled"){this._toggleClass(null,"ui-state-disabled",value);this.element[0].disabled=value;if(value){this.element.blur()}}},refresh:function(){var isDisabled=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");if(isDisabled!==this.options.disabled){this._setOptions({disabled:isDisabled})}this._updateTooltip()}});if($.uiBackCompat!==false){$.widget("ui.button",$.ui.button,{options:{text:true,icons:{primary:null,secondary:null}},_create:function(){if(this.options.showLabel&&!this.options.text){this.options.showLabel=this.options.text}if(!this.options.showLabel&&this.options.text){this.options.text=this.options.showLabel}if(!this.options.icon&&(this.options.icons.primary||this.options.icons.secondary)){if(this.options.icons.primary){this.options.icon=this.options.icons.primary}else{this.options.icon=this.options.icons.secondary;this.options.iconPosition="end"}}else if(this.options.icon){this.options.icons.primary=this.options.icon}this._super()},_setOption:function(key,value){if(key==="text"){this._super("showLabel",value);return}if(key==="showLabel"){this.options.text=value}if(key==="icon"){this.options.icons.primary=value}if(key==="icons"){if(value.primary){this._super("icon",value.primary);this._super("iconPosition","beginning")}else if(value.secondary){this._super("icon",value.secondary);this._super("iconPosition","end")}}this._superApply(arguments)}});$.fn.button=function(orig){return function(){if(!this.length||this.length&&this[0].tagName!=="INPUT"||this.length&&this[0].tagName==="INPUT"&&(this.attr("type")!=="checkbox"&&this.attr("type")!=="radio")){return orig.apply(this,arguments)}if(!$.ui.checkboxradio){$.error("Checkboxradio widget missing")}if(arguments.length===0){return this.checkboxradio({icon:false})}return this.checkboxradio.apply(this,arguments)}}($.fn.button);$.fn.buttonset=function(){if(!$.ui.controlgroup){$.error("Controlgroup widget missing")}if(arguments[0]==="option"&&arguments[1]==="items"&&arguments[2]){return this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]])}if(arguments[0]==="option"&&arguments[1]==="items"){return this.controlgroup.apply(this,[arguments[0],"items.button"])}if(typeof arguments[0]==="object"&&arguments[0].items){arguments[0].items={button:arguments[0].items}}return this.controlgroup.apply(this,arguments)}}var widgetsButton=$.ui.button;$.extend($.ui,{datepicker:{version:"1.12.1"}});var datepicker_instActive;function datepicker_getZindex(elem){var position,value;while(elem.length&&elem[0]!==document){position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value}}elem=elem.parent()}return 0}function Datepicker(){this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};$.extend(this._defaults,this.regional[""]);this.regional.en=$.extend(true,{},this.regional[""]);this.regional["en-US"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(settings){datepicker_extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var nodeName,inline,inst;nodeName=target.nodeName.toLowerCase();inline=nodeName==="div"||nodeName==="span";if(!target.id){this.uuid+=1;target.id="dp"+this.uuid}inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{});if(nodeName==="input"){this._connectDatepicker(target,inst)}else if(inline){this._inlineDatepicker(target,inst)}},_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:!inline?this.dpDiv:datepicker_bindHover($("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}this._attachments(input,inst);input.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp);this._autoSize(inst);$.data(target,"datepicker",inst);if(inst.settings.disabled){this._disableDatepicker(target)}},_attachments:function(input,inst){var showOn,buttonText,buttonImage,appendText=this._get(inst,"appendText"),isRTL=this._get(inst,"isRTL");if(inst.append){inst.append.remove()}if(appendText){inst.append=$("<span class='"+this._appendClass+"'>"+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}input.off("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove()}showOn=this._get(inst,"showOn");if(showOn==="focus"||showOn==="both"){input.on("focus",this._showDatepicker)}if(showOn==="button"||showOn==="both"){buttonText=this._get(inst,"buttonText");buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$("<button type='button'></button>").addClass(this._triggerClass).html(!buttonImage?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.on("click",function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput===input[0]){$.datepicker._hideDatepicker()}else if($.datepicker._datepickerShowing&&$.datepicker._lastInput!==input[0]){$.datepicker._hideDatepicker();$.datepicker._showDatepicker(input[0])}else{$.datepicker._showDatepicker(input[0])}return false})}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var findMax,max,maxI,i,date=new Date(2009,12-1,20),dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){findMax=function(names){max=0;maxI=0;for(i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i}}return maxI};date.setMonth(findMax(this._get(inst,dateFormat.match(/MM/)?"monthNames":"monthNamesShort")));date.setDate(findMax(this._get(inst,dateFormat.match(/DD/)?"dayNames":"dayNamesShort"))+20-date.getDay())}inst.input.attr("size",this._formatDate(inst,date).length)}},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv);$.data(target,"datepicker",inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst);if(inst.settings.disabled){this._disableDatepicker(target)}inst.dpDiv.css("display","block")},_dialogDatepicker:function(input,date,onSelect,settings,pos){var id,browserWidth,browserHeight,scrollX,scrollY,inst=this._dialogInst;if(!inst){this.uuid+=1;id="dp"+this.uuid;this._dialogInput=$("<input type='text' id='"+id+"' style='position: absolute; top: -100px; width: 0px;'/>");this._dialogInput.on("keydown",this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],"datepicker",inst)}datepicker_extendRemove(inst.settings,settings||{});date=date&&date.constructor===Date?this._formatDate(inst,date):date;this._dialogInput.val(date);this._pos=pos?pos.length?pos:[pos.pageX,pos.pageY]:null;if(!this._pos){browserWidth=document.documentElement.clientWidth;browserHeight=document.documentElement.clientHeight;scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[browserWidth/2-100+scrollX,browserHeight/2-150+scrollY]}this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],"datepicker",inst);return this},_destroyDatepicker:function(target){var nodeName,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();$.removeData(target,"datepicker");if(nodeName==="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)}else if(nodeName==="div"||nodeName==="span"){$target.removeClass(this.markerClassName).empty()}if(datepicker_instActive===inst){datepicker_instActive=null}},_enableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",false)}this._disabledInputs=$.map(this._disabledInputs,function(value){return value===target?null:value})},_disableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",true)}this._disabledInputs=$.map(this._disabledInputs,function(value){return value===target?null:value});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]===target){return true}}return false},_getInst:function(target){try{return $.data(target,"datepicker")}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var settings,date,minDate,maxDate,inst=this._getInst(target);if(arguments.length===2&&typeof name==="string"){return name==="defaults"?$.extend({},$.datepicker._defaults):inst?name==="all"?$.extend({},inst.settings):this._get(inst,name):null}settings=name||{};if(typeof name==="string"){settings={};settings[name]=value}if(inst){if(this._curInst===inst){this._hideDatepicker()}date=this._getDateDatepicker(target,true);minDate=this._getMinMaxDate(inst,"min");maxDate=this._getMinMaxDate(inst,"max");datepicker_extendRemove(inst.settings,settings);if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){inst.settings.minDate=this._formatDate(inst,minDate)}if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){inst.settings.maxDate=this._formatDate(inst,maxDate)}if("disabled"in settings){if(settings.disabled){this._disableDatepicker(target)}else{this._enableDatepicker(target)}}this._attachments($(target),inst);this._autoSize(inst);this._setDate(inst,date);this._updateAlternate(inst);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault)}return inst?this._getDate(inst):null},_doKeyDown:function(event){var onSelect,dateStr,sel,inst=$.datepicker._getInst(event.target),handled=true,isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker();handled=false;break;case 13:sel=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}onSelect=$.datepicker._get(inst,"onSelect");if(onSelect){dateStr=$.datepicker._formatDate(inst);onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst])}else{$.datepicker._hideDatepicker()}return false;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(event.target,event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(event.target,event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths"),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,isRTL?+1:-1,"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths"),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,isRTL?-1:+1,"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths"),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else if(event.keyCode===36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var chars,chr,inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));chr=String.fromCharCode(event.charCode==null?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_doKeyUp:function(event){var date,inst=$.datepicker._getInst(event.target);if(inst.input.val()!==inst.lastVal){try{date=$.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),inst.input?inst.input.val():null,$.datepicker._getFormatConfig(inst));if(date){$.datepicker._setDateFromField(inst);$.datepicker._updateAlternate(inst);$.datepicker._updateDatepicker(inst)}}catch(err){}}return true},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!=="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput===input){return}var inst,beforeShow,beforeShowSettings,isFixed,offset,showAnim,duration;inst=$.datepicker._getInst(input);if($.datepicker._curInst&&$.datepicker._curInst!==inst){$.datepicker._curInst.dpDiv.stop(true,true);if(inst&&$.datepicker._datepickerShowing){$.datepicker._hideDatepicker($.datepicker._curInst.input[0])}}beforeShow=$.datepicker._get(inst,"beforeShow");beforeShowSettings=beforeShow?beforeShow.apply(input,[input,inst]):{};if(beforeShowSettings===false){return}datepicker_extendRemove(inst.settings,beforeShowSettings);inst.lastVal=null;$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")==="fixed";return!isFixed});offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.dpDiv.empty();inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":isFixed?"fixed":"absolute",display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){showAnim=$.datepicker._get(inst,"showAnim");duration=$.datepicker._get(inst,"duration");inst.dpDiv.css("z-index",datepicker_getZindex($(input))+1);$.datepicker._datepickerShowing=true;if($.effects&&$.effects.effect[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration)}else{inst.dpDiv[showAnim||"show"](showAnim?duration:null)}if($.datepicker._shouldFocusInput(inst)){inst.input.trigger("focus")}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){this.maxRows=4;datepicker_instActive=inst;inst.dpDiv.empty().append(this._generateHTML(inst));this._attachHandlers(inst);var origyearshtml,numMonths=this._getNumberOfMonths(inst),cols=numMonths[1],width=17,activeCell=inst.dpDiv.find("."+this._dayOverClass+" a");if(activeCell.length>0){datepicker_handleMouseover.apply(activeCell.get(0))}inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",width*cols+"em")}inst.dpDiv[(numMonths[0]!==1||numMonths[1]!==1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst===$.datepicker._curInst&&$.datepicker._datepickerShowing&&$.datepicker._shouldFocusInput(inst)){inst.input.trigger("focus")}if(inst.yearshtml){origyearshtml=inst.yearshtml;setTimeout(function(){if(origyearshtml===inst.yearshtml&&inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml)}origyearshtml=inst.yearshtml=null},0)}},_shouldFocusInput:function(inst){return inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&!inst.input.is(":focus")},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth(),dpHeight=inst.dpDiv.outerHeight(),inputWidth=inst.input?inst.input.outerWidth():0,inputHeight=inst.input?inst.input.outerHeight():0,viewWidth=document.documentElement.clientWidth+(isFixed?0:$(document).scrollLeft()),viewHeight=document.documentElement.clientHeight+(isFixed?0:$(document).scrollTop());offset.left-=this._get(inst,"isRTL")?dpWidth-inputWidth:0;offset.left-=isFixed&&offset.left===inst.input.offset().left?$(document).scrollLeft():0;offset.top-=isFixed&&offset.top===inst.input.offset().top+inputHeight?$(document).scrollTop():0;offset.left-=Math.min(offset.left,offset.left+dpWidth>viewWidth&&viewWidth>dpWidth?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,offset.top+dpHeight>viewHeight&&viewHeight>dpHeight?Math.abs(dpHeight+inputHeight):0);return offset},_findPos:function(obj){var position,inst=this._getInst(obj),isRTL=this._get(inst,"isRTL");while(obj&&(obj.type==="hidden"||obj.nodeType!==1||$.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"]}position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input){var showAnim,duration,postProcess,onClose,inst=this._curInst;if(!inst||input&&inst!==$.data(input,"datepicker")){return}if(this._datepickerShowing){showAnim=this._get(inst,"showAnim");duration=this._get(inst,"duration");postProcess=function(){$.datepicker._tidyDialog(inst)};if($.effects&&($.effects.effect[showAnim]||$.effects[showAnim])){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim==="slideDown"?"slideUp":showAnim==="fadeIn"?"fadeOut":"hide"](showAnim?duration:null,postProcess)}if(!showAnim){postProcess()}this._datepickerShowing=false;onClose=this._get(inst,"onClose");if(onClose){onClose.apply(inst.input?inst.input[0]:null,[inst.input?inst.input.val():"",inst])}this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target),inst=$.datepicker._getInst($target[0]);if($target[0].id!==$.datepicker._mainDivId&&$target.parents("#"+$.datepicker._mainDivId).length===0&&!$target.hasClass($.datepicker.markerClassName)&&!$target.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)||$target.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!==inst){$.datepicker._hideDatepicker()}},_adjustDate:function(id,offset,period){var target=$(id),inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period==="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var date,target=$(id),inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{date=new Date;inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id),inst=this._getInst(target[0]);inst["selected"+(period==="M"?"Month":"Year")]=inst["draw"+(period==="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_selectDay:function(id,month,year,td){var inst,target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},_clearDate:function(id){var target=$(id);this._selectDate(target,"")},_selectDate:function(id,dateStr){var onSelect,target=$(id),inst=this._getInst(target[0]);dateStr=dateStr!=null?dateStr:this._formatDate(inst);if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst])}else if(inst.input){inst.input.trigger("change")}if(inst.inline){this._updateDatepicker(inst)}else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof inst.input[0]!=="object"){inst.input.trigger("focus")}this._lastInput=null}},_updateAlternate:function(inst){var altFormat,date,dateStr,altField=this._get(inst,"altField");if(altField){altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).val(dateStr)}},noWeekends:function(date){var day=date.getDay();return[day>0&&day<6,""]},iso8601Week:function(date){var time,checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/864e5)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=typeof value==="object"?value.toString():value+"";if(value===""){return null}var iFormat,dim,extra,iValue=0,shortYearCutoffTemp=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff,shortYearCutoff=typeof shortYearCutoffTemp!=="string"?shortYearCutoffTemp:(new Date).getFullYear()%100+parseInt(shortYearCutoffTemp,10),dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,year=-1,month=-1,day=-1,doy=-1,literal=false,date,lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches},getNumber=function(match){var isDoubled=lookAhead(match),size=match==="@"?14:match==="!"?20:match==="y"&&isDoubled?4:match==="o"?3:2,minSize=match==="y"?size:1,digits=new RegExp("^\\d{"+minSize+","+size+"}"),num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue}iValue+=num[0].length;return parseInt(num[0],10)},getName=function(match,shortNames,longNames){var index=-1,names=$.map(lookAhead(match)?longNames:shortNames,function(v,k){return[[k,v]]}).sort(function(a,b){return-(a[1].length-b[1].length)});$.each(names,function(i,pair){var name=pair[1];if(value.substr(iValue,name.length).toLowerCase()===name.toLowerCase()){index=pair[0];iValue+=name.length;return false}});if(index!==-1){return index+1}else{throw"Unknown name at position "+iValue}},checkLiteral=function(){if(value.charAt(iValue)!==format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":date=new Date((getNumber("!")-this._ticksTo1970)/1e4);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(iValue<value.length){extra=value.substr(iValue);if(!/^\s+/.test(extra)){throw"Extra/unparsed characters found in date: "+extra}}if(year===-1){year=(new Date).getFullYear()}else if(year<100){year+=(new Date).getFullYear()-(new Date).getFullYear()%100+(year<=shortYearCutoff?0:-100)}if(doy>-1){month=1;day=doy;do{dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!==year||date.getMonth()+1!==month||date.getDate()!==day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*1e7,formatDate:function(format,date,settings){if(!date){return""}var iFormat,dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches},formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num},formatName=function(match,value,shortNames,longNames){return lookAhead(match)?longNames[value]:shortNames[value]},output="",literal=false;if(date){for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",Math.round((new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime()-new Date(date.getFullYear(),0,0).getTime())/864e5),3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=lookAhead("y")?date.getFullYear():(date.getFullYear()%100<10?"0":"")+date.getFullYear()%100;break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*1e4+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var iFormat,chars="",literal=false,lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst,noDefault){if(inst.input.val()===inst.lastVal){return}var dateFormat=this._get(inst,"dateFormat"),dates=inst.lastVal=inst.input?inst.input.val():null,defaultDate=this._getDefaultDate(inst),date=defaultDate,settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){dates=noDefault?"":dates}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=dates?date.getDate():0;inst.currentMonth=dates?date.getMonth():0;inst.currentYear=dates?date.getFullYear():0;this._adjustInstDate(inst)},_getDefaultDate:function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date))},_determineDate:function(inst,date,defaultDate){var offsetNumeric=function(offset){var date=new Date;date.setDate(date.getDate()+offset);return date},offsetString=function(offset){try{return $.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),offset,$.datepicker._getFormatConfig(inst))}catch(e){}var date=(offset.toLowerCase().match(/^c/)?$.datepicker._getDate(inst):null)||new Date,year=date.getFullYear(),month=date.getMonth(),day=date.getDate(),pattern=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)},newDate=date==null||date===""?defaultDate:typeof date==="string"?offsetString(date):typeof date==="number"?isNaN(date)?defaultDate:offsetNumeric(date):new Date(date.getTime());newDate=newDate&&newDate.toString()==="Invalid Date"?defaultDate:newDate;if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0)}return this._daylightSavingAdjust(newDate)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,noChange){var clear=!date,origMonth=inst.selectedMonth,origYear=inst.selectedYear,newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!==inst.selectedMonth||origYear!==inst.selectedYear)&&!noChange){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=!inst.currentYear||inst.input&&inst.input.val()===""?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return startDate},_attachHandlers:function(inst){var stepMonths=this._get(inst,"stepMonths"),id="#"+inst.id.replace(/\\\\/g,"\\");inst.dpDiv.find("[data-handler]").map(function(){var handler={prev:function(){$.datepicker._adjustDate(id,-stepMonths,"M")},next:function(){$.datepicker._adjustDate(id,+stepMonths,"M")},hide:function(){$.datepicker._hideDatepicker()},today:function(){$.datepicker._gotoToday(id)},selectDay:function(){$.datepicker._selectDay(id,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this);return false},selectMonth:function(){$.datepicker._selectMonthYear(id,this,"M");return false},selectYear:function(){$.datepicker._selectMonthYear(id,this,"Y");return false}};$(this).on(this.getAttribute("data-event"),handler[this.getAttribute("data-handler")])})},_generateHTML:function(inst){var maxDraw,prevText,prev,nextText,next,currentText,gotoDate,controls,buttonPanel,firstDay,showWeek,dayNames,dayNamesMin,monthNames,monthNamesShort,beforeShowDay,showOtherMonths,selectOtherMonths,defaultDate,html,dow,row,group,col,selectedDate,cornerClass,calender,thead,day,daysInMonth,leadDays,curRows,numRows,printDate,dRow,tbody,daySettings,otherMonth,unselectable,tempDate=new Date,today=this._daylightSavingAdjust(new Date(tempDate.getFullYear(),tempDate.getMonth(),tempDate.getDate())),isRTL=this._get(inst,"isRTL"),showButtonPanel=this._get(inst,"showButtonPanel"),hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext"),navigationAsDateFormat=this._get(inst,"navigationAsDateFormat"),numMonths=this._getNumberOfMonths(inst),showCurrentAtPos=this._get(inst,"showCurrentAtPos"),stepMonths=this._get(inst,"stepMonths"),isMultiMonth=numMonths[0]!==1||numMonths[1]!==1,currentDate=this._daylightSavingAdjust(!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)),minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),drawMonth=inst.drawMonth-showCurrentAtPos,drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[0]*numMonths[1]+1,maxDate.getDate()));maxDraw=minDate&&maxDraw<minDate?minDate:maxDraw;while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;prevText=this._get(inst,"prevText");prevText=!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst));prev=this._canAdjustMonth(inst,-1,drawYear,drawMonth)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'"+" title='"+prevText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")+"'>"+prevText+"</span></a>":hideIfNoPrevNext?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+prevText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")+"'>"+prevText+"</span></a>";nextText=this._get(inst,"nextText");nextText=!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst));next=this._canAdjustMonth(inst,+1,drawYear,drawMonth)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'"+" title='"+nextText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")+"'>"+nextText+"</span></a>":hideIfNoPrevNext?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+nextText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")+"'>"+nextText+"</span></a>";currentText=this._get(inst,"currentText");gotoDate=this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today;currentText=!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst));controls=!inst.inline?"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(inst,"closeText")+"</button>":"";buttonPanel=showButtonPanel?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'"+">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=isNaN(firstDay)?0:firstDay;showWeek=this._get(inst,"showWeek");dayNames=this._get(inst,"dayNames");dayNamesMin=this._get(inst,"dayNamesMin");monthNames=this._get(inst,"monthNames");monthNamesShort=this._get(inst,"monthNamesShort");beforeShowDay=this._get(inst,"beforeShowDay");showOtherMonths=this._get(inst,"showOtherMonths");selectOtherMonths=this._get(inst,"selectOtherMonths");defaultDate=this._getDefaultDate(inst);html="";for(row=0;row<numMonths[0];row++){group="";this.maxRows=4;for(col=0;col<numMonths[1];col++){selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));cornerClass=" ui-corner-all";calender="";if(isMultiMonth){calender+="<div class='ui-datepicker-group";if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}}calender+="'>"}calender+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+cornerClass+"'>"+(/all|left/.test(cornerClass)&&row===0?isRTL?next:prev:"")+(/all|right/.test(cornerClass)&&row===0?isRTL?prev:next:"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>";thead=showWeek?"<th class='ui-datepicker-week-col'>"+this._get(inst,"weekHeader")+"</th>":"";for(dow=0;dow<7;dow++){day=(dow+firstDay)%7;thead+="<th scope='col'"+((dow+firstDay+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+dayNames[day]+"'>"+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear===inst.selectedYear&&drawMonth===inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;curRows=Math.ceil((leadDays+daysInMonth)/7);numRows=isMultiMonth?this.maxRows>curRows?this.maxRows:curRows:curRows;this.maxRows=numRows;printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(dRow=0;dRow<numRows;dRow++){calender+="<tr>";tbody=!showWeek?"":"<td class='ui-datepicker-week-col'>"+this._get(inst,"calculateWeek")(printDate)+"</td>";for(dow=0;dow<7;dow++){daySettings=beforeShowDay?beforeShowDay.apply(inst.input?inst.input[0]:null,[printDate]):[true,""];otherMonth=printDate.getMonth()!==drawMonth;unselectable=otherMonth&&!selectOtherMonths||!daySettings[0]||minDate&&printDate<minDate||maxDate&&printDate>maxDate;tbody+="<td class='"+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+(printDate.getTime()===selectedDate.getTime()&&drawMonth===inst.selectedMonth&&inst._keyEvent||defaultDate.getTime()===printDate.getTime()&&defaultDate.getTime()===selectedDate.getTime()?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()===currentDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()===today.getTime()?" ui-datepicker-today":""))+"'"+((!otherMonth||showOtherMonths)&&daySettings[2]?" title='"+daySettings[2].replace(/'/g,"&#39;")+"'":"")+(unselectable?"":" data-handler='selectDay' data-event='click' data-month='"+printDate.getMonth()+"' data-year='"+printDate.getFullYear()+"'")+">"+(otherMonth&&!showOtherMonths?"&#xa0;":unselectable?"<span class='ui-state-default'>"+printDate.getDate()+"</span>":"<a class='ui-state-default"+(printDate.getTime()===today.getTime()?" ui-state-highlight":"")+(printDate.getTime()===currentDate.getTime()?" ui-state-active":"")+(otherMonth?" ui-priority-secondary":"")+"' href='#'>"+printDate.getDate()+"</a>")+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+(numMonths[0]>0&&col===numMonths[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"");group+=calender}html+=group}html+=buttonPanel;inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var inMinYear,inMaxYear,month,years,thisYear,determineYear,year,endYear,changeMonth=this._get(inst,"changeMonth"),changeYear=this._get(inst,"changeYear"),showMonthAfterYear=this._get(inst,"showMonthAfterYear"),html="<div class='ui-datepicker-title'>",monthHtml="";if(secondary||!changeMonth){monthHtml+="<span class='ui-datepicker-month'>"+monthNames[drawMonth]+"</span>"}else{inMinYear=minDate&&minDate.getFullYear()===drawYear;inMaxYear=maxDate&&maxDate.getFullYear()===drawYear;monthHtml+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";for(month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+="<option value='"+month+"'"+(month===drawMonth?" selected='selected'":"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")}if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+="<span class='ui-datepicker-year'>"+drawYear+"</span>"}else{years=this._get(inst,"yearRange").split(":");thisYear=(new Date).getFullYear();determineYear=function(value){var year=value.match(/c[+\-].*/)?drawYear+parseInt(value.substring(1),10):value.match(/[+\-].*/)?thisYear+parseInt(value,10):parseInt(value,10);return isNaN(year)?thisYear:year};year=determineYear(years[0]);endYear=Math.max(year,determineYear(years[1]||""));year=minDate?Math.max(year,minDate.getFullYear()):year;endYear=maxDate?Math.min(endYear,maxDate.getFullYear()):endYear;inst.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";for(;year<=endYear;year++){inst.yearshtml+="<option value='"+year+"'"+(year===drawYear?" selected='selected'":"")+">"+year+"</option>"}inst.yearshtml+="</select>";html+=inst.yearshtml;inst.yearshtml=null}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.selectedYear+(period==="Y"?offset:0),month=inst.selectedMonth+(period==="M"?offset:0),day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period==="D"?offset:0),date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period==="M"||period==="Y"){this._notifyChange(inst)}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),newDate=minDate&&date<minDate?minDate:date;return maxDate&&newDate>maxDate?maxDate:newDate},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply(inst.input?inst.input[0]:null,[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return numMonths==null?[1,1]:typeof numMonths==="number"?[1,numMonths]:numMonths},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst),date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var yearSplit,currentYear,minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),minYear=null,maxYear=null,years=this._get(inst,"yearRange");if(years){yearSplit=years.split(":");currentYear=(new Date).getFullYear();minYear=parseInt(yearSplit[0],10);maxYear=parseInt(yearSplit[1],10);if(yearSplit[0].match(/[+\-].*/)){minYear+=currentYear}if(yearSplit[1].match(/[+\-].*/)){maxYear+=currentYear}}return(!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime())&&(!minYear||date.getFullYear()>=minYear)&&(!maxYear||date.getFullYear()<=maxYear)},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=typeof shortYearCutoff!=="string"?shortYearCutoff:(new Date).getFullYear()%100+parseInt(shortYearCutoff,10);return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=day?typeof day==="object"?day:this._daylightSavingAdjust(new Date(year,month,day)):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function datepicker_bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.on("mouseout",selector,function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).removeClass("ui-datepicker-next-hover")}}).on("mouseover",selector,datepicker_handleMouseover)}function datepicker_handleMouseover(){if(!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline?datepicker_instActive.dpDiv.parent()[0]:datepicker_instActive.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).addClass("ui-datepicker-next-hover")}}}function datepicker_extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null){target[name]=props[name]}}return target}$.fn.datepicker=function(options){if(!this.length){return this}if(!$.datepicker.initialized){$(document).on("mousedown",$.datepicker._checkExternalClick);$.datepicker.initialized=true}if($("#"+$.datepicker._mainDivId).length===0){$("body").append($.datepicker.dpDiv)}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options==="string"&&(options==="isDisabled"||options==="getDate"||options==="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options==="option"&&arguments.length===2&&typeof arguments[1]==="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options==="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker;$.datepicker.initialized=false;$.datepicker.uuid=(new Date).getTime();$.datepicker.version="1.12.1";var widgetsDatepicker=$.datepicker;var ie=$.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var mouseHandled=false;$(document).on("mouseup",function(){mouseHandled=false});var widgetsMouse=$.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var that=this;this.element.on("mousedown."+this.widgetName,function(event){return that._mouseDown(event)}).on("click."+this.widgetName,function(event){if(true===$.data(event.target,that.widgetName+".preventClickEvent")){$.removeData(event.target,that.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.off("."+this.widgetName);if(this._mouseMoveDelegate){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)}},_mouseDown:function(event){if(mouseHandled){return}this._mouseMoved=false;this._mouseStarted&&this._mouseUp(event);this._mouseDownEvent=event;var that=this,btnIsLeft=event.which===1,elIsCancel=typeof this.options.cancel==="string"&&event.target.nodeName?$(event.target).closest(this.options.cancel).length:false;if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){that.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(event)!==false;if(!this._mouseStarted){event.preventDefault();return true}}if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(event){return that._mouseMove(event)};this._mouseUpDelegate=function(event){return that._mouseUp(event)};this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();mouseHandled=true;return true},_mouseMove:function(event){if(this._mouseMoved){if($.ui.ie&&(!document.documentMode||document.documentMode<9)&&!event.button){return this._mouseUp(event)}else if(!event.which){if(event.originalEvent.altKey||event.originalEvent.ctrlKey||event.originalEvent.metaKey||event.originalEvent.shiftKey){this.ignoreMissingWhich=true}else if(!this.ignoreMissingWhich){return this._mouseUp(event)}}}if(event.which||event.button){this._mouseMoved=true}if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault()}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(this._mouseDownEvent,event)!==false;this._mouseStarted?this._mouseDrag(event):this._mouseUp(event)}return!this._mouseStarted},_mouseUp:function(event){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target===this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(event)}if(this._mouseDelayTimer){clearTimeout(this._mouseDelayTimer);delete this._mouseDelayTimer}this.ignoreMissingWhich=false;mouseHandled=false;event.preventDefault()},_mouseDistanceMet:function(event){return Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}});var plugin=$.ui.plugin={add:function(module,option,set){var i,proto=$.ui[module].prototype;for(i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,args,allowDisconnected){var i,set=instance.plugins[name];if(!set){return}if(!allowDisconnected&&(!instance.element[0].parentNode||instance.element[0].parentNode.nodeType===11)){return}for(i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args)}}}};var safeBlur=$.ui.safeBlur=function(element){if(element&&element.nodeName.toLowerCase()!=="body"){$(element).trigger("blur")}};$.widget("ui.draggable",$.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false,drag:null,start:null,stop:null},_create:function(){if(this.options.helper==="original"){this._setPositionRelative()}if(this.options.addClasses){this._addClass("ui-draggable")}this._setHandleClassName();this._mouseInit()},_setOption:function(key,value){this._super(key,value);if(key==="handle"){this._removeHandleClassName();this._setHandleClassName()}},_destroy:function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=true;return}this._removeHandleClassName();this._mouseDestroy()},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).closest(".ui-resizable-handle").length>0){return false}this.handle=this._getHandle(event);if(!this.handle){return false}this._blurActiveElement(event);this._blockFrames(o.iframeFix===true?"iframe":o.iframeFix);return true},_blockFrames:function(selector){this.iframeBlocks=this.document.find(selector).map(function(){var iframe=$(this);return $("<div>").css("position","absolute").appendTo(iframe.parent()).outerWidth(iframe.outerWidth()).outerHeight(iframe.outerHeight()).offset(iframe.offset())[0]})},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks}},_blurActiveElement:function(event){var activeElement=$.ui.safeActiveElement(this.document[0]),target=$(event.target);if(target.closest(activeElement).length){return}$.ui.safeBlur(activeElement)},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._addClass(this.helper,"ui-draggable-dragging");this._cacheHelperProportions();if($.ui.ddmanager){$.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent(true);this.offsetParent=this.helper.offsetParent();this.hasFixedAncestor=this.helper.parents().filter(function(){return $(this).css("position")==="fixed"}).length>0;this.positionAbs=this.element.offset();this._refreshOffsets(event);this.originalPosition=this.position=this._generatePosition(event,false);this.originalPageX=event.pageX;this.originalPageY=event.pageY;o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt);this._setContainment();if(this._trigger("start",event)===false){this._clear();return false}this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}this._mouseDrag(event,true);if($.ui.ddmanager){$.ui.ddmanager.dragStart(this,event)}return true},_refreshOffsets:function(event){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:false,parent:this._getParentOffset(),relative:this._getRelativeOffset()};this.offset.click={left:event.pageX-this.offset.left,top:event.pageY-this.offset.top}},_mouseDrag:function(event,noPropagation){if(this.hasFixedAncestor){this.offset.parent=this._getParentOffset()}this.position=this._generatePosition(event,true);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===false){this._mouseUp(new $.Event("mouseup",event));return false}this.position=ui.position}this.helper[0].style.left=this.position.left+"px";this.helper[0].style.top=this.position.top+"px";if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}return false},_mouseStop:function(event){var that=this,dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour){dropped=$.ui.ddmanager.drop(this,event)}if(this.dropped){dropped=this.dropped;this.dropped=false}if(this.options.revert==="invalid"&&!dropped||this.options.revert==="valid"&&dropped||this.options.revert===true||$.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped)){$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(that._trigger("stop",event)!==false){that._clear()}})}else{if(this._trigger("stop",event)!==false){this._clear()}}return false},_mouseUp:function(event){this._unblockFrames();if($.ui.ddmanager){$.ui.ddmanager.dragStop(this,event)}if(this.handleElement.is(event.target)){this.element.trigger("focus")}return $.ui.mouse.prototype._mouseUp.call(this,event)},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp(new $.Event("mouseup",{target:this.element[0]}))}else{this._clear()}return this},_getHandle:function(event){return this.options.handle?!!$(event.target).closest(this.element.find(this.options.handle)).length:true},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element;this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(event){var o=this.options,helperIsFunction=$.isFunction(o.helper),helper=helperIsFunction?$(o.helper.apply(this.element[0],[event])):o.helper==="clone"?this.element.clone().removeAttr("id"):this.element;if(!helper.parents("body").length){helper.appendTo(o.appendTo==="parent"?this.element[0].parentNode:o.appendTo)}if(helperIsFunction&&helper[0]===this.element[0]){this._setPositionRelative()}if(helper[0]!==this.element[0]&&!/(fixed|absolute)/.test(helper.css("position"))){helper.css("position","absolute")}return helper},_setPositionRelative:function(){if(!/^(?:r|a|f)/.test(this.element.css("position"))){this.element[0].style.position="relative"}},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_isRootNode:function(element){return/(html|body)/i.test(element.tagName)||element===this.document[0]},_getParentOffset:function(){var po=this.offsetParent.offset(),document=this.document[0];if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}if(this._isRootNode(this.offsetParent[0])){po={top:0,left:0}}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition!=="relative"){return{top:0,left:0}}var p=this.element.position(),scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+(!scrollIsRootNode?this.scrollParent.scrollTop():0),left:p.left-(parseInt(this.helper.css("left"),10)||0)+(!scrollIsRootNode?this.scrollParent.scrollLeft():0)}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var isUserScrollable,c,ce,o=this.options,document=this.document[0];this.relativeContainer=null;if(!o.containment){this.containment=null;return}if(o.containment==="window"){this.containment=[$(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,$(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,$(window).scrollLeft()+$(window).width()-this.helperProportions.width-this.margins.left,$(window).scrollTop()+($(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment==="document"){this.containment=[0,0,$(document).width()-this.helperProportions.width-this.margins.left,($(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment.constructor===Array){this.containment=o.containment;return}if(o.containment==="parent"){o.containment=this.helper[0].parentNode}c=$(o.containment);ce=c[0];if(!ce){return}isUserScrollable=/(scroll|auto)/.test(c.css("overflow"));this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(isUserScrollable?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(isUserScrollable?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relativeContainer=c},_convertPositionTo:function(d,pos){if(!pos){pos=this.position}var mod=d==="absolute"?1:-1,scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top)*mod,left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)*mod}},_generatePosition:function(event,constrainPosition){var containment,co,top,left,o=this.options,scrollIsRootNode=this._isRootNode(this.scrollParent[0]),pageX=event.pageX,pageY=event.pageY;if(!scrollIsRootNode||!this.offset.scroll){this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}}if(constrainPosition){if(this.containment){if(this.relativeContainer){co=this.relativeContainer.offset();containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top]}else{containment=this.containment}if(event.pageX-this.offset.click.left<containment[0]){pageX=containment[0]+this.offset.click.left}if(event.pageY-this.offset.click.top<containment[1]){pageY=containment[1]+this.offset.click.top}if(event.pageX-this.offset.click.left>containment[2]){pageX=containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>containment[3]){pageY=containment[3]+this.offset.click.top}}if(o.grid){top=o.grid[1]?this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY;pageY=containment?top-this.offset.click.top>=containment[1]||top-this.offset.click.top>containment[3]?top:top-this.offset.click.top>=containment[1]?top-o.grid[1]:top+o.grid[1]:top;left=o.grid[0]?this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX;pageX=containment?left-this.offset.click.left>=containment[0]||left-this.offset.click.left>containment[2]?left:left-this.offset.click.left>=containment[0]?left-o.grid[0]:left+o.grid[0]:left}if(o.axis==="y"){pageX=this.originalPageX}if(o.axis==="x"){pageY=this.originalPageY}}return{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging");if(this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false;if(this.destroyOnClear){this.destroy()}},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui,this],true);if(/^(drag|start|stop)/.test(type)){this.positionAbs=this._convertPositionTo("absolute");ui.offset=this.positionAbs}return $.Widget.prototype._trigger.call(this,type,event,ui)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui,draggable){var uiSortable=$.extend({},ui,{item:draggable.element});draggable.sortables=[];$(draggable.options.connectToSortable).each(function(){var sortable=$(this).sortable("instance");if(sortable&&!sortable.options.disabled){draggable.sortables.push(sortable);sortable.refreshPositions();sortable._trigger("activate",event,uiSortable)}})},stop:function(event,ui,draggable){var uiSortable=$.extend({},ui,{item:draggable.element});draggable.cancelHelperRemoval=false;$.each(draggable.sortables,function(){var sortable=this;if(sortable.isOver){sortable.isOver=0;draggable.cancelHelperRemoval=true;sortable.cancelHelperRemoval=false;sortable._storedCSS={position:sortable.placeholder.css("position"),top:sortable.placeholder.css("top"),left:sortable.placeholder.css("left")};sortable._mouseStop(event);sortable.options.helper=sortable.options._helper}else{sortable.cancelHelperRemoval=true;sortable._trigger("deactivate",event,uiSortable)}})},drag:function(event,ui,draggable){$.each(draggable.sortables,function(){var innermostIntersecting=false,sortable=this;sortable.positionAbs=draggable.positionAbs;sortable.helperProportions=draggable.helperProportions;sortable.offset.click=draggable.offset.click;if(sortable._intersectsWith(sortable.containerCache)){innermostIntersecting=true;$.each(draggable.sortables,function(){this.positionAbs=draggable.positionAbs;this.helperProportions=draggable.helperProportions;this.offset.click=draggable.offset.click;if(this!==sortable&&this._intersectsWith(this.containerCache)&&$.contains(sortable.element[0],this.element[0])){innermostIntersecting=false}return innermostIntersecting})}if(innermostIntersecting){if(!sortable.isOver){sortable.isOver=1;draggable._parent=ui.helper.parent();sortable.currentItem=ui.helper.appendTo(sortable.element).data("ui-sortable-item",true);sortable.options._helper=sortable.options.helper;sortable.options.helper=function(){return ui.helper[0]};event.target=sortable.currentItem[0];sortable._mouseCapture(event,true);sortable._mouseStart(event,true,true);sortable.offset.click.top=draggable.offset.click.top;sortable.offset.click.left=draggable.offset.click.left;sortable.offset.parent.left-=draggable.offset.parent.left-sortable.offset.parent.left;sortable.offset.parent.top-=draggable.offset.parent.top-sortable.offset.parent.top;draggable._trigger("toSortable",event);draggable.dropped=sortable.element;$.each(draggable.sortables,function(){this.refreshPositions()});draggable.currentItem=draggable.element;sortable.fromOutside=draggable}if(sortable.currentItem){sortable._mouseDrag(event);ui.position=sortable.position}}else{if(sortable.isOver){sortable.isOver=0;sortable.cancelHelperRemoval=true;sortable.options._revert=sortable.options.revert;sortable.options.revert=false;sortable._trigger("out",event,sortable._uiHash(sortable));sortable._mouseStop(event,true);sortable.options.revert=sortable.options._revert;sortable.options.helper=sortable.options._helper;if(sortable.placeholder){sortable.placeholder.remove()}ui.helper.appendTo(draggable._parent);draggable._refreshOffsets(event);ui.position=draggable._generatePosition(event,true);draggable._trigger("fromSortable",event);draggable.dropped=false;$.each(draggable.sortables,function(){this.refreshPositions()})}}})}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui,instance){var t=$("body"),o=instance.options;if(t.css("cursor")){o._cursor=t.css("cursor")}t.css("cursor",o.cursor)},stop:function(event,ui,instance){var o=instance.options;if(o._cursor){$("body").css("cursor",o._cursor)}}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui,instance){var t=$(ui.helper),o=instance.options;if(t.css("opacity")){o._opacity=t.css("opacity")}t.css("opacity",o.opacity)},stop:function(event,ui,instance){var o=instance.options;if(o._opacity){$(ui.helper).css("opacity",o._opacity)}}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui,i){if(!i.scrollParentNotHidden){i.scrollParentNotHidden=i.helper.scrollParent(false)}if(i.scrollParentNotHidden[0]!==i.document[0]&&i.scrollParentNotHidden[0].tagName!=="HTML"){i.overflowOffset=i.scrollParentNotHidden.offset()}},drag:function(event,ui,i){var o=i.options,scrolled=false,scrollParent=i.scrollParentNotHidden[0],document=i.document[0];if(scrollParent!==document&&scrollParent.tagName!=="HTML"){if(!o.axis||o.axis!=="x"){if(i.overflowOffset.top+scrollParent.offsetHeight-event.pageY<o.scrollSensitivity){scrollParent.scrollTop=scrolled=scrollParent.scrollTop+o.scrollSpeed}else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity){scrollParent.scrollTop=scrolled=scrollParent.scrollTop-o.scrollSpeed}}if(!o.axis||o.axis!=="y"){if(i.overflowOffset.left+scrollParent.offsetWidth-event.pageX<o.scrollSensitivity){scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft+o.scrollSpeed}else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity){scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft-o.scrollSpeed}}}else{if(!o.axis||o.axis!=="x"){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed)}else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed)}}if(!o.axis||o.axis!=="y"){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed)}else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed)}}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(i,event)}}});$.ui.plugin.add("draggable","snap",{start:function(event,ui,i){var o=i.options;i.snapElements=[];$(o.snap.constructor!==String?o.snap.items||":data(ui-draggable)":o.snap).each(function(){var $t=$(this),$o=$t.offset();if(this!==i.element[0]){i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left})}})},drag:function(event,ui,inst){var ts,bs,ls,rs,l,r,t,b,i,first,o=inst.options,d=o.snapTolerance,x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(i=inst.snapElements.length-1;i>=0;i--){l=inst.snapElements[i].left-inst.margins.left;r=l+inst.snapElements[i].width;t=inst.snapElements[i].top-inst.margins.top;b=t+inst.snapElements[i].height;if(x2<l-d||x1>r+d||y2<t-d||y1>b+d||!$.contains(inst.snapElements[i].item.ownerDocument,inst.snapElements[i].item)){if(inst.snapElements[i].snapping){inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}))}inst.snapElements[i].snapping=false;continue}if(o.snapMode!=="inner"){ts=Math.abs(t-y2)<=d;bs=Math.abs(b-y1)<=d;ls=Math.abs(l-x2)<=d;rs=Math.abs(r-x1)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left}}first=ts||bs||ls||rs;if(o.snapMode!=="outer"){ts=Math.abs(t-y1)<=d;bs=Math.abs(b-y2)<=d;ls=Math.abs(l-x1)<=d;rs=Math.abs(r-x2)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left}}if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)){inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}))}inst.snapElements[i].snapping=ts||bs||ls||rs||first}}});$.ui.plugin.add("draggable","stack",{start:function(event,ui,instance){var min,o=instance.options,group=$.makeArray($(o.stack)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-(parseInt($(b).css("zIndex"),10)||0)});if(!group.length){return}min=parseInt($(group[0]).css("zIndex"),10)||0;$(group).each(function(i){$(this).css("zIndex",min+i)});this.css("zIndex",min+group.length)}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui,instance){var t=$(ui.helper),o=instance.options;if(t.css("zIndex")){o._zIndex=t.css("zIndex")}t.css("zIndex",o.zIndex)},stop:function(event,ui,instance){var o=instance.options;if(o._zIndex){$(ui.helper).css("zIndex",o._zIndex)}}});var widgetsDraggable=$.ui.draggable;$.widget("ui.resizable",$.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(value){return parseFloat(value)||0},_isNumber:function(value){return!isNaN(parseFloat(value))},_hasScroll:function(el,a){if($(el).css("overflow")==="hidden"){return false}var scroll=a&&a==="left"?"scrollLeft":"scrollTop",has=false;if(el[scroll]>0){return true}el[scroll]=1;has=el[scroll]>0;el[scroll]=0;return has},_create:function(){var margins,o=this.options,that=this;this._addClass("ui-resizable");$.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)){this.element.wrap($("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance"));this.elementIsWrapper=true;margins={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")};this.element.css(margins);this.originalElement.css("margin",0);this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css(margins);this._proportionallyResize()}this._setupHandles();if(o.autoHide){$(this.element).on("mouseenter",function(){if(o.disabled){return}that._removeClass("ui-resizable-autohide");that._handles.show()}).on("mouseleave",function(){if(o.disabled){return}if(!that.resizing){that._addClass("ui-resizable-autohide");that._handles.hide()}})}this._mouseInit()},_destroy:function(){this._mouseDestroy();var wrapper,_destroy=function(exp){$(exp).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){_destroy(this.element);wrapper=this.element;this.originalElement.css({position:wrapper.css("position"),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css("top"),left:wrapper.css("left")}).insertAfter(wrapper);wrapper.remove()}this.originalElement.css("resize",this.originalResizeStyle);_destroy(this.originalElement);return this},_setOption:function(key,value){this._super(key,value);switch(key){case"handles":this._removeHandles();this._setupHandles();break;default:break}},_setupHandles:function(){var o=this.options,handle,i,n,hname,axis,that=this;this.handles=o.handles||(!$(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});this._handles=$();if(this.handles.constructor===String){if(this.handles==="all"){this.handles="n,e,s,w,se,sw,ne,nw"}n=this.handles.split(",");this.handles={};for(i=0;i<n.length;i++){handle=$.trim(n[i]);hname="ui-resizable-"+handle;axis=$("<div>");this._addClass(axis,"ui-resizable-handle "+hname);axis.css({zIndex:o.zIndex});this.handles[handle]=".ui-resizable-"+handle;this.element.append(axis)}}this._renderAxis=function(target){var i,axis,padPos,padWrapper;target=target||this.element;for(i in this.handles){if(this.handles[i].constructor===String){this.handles[i]=this.element.children(this.handles[i]).first().show()}else if(this.handles[i].jquery||this.handles[i].nodeType){this.handles[i]=$(this.handles[i]);this._on(this.handles[i],{mousedown:that._mouseDown})}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)){axis=$(this.handles[i],this.element);padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();padPos=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");target.css(padPos,padWrapper);this._proportionallyResize()}this._handles=this._handles.add(this.handles[i])}};this._renderAxis(this.element);this._handles=this._handles.add(this.element.find(".ui-resizable-handle"));this._handles.disableSelection();this._handles.on("mouseover",function(){if(!that.resizing){if(this.className){axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}that.axis=axis&&axis[1]?axis[1]:"se"}});if(o.autoHide){this._handles.hide();this._addClass("ui-resizable-autohide")}},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(event){var i,handle,capture=false;for(i in this.handles){handle=$(this.handles[i])[0];if(handle===event.target||$.contains(handle,event.target)){capture=true}}return!this.options.disabled&&capture},_mouseStart:function(event){var curleft,curtop,cursor,o=this.options,el=this.element;this.resizing=true;this._renderProxy();curleft=this._num(this.helper.css("left"));curtop=this._num(this.helper.css("top"));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalPosition={left:curleft,top:curtop};this.originalMousePosition={left:event.pageX,top:event.pageY};this.aspectRatio=typeof o.aspectRatio==="number"?o.aspectRatio:this.originalSize.width/this.originalSize.height||1;cursor=$(".ui-resizable-"+this.axis).css("cursor");$("body").css("cursor",cursor==="auto"?this.axis+"-resize":cursor);this._addClass("ui-resizable-resizing");this._propagate("start",event);return true},_mouseDrag:function(event){var data,props,smp=this.originalMousePosition,a=this.axis,dx=event.pageX-smp.left||0,dy=event.pageY-smp.top||0,trigger=this._change[a];this._updatePrevProperties();if(!trigger){return false}data=trigger.apply(this,[event,dx,dy]);this._updateVirtualBoundaries(event.shiftKey);if(this._aspectRatio||event.shiftKey){data=this._updateRatio(data,event)}data=this._respectSize(data,event);this._updateCache(data);this._propagate("resize",event);props=this._applyChanges();if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}if(!$.isEmptyObject(props)){this._updatePrevProperties();this._trigger("resize",event,this.ui());this._applyChanges()}return false},_mouseStop:function(event){this.resizing=false;var pr,ista,soffseth,soffsetw,s,left,top,o=this.options,that=this;if(this._helper){pr=this._proportionallyResizeElements;ista=pr.length&&/textarea/i.test(pr[0].nodeName);soffseth=ista&&this._hasScroll(pr[0],"left")?0:that.sizeDiff.height;soffsetw=ista?0:that.sizeDiff.width;s={width:that.helper.width()-soffsetw,height:that.helper.height()-soffseth};left=parseFloat(that.element.css("left"))+(that.position.left-that.originalPosition.left)||null;top=parseFloat(that.element.css("top"))+(that.position.top-that.originalPosition.top)||null;if(!o.animate){this.element.css($.extend(s,{top:top,left:left}))}that.helper.height(that.size.height);that.helper.width(that.size.width);if(this._helper&&!o.animate){this._proportionallyResize()}}$("body").css("cursor","auto");this._removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper){this.helper.remove()}return false},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left};this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var props={};if(this.position.top!==this.prevPosition.top){props.top=this.position.top+"px"}if(this.position.left!==this.prevPosition.left){props.left=this.position.left+"px"}if(this.size.width!==this.prevSize.width){props.width=this.size.width+"px"}if(this.size.height!==this.prevSize.height){props.height=this.size.height+"px"}this.helper.css(props);return props},_updateVirtualBoundaries:function(forceAspectRatio){var pMinWidth,pMaxWidth,pMinHeight,pMaxHeight,b,o=this.options;b={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:Infinity,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:Infinity};if(this._aspectRatio||forceAspectRatio){pMinWidth=b.minHeight*this.aspectRatio;pMinHeight=b.minWidth/this.aspectRatio;pMaxWidth=b.maxHeight*this.aspectRatio;pMaxHeight=b.maxWidth/this.aspectRatio;if(pMinWidth>b.minWidth){b.minWidth=pMinWidth}if(pMinHeight>b.minHeight){b.minHeight=pMinHeight}if(pMaxWidth<b.maxWidth){b.maxWidth=pMaxWidth}if(pMaxHeight<b.maxHeight){b.maxHeight=pMaxHeight}}this._vBoundaries=b},_updateCache:function(data){this.offset=this.helper.offset();if(this._isNumber(data.left)){this.position.left=data.left}if(this._isNumber(data.top)){this.position.top=data.top}if(this._isNumber(data.height)){this.size.height=data.height}if(this._isNumber(data.width)){this.size.width=data.width}},_updateRatio:function(data){var cpos=this.position,csize=this.size,a=this.axis;if(this._isNumber(data.height)){data.width=data.height*this.aspectRatio}else if(this._isNumber(data.width)){data.height=data.width/this.aspectRatio}if(a==="sw"){data.left=cpos.left+(csize.width-data.width);data.top=null}if(a==="nw"){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width)}return data},_respectSize:function(data){var o=this._vBoundaries,a=this.axis,ismaxw=this._isNumber(data.width)&&o.maxWidth&&o.maxWidth<data.width,ismaxh=this._isNumber(data.height)&&o.maxHeight&&o.maxHeight<data.height,isminw=this._isNumber(data.width)&&o.minWidth&&o.minWidth>data.width,isminh=this._isNumber(data.height)&&o.minHeight&&o.minHeight>data.height,dw=this.originalPosition.left+this.originalSize.width,dh=this.originalPosition.top+this.originalSize.height,cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw){data.width=o.minWidth}if(isminh){data.height=o.minHeight}if(ismaxw){data.width=o.maxWidth}if(ismaxh){data.height=o.maxHeight}if(isminw&&cw){data.left=dw-o.minWidth}if(ismaxw&&cw){data.left=dw-o.maxWidth}if(isminh&&ch){data.top=dh-o.minHeight}if(ismaxh&&ch){data.top=dh-o.maxHeight}if(!data.width&&!data.height&&!data.left&&data.top){data.top=null}else if(!data.width&&!data.height&&!data.top&&data.left){data.left=null}return data},_getPaddingPlusBorderDimensions:function(element){var i=0,widths=[],borders=[element.css("borderTopWidth"),element.css("borderRightWidth"),element.css("borderBottomWidth"),element.css("borderLeftWidth")],paddings=[element.css("paddingTop"),element.css("paddingRight"),element.css("paddingBottom"),element.css("paddingLeft")];for(;i<4;i++){widths[i]=parseFloat(borders[i])||0;widths[i]+=parseFloat(paddings[i])||0}return{height:widths[0]+widths[2],width:widths[1]+widths[3]}},_proportionallyResize:function(){if(!this._proportionallyResizeElements.length){return}var prel,i=0,element=this.helper||this.element;for(;i<this._proportionallyResizeElements.length;i++){prel=this._proportionallyResizeElements[i];if(!this.outerDimensions){this.outerDimensions=this._getPaddingPlusBorderDimensions(prel)}prel.css({height:element.height()-this.outerDimensions.height||0,width:element.width()-this.outerDimensions.width||0})}},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(this._helper){this.helper=this.helper||$("<div style='overflow:hidden;'></div>");this._addClass(this.helper,this._helper);this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(event,dx){return{width:this.originalSize.width+dx}},w:function(event,dx){var cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx}},n:function(event,dx,dy){var cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy}},s:function(event,dx,dy){return{height:this.originalSize.height+dy}},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);n!=="resize"&&this._trigger(n,event,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});$.ui.plugin.add("resizable","animate",{stop:function(event){var that=$(this).resizable("instance"),o=that.options,pr=that._proportionallyResizeElements,ista=pr.length&&/textarea/i.test(pr[0].nodeName),soffseth=ista&&that._hasScroll(pr[0],"left")?0:that.sizeDiff.height,soffsetw=ista?0:that.sizeDiff.width,style={width:that.size.width-soffsetw,height:that.size.height-soffseth},left=parseFloat(that.element.css("left"))+(that.position.left-that.originalPosition.left)||null,top=parseFloat(that.element.css("top"))+(that.position.top-that.originalPosition.top)||null;that.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:function(){var data={width:parseFloat(that.element.css("width")),height:parseFloat(that.element.css("height")),top:parseFloat(that.element.css("top")),left:parseFloat(that.element.css("left"))};if(pr&&pr.length){$(pr[0]).css({width:data.width,height:data.height})}that._updateCache(data);that._propagate("resize",event)}})}});$.ui.plugin.add("resizable","containment",{start:function(){var element,p,co,ch,cw,width,height,that=$(this).resizable("instance"),o=that.options,el=that.element,oc=o.containment,ce=oc instanceof $?oc.get(0):/parent/.test(oc)?el.parent().get(0):oc;if(!ce){return}that.containerElement=$(ce);if(/document/.test(oc)||oc===document){that.containerOffset={left:0,top:0};that.containerPosition={left:0,top:0};that.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight}}else{element=$(ce);p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=that._num(element.css("padding"+name))});that.containerOffset=element.offset();that.containerPosition=element.position();that.containerSize={height:element.innerHeight()-p[3],width:element.innerWidth()-p[1]};co=that.containerOffset;ch=that.containerSize.height;cw=that.containerSize.width;width=that._hasScroll(ce,"left")?ce.scrollWidth:cw;height=that._hasScroll(ce)?ce.scrollHeight:ch;that.parentData={element:ce,left:co.left,top:co.top,width:width,height:height}}},resize:function(event){var woset,hoset,isParent,isOffsetRelative,that=$(this).resizable("instance"),o=that.options,co=that.containerOffset,cp=that.position,pRatio=that._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=that.containerElement,continueResize=true;if(ce[0]!==document&&/static/.test(ce.css("position"))){cop=co}if(cp.left<(that._helper?co.left:0)){that.size.width=that.size.width+(that._helper?that.position.left-co.left:that.position.left-cop.left);if(pRatio){that.size.height=that.size.width/that.aspectRatio;continueResize=false}that.position.left=o.helper?co.left:0}if(cp.top<(that._helper?co.top:0)){that.size.height=that.size.height+(that._helper?that.position.top-co.top:that.position.top);if(pRatio){that.size.width=that.size.height*that.aspectRatio;continueResize=false}that.position.top=that._helper?co.top:0}isParent=that.containerElement.get(0)===that.element.parent().get(0);isOffsetRelative=/relative|absolute/.test(that.containerElement.css("position"));if(isParent&&isOffsetRelative){that.offset.left=that.parentData.left+that.position.left;that.offset.top=that.parentData.top+that.position.top}else{that.offset.left=that.element.offset().left;that.offset.top=that.element.offset().top}woset=Math.abs(that.sizeDiff.width+(that._helper?that.offset.left-cop.left:that.offset.left-co.left));hoset=Math.abs(that.sizeDiff.height+(that._helper?that.offset.top-cop.top:that.offset.top-co.top));if(woset+that.size.width>=that.parentData.width){that.size.width=that.parentData.width-woset;if(pRatio){that.size.height=that.size.width/that.aspectRatio;continueResize=false}}if(hoset+that.size.height>=that.parentData.height){that.size.height=that.parentData.height-hoset;if(pRatio){that.size.width=that.size.height*that.aspectRatio;continueResize=false}}if(!continueResize){that.position.left=that.prevPosition.left;that.position.top=that.prevPosition.top;that.size.width=that.prevSize.width;that.size.height=that.prevSize.height}},stop:function(){var that=$(this).resizable("instance"),o=that.options,co=that.containerOffset,cop=that.containerPosition,ce=that.containerElement,helper=$(that.helper),ho=helper.offset(),w=helper.outerWidth()-that.sizeDiff.width,h=helper.outerHeight()-that.sizeDiff.height;if(that._helper&&!o.animate&&/relative/.test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h})}if(that._helper&&!o.animate&&/static/.test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h})}}});$.ui.plugin.add("resizable","alsoResize",{start:function(){var that=$(this).resizable("instance"),o=that.options;$(o.alsoResize).each(function(){var el=$(this);el.data("ui-resizable-alsoresize",{width:parseFloat(el.width()),height:parseFloat(el.height()),left:parseFloat(el.css("left")),top:parseFloat(el.css("top"))})})},resize:function(event,ui){var that=$(this).resizable("instance"),o=that.options,os=that.originalSize,op=that.originalPosition,delta={height:that.size.height-os.height||0,width:that.size.width-os.width||0,top:that.position.top-op.top||0,left:that.position.left-op.left||0};$(o.alsoResize).each(function(){var el=$(this),start=$(this).data("ui-resizable-alsoresize"),style={},css=el.parents(ui.originalElement[0]).length?["width","height"]:["width","height","top","left"];$.each(css,function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0){style[prop]=sum||null}});el.css(style)})},stop:function(){$(this).removeData("ui-resizable-alsoresize")}});$.ui.plugin.add("resizable","ghost",{start:function(){var that=$(this).resizable("instance"),cs=that.size;that.ghost=that.originalElement.clone();that.ghost.css({opacity:.25,display:"block",position:"relative",height:cs.height,width:cs.width,margin:0,left:0,top:0});that._addClass(that.ghost,"ui-resizable-ghost");if($.uiBackCompat!==false&&typeof that.options.ghost==="string"){that.ghost.addClass(this.options.ghost)}that.ghost.appendTo(that.helper)},resize:function(){var that=$(this).resizable("instance");if(that.ghost){that.ghost.css({position:"relative",height:that.size.height,width:that.size.width})}},stop:function(){var that=$(this).resizable("instance");if(that.ghost&&that.helper){that.helper.get(0).removeChild(that.ghost.get(0))}}});$.ui.plugin.add("resizable","grid",{resize:function(){var outerDimensions,that=$(this).resizable("instance"),o=that.options,cs=that.size,os=that.originalSize,op=that.originalPosition,a=that.axis,grid=typeof o.grid==="number"?[o.grid,o.grid]:o.grid,gridX=grid[0]||1,gridY=grid[1]||1,ox=Math.round((cs.width-os.width)/gridX)*gridX,oy=Math.round((cs.height-os.height)/gridY)*gridY,newWidth=os.width+ox,newHeight=os.height+oy,isMaxWidth=o.maxWidth&&o.maxWidth<newWidth,isMaxHeight=o.maxHeight&&o.maxHeight<newHeight,isMinWidth=o.minWidth&&o.minWidth>newWidth,isMinHeight=o.minHeight&&o.minHeight>newHeight;o.grid=grid;if(isMinWidth){newWidth+=gridX}if(isMinHeight){newHeight+=gridY}if(isMaxWidth){newWidth-=gridX}if(isMaxHeight){newHeight-=gridY}if(/^(se|s|e)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight}else if(/^(ne)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;that.position.top=op.top-oy}else if(/^(sw)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;that.position.left=op.left-ox}else{if(newHeight-gridY<=0||newWidth-gridX<=0){outerDimensions=that._getPaddingPlusBorderDimensions(this)}if(newHeight-gridY>0){that.size.height=newHeight;that.position.top=op.top-oy}else{newHeight=gridY-outerDimensions.height;that.size.height=newHeight;that.position.top=op.top+os.height-newHeight}if(newWidth-gridX>0){that.size.width=newWidth;that.position.left=op.left-ox}else{newWidth=gridX-outerDimensions.width;that.size.width=newWidth;that.position.left=op.left+os.width-newWidth}}}});var widgetsResizable=$.ui.resizable;$.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:true,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:true,closeText:"Close",draggable:true,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",of:window,collision:"fit",using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css("top",pos.top-topOffset)}}},resizable:true,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},resizableRelatedOptions:{maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height};this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)};this.originalTitle=this.element.attr("title");if(this.options.title==null&&this.originalTitle!=null){this.options.title=this.originalTitle}if(this.options.disabled){this.options.disabled=false}this._createWrapper();this.element.show().removeAttr("title").appendTo(this.uiDialog);this._addClass("ui-dialog-content","ui-widget-content");this._createTitlebar();this._createButtonPane();if(this.options.draggable&&$.fn.draggable){this._makeDraggable()}if(this.options.resizable&&$.fn.resizable){this._makeResizable()}this._isOpen=false;this._trackFocus()},_init:function(){if(this.options.autoOpen){this.open()}},_appendTo:function(){var element=this.options.appendTo;if(element&&(element.jquery||element.nodeType)){return $(element)}return this.document.find(element||"body").eq(0)},_destroy:function(){var next,originalPosition=this.originalPosition;this._untrackInstance();this._destroyOverlay();this.element.removeUniqueId().css(this.originalCss).detach();this.uiDialog.remove();if(this.originalTitle){this.element.attr("title",this.originalTitle)}next=originalPosition.parent.children().eq(originalPosition.index);if(next.length&&next[0]!==this.element[0]){next.before(this.element)}else{originalPosition.parent.append(this.element)}},widget:function(){return this.uiDialog},disable:$.noop,enable:$.noop,close:function(event){var that=this;if(!this._isOpen||this._trigger("beforeClose",event)===false){return}this._isOpen=false;this._focusedElement=null;this._destroyOverlay();this._untrackInstance();if(!this.opener.filter(":focusable").trigger("focus").length){$.ui.safeBlur($.ui.safeActiveElement(this.document[0]))}this._hide(this.uiDialog,this.options.hide,function(){that._trigger("close",event)})},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(event,silent){var moved=false,zIndices=this.uiDialog.siblings(".ui-front:visible").map(function(){return+$(this).css("z-index")}).get(),zIndexMax=Math.max.apply(null,zIndices);if(zIndexMax>=+this.uiDialog.css("z-index")){this.uiDialog.css("z-index",zIndexMax+1);moved=true}if(moved&&!silent){this._trigger("focus",event)}return moved},open:function(){var that=this;if(this._isOpen){if(this._moveToTop()){this._focusTabbable()}return}this._isOpen=true;this.opener=$($.ui.safeActiveElement(this.document[0]));this._size();this._position();this._createOverlay();this._moveToTop(null,true);if(this.overlay){this.overlay.css("z-index",this.uiDialog.css("z-index")-1)}this._show(this.uiDialog,this.options.show,function(){that._focusTabbable();that._trigger("focus")});this._makeFocusTarget();this._trigger("open")},_focusTabbable:function(){var hasFocus=this._focusedElement;if(!hasFocus){hasFocus=this.element.find("[autofocus]")}if(!hasFocus.length){hasFocus=this.element.find(":tabbable")}if(!hasFocus.length){hasFocus=this.uiDialogButtonPane.find(":tabbable")}if(!hasFocus.length){hasFocus=this.uiDialogTitlebarClose.filter(":tabbable")}if(!hasFocus.length){hasFocus=this.uiDialog}hasFocus.eq(0).trigger("focus")},_keepFocus:function(event){function checkFocus(){var activeElement=$.ui.safeActiveElement(this.document[0]),isActive=this.uiDialog[0]===activeElement||$.contains(this.uiDialog[0],activeElement);if(!isActive){this._focusTabbable()}}event.preventDefault();checkFocus.call(this);this._delay(checkFocus)},_createWrapper:function(){this.uiDialog=$("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo());this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front");this._on(this.uiDialog,{keydown:function(event){if(this.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){event.preventDefault();this.close(event);return}if(event.keyCode!==$.ui.keyCode.TAB||event.isDefaultPrevented()){return}var tabbables=this.uiDialog.find(":tabbable"),first=tabbables.filter(":first"),last=tabbables.filter(":last");if((event.target===last[0]||event.target===this.uiDialog[0])&&!event.shiftKey){this._delay(function(){first.trigger("focus")});event.preventDefault()}else if((event.target===first[0]||event.target===this.uiDialog[0])&&event.shiftKey){this._delay(function(){last.trigger("focus")});event.preventDefault()}},mousedown:function(event){if(this._moveToTop(event)){this._focusTabbable()}}});if(!this.element.find("[aria-describedby]").length){this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})}},_createTitlebar:function(){var uiDialogTitle;this.uiDialogTitlebar=$("<div>");this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix");this._on(this.uiDialogTitlebar,{mousedown:function(event){if(!$(event.target).closest(".ui-dialog-titlebar-close")){this.uiDialog.trigger("focus")}}});this.uiDialogTitlebarClose=$("<button type='button'></button>").button({label:$("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:false}).appendTo(this.uiDialogTitlebar);this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close");this._on(this.uiDialogTitlebarClose,{click:function(event){event.preventDefault();this.close(event)}});uiDialogTitle=$("<span>").uniqueId().prependTo(this.uiDialogTitlebar);this._addClass(uiDialogTitle,"ui-dialog-title");this._title(uiDialogTitle);this.uiDialogTitlebar.prependTo(this.uiDialog);this.uiDialog.attr({"aria-labelledby":uiDialogTitle.attr("id")})},_title:function(title){if(this.options.title){title.text(this.options.title)}else{title.html("&#160;")}},_createButtonPane:function(){this.uiDialogButtonPane=$("<div>");this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix");this.uiButtonSet=$("<div>").appendTo(this.uiDialogButtonPane);this._addClass(this.uiButtonSet,"ui-dialog-buttonset");this._createButtons()},_createButtons:function(){var that=this,buttons=this.options.buttons;this.uiDialogButtonPane.remove();this.uiButtonSet.empty();if($.isEmptyObject(buttons)||$.isArray(buttons)&&!buttons.length){this._removeClass(this.uiDialog,"ui-dialog-buttons");return}$.each(buttons,function(name,props){var click,buttonOptions;props=$.isFunction(props)?{click:props,text:name}:props;props=$.extend({type:"button"},props);click=props.click;buttonOptions={icon:props.icon,iconPosition:props.iconPosition,showLabel:props.showLabel,icons:props.icons,text:props.text};delete props.click;delete props.icon;delete props.iconPosition;delete props.showLabel;delete props.icons;if(typeof props.text==="boolean"){delete props.text}$("<button></button>",props).button(buttonOptions).appendTo(that.uiButtonSet).on("click",function(){click.apply(that.element[0],arguments)})});this._addClass(this.uiDialog,"ui-dialog-buttons");this.uiDialogButtonPane.appendTo(this.uiDialog)},_makeDraggable:function(){var that=this,options=this.options;function filteredUi(ui){return{position:ui.position,offset:ui.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(event,ui){that._addClass($(this),"ui-dialog-dragging");that._blockFrames();that._trigger("dragStart",event,filteredUi(ui))},drag:function(event,ui){that._trigger("drag",event,filteredUi(ui))},stop:function(event,ui){var left=ui.offset.left-that.document.scrollLeft(),top=ui.offset.top-that.document.scrollTop();options.position={my:"left top",at:"left"+(left>=0?"+":"")+left+" "+"top"+(top>=0?"+":"")+top,of:that.window};that._removeClass($(this),"ui-dialog-dragging");that._unblockFrames();that._trigger("dragStop",event,filteredUi(ui))}})},_makeResizable:function(){var that=this,options=this.options,handles=options.resizable,position=this.uiDialog.css("position"),resizeHandles=typeof handles==="string"?handles:"n,e,s,w,se,sw,ne,nw";function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:this._minHeight(),handles:resizeHandles,start:function(event,ui){that._addClass($(this),"ui-dialog-resizing");that._blockFrames();that._trigger("resizeStart",event,filteredUi(ui))},resize:function(event,ui){that._trigger("resize",event,filteredUi(ui))},stop:function(event,ui){var offset=that.uiDialog.offset(),left=offset.left-that.document.scrollLeft(),top=offset.top-that.document.scrollTop();options.height=that.uiDialog.height();options.width=that.uiDialog.width();options.position={my:"left top",at:"left"+(left>=0?"+":"")+left+" "+"top"+(top>=0?"+":"")+top,of:that.window};that._removeClass($(this),"ui-dialog-resizing");that._unblockFrames();that._trigger("resizeStop",event,filteredUi(ui))}}).css("position",position)},_trackFocus:function(){this._on(this.widget(),{focusin:function(event){this._makeFocusTarget();this._focusedElement=$(event.target)}})},_makeFocusTarget:function(){this._untrackInstance();this._trackingInstances().unshift(this)},_untrackInstance:function(){var instances=this._trackingInstances(),exists=$.inArray(this,instances);if(exists!==-1){instances.splice(exists,1)}},_trackingInstances:function(){var instances=this.document.data("ui-dialog-instances");if(!instances){instances=[];this.document.data("ui-dialog-instances",instances)}return instances},_minHeight:function(){var options=this.options;return options.height==="auto"?options.minHeight:Math.min(options.minHeight,options.height)},_position:function(){var isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show()}this.uiDialog.position(this.options.position);if(!isVisible){this.uiDialog.hide()}},_setOptions:function(options){var that=this,resize=false,resizableOptions={};$.each(options,function(key,value){that._setOption(key,value);if(key in that.sizeRelatedOptions){resize=true}if(key in that.resizableRelatedOptions){resizableOptions[key]=value}});if(resize){this._size();this._position()}if(this.uiDialog.is(":data(ui-resizable)")){this.uiDialog.resizable("option",resizableOptions)}},_setOption:function(key,value){var isDraggable,isResizable,uiDialog=this.uiDialog;if(key==="disabled"){return}this._super(key,value);if(key==="appendTo"){this.uiDialog.appendTo(this._appendTo())}if(key==="buttons"){this._createButtons()}if(key==="closeText"){this.uiDialogTitlebarClose.button({label:$("<a>").text(""+this.options.closeText).html()})}if(key==="draggable"){isDraggable=uiDialog.is(":data(ui-draggable)");if(isDraggable&&!value){uiDialog.draggable("destroy")}if(!isDraggable&&value){this._makeDraggable()}}if(key==="position"){this._position()}if(key==="resizable"){isResizable=uiDialog.is(":data(ui-resizable)");if(isResizable&&!value){uiDialog.resizable("destroy")}if(isResizable&&typeof value==="string"){uiDialog.resizable("option","handles",value)}if(!isResizable&&value!==false){this._makeResizable()}}if(key==="title"){this._title(this.uiDialogTitlebar.find(".ui-dialog-title"))}},_size:function(){var nonContentHeight,minContentHeight,maxContentHeight,options=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0});if(options.minWidth>options.width){options.width=options.minWidth}nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).outerHeight();minContentHeight=Math.max(0,options.minHeight-nonContentHeight);maxContentHeight=typeof options.maxHeight==="number"?Math.max(0,options.maxHeight-nonContentHeight):"none";if(options.height==="auto"){this.element.css({minHeight:minContentHeight,maxHeight:maxContentHeight,height:"auto"})}else{this.element.height(Math.max(0,options.height-nonContentHeight))}if(this.uiDialog.is(":data(ui-resizable)")){this.uiDialog.resizable("option","minHeight",this._minHeight())}},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var iframe=$(this);return $("<div>").css({position:"absolute",width:iframe.outerWidth(),height:iframe.outerHeight()}).appendTo(iframe.parent()).offset(iframe.offset())[0]})},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks}},_allowInteraction:function(event){if($(event.target).closest(".ui-dialog").length){return true}return!!$(event.target).closest(".ui-datepicker").length},_createOverlay:function(){if(!this.options.modal){return}var isOpening=true;this._delay(function(){isOpening=false});if(!this.document.data("ui-dialog-overlays")){this._on(this.document,{focusin:function(event){if(isOpening){return}if(!this._allowInteraction(event)){event.preventDefault();this._trackingInstances()[0]._focusTabbable()}}})}this.overlay=$("<div>").appendTo(this._appendTo());this._addClass(this.overlay,null,"ui-widget-overlay ui-front");this._on(this.overlay,{mousedown:"_keepFocus"});this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)},_destroyOverlay:function(){if(!this.options.modal){return}if(this.overlay){var overlays=this.document.data("ui-dialog-overlays")-1;if(!overlays){this._off(this.document,"focusin");this.document.removeData("ui-dialog-overlays")}else{this.document.data("ui-dialog-overlays",overlays)}this.overlay.remove();this.overlay=null}}});if($.uiBackCompat!==false){$.widget("ui.dialog",$.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super();this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(key,value){if(key==="dialogClass"){this.uiDialog.removeClass(this.options.dialogClass).addClass(value)}this._superApply(arguments)}})}var widgetsDialog=$.ui.dialog;$.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:true,greedy:false,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var proportions,o=this.options,accept=o.accept;this.isover=false;this.isout=true;this.accept=$.isFunction(accept)?accept:function(d){return d.is(accept)};this.proportions=function(){if(arguments.length){proportions=arguments[0]}else{return proportions?proportions:proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}}};this._addToManager(o.scope);o.addClasses&&this._addClass("ui-droppable")},_addToManager:function(scope){$.ui.ddmanager.droppables[scope]=$.ui.ddmanager.droppables[scope]||[];$.ui.ddmanager.droppables[scope].push(this)},_splice:function(drop){var i=0;for(;i<drop.length;i++){if(drop[i]===this){drop.splice(i,1)}}},_destroy:function(){var drop=$.ui.ddmanager.droppables[this.options.scope];this._splice(drop)},_setOption:function(key,value){if(key==="accept"){this.accept=$.isFunction(value)?value:function(d){return d.is(value)}}else if(key==="scope"){var drop=$.ui.ddmanager.droppables[this.options.scope];this._splice(drop);this._addToManager(value)}this._super(key,value)},_activate:function(event){var draggable=$.ui.ddmanager.current;this._addActiveClass();if(draggable){this._trigger("activate",event,this.ui(draggable))}},_deactivate:function(event){var draggable=$.ui.ddmanager.current;this._removeActiveClass();if(draggable){this._trigger("deactivate",event,this.ui(draggable))}},_over:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){this._addHoverClass();this._trigger("over",event,this.ui(draggable))}},_out:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){this._removeHoverClass();this._trigger("out",event,this.ui(draggable))}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current,childrenIntersection=false;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return false}this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var inst=$(this).droppable("instance");if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope===draggable.options.scope&&inst.accept.call(inst.element[0],draggable.currentItem||draggable.element)&&intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance,event)){childrenIntersection=true;return false}});if(childrenIntersection){return false}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){this._removeActiveClass();this._removeHoverClass();this._trigger("drop",event,this.ui(draggable));return this.element}return false},ui:function(c){return{draggable:c.currentItem||c.element,helper:c.helper,position:c.position,offset:c.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var intersect=$.ui.intersect=function(){function isOverAxis(x,reference,size){return x>=reference&&x<reference+size}return function(draggable,droppable,toleranceMode,event){if(!droppable.offset){return false}var x1=(draggable.positionAbs||draggable.position.absolute).left+draggable.margins.left,y1=(draggable.positionAbs||draggable.position.absolute).top+draggable.margins.top,x2=x1+draggable.helperProportions.width,y2=y1+draggable.helperProportions.height,l=droppable.offset.left,t=droppable.offset.top,r=l+droppable.proportions().width,b=t+droppable.proportions().height;switch(toleranceMode){case"fit":return l<=x1&&x2<=r&&t<=y1&&y2<=b;case"intersect":return l<x1+draggable.helperProportions.width/2&&x2-draggable.helperProportions.width/2<r&&t<y1+draggable.helperProportions.height/2&&y2-draggable.helperProportions.height/2<b;case"pointer":return isOverAxis(event.pageY,t,droppable.proportions().height)&&isOverAxis(event.pageX,l,droppable.proportions().width);case"touch":return(y1>=t&&y1<=b||y2>=t&&y2<=b||y1<t&&y2>b)&&(x1>=l&&x1<=r||x2>=l&&x2<=r||x1<l&&x2>r);default:return false}}}();$.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(t,event){var i,j,m=$.ui.ddmanager.droppables[t.options.scope]||[],type=event?event.type:null,list=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();droppablesLoop:for(i=0;i<m.length;i++){if(m[i].options.disabled||t&&!m[i].accept.call(m[i].element[0],t.currentItem||t.element)){continue}for(j=0;j<list.length;j++){if(list[j]===m[i].element[0]){m[i].proportions().height=0;continue droppablesLoop}}m[i].visible=m[i].element.css("display")!=="none";if(!m[i].visible){continue}if(type==="mousedown"){m[i]._activate.call(m[i],event)}m[i].offset=m[i].element.offset();m[i].proportions({width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight})}},drop:function(draggable,event){var dropped=false;$.each(($.ui.ddmanager.droppables[draggable.options.scope]||[]).slice(),function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&intersect(draggable,this,this.options.tolerance,event)){dropped=this._drop.call(this,event)||dropped}if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],draggable.currentItem||draggable.element)){this.isout=true;this.isover=false;this._deactivate.call(this,event)}});return dropped},dragStart:function(draggable,event){draggable.element.parentsUntil("body").on("scroll.droppable",function(){if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}})},drag:function(draggable,event){if(draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var parentInstance,scope,parent,intersects=intersect(draggable,this,this.options.tolerance,event),c=!intersects&&this.isover?"isout":intersects&&!this.isover?"isover":null;if(!c){return}if(this.options.greedy){scope=this.options.scope;parent=this.element.parents(":data(ui-droppable)").filter(function(){return $(this).droppable("instance").options.scope===scope});if(parent.length){parentInstance=$(parent[0]).droppable("instance");parentInstance.greedyChild=c==="isover"}}if(parentInstance&&c==="isover"){parentInstance.isover=false;parentInstance.isout=true;parentInstance._out.call(parentInstance,event)}this[c]=true;this[c==="isout"?"isover":"isout"]=false;this[c==="isover"?"_over":"_out"].call(this,event);if(parentInstance&&c==="isout"){parentInstance.isout=false;parentInstance.isover=true;parentInstance._over.call(parentInstance,event)}})},dragStop:function(draggable,event){draggable.element.parentsUntil("body").off("scroll.droppable");if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}}};if($.uiBackCompat!==false){$.widget("ui.droppable",$.ui.droppable,{options:{hoverClass:false,activeClass:false},_addActiveClass:function(){this._super();if(this.options.activeClass){this.element.addClass(this.options.activeClass)}},_removeActiveClass:function(){this._super();if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}},_addHoverClass:function(){this._super();if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}},_removeHoverClass:function(){this._super();if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}}})}var widgetsDroppable=$.ui.droppable;var widgetsProgressbar=$.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue();this.element.attr({role:"progressbar","aria-valuemin":this.min});this._addClass("ui-progressbar","ui-widget ui-widget-content");this.valueDiv=$("<div>").appendTo(this.element);this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header");this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow");this.valueDiv.remove()},value:function(newValue){if(newValue===undefined){return this.options.value}this.options.value=this._constrainedValue(newValue);this._refreshValue()},_constrainedValue:function(newValue){if(newValue===undefined){newValue=this.options.value}this.indeterminate=newValue===false;if(typeof newValue!=="number"){newValue=0}return this.indeterminate?false:Math.min(this.options.max,Math.max(this.min,newValue))},_setOptions:function(options){var value=options.value;delete options.value;this._super(options);this.options.value=this._constrainedValue(value);this._refreshValue()},_setOption:function(key,value){if(key==="max"){value=Math.max(this.min,value)}this._super(key,value)},_setOptionDisabled:function(value){this._super(value);this.element.attr("aria-disabled",value);this._toggleClass(null,"ui-state-disabled",!!value)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var value=this.options.value,percentage=this._percentage();this.valueDiv.toggle(this.indeterminate||value>this.min).width(percentage.toFixed(0)+"%");this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,value===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate);if(this.indeterminate){this.element.removeAttr("aria-valuenow");if(!this.overlayDiv){this.overlayDiv=$("<div>").appendTo(this.valueDiv);this._addClass(this.overlayDiv,"ui-progressbar-overlay")}}else{this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":value});if(this.overlayDiv){this.overlayDiv.remove();this.overlayDiv=null}}if(this.oldValue!==value){this.oldValue=value;this._trigger("change")}if(value===this.options.max){this._trigger("complete")}}});var widgetsSelectable=$.widget("ui.selectable",$.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var that=this;this._addClass("ui-selectable");this.dragged=false;this.refresh=function(){that.elementPos=$(that.element[0]).offset();that.selectees=$(that.options.filter,that.element[0]);that._addClass(that.selectees,"ui-selectee");that.selectees.each(function(){var $this=$(this),selecteeOffset=$this.offset(),pos={left:selecteeOffset.left-that.elementPos.left,top:selecteeOffset.top-that.elementPos.top};$.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.outerWidth(),bottom:pos.top+$this.outerHeight(),startselected:false,selected:$this.hasClass("ui-selected"),selecting:$this.hasClass("ui-selecting"),unselecting:$this.hasClass("ui-unselecting")})})};this.refresh();this._mouseInit();this.helper=$("<div>");this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item");this._mouseDestroy()},_mouseStart:function(event){var that=this,options=this.options;this.opos=[event.pageX,event.pageY];this.elementPos=$(this.element[0]).offset();if(this.options.disabled){return}this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);$(options.appendTo).append(this.helper);this.helper.css({left:event.pageX,top:event.pageY,width:0,height:0});if(options.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var selectee=$.data(this,"selectable-item");selectee.startselected=true;if(!event.metaKey&&!event.ctrlKey){that._removeClass(selectee.$element,"ui-selected");selectee.selected=false;that._addClass(selectee.$element,"ui-unselecting");selectee.unselecting=true;that._trigger("unselecting",event,{unselecting:selectee.element})}});$(event.target).parents().addBack().each(function(){var doSelect,selectee=$.data(this,"selectable-item");if(selectee){doSelect=!event.metaKey&&!event.ctrlKey||!selectee.$element.hasClass("ui-selected");that._removeClass(selectee.$element,doSelect?"ui-unselecting":"ui-selected")._addClass(selectee.$element,doSelect?"ui-selecting":"ui-unselecting");selectee.unselecting=!doSelect;selectee.selecting=doSelect;selectee.selected=doSelect;if(doSelect){that._trigger("selecting",event,{selecting:selectee.element})}else{that._trigger("unselecting",event,{unselecting:selectee.element})}return false}})},_mouseDrag:function(event){this.dragged=true;if(this.options.disabled){return}var tmp,that=this,options=this.options,x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY;if(x1>x2){tmp=x2;x2=x1;x1=tmp}if(y1>y2){tmp=y2;y2=y1;y1=tmp}this.helper.css({left:x1,top:y1,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item"),hit=false,offset={};if(!selectee||selectee.element===that.element[0]){return}offset.left=selectee.left+that.elementPos.left;offset.right=selectee.right+that.elementPos.left;offset.top=selectee.top+that.elementPos.top;offset.bottom=selectee.bottom+that.elementPos.top;if(options.tolerance==="touch"){hit=!(offset.left>x2||offset.right<x1||offset.top>y2||offset.bottom<y1)}else if(options.tolerance==="fit"){hit=offset.left>x1&&offset.right<x2&&offset.top>y1&&offset.bottom<y2}if(hit){if(selectee.selected){that._removeClass(selectee.$element,"ui-selected");selectee.selected=false}if(selectee.unselecting){that._removeClass(selectee.$element,"ui-unselecting");selectee.unselecting=false}if(!selectee.selecting){that._addClass(selectee.$element,"ui-selecting");selectee.selecting=true;that._trigger("selecting",event,{selecting:selectee.element})}}else{if(selectee.selecting){if((event.metaKey||event.ctrlKey)&&selectee.startselected){that._removeClass(selectee.$element,"ui-selecting");selectee.selecting=false;that._addClass(selectee.$element,"ui-selected");selectee.selected=true}else{that._removeClass(selectee.$element,"ui-selecting");selectee.selecting=false;if(selectee.startselected){that._addClass(selectee.$element,"ui-unselecting");selectee.unselecting=true}that._trigger("unselecting",event,{unselecting:selectee.element})}}if(selectee.selected){if(!event.metaKey&&!event.ctrlKey&&!selectee.startselected){that._removeClass(selectee.$element,"ui-selected");selectee.selected=false;that._addClass(selectee.$element,"ui-unselecting");selectee.unselecting=true;that._trigger("unselecting",event,{unselecting:selectee.element})}}}});return false},_mouseStop:function(event){var that=this;this.dragged=false;$(".ui-unselecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");that._removeClass(selectee.$element,"ui-unselecting");selectee.unselecting=false;selectee.startselected=false;that._trigger("unselected",event,{unselected:selectee.element})});$(".ui-selecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");that._removeClass(selectee.$element,"ui-selecting")._addClass(selectee.$element,"ui-selected");selectee.selecting=false;selectee.selected=true;selectee.startselected=true;that._trigger("selected",event,{selected:selectee.element})});this._trigger("stop",event);this.helper.remove();return false}});var widgetsSelectmenu=$.widget("ui.selectmenu",[$.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:false,change:null,close:null,focus:null,open:null,select:null},_create:function(){var selectmenuId=this.element.uniqueId().attr("id");this.ids={element:selectmenuId,button:selectmenuId+"-button",menu:selectmenuId+"-menu"};this._drawButton();this._drawMenu();this._bindFormResetHandler();this._rendered=false;this.menuItems=$()},_drawButton:function(){var icon,that=this,item=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button);this._on(this.labels,{click:function(event){this.button.focus();event.preventDefault()}});this.element.hide();this.button=$("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element);this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget");icon=$("<span>").appendTo(this.button);this._addClass(icon,"ui-selectmenu-icon","ui-icon "+this.options.icons.button);this.buttonItem=this._renderButtonItem(item).appendTo(this.button);if(this.options.width!==false){this._resizeButton()}this._on(this.button,this._buttonEvents);this.button.one("focusin",function(){if(!that._rendered){that._refreshMenu()}})},_drawMenu:function(){var that=this;this.menu=$("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu});this.menuWrap=$("<div>").append(this.menu);this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front");this.menuWrap.appendTo(this._appendTo());this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(event,ui){event.preventDefault();that._setSelection();that._select(ui.item.data("ui-selectmenu-item"),event)},focus:function(event,ui){var item=ui.item.data("ui-selectmenu-item");if(that.focusIndex!=null&&item.index!==that.focusIndex){that._trigger("focus",event,{item:item});if(!that.isOpen){that._select(item,event)}}that.focusIndex=item.index;that.button.attr("aria-activedescendant",that.menuItems.eq(item.index).attr("id"))}}).menu("instance");this.menuInstance._off(this.menu,"mouseleave");this.menuInstance._closeOnDocumentClick=function(){return false};this.menuInstance._isDivider=function(){return false}},refresh:function(){this._refreshMenu();this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{}));if(this.options.width===null){this._resizeButton()}},_refreshMenu:function(){var item,options=this.element.find("option");this.menu.empty();this._parseOptions(options);this._renderMenu(this.menu,this.items);this.menuInstance.refresh();this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper");this._rendered=true;if(!options.length){return}item=this._getSelectedItem();this.menuInstance.focus(null,item);this._setAria(item.data("ui-selectmenu-item"));this._setOption("disabled",this.element.prop("disabled"))},open:function(event){if(this.options.disabled){return}if(!this._rendered){this._refreshMenu()}else{this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active");this.menuInstance.focus(null,this._getSelectedItem())}if(!this.menuItems.length){return}this.isOpen=true;this._toggleAttr();this._resizeMenu();this._position();this._on(this.document,this._documentClick);this._trigger("open",event)},_position:function(){this.menuWrap.position($.extend({of:this.button},this.options.position))},close:function(event){if(!this.isOpen){return}this.isOpen=false;this._toggleAttr();this.range=null;this._off(this.document);this._trigger("close",event)},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(item){var buttonItem=$("<span>");this._setText(buttonItem,item.label);this._addClass(buttonItem,"ui-selectmenu-text");return buttonItem},_renderMenu:function(ul,items){var that=this,currentOptgroup="";$.each(items,function(index,item){var li;if(item.optgroup!==currentOptgroup){li=$("<li>",{text:item.optgroup});that._addClass(li,"ui-selectmenu-optgroup","ui-menu-divider"+(item.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""));li.appendTo(ul);currentOptgroup=item.optgroup}that._renderItemData(ul,item)})},_renderItemData:function(ul,item){return this._renderItem(ul,item).data("ui-selectmenu-item",item)},_renderItem:function(ul,item){var li=$("<li>"),wrapper=$("<div>",{title:item.element.attr("title")});if(item.disabled){this._addClass(li,null,"ui-state-disabled")}this._setText(wrapper,item.label);return li.append(wrapper).appendTo(ul)},_setText:function(element,value){if(value){element.text(value)}else{element.html("&#160;")}},_move:function(direction,event){var item,next,filter=".ui-menu-item";if(this.isOpen){item=this.menuItems.eq(this.focusIndex).parent("li")}else{item=this.menuItems.eq(this.element[0].selectedIndex).parent("li");filter+=":not(.ui-state-disabled)"}if(direction==="first"||direction==="last"){next=item[direction==="first"?"prevAll":"nextAll"](filter).eq(-1)}else{next=item[direction+"All"](filter).eq(0)}if(next.length){this.menuInstance.focus(event,next)}},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(event){this[this.isOpen?"close":"open"](event)},_setSelection:function(){var selection;if(!this.range){return}if(window.getSelection){selection=window.getSelection();selection.removeAllRanges();selection.addRange(this.range)}else{this.range.select()}this.button.focus()},_documentClick:{mousedown:function(event){if(!this.isOpen){return}if(!$(event.target).closest(".ui-selectmenu-menu, #"+$.ui.escapeSelector(this.ids.button)).length){this.close(event)}}},_buttonEvents:{mousedown:function(){var selection;if(window.getSelection){selection=window.getSelection();if(selection.rangeCount){this.range=selection.getRangeAt(0)}}else{this.range=document.selection.createRange()}},click:function(event){this._setSelection();this._toggle(event)},keydown:function(event){var preventDefault=true;switch(event.keyCode){case $.ui.keyCode.TAB:case $.ui.keyCode.ESCAPE:this.close(event);preventDefault=false;break;case $.ui.keyCode.ENTER:if(this.isOpen){this._selectFocusedItem(event)}break;case $.ui.keyCode.UP:if(event.altKey){this._toggle(event)}else{this._move("prev",event)}break;case $.ui.keyCode.DOWN:if(event.altKey){this._toggle(event)}else{this._move("next",event)}break;case $.ui.keyCode.SPACE:if(this.isOpen){this._selectFocusedItem(event)}else{this._toggle(event)}break;case $.ui.keyCode.LEFT:this._move("prev",event);break;case $.ui.keyCode.RIGHT:this._move("next",event);break;case $.ui.keyCode.HOME:case $.ui.keyCode.PAGE_UP:this._move("first",event);break;case $.ui.keyCode.END:case $.ui.keyCode.PAGE_DOWN:this._move("last",event);break;default:this.menu.trigger(event);preventDefault=false}if(preventDefault){event.preventDefault()}}},_selectFocusedItem:function(event){var item=this.menuItems.eq(this.focusIndex).parent("li");if(!item.hasClass("ui-state-disabled")){this._select(item.data("ui-selectmenu-item"),event)}},_select:function(item,event){var oldIndex=this.element[0].selectedIndex;this.element[0].selectedIndex=item.index;this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(item));this._setAria(item);this._trigger("select",event,{item:item});if(item.index!==oldIndex){this._trigger("change",event,{item:item})}this.close(event)},_setAria:function(item){var id=this.menuItems.eq(item.index).attr("id");this.button.attr({"aria-labelledby":id,"aria-activedescendant":id});this.menu.attr("aria-activedescendant",id)},_setOption:function(key,value){if(key==="icons"){var icon=this.button.find("span.ui-icon");this._removeClass(icon,null,this.options.icons.button)._addClass(icon,null,value.button)}this._super(key,value);if(key==="appendTo"){this.menuWrap.appendTo(this._appendTo())}if(key==="width"){this._resizeButton()}},_setOptionDisabled:function(value){this._super(value);this.menuInstance.option("disabled",value);this.button.attr("aria-disabled",value);this._toggleClass(this.button,null,"ui-state-disabled",value);this.element.prop("disabled",value);if(value){this.button.attr("tabindex",-1);this.close()}else{this.button.attr("tabindex",0)}},_appendTo:function(){var element=this.options.appendTo;if(element){element=element.jquery||element.nodeType?$(element):this.document.find(element).eq(0)}if(!element||!element[0]){element=this.element.closest(".ui-front, dialog")}if(!element.length){element=this.document[0].body}return element},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen);this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen);this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var width=this.options.width;if(width===false){this.button.css("width","");return}if(width===null){width=this.element.show().outerWidth();this.element.hide()}this.button.outerWidth(width)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var options=this._super();options.disabled=this.element.prop("disabled");return options},_parseOptions:function(options){var that=this,data=[];options.each(function(index,item){data.push(that._parseOption($(item),index))});this.items=data},_parseOption:function(option,index){var optgroup=option.parent("optgroup");return{element:option,index:index,value:option.val(),label:option.text(),optgroup:optgroup.attr("label")||"",disabled:optgroup.prop("disabled")||option.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler();this.menuWrap.remove();this.button.remove();this.element.show();this.element.removeUniqueId();this.labels.attr("for",this.ids.element)}}]);var widgetsSlider=$.widget("ui.slider",$.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:false,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this._calculateNewMax();this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content");this._refresh();this._animateOff=false},_refresh:function(){this._createRange();this._createHandles();this._setupEvents();this._refreshValue()},_createHandles:function(){var i,handleCount,options=this.options,existingHandles=this.element.find(".ui-slider-handle"),handle="<span tabindex='0'></span>",handles=[];handleCount=options.values&&options.values.length||1;if(existingHandles.length>handleCount){existingHandles.slice(handleCount).remove();existingHandles=existingHandles.slice(0,handleCount)}for(i=existingHandles.length;i<handleCount;i++){handles.push(handle)}this.handles=existingHandles.add($(handles.join("")).appendTo(this.element));this._addClass(this.handles,"ui-slider-handle","ui-state-default");this.handle=this.handles.eq(0);this.handles.each(function(i){$(this).data("ui-slider-handle-index",i).attr("tabIndex",0)})},_createRange:function(){var options=this.options;if(options.range){if(options.range===true){if(!options.values){options.values=[this._valueMin(),this._valueMin()]}else if(options.values.length&&options.values.length!==2){options.values=[options.values[0],options.values[0]]}else if($.isArray(options.values)){options.values=options.values.slice(0)}}if(!this.range||!this.range.length){this.range=$("<div>").appendTo(this.element);this._addClass(this.range,"ui-slider-range")}else{this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max");this.range.css({left:"",bottom:""})}if(options.range==="min"||options.range==="max"){this._addClass(this.range,"ui-slider-range-"+options.range)}}else{if(this.range){this.range.remove()}this.range=null}},_setupEvents:function(){this._off(this.handles);this._on(this.handles,this._handleEvents);this._hoverable(this.handles);this._focusable(this.handles)},_destroy:function(){this.handles.remove();if(this.range){this.range.remove()}this._mouseDestroy()},_mouseCapture:function(event){var position,normValue,distance,closestHandle,index,allowed,offset,mouseOverHandle,that=this,o=this.options;if(o.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();position={x:event.pageX,y:event.pageY};normValue=this._normValueFromMouse(position);distance=this._valueMax()-this._valueMin()+1;this.handles.each(function(i){var thisDistance=Math.abs(normValue-that.values(i));if(distance>thisDistance||distance===thisDistance&&(i===that._lastChangedValue||that.values(i)===o.min)){distance=thisDistance;closestHandle=$(this);index=i}});allowed=this._start(event,index);if(allowed===false){return false}this._mouseSliding=true;this._handleIndex=index;this._addClass(closestHandle,null,"ui-state-active");closestHandle.trigger("focus");offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().addBack().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-closestHandle.width()/2,top:event.pageY-offset.top-closestHandle.height()/2-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue)}this._animateOff=true;return true},_mouseStart:function(){return true},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false},_mouseStop:function(event){this._removeClass(this.handles,null,"ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}percentMouse=pixelMouse/pixelTotal;if(percentMouse>1){percentMouse=1}if(percentMouse<0){percentMouse=0}if(this.orientation==="vertical"){percentMouse=1-percentMouse}valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse)},_uiHash:function(index,value,values){var uiHash={handle:this.handles[index],handleIndex:index,value:value!==undefined?value:this.value()};if(this._hasMultipleValues()){uiHash.value=value!==undefined?value:this.values(index);uiHash.values=values||this.values()}return uiHash},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(event,index){return this._trigger("start",event,this._uiHash(index))},_slide:function(event,index,newVal){var allowed,otherVal,currentValue=this.value(),newValues=this.values();if(this._hasMultipleValues()){otherVal=this.values(index?0:1);currentValue=this.values(index);if(this.options.values.length===2&&this.options.range===true){newVal=index===0?Math.min(otherVal,newVal):Math.max(otherVal,newVal)}newValues[index]=newVal}if(newVal===currentValue){return}allowed=this._trigger("slide",event,this._uiHash(index,newVal,newValues));if(allowed===false){return}if(this._hasMultipleValues()){this.values(index,newVal)}else{this.value(newVal)}},_stop:function(event,index){this._trigger("stop",event,this._uiHash(index))},_change:function(event,index){if(!this._keySliding&&!this._mouseSliding){this._lastChangedValue=index;this._trigger("change",event,this._uiHash(index))}},value:function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue);this._refreshValue();this._change(null,0);return}return this._value()},values:function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return}if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(newValues[i]);this._change(null,i)}this._refreshValue()}else{if(this._hasMultipleValues()){return this._values(index)}else{return this.value()}}}else{return this._values()}},_setOption:function(key,value){var i,valsLength=0;if(key==="range"&&this.options.range===true){if(value==="min"){this.options.value=this._values(0);this.options.values=null}else if(value==="max"){this.options.value=this._values(this.options.values.length-1);this.options.values=null}}if($.isArray(this.options.values)){valsLength=this.options.values.length}this._super(key,value);switch(key){case"orientation":this._detectOrientation();this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation);this._refreshValue();if(this.options.range){this._refreshRange(value)}this.handles.css(value==="horizontal"?"bottom":"left","");break;case"value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();for(i=valsLength-1;i>=0;i--){this._change(null,i)}this._animateOff=false;break;case"step":case"min":case"max":this._animateOff=true;this._calculateNewMax();this._refreshValue();this._animateOff=false;break;case"range":this._animateOff=true;this._refresh();this._animateOff=false;break}},_setOptionDisabled:function(value){this._super(value);this._toggleClass(null,"ui-state-disabled",!!value)},_value:function(){var val=this.options.value;val=this._trimAlignValue(val);return val},_values:function(index){var val,vals,i;if(arguments.length){val=this.options.values[index];val=this._trimAlignValue(val);return val}else if(this._hasMultipleValues()){vals=this.options.values.slice();for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(vals[i])}return vals}else{return[]}},_trimAlignValue:function(val){if(val<=this._valueMin()){return this._valueMin()}if(val>=this._valueMax()){return this._valueMax()}var step=this.options.step>0?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=valModStep>0?step:-step}return parseFloat(alignValue.toFixed(5))},_calculateNewMax:function(){var max=this.options.max,min=this._valueMin(),step=this.options.step,aboveMin=Math.round((max-min)/step)*step;max=aboveMin+min;if(max>this.options.max){max-=step}this.max=parseFloat(max.toFixed(this._precision()))},_precision:function(){var precision=this._precisionOf(this.options.step);if(this.options.min!==null){precision=Math.max(precision,this._precisionOf(this.options.min))}return precision},_precisionOf:function(num){var str=num.toString(),decimal=str.indexOf(".");return decimal===-1?0:str.length-decimal-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(orientation){if(orientation==="vertical"){this.range.css({width:"",left:""})}if(orientation==="horizontal"){this.range.css({height:"",bottom:""})}},_refreshValue:function(){var lastValPercent,valPercent,value,valueMin,valueMax,oRange=this.options.range,o=this.options,that=this,animate=!this._animateOff?o.animate:false,_set={};if(this._hasMultipleValues()){this.handles.each(function(i){valPercent=(that.values(i)-that._valueMin())/(that._valueMax()-that._valueMin())*100;_set[that.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(that.options.range===true){if(that.orientation==="horizontal"){if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate)}if(i===1){that.range[animate?"animate":"css"]({width:valPercent-lastValPercent+"%"},{queue:false,duration:o.animate})}}else{if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({bottom:valPercent+"%"},o.animate)}if(i===1){that.range[animate?"animate":"css"]({height:valPercent-lastValPercent+"%"},{queue:false,duration:o.animate})}}}lastValPercent=valPercent})}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=valueMax!==valueMin?(value-valueMin)/(valueMax-valueMin)*100:0;_set[this.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:100-valPercent+"%"},o.animate)}if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:100-valPercent+"%"},o.animate)}}},_handleEvents:{keydown:function(event){var allowed,curVal,newVal,step,index=$(event.target).data("ui-slider-handle-index");switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.PAGE_UP:case $.ui.keyCode.PAGE_DOWN:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:event.preventDefault();if(!this._keySliding){this._keySliding=true;this._addClass($(event.target),null,"ui-state-active");allowed=this._start(event,index);if(allowed===false){return}}break}step=this.options.step;if(this._hasMultipleValues()){curVal=newVal=this.values(index)}else{curVal=newVal=this.value()}switch(event.keyCode){case $.ui.keyCode.HOME:newVal=this._valueMin();break;case $.ui.keyCode.END:newVal=this._valueMax();break;case $.ui.keyCode.PAGE_UP:newVal=this._trimAlignValue(curVal+(this._valueMax()-this._valueMin())/this.numPages);break;case $.ui.keyCode.PAGE_DOWN:newVal=this._trimAlignValue(curVal-(this._valueMax()-this._valueMin())/this.numPages);break;case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal===this._valueMax()){return}newVal=this._trimAlignValue(curVal+step);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal===this._valueMin()){return}newVal=this._trimAlignValue(curVal-step);break}this._slide(event,index,newVal)},keyup:function(event){var index=$(event.target).data("ui-slider-handle-index");if(this._keySliding){this._keySliding=false;this._stop(event,index);this._change(event,index);this._removeClass($(event.target),null,"ui-state-active")}}}});var widgetsSortable=$.widget("ui.sortable",$.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:false,options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(x,reference,size){return x>=reference&&x<reference+size},_isFloating:function(item){return/left|right/.test(item.css("float"))||/inline|table-cell/.test(item.css("display"))},_create:function(){this.containerCache={};this._addClass("ui-sortable");this.refresh();this.offset=this.element.offset();this._mouseInit();this._setHandleClassName();this.ready=true},_setOption:function(key,value){this._super(key,value);if(key==="handle"){this._setHandleClassName()}},_setHandleClassName:function(){var that=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle");$.each(this.items,function(){that._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--){this.items[i].item.removeData(this.widgetName+"-item")}return this},_mouseCapture:function(event,overrideHandle){var currentItem=null,validHandle=false,that=this;if(this.reverting){return false}if(this.options.disabled||this.options.type==="static"){return false}this._refreshItems(event);$(event.target).parents().each(function(){if($.data(this,that.widgetName+"-item")===that){currentItem=$(this);return false}});if($.data(event.target,that.widgetName+"-item")===that){currentItem=$(event.target)}if(!currentItem){return false}if(this.options.handle&&!overrideHandle){$(this.options.handle,currentItem).find("*").addBack().each(function(){if(this===event.target){validHandle=true}});if(!validHandle){return false}}this.currentItem=currentItem;this._removeCurrentsFromItems();return true},_mouseStart:function(event,overrideHandle,noActivation){var i,body,o=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!==this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(o.containment){this._setContainment()}if(o.cursor&&o.cursor!=="auto"){body=this.document.find("body");this.storedCursor=body.css("cursor");body.css("cursor",o.cursor);this.storedStylesheet=$("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(body)}if(o.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",o.opacity)}if(o.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",o.zIndex)}if(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!noActivation){for(i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,this._uiHash(this))}}if($.ui.ddmanager){$.ui.ddmanager.current=this}if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}this.dragging=true;this._addClass(this.helper,"ui-sortable-helper");this._mouseDrag(event);return true},_mouseDrag:function(event){var i,item,itemElement,intersection,o=this.options,scrolled=false;this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){if(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-event.pageY<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed}else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed}if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-event.pageX<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed}else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed}}else{if(event.pageY-this.document.scrollTop()<o.scrollSensitivity){scrolled=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed)}else if(this.window.height()-(event.pageY-this.document.scrollTop())<o.scrollSensitivity){scrolled=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)}if(event.pageX-this.document.scrollLeft()<o.scrollSensitivity){scrolled=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed)}else if(this.window.width()-(event.pageX-this.document.scrollLeft())<o.scrollSensitivity){scrolled=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed)}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px"}for(i=this.items.length-1;i>=0;i--){item=this.items[i];itemElement=item.item[0];intersection=this._intersectsWithPointer(item);if(!intersection){continue}if(item.instance!==this.currentContainer){continue}if(itemElement!==this.currentItem[0]&&this.placeholder[intersection===1?"next":"prev"]()[0]!==itemElement&&!$.contains(this.placeholder[0],itemElement)&&(this.options.type==="semi-dynamic"?!$.contains(this.element[0],itemElement):true)){this.direction=intersection===1?"down":"up";if(this.options.tolerance==="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item)}else{break}this._trigger("change",event,this._uiHash());break}}this._contactContainers(event);if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}this._trigger("sort",event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(event,noPropagation){if(!event){return}if($.ui.ddmanager&&!this.options.dropBehaviour){$.ui.ddmanager.drop(this,event)}if(this.options.revert){var that=this,cur=this.placeholder.offset(),axis=this.options.axis,animation={};if(!axis||axis==="x"){animation.left=cur.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)}if(!axis||axis==="y"){animation.top=cur.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)}this.reverting=true;$(this.helper).animate(animation,parseInt(this.options.revert,10)||500,function(){that._clear(event)})}else{this._clear(event,noPropagation)}return false},cancel:function(){if(this.dragging){this._mouseUp(new $.Event("mouseup",{target:null}));if(this.options.helper==="original"){this.currentItem.css(this._storedCSS);this._removeClass(this.currentItem,"ui-sortable-helper")}else{this.currentItem.show()}for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,this._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,this._uiHash(this));this.containers[i].containerCache.over=0}}}if(this.placeholder){if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem)}else{$(this.domPosition.parent).prepend(this.currentItem)}}return this},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected),str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||"id")||"").match(o.expression||/(.+)[\-=_](.+)/);if(res){str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]))}});if(!str.length&&o.key){str.push(o.key+"=")}return str.join("&")},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected),ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||"id")||"")});return ret},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height,l=item.left,r=l+item.width,t=item.top,b=t+item.height,dyClick=this.offset.click.top,dxClick=this.offset.click.left,isOverElementHeight=this.options.axis==="x"||y1+dyClick>t&&y1+dyClick<b,isOverElementWidth=this.options.axis==="y"||x1+dxClick>l&&x1+dxClick<r,isOverElement=isOverElementHeight&&isOverElementWidth;if(this.options.tolerance==="pointer"||this.options.forcePointerForContainers||this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>item[this.floating?"width":"height"]){return isOverElement}else{return l<x1+this.helperProportions.width/2&&x2-this.helperProportions.width/2<r&&t<y1+this.helperProportions.height/2&&y2-this.helperProportions.height/2<b}},_intersectsWithPointer:function(item){var verticalDirection,horizontalDirection,isOverElementHeight=this.options.axis==="x"||this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=this.options.axis==="y"||this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth;if(!isOverElement){return false}verticalDirection=this._getDragVerticalDirection();horizontalDirection=this._getDragHorizontalDirection();return this.floating?horizontalDirection==="right"||verticalDirection==="down"?2:1:verticalDirection&&(verticalDirection==="down"?2:1)},_intersectsWithSides:function(item){var isOverBottomHalf=this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+item.height/2,item.height),isOverRightHalf=this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+item.width/2,item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return horizontalDirection==="right"&&isOverRightHalf||horizontalDirection==="left"&&!isOverRightHalf}else{return verticalDirection&&(verticalDirection==="down"&&isOverBottomHalf||verticalDirection==="up"&&!isOverBottomHalf)}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!==0&&(delta>0?"down":"up")},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!==0&&(delta>0?"right":"left")},refresh:function(event){this._refreshItems(event);this._setHandleClassName();this.refreshPositions();return this},_connectWith:function(){var options=this.options;return options.connectWith.constructor===String?[options.connectWith]:options.connectWith},_getItemsAsjQuery:function(connected){var i,j,cur,inst,items=[],queries=[],connectWith=this._connectWith();if(connectWith&&connected){for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i],this.document[0]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst])}}}}queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);function addItems(){items.push(this)}for(i=queries.length-1;i>=0;i--){queries[i][0].each(addItems)}return $(items)},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=$.grep(this.items,function(item){for(var j=0;j<list.length;j++){if(list[j]===item.item[0]){return false}}return true})},_refreshItems:function(event){this.items=[];this.containers=[this];var i,j,cur,inst,targetData,_queries,item,queriesLength,items=this.items,queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]],connectWith=this._connectWith();if(connectWith&&this.ready){for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i],this.document[0]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst)}}}}for(i=queries.length-1;i>=0;i--){targetData=queries[i][1];_queries=queries[i][0];for(j=0,queriesLength=_queries.length;j<queriesLength;j++){item=$(_queries[j]);item.data(this.widgetName+"-item",targetData);items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0})}}},refreshPositions:function(fast){this.floating=this.items.length?this.options.axis==="x"||this._isFloating(this.items[0].item):false;if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}var i,item,t,p;for(i=this.items.length-1;i>=0;i--){item=this.items[i];if(item.instance!==this.currentContainer&&this.currentContainer&&item.item[0]!==this.currentItem[0]){continue}t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight()}p=t.offset();item.left=p.left;item.top=p.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(i=this.containers.length-1;i>=0;i--){p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight()}}return this},_createPlaceholder:function(that){that=that||this;var className,o=that.options;if(!o.placeholder||o.placeholder.constructor===String){className=o.placeholder;o.placeholder={element:function(){var nodeName=that.currentItem[0].nodeName.toLowerCase(),element=$("<"+nodeName+">",that.document[0]);that._addClass(element,"ui-sortable-placeholder",className||that.currentItem[0].className)._removeClass(element,"ui-sortable-helper");if(nodeName==="tbody"){that._createTrPlaceholder(that.currentItem.find("tr").eq(0),$("<tr>",that.document[0]).appendTo(element))}else if(nodeName==="tr"){that._createTrPlaceholder(that.currentItem,element)}else if(nodeName==="img"){element.attr("src",that.currentItem.attr("src"))}if(!className){element.css("visibility","hidden")}return element},update:function(container,p){if(className&&!o.forcePlaceholderSize){return}if(!p.height()){p.height(that.currentItem.innerHeight()-parseInt(that.currentItem.css("paddingTop")||0,10)-parseInt(that.currentItem.css("paddingBottom")||0,10))}if(!p.width()){p.width(that.currentItem.innerWidth()-parseInt(that.currentItem.css("paddingLeft")||0,10)-parseInt(that.currentItem.css("paddingRight")||0,10))}}}}that.placeholder=$(o.placeholder.element.call(that.element,that.currentItem));that.currentItem.after(that.placeholder);o.placeholder.update(that,that.placeholder)},_createTrPlaceholder:function(sourceTr,targetTr){var that=this;sourceTr.children().each(function(){$("<td>&#160;</td>",that.document[0]).attr("colspan",$(this).attr("colspan")||1).appendTo(targetTr)})},_contactContainers:function(event){var i,j,dist,itemWithLeastDistance,posProperty,sizeProperty,cur,nearBottom,floating,axis,innermostContainer=null,innermostIndex=null;for(i=this.containers.length-1;i>=0;i--){if($.contains(this.currentItem[0],this.containers[i].element[0])){continue}if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$.contains(this.containers[i].element[0],innermostContainer.element[0])){continue}innermostContainer=this.containers[i];innermostIndex=i}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0}}}if(!innermostContainer){return}if(this.containers.length===1){if(!this.containers[innermostIndex].containerCache.over){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}}else{dist=1e4;itemWithLeastDistance=null;floating=innermostContainer.floating||this._isFloating(this.currentItem);posProperty=floating?"left":"top";sizeProperty=floating?"width":"height";axis=floating?"pageX":"pageY";for(j=this.items.length-1;j>=0;j--){if(!$.contains(this.containers[innermostIndex].element[0],this.items[j].item[0])){continue}if(this.items[j].item[0]===this.currentItem[0]){continue}cur=this.items[j].item.offset()[posProperty];nearBottom=false;if(event[axis]-cur>this.items[j][sizeProperty]/2){nearBottom=true}if(Math.abs(event[axis]-cur)<dist){dist=Math.abs(event[axis]-cur);itemWithLeastDistance=this.items[j];this.direction=nearBottom?"up":"down"}}if(!itemWithLeastDistance&&!this.options.dropOnEmpty){return}if(this.currentContainer===this.containers[innermostIndex]){if(!this.currentContainer.containerCache.over){this.containers[innermostIndex]._trigger("over",event,this._uiHash());this.currentContainer.containerCache.over=1}return}itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[innermostIndex].element,true);this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.currentContainer=this.containers[innermostIndex];this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}},_createHelper:function(event){var o=this.options,helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):o.helper==="clone"?this.currentItem.clone():this.currentItem;if(!helper.parents("body").length){$(o.appendTo!=="parent"?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0])}if(helper[0]===this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(!helper[0].style.width||o.forceHelperSize){helper.width(this.currentItem.width())}if(!helper[0].style.height||o.forceHelperSize){helper.height(this.currentItem.height())}return helper},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition==="absolute"&&this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&$.ui.ie){po={top:0,left:0}}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var ce,co,over,o=this.options;if(o.containment==="parent"){o.containment=this.helper[0].parentNode}if(o.containment==="document"||o.containment==="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,o.containment==="document"?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,(o.containment==="document"?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!/^(document|window|parent)$/.test(o.containment)){ce=$(o.containment)[0];co=$(o.containment).offset();over=$(ce).css("overflow")!=="hidden";this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(d,pos){if(!pos){pos=this.position}var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop())*mod,left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod}},_generatePosition:function(event){var top,left,o=this.options,pageX=event.pageX,pageY=event.pageY,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);if(this.cssPosition==="relative"&&!(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0]){pageX=this.containment[0]+this.offset.click.left}if(event.pageY-this.offset.click.top<this.containment[1]){pageY=this.containment[1]+this.offset.click.top}if(event.pageX-this.offset.click.left>this.containment[2]){pageX=this.containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>this.containment[3]){pageY=this.containment[3]+this.offset.click.top}}if(o.grid){top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?top-this.offset.click.top>=this.containment[1]&&top-this.offset.click.top<=this.containment[3]?top:top-this.offset.click.top>=this.containment[1]?top-o.grid[1]:top+o.grid[1]:top;left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?left-this.offset.click.left>=this.containment[0]&&left-this.offset.click.left<=this.containment[2]?left:left-this.offset.click.left>=this.containment[0]?left-o.grid[0]:left+o.grid[0]:left}}return{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop()),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())}},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],this.direction==="down"?i.item[0]:i.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var counter=this.counter;this._delay(function(){if(counter===this.counter){this.refreshPositions(!hardRefresh)}})},_clear:function(event,noPropagation){this.reverting=false;var i,delayedTriggers=[];if(!this._noFinalSort&&this.currentItem.parent().length){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(i in this._storedCSS){if(this._storedCSS[i]==="auto"||this._storedCSS[i]==="static"){this._storedCSS[i]=""}}this.currentItem.css(this._storedCSS);this._removeClass(this.currentItem,"ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!noPropagation){delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!noPropagation){delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash())})}if(this!==this.currentContainer){if(!noPropagation){delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash())});delayedTriggers.push(function(c){return function(event){c._trigger("receive",event,this._uiHash(this))}}.call(this,this.currentContainer));delayedTriggers.push(function(c){return function(event){c._trigger("update",event,this._uiHash(this))}}.call(this,this.currentContainer))}}function delayEvent(type,instance,container){return function(event){container._trigger(type,event,instance._uiHash(instance))}}for(i=this.containers.length-1;i>=0;i--){if(!noPropagation){delayedTriggers.push(delayEvent("deactivate",this,this.containers[i]))}if(this.containers[i].containerCache.over){delayedTriggers.push(delayEvent("out",this,this.containers[i]));this.containers[i].containerCache.over=0}}if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove()}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex)}this.dragging=false;if(!noPropagation){this._trigger("beforeStop",event,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(!this.cancelHelperRemoval){if(this.helper[0]!==this.currentItem[0]){this.helper.remove()}this.helper=null}if(!noPropagation){for(i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event)}this._trigger("stop",event,this._uiHash())}this.fromOutside=false;return!this.cancelHelperRemoval},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(_inst){var inst=_inst||this;return{helper:inst.helper,placeholder:inst.placeholder||$([]),position:inst.position,originalPosition:inst.originalPosition,offset:inst.positionAbs,item:inst.currentItem,sender:_inst?_inst.element:null}}});function spinnerModifer(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger("change")}}}$.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:true,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max);this._setOption("min",this.options.min);this._setOption("step",this.options.step);if(this.value()!==""){this._value(this.element.val(),true)}this._draw();this._on(this._events);this._refresh();this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var options=this._super();var element=this.element;$.each(["min","max","step"],function(i,option){var value=element.attr(option);if(value!=null&&value.length){options[option]=value}});return options},_events:{keydown:function(event){if(this._start(event)&&this._keydown(event)){event.preventDefault()}},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(event){if(this.cancelBlur){delete this.cancelBlur;return}this._stop();this._refresh();if(this.previous!==this.element.val()){this._trigger("change",event)}},mousewheel:function(event,delta){if(!delta){return}if(!this.spinning&&!this._start(event)){return false}this._spin((delta>0?1:-1)*this.options.step,event);clearTimeout(this.mousewheelTimer);this.mousewheelTimer=this._delay(function(){if(this.spinning){this._stop(event)}},100);event.preventDefault()},"mousedown .ui-spinner-button":function(event){var previous;previous=this.element[0]===$.ui.safeActiveElement(this.document[0])?this.previous:this.element.val();function checkFocus(){var isActive=this.element[0]===$.ui.safeActiveElement(this.document[0]);if(!isActive){this.element.trigger("focus");this.previous=previous;this._delay(function(){this.previous=previous})}}event.preventDefault();checkFocus.call(this);this.cancelBlur=true;this._delay(function(){delete this.cancelBlur;checkFocus.call(this)});if(this._start(event)===false){return}this._repeat(null,$(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(event){if(!$(event.currentTarget).hasClass("ui-state-active")){return}if(this._start(event)===false){return false}this._repeat(null,$(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event)},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance();this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content");this._addClass("ui-spinner-input");this.element.attr("role","spinbutton");this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",true).button({classes:{"ui-button":""}});this._removeClass(this.buttons,"ui-corner-all");this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up");this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down");this.buttons.first().button({icon:this.options.icons.up,showLabel:false});this.buttons.last().button({icon:this.options.icons.down,showLabel:false});if(this.buttons.height()>Math.ceil(this.uiSpinner.height()*.5)&&this.uiSpinner.height()>0){this.uiSpinner.height(this.uiSpinner.height())}},_keydown:function(event){var options=this.options,keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.UP:this._repeat(null,1,event);return true;case keyCode.DOWN:this._repeat(null,-1,event);return true;case keyCode.PAGE_UP:this._repeat(null,options.page,event);return true;case keyCode.PAGE_DOWN:this._repeat(null,-options.page,event);return true}return false},_start:function(event){if(!this.spinning&&this._trigger("start",event)===false){return false}if(!this.counter){this.counter=1}this.spinning=true;return true},_repeat:function(i,steps,event){i=i||500;clearTimeout(this.timer);this.timer=this._delay(function(){this._repeat(40,steps,event)},i);this._spin(steps*this.options.step,event)},_spin:function(step,event){var value=this.value()||0;if(!this.counter){this.counter=1}value=this._adjustValue(value+step*this._increment(this.counter));if(!this.spinning||this._trigger("spin",event,{value:value})!==false){this._value(value);this.counter++}},_increment:function(i){var incremental=this.options.incremental;if(incremental){return $.isFunction(incremental)?incremental(i):Math.floor(i*i*i/5e4-i*i/500+17*i/200+1)}return 1},_precision:function(){var precision=this._precisionOf(this.options.step);if(this.options.min!==null){precision=Math.max(precision,this._precisionOf(this.options.min))}return precision},_precisionOf:function(num){var str=num.toString(),decimal=str.indexOf(".");return decimal===-1?0:str.length-decimal-1},_adjustValue:function(value){var base,aboveMin,options=this.options;base=options.min!==null?options.min:0;aboveMin=value-base;aboveMin=Math.round(aboveMin/options.step)*options.step;value=base+aboveMin;value=parseFloat(value.toFixed(this._precision()));if(options.max!==null&&value>options.max){return options.max}if(options.min!==null&&value<options.min){return options.min}return value},_stop:function(event){if(!this.spinning){return}clearTimeout(this.timer);clearTimeout(this.mousewheelTimer);this.counter=0;this.spinning=false;this._trigger("stop",event)},_setOption:function(key,value){var prevValue,first,last;if(key==="culture"||key==="numberFormat"){prevValue=this._parse(this.element.val());this.options[key]=value;this.element.val(this._format(prevValue));return}if(key==="max"||key==="min"||key==="step"){if(typeof value==="string"){value=this._parse(value)}}if(key==="icons"){first=this.buttons.first().find(".ui-icon");this._removeClass(first,null,this.options.icons.up);this._addClass(first,null,value.up);last=this.buttons.last().find(".ui-icon");this._removeClass(last,null,this.options.icons.down);this._addClass(last,null,value.down)}this._super(key,value)},_setOptionDisabled:function(value){this._super(value);this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!value);this.element.prop("disabled",!!value);this.buttons.button(value?"disable":"enable")},_setOptions:spinnerModifer(function(options){this._super(options)}),_parse:function(val){if(typeof val==="string"&&val!==""){val=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(val,10,this.options.culture):+val}return val===""||isNaN(val)?null:val},_format:function(value){if(value===""){return""}return window.Globalize&&this.options.numberFormat?Globalize.format(value,this.options.numberFormat,this.options.culture):value},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var value=this.value();if(value===null){return false}return value===this._adjustValue(value)},_value:function(value,allowAny){var parsed;if(value!==""){parsed=this._parse(value);if(parsed!==null){if(!allowAny){parsed=this._adjustValue(parsed)}value=this._format(parsed)}}this.element.val(value);this._refresh()},_destroy:function(){this.element.prop("disabled",false).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow");this.uiSpinner.replaceWith(this.element)},stepUp:spinnerModifer(function(steps){this._stepUp(steps)}),_stepUp:function(steps){if(this._start()){this._spin((steps||1)*this.options.step);this._stop()}},stepDown:spinnerModifer(function(steps){this._stepDown(steps)}),_stepDown:function(steps){if(this._start()){this._spin((steps||1)*-this.options.step);this._stop()}},pageUp:spinnerModifer(function(pages){this._stepUp((pages||1)*this.options.page)}),pageDown:spinnerModifer(function(pages){this._stepDown((pages||1)*this.options.page)}),value:function(newVal){if(!arguments.length){return this._parse(this.element.val())}spinnerModifer(this._value).call(this,newVal)},widget:function(){return this.uiSpinner}});if($.uiBackCompat!==false){$.widget("ui.spinner",$.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}})}var widgetsSpinner=$.ui.spinner;$.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:false,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var rhash=/#.*$/;return function(anchor){var anchorUrl,locationUrl;anchorUrl=anchor.href.replace(rhash,"");locationUrl=location.href.replace(rhash,"");try{anchorUrl=decodeURIComponent(anchorUrl)}catch(error){}try{locationUrl=decodeURIComponent(locationUrl)}catch(error){}return anchor.hash.length>1&&anchorUrl===locationUrl}}(),_create:function(){var that=this,options=this.options;this.running=false;this._addClass("ui-tabs","ui-widget ui-widget-content");this._toggleClass("ui-tabs-collapsible",null,options.collapsible);this._processTabs();options.active=this._initialActive();if($.isArray(options.disabled)){options.disabled=$.unique(options.disabled.concat($.map(this.tabs.filter(".ui-state-disabled"),function(li){return that.tabs.index(li)}))).sort()}if(this.options.active!==false&&this.anchors.length){this.active=this._findActive(options.active)}else{this.active=$()}this._refresh();if(this.active.length){this.load(options.active)}},_initialActive:function(){var active=this.options.active,collapsible=this.options.collapsible,locationHash=location.hash.substring(1);if(active===null){if(locationHash){this.tabs.each(function(i,tab){if($(tab).attr("aria-controls")===locationHash){active=i;return false}})}if(active===null){active=this.tabs.index(this.tabs.filter(".ui-tabs-active"))}if(active===null||active===-1){active=this.tabs.length?0:false}}if(active!==false){active=this.tabs.index(this.tabs.eq(active));if(active===-1){active=collapsible?false:0}}if(!collapsible&&active===false&&this.anchors.length){active=0}return active},_getCreateEventData:function(){return{tab:this.active,panel:!this.active.length?$():this._getPanelForTab(this.active)}},_tabKeydown:function(event){var focusedTab=$($.ui.safeActiveElement(this.document[0])).closest("li"),selectedIndex=this.tabs.index(focusedTab),goingForward=true;if(this._handlePageNav(event)){return}switch(event.keyCode){case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:selectedIndex++;break;case $.ui.keyCode.UP:case $.ui.keyCode.LEFT:goingForward=false;selectedIndex--;break;case $.ui.keyCode.END:selectedIndex=this.anchors.length-1;break;case $.ui.keyCode.HOME:selectedIndex=0;break;case $.ui.keyCode.SPACE:event.preventDefault();clearTimeout(this.activating);this._activate(selectedIndex);return;case $.ui.keyCode.ENTER:event.preventDefault();clearTimeout(this.activating);this._activate(selectedIndex===this.options.active?false:selectedIndex);return;default:return}event.preventDefault();clearTimeout(this.activating);selectedIndex=this._focusNextTab(selectedIndex,goingForward);if(!event.ctrlKey&&!event.metaKey){focusedTab.attr("aria-selected","false");this.tabs.eq(selectedIndex).attr("aria-selected","true");this.activating=this._delay(function(){this.option("active",selectedIndex)},this.delay)}},_panelKeydown:function(event){if(this._handlePageNav(event)){return}if(event.ctrlKey&&event.keyCode===$.ui.keyCode.UP){event.preventDefault();this.active.trigger("focus")}},_handlePageNav:function(event){if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_UP){this._activate(this._focusNextTab(this.options.active-1,false));return true}if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_DOWN){this._activate(this._focusNextTab(this.options.active+1,true));return true}},_findNextTab:function(index,goingForward){var lastTabIndex=this.tabs.length-1;function constrain(){if(index>lastTabIndex){index=0}if(index<0){index=lastTabIndex}return index}while($.inArray(constrain(),this.options.disabled)!==-1){index=goingForward?index+1:index-1}return index},_focusNextTab:function(index,goingForward){index=this._findNextTab(index,goingForward);this.tabs.eq(index).trigger("focus");return index},_setOption:function(key,value){if(key==="active"){this._activate(value);return}this._super(key,value);if(key==="collapsible"){this._toggleClass("ui-tabs-collapsible",null,value);if(!value&&this.options.active===false){this._activate(0)}}if(key==="event"){this._setupEvents(value)}if(key==="heightStyle"){this._setupHeightStyle(value)}},_sanitizeSelector:function(hash){return hash?hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var options=this.options,lis=this.tablist.children(":has(a[href])");options.disabled=$.map(lis.filter(".ui-state-disabled"),function(tab){return lis.index(tab)});this._processTabs();if(options.active===false||!this.anchors.length){options.active=false;this.active=$()}else if(this.active.length&&!$.contains(this.tablist[0],this.active[0])){if(this.tabs.length===options.disabled.length){options.active=false;this.active=$()}else{this._activate(this._findNextTab(Math.max(0,options.active-1),false))}}else{options.active=this.tabs.index(this.active)}this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled);this._setupEvents(this.options.event);this._setupHeightStyle(this.options.heightStyle);this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1});this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"});if(!this.active.length){this.tabs.eq(0).attr("tabIndex",0)}else{this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0});this._addClass(this.active,"ui-tabs-active","ui-state-active");this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})}},_processTabs:function(){var that=this,prevTabs=this.tabs,prevAnchors=this.anchors,prevPanels=this.panels;this.tablist=this._getList().attr("role","tablist");this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header");this.tablist.on("mousedown"+this.eventNamespace,"> li",function(event){if($(this).is(".ui-state-disabled")){event.preventDefault()}}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){if($(this).closest("li").is(".ui-state-disabled")){this.blur()}});this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1});this._addClass(this.tabs,"ui-tabs-tab","ui-state-default");this.anchors=this.tabs.map(function(){return $("a",this)[0]}).attr({role:"presentation",tabIndex:-1});this._addClass(this.anchors,"ui-tabs-anchor");this.panels=$();this.anchors.each(function(i,anchor){var selector,panel,panelId,anchorId=$(anchor).uniqueId().attr("id"),tab=$(anchor).closest("li"),originalAriaControls=tab.attr("aria-controls");if(that._isLocal(anchor)){selector=anchor.hash;panelId=selector.substring(1);panel=that.element.find(that._sanitizeSelector(selector))}else{panelId=tab.attr("aria-controls")||$({}).uniqueId()[0].id;selector="#"+panelId;panel=that.element.find(selector);if(!panel.length){panel=that._createPanel(panelId);panel.insertAfter(that.panels[i-1]||that.tablist)}panel.attr("aria-live","polite")}if(panel.length){that.panels=that.panels.add(panel)}if(originalAriaControls){tab.data("ui-tabs-aria-controls",originalAriaControls)}tab.attr({"aria-controls":panelId,"aria-labelledby":anchorId});panel.attr("aria-labelledby",anchorId)});this.panels.attr("role","tabpanel");this._addClass(this.panels,"ui-tabs-panel","ui-widget-content");if(prevTabs){this._off(prevTabs.not(this.tabs));this._off(prevAnchors.not(this.anchors));this._off(prevPanels.not(this.panels))}},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(id){return $("<div>").attr("id",id).data("ui-tabs-destroy",true)},_setOptionDisabled:function(disabled){var currentItem,li,i;if($.isArray(disabled)){if(!disabled.length){disabled=false}else if(disabled.length===this.anchors.length){disabled=true}}for(i=0;li=this.tabs[i];i++){currentItem=$(li);if(disabled===true||$.inArray(i,disabled)!==-1){currentItem.attr("aria-disabled","true");this._addClass(currentItem,null,"ui-state-disabled")}else{currentItem.removeAttr("aria-disabled");this._removeClass(currentItem,null,"ui-state-disabled")}}this.options.disabled=disabled;this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,disabled===true)},_setupEvents:function(event){var events={};if(event){$.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler"})}this._off(this.anchors.add(this.tabs).add(this.panels));this._on(true,this.anchors,{click:function(event){event.preventDefault()}});this._on(this.anchors,events);this._on(this.tabs,{keydown:"_tabKeydown"});this._on(this.panels,{keydown:"_panelKeydown"});this._focusable(this.tabs);this._hoverable(this.tabs)},_setupHeightStyle:function(heightStyle){var maxHeight,parent=this.element.parent();if(heightStyle==="fill"){maxHeight=parent.height();maxHeight-=this.element.outerHeight()-this.element.height();this.element.siblings(":visible").each(function(){var elem=$(this),position=elem.css("position");if(position==="absolute"||position==="fixed"){return}maxHeight-=elem.outerHeight(true)});this.element.children().not(this.panels).each(function(){maxHeight-=$(this).outerHeight(true)});this.panels.each(function(){$(this).height(Math.max(0,maxHeight-$(this).innerHeight()+$(this).height()))}).css("overflow","auto")}else if(heightStyle==="auto"){maxHeight=0;this.panels.each(function(){maxHeight=Math.max(maxHeight,$(this).height("").height())}).height(maxHeight)}},_eventHandler:function(event){var options=this.options,active=this.active,anchor=$(event.currentTarget),tab=anchor.closest("li"),clickedIsActive=tab[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$():this._getPanelForTab(tab),toHide=!active.length?$():this._getPanelForTab(active),eventData={oldTab:active,oldPanel:toHide,newTab:collapsing?$():tab,newPanel:toShow};event.preventDefault();if(tab.hasClass("ui-state-disabled")||tab.hasClass("ui-tabs-loading")||this.running||clickedIsActive&&!options.collapsible||this._trigger("beforeActivate",event,eventData)===false){return}options.active=collapsing?false:this.tabs.index(tab);this.active=clickedIsActive?$():tab;if(this.xhr){this.xhr.abort()}if(!toHide.length&&!toShow.length){$.error("jQuery UI Tabs: Mismatching fragment identifier.")}if(toShow.length){this.load(this.tabs.index(tab),event)}this._toggle(event,eventData)},_toggle:function(event,eventData){var that=this,toShow=eventData.newPanel,toHide=eventData.oldPanel;this.running=true;function complete(){that.running=false;that._trigger("activate",event,eventData)}function show(){that._addClass(eventData.newTab.closest("li"),"ui-tabs-active","ui-state-active");if(toShow.length&&that.options.show){that._show(toShow,that.options.show,complete)}else{toShow.show();complete()}}if(toHide.length&&this.options.hide){this._hide(toHide,this.options.hide,function(){that._removeClass(eventData.oldTab.closest("li"),"ui-tabs-active","ui-state-active");show()})}else{this._removeClass(eventData.oldTab.closest("li"),"ui-tabs-active","ui-state-active");toHide.hide();show()}toHide.attr("aria-hidden","true");eventData.oldTab.attr({"aria-selected":"false","aria-expanded":"false"});if(toShow.length&&toHide.length){eventData.oldTab.attr("tabIndex",-1)}else if(toShow.length){this.tabs.filter(function(){return $(this).attr("tabIndex")===0}).attr("tabIndex",-1)}toShow.attr("aria-hidden","false");eventData.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(index){var anchor,active=this._findActive(index);if(active[0]===this.active[0]){return}if(!active.length){active=this.active}anchor=active.find(".ui-tabs-anchor")[0];this._eventHandler({target:anchor,currentTarget:anchor,preventDefault:$.noop})},_findActive:function(index){return index===false?$():this.tabs.eq(index)},_getIndex:function(index){if(typeof index==="string"){index=this.anchors.index(this.anchors.filter("[href$='"+$.ui.escapeSelector(index)+"']"))}return index},_destroy:function(){if(this.xhr){this.xhr.abort()}this.tablist.removeAttr("role").off(this.eventNamespace);this.anchors.removeAttr("role tabIndex").removeUniqueId();this.tabs.add(this.panels).each(function(){if($.data(this,"ui-tabs-destroy")){$(this).remove()}else{$(this).removeAttr("role tabIndex "+"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}});this.tabs.each(function(){var li=$(this),prev=li.data("ui-tabs-aria-controls");if(prev){li.attr("aria-controls",prev).removeData("ui-tabs-aria-controls")}else{li.removeAttr("aria-controls")}});this.panels.show();if(this.options.heightStyle!=="content"){this.panels.css("height","")}},enable:function(index){var disabled=this.options.disabled;if(disabled===false){return}if(index===undefined){disabled=false}else{index=this._getIndex(index);if($.isArray(disabled)){disabled=$.map(disabled,function(num){return num!==index?num:null})}else{disabled=$.map(this.tabs,function(li,num){return num!==index?num:null})}}this._setOptionDisabled(disabled)},disable:function(index){var disabled=this.options.disabled;if(disabled===true){return}if(index===undefined){disabled=true}else{index=this._getIndex(index);if($.inArray(index,disabled)!==-1){return}if($.isArray(disabled)){disabled=$.merge([index],disabled).sort()}else{disabled=[index]}}this._setOptionDisabled(disabled)},load:function(index,event){index=this._getIndex(index);var that=this,tab=this.tabs.eq(index),anchor=tab.find(".ui-tabs-anchor"),panel=this._getPanelForTab(tab),eventData={tab:tab,panel:panel},complete=function(jqXHR,status){if(status==="abort"){that.panels.stop(false,true)}that._removeClass(tab,"ui-tabs-loading");panel.removeAttr("aria-busy");if(jqXHR===that.xhr){delete that.xhr}};if(this._isLocal(anchor[0])){return}this.xhr=$.ajax(this._ajaxSettings(anchor,event,eventData));if(this.xhr&&this.xhr.statusText!=="canceled"){this._addClass(tab,"ui-tabs-loading");panel.attr("aria-busy","true");this.xhr.done(function(response,status,jqXHR){setTimeout(function(){panel.html(response);that._trigger("load",event,eventData);complete(jqXHR,status)},1)}).fail(function(jqXHR,status){setTimeout(function(){complete(jqXHR,status)},1)})}},_ajaxSettings:function(anchor,event,eventData){var that=this;return{url:anchor.attr("href").replace(/#.*$/,""),beforeSend:function(jqXHR,settings){return that._trigger("beforeLoad",event,$.extend({jqXHR:jqXHR,ajaxSettings:settings},eventData))}}},_getPanelForTab:function(tab){var id=$(tab).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+id))}});if($.uiBackCompat!==false){$.widget("ui.tabs",$.ui.tabs,{_processTabs:function(){this._superApply(arguments);this._addClass(this.tabs,"ui-tab")}})}var widgetsTabs=$.ui.tabs;$.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var title=$(this).attr("title")||"";return $("<a>").text(title).html()},hide:true,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:true,track:false,close:null,open:null},_addDescribedBy:function(elem,id){var describedby=(elem.attr("aria-describedby")||"").split(/\s+/);describedby.push(id);elem.data("ui-tooltip-id",id).attr("aria-describedby",$.trim(describedby.join(" ")))},_removeDescribedBy:function(elem){var id=elem.data("ui-tooltip-id"),describedby=(elem.attr("aria-describedby")||"").split(/\s+/),index=$.inArray(id,describedby);if(index!==-1){describedby.splice(index,1)}elem.removeData("ui-tooltip-id");describedby=$.trim(describedby.join(" "));if(describedby){elem.attr("aria-describedby",describedby)}else{elem.removeAttr("aria-describedby")}},_create:function(){this._on({mouseover:"open",focusin:"open"});this.tooltips={};this.parents={};this.liveRegion=$("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body);this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible");this.disabledTitles=$([])},_setOption:function(key,value){var that=this;this._super(key,value);if(key==="content"){$.each(this.tooltips,function(id,tooltipData){that._updateContent(tooltipData.element)})}},_setOptionDisabled:function(value){this[value?"_disable":"_enable"]()},_disable:function(){var that=this;$.each(this.tooltips,function(id,tooltipData){var event=$.Event("blur");event.target=event.currentTarget=tooltipData.element[0];that.close(event,true)});this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var element=$(this);if(element.is("[title]")){return element.data("ui-tooltip-title",element.attr("title")).removeAttr("title")}}))},_enable:function(){this.disabledTitles.each(function(){var element=$(this);if(element.data("ui-tooltip-title")){element.attr("title",element.data("ui-tooltip-title"))}});this.disabledTitles=$([])},open:function(event){var that=this,target=$(event?event.target:this.element).closest(this.options.items);if(!target.length||target.data("ui-tooltip-id")){return}if(target.attr("title")){target.data("ui-tooltip-title",target.attr("title"))}target.data("ui-tooltip-open",true);if(event&&event.type==="mouseover"){target.parents().each(function(){var parent=$(this),blurEvent;if(parent.data("ui-tooltip-open")){blurEvent=$.Event("blur");blurEvent.target=blurEvent.currentTarget=this;that.close(blurEvent,true)}if(parent.attr("title")){parent.uniqueId();that.parents[this.id]={element:this,title:parent.attr("title")};parent.attr("title","")}})}this._registerCloseHandlers(event,target);this._updateContent(target,event)},_updateContent:function(target,event){var content,contentOption=this.options.content,that=this,eventType=event?event.type:null;if(typeof contentOption==="string"||contentOption.nodeType||contentOption.jquery){return this._open(event,target,contentOption)}content=contentOption.call(target[0],function(response){that._delay(function(){if(!target.data("ui-tooltip-open")){return}if(event){event.type=eventType}this._open(event,target,response)})});if(content){this._open(event,target,content)}},_open:function(event,target,content){var tooltipData,tooltip,delayedShow,a11yContent,positionOption=$.extend({},this.options.position);if(!content){return}tooltipData=this._find(target);if(tooltipData){tooltipData.tooltip.find(".ui-tooltip-content").html(content);return}if(target.is("[title]")){if(event&&event.type==="mouseover"){target.attr("title","")}else{target.removeAttr("title")}}tooltipData=this._tooltip(target);tooltip=tooltipData.tooltip;this._addDescribedBy(target,tooltip.attr("id"));tooltip.find(".ui-tooltip-content").html(content);this.liveRegion.children().hide();a11yContent=$("<div>").html(tooltip.find(".ui-tooltip-content").html());a11yContent.removeAttr("name").find("[name]").removeAttr("name");a11yContent.removeAttr("id").find("[id]").removeAttr("id");a11yContent.appendTo(this.liveRegion);function position(event){positionOption.of=event;if(tooltip.is(":hidden")){return}tooltip.position(positionOption)}if(this.options.track&&event&&/^mouse/.test(event.type)){this._on(this.document,{mousemove:position});position(event)}else{tooltip.position($.extend({of:target},this.options.position))}tooltip.hide();this._show(tooltip,this.options.show);if(this.options.track&&this.options.show&&this.options.show.delay){delayedShow=this.delayedShow=setInterval(function(){if(tooltip.is(":visible")){position(positionOption.of);clearInterval(delayedShow)}},$.fx.interval)}this._trigger("open",event,{tooltip:tooltip})},_registerCloseHandlers:function(event,target){var events={keyup:function(event){if(event.keyCode===$.ui.keyCode.ESCAPE){var fakeEvent=$.Event(event);fakeEvent.currentTarget=target[0];this.close(fakeEvent,true)}}};if(target[0]!==this.element[0]){events.remove=function(){this._removeTooltip(this._find(target).tooltip)}}if(!event||event.type==="mouseover"){events.mouseleave="close"}if(!event||event.type==="focusin"){events.focusout="close"}this._on(true,target,events)},close:function(event){var tooltip,that=this,target=$(event?event.currentTarget:this.element),tooltipData=this._find(target);if(!tooltipData){target.removeData("ui-tooltip-open");return}tooltip=tooltipData.tooltip;if(tooltipData.closing){return}clearInterval(this.delayedShow);if(target.data("ui-tooltip-title")&&!target.attr("title")){target.attr("title",target.data("ui-tooltip-title"))}this._removeDescribedBy(target);tooltipData.hiding=true;tooltip.stop(true);this._hide(tooltip,this.options.hide,function(){that._removeTooltip($(this))});target.removeData("ui-tooltip-open");this._off(target,"mouseleave focusout keyup");if(target[0]!==this.element[0]){this._off(target,"remove")}this._off(this.document,"mousemove");if(event&&event.type==="mouseleave"){$.each(this.parents,function(id,parent){$(parent.element).attr("title",parent.title);delete that.parents[id]})}tooltipData.closing=true;this._trigger("close",event,{tooltip:tooltip});if(!tooltipData.hiding){tooltipData.closing=false}},_tooltip:function(element){var tooltip=$("<div>").attr("role","tooltip"),content=$("<div>").appendTo(tooltip),id=tooltip.uniqueId().attr("id");this._addClass(content,"ui-tooltip-content");this._addClass(tooltip,"ui-tooltip","ui-widget ui-widget-content");tooltip.appendTo(this._appendTo(element));return this.tooltips[id]={element:element,tooltip:tooltip}},_find:function(target){var id=target.data("ui-tooltip-id");return id?this.tooltips[id]:null},_removeTooltip:function(tooltip){tooltip.remove();delete this.tooltips[tooltip.attr("id")]},_appendTo:function(target){var element=target.closest(".ui-front, dialog");if(!element.length){element=this.document[0].body}return element},_destroy:function(){var that=this;$.each(this.tooltips,function(id,tooltipData){var event=$.Event("blur"),element=tooltipData.element;event.target=event.currentTarget=element[0];that.close(event,true);$("#"+id).remove();if(element.data("ui-tooltip-title")){if(!element.attr("title")){element.attr("title",element.data("ui-tooltip-title"))}element.removeData("ui-tooltip-title")}});this.liveRegion.remove()}});if($.uiBackCompat!==false){$.widget("ui.tooltip",$.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var tooltipData=this._superApply(arguments);if(this.options.tooltipClass){tooltipData.tooltip.addClass(this.options.tooltipClass)}return tooltipData}})}var widgetsTooltip=$.ui.tooltip});if(typeof jQuery==="undefined"){throw new Error("Bootstrap's JavaScript requires jQuery")}+function($){"use strict";function transitionEnd(){var el=document.createElement("bootstrap");var transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var name in transEndEventNames){if(el.style[name]!==undefined){return{end:transEndEventNames[name]}}}return false}$.fn.emulateTransitionEnd=function(duration){var called=false,$el=this;$(this).one($.support.transition.end,function(){called=true});var callback=function(){if(!called)$($el).trigger($.support.transition.end)};setTimeout(callback,duration);return this};$(function(){$.support.transition=transitionEnd()})}(jQuery);+function($){"use strict";var dismiss='[data-dismiss="alert"]';var Alert=function(el){$(el).on("click",dismiss,this.close)};Alert.prototype.close=function(e){var $this=$(this);var selector=$this.attr("data-target");if(!selector){selector=$this.attr("href");selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,"")}var $parent=$(selector);if(e)e.preventDefault();if(!$parent.length){$parent=$this.hasClass("alert")?$this:$this.parent()}$parent.trigger(e=$.Event("close.bs.alert"));if(e.isDefaultPrevented())return;$parent.removeClass("in");function removeElement(){$parent.trigger("closed.bs.alert").remove()}$.support.transition&&$parent.hasClass("fade")?$parent.one($.support.transition.end,removeElement).emulateTransitionEnd(150):removeElement()};var old=$.fn.alert;$.fn.alert=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.alert");if(!data)$this.data("bs.alert",data=new Alert(this));if(typeof option=="string")data[option].call($this)})};$.fn.alert.Constructor=Alert;$.fn.alert.noConflict=function(){$.fn.alert=old;return this};$(document).on("click.bs.alert.data-api",dismiss,Alert.prototype.close)}(jQuery);+function($){"use strict";var Button=function(element,options){this.$element=$(element);this.options=$.extend({},Button.DEFAULTS,options);this.isLoading=false};Button.DEFAULTS={loadingText:"loading..."};Button.prototype.setState=function(state){var d="disabled";var $el=this.$element;var val=$el.is("input")?"val":"html";var data=$el.data();state=state+"Text";if(!data.resetText)$el.data("resetText",$el[val]());$el[val](data[state]||this.options[state]);setTimeout($.proxy(function(){if(state=="loadingText"){this.isLoading=true;$el.addClass(d).attr(d,d)}else if(this.isLoading){this.isLoading=false;$el.removeClass(d).removeAttr(d)}},this),0)};Button.prototype.toggle=function(){var changed=true;var $parent=this.$element.closest('[data-toggle="buttons"]');if($parent.length){var $input=this.$element.find("input");if($input.prop("type")=="radio"){if($input.prop("checked")&&this.$element.hasClass("active"))changed=false;else $parent.find(".active").removeClass("active")}if(changed)$input.prop("checked",!this.$element.hasClass("active")).trigger("change")}if(changed)this.$element.toggleClass("active")};var old=$.fn.button;$.fn.button=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.button");var options=typeof option=="object"&&option;if(!data)$this.data("bs.button",data=new Button(this,options));if(option=="toggle")data.toggle();else if(option)data.setState(option)})};$.fn.button.Constructor=Button;$.fn.button.noConflict=function(){$.fn.button=old;return this};$(document).on("click.bs.button.data-api","[data-toggle^=button]",function(e){var $btn=$(e.target);if(!$btn.hasClass("btn"))$btn=$btn.closest(".btn");$btn.button("toggle");e.preventDefault()})}(jQuery);+function($){"use strict";var Carousel=function(element,options){this.$element=$(element);this.$indicators=this.$element.find(".carousel-indicators");this.options=options;this.paused=this.sliding=this.interval=this.$active=this.$items=null;this.options.pause=="hover"&&this.$element.on("mouseenter",$.proxy(this.pause,this)).on("mouseleave",$.proxy(this.cycle,this))};Carousel.DEFAULTS={interval:5e3,pause:"hover",wrap:true};Carousel.prototype.cycle=function(e){e||(this.paused=false);this.interval&&clearInterval(this.interval);this.options.interval&&!this.paused&&(this.interval=setInterval($.proxy(this.next,this),this.options.interval));return this};Carousel.prototype.getActiveIndex=function(){this.$active=this.$element.find(".item.active");this.$items=this.$active.parent().children();return this.$items.index(this.$active)};Carousel.prototype.to=function(pos){var that=this;var activeIndex=this.getActiveIndex();if(pos>this.$items.length-1||pos<0)return;if(this.sliding)return this.$element.one("slid.bs.carousel",function(){that.to(pos)});if(activeIndex==pos)return this.pause().cycle();return this.slide(pos>activeIndex?"next":"prev",$(this.$items[pos]))};Carousel.prototype.pause=function(e){e||(this.paused=true);if(this.$element.find(".next, .prev").length&&$.support.transition){this.$element.trigger($.support.transition.end);this.cycle(true)}this.interval=clearInterval(this.interval);return this};Carousel.prototype.next=function(){if(this.sliding)return;return this.slide("next")};Carousel.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")};Carousel.prototype.slide=function(type,next){var $active=this.$element.find(".item.active");var $next=next||$active[type]();var isCycling=this.interval;var direction=type=="next"?"left":"right";var fallback=type=="next"?"first":"last";var that=this;if(!$next.length){if(!this.options.wrap)return;$next=this.$element.find(".item")[fallback]()}if($next.hasClass("active"))return this.sliding=false;var e=$.Event("slide.bs.carousel",{relatedTarget:$next[0],direction:direction});this.$element.trigger(e);if(e.isDefaultPrevented())return;this.sliding=true;isCycling&&this.pause();if(this.$indicators.length){this.$indicators.find(".active").removeClass("active");this.$element.one("slid.bs.carousel",function(){var $nextIndicator=$(that.$indicators.children()[that.getActiveIndex()]);$nextIndicator&&$nextIndicator.addClass("active")})}if($.support.transition&&this.$element.hasClass("slide")){$next.addClass(type);$next[0].offsetWidth;$active.addClass(direction);$next.addClass(direction);$active.one($.support.transition.end,function(){$next.removeClass([type,direction].join(" ")).addClass("active");$active.removeClass(["active",direction].join(" "));that.sliding=false;setTimeout(function(){that.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd($active.css("transition-duration").slice(0,-1)*1e3)}else{$active.removeClass("active");$next.addClass("active");this.sliding=false;this.$element.trigger("slid.bs.carousel")}isCycling&&this.cycle();return this};var old=$.fn.carousel;$.fn.carousel=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.carousel");var options=$.extend({},Carousel.DEFAULTS,$this.data(),typeof option=="object"&&option);var action=typeof option=="string"?option:options.slide;if(!data)$this.data("bs.carousel",data=new Carousel(this,options));if(typeof option=="number")data.to(option);else if(action)data[action]();else if(options.interval)data.pause().cycle()})};$.fn.carousel.Constructor=Carousel;$.fn.carousel.noConflict=function(){$.fn.carousel=old;return this};$(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(e){var $this=$(this),href;var $target=$($this.attr("data-target")||(href=$this.attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,""));var options=$.extend({},$target.data(),$this.data());var slideIndex=$this.attr("data-slide-to");if(slideIndex)options.interval=false;$target.carousel(options);if(slideIndex=$this.attr("data-slide-to")){$target.data("bs.carousel").to(slideIndex)}e.preventDefault()});$(window).on("load",function(){$('[data-ride="carousel"]').each(function(){var $carousel=$(this);$carousel.carousel($carousel.data())})})}(jQuery);+function($){"use strict";var Collapse=function(element,options){this.$element=$(element);this.options=$.extend({},Collapse.DEFAULTS,options);this.transitioning=null;if(this.options.parent)this.$parent=$(this.options.parent);if(this.options.toggle)this.toggle()};Collapse.DEFAULTS={toggle:true};Collapse.prototype.dimension=function(){var hasWidth=this.$element.hasClass("width");return hasWidth?"width":"height"};Collapse.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in"))return;var startEvent=$.Event("show.bs.collapse");this.$element.trigger(startEvent);if(startEvent.isDefaultPrevented())return;var actives=this.$parent&&this.$parent.find("> .panel > .in");if(actives&&actives.length){var hasData=actives.data("bs.collapse");if(hasData&&hasData.transitioning)return;actives.collapse("hide");hasData||actives.data("bs.collapse",null)}var dimension=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[dimension](0);this.transitioning=1;var complete=function(){this.$element.removeClass("collapsing").addClass("collapse in")[dimension]("auto");this.transitioning=0;this.$element.trigger("shown.bs.collapse")};if(!$.support.transition)return complete.call(this);var scrollSize=$.camelCase(["scroll",dimension].join("-"));this.$element.one($.support.transition.end,$.proxy(complete,this)).emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])};Collapse.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in"))return;var startEvent=$.Event("hide.bs.collapse");this.$element.trigger(startEvent);if(startEvent.isDefaultPrevented())return;var dimension=this.dimension();this.$element[dimension](this.$element[dimension]())[0].offsetHeight;this.$element.addClass("collapsing").removeClass("collapse").removeClass("in");this.transitioning=1;var complete=function(){this.transitioning=0;this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};if(!$.support.transition)return complete.call(this);this.$element[dimension](0).one($.support.transition.end,$.proxy(complete,this)).emulateTransitionEnd(350)};Collapse.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var old=$.fn.collapse;$.fn.collapse=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.collapse");var options=$.extend({},Collapse.DEFAULTS,$this.data(),typeof option=="object"&&option);if(!data&&options.toggle&&option=="show")option=!option;if(!data)$this.data("bs.collapse",data=new Collapse(this,options));if(typeof option=="string")data[option]()})};$.fn.collapse.Constructor=Collapse;$.fn.collapse.noConflict=function(){$.fn.collapse=old;return this};$(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(e){var $this=$(this),href;var target=$this.attr("data-target")||e.preventDefault()||(href=$this.attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,"");var $target=$(target);var data=$target.data("bs.collapse");var option=data?"toggle":$this.data();var parent=$this.attr("data-parent");var $parent=parent&&$(parent);if(!data||!data.transitioning){if($parent)$parent.find('[data-toggle=collapse][data-parent="'+parent+'"]').not($this).addClass("collapsed");$this[$target.hasClass("in")?"addClass":"removeClass"]("collapsed")}$target.collapse(option)})}(jQuery);+function($){"use strict";var backdrop=".dropdown-backdrop";var toggle="[data-toggle=dropdown]";var Dropdown=function(element){$(element).on("click.bs.dropdown",this.toggle)};Dropdown.prototype.toggle=function(e){var $this=$(this);if($this.is(".disabled, :disabled"))return;var $parent=getParent($this);var isActive=$parent.hasClass("open");clearMenus();if(!isActive){if("ontouchstart"in document.documentElement&&!$parent.closest(".navbar-nav").length){$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on("click",clearMenus)}var relatedTarget={relatedTarget:this};$parent.trigger(e=$.Event("show.bs.dropdown",relatedTarget));if(e.isDefaultPrevented())return;$parent.toggleClass("open").trigger("shown.bs.dropdown",relatedTarget);$this.focus()}return false};Dropdown.prototype.keydown=function(e){if(!/(38|40|27)/.test(e.keyCode))return;var $this=$(this);e.preventDefault();e.stopPropagation();if($this.is(".disabled, :disabled"))return;var $parent=getParent($this);var isActive=$parent.hasClass("open");if(!isActive||isActive&&e.keyCode==27){if(e.which==27)$parent.find(toggle).focus();return $this.click()}var desc=" li:not(.divider):visible a";var $items=$parent.find("[role=menu]"+desc+", [role=listbox]"+desc);if(!$items.length)return;var index=$items.index($items.filter(":focus"));if(e.keyCode==38&&index>0)index--;if(e.keyCode==40&&index<$items.length-1)index++;if(!~index)index=0;$items.eq(index).focus()};function clearMenus(e){$(backdrop).remove();$(toggle).each(function(){var $parent=getParent($(this));var relatedTarget={relatedTarget:this};if(!$parent.hasClass("open"))return;$parent.trigger(e=$.Event("hide.bs.dropdown",relatedTarget));if(e.isDefaultPrevented())return;$parent.removeClass("open").trigger("hidden.bs.dropdown",relatedTarget)})}function getParent($this){var selector=$this.attr("data-target");if(!selector){selector=$this.attr("href");selector=selector&&/#[A-Za-z]/.test(selector)&&selector.replace(/.*(?=#[^\s]*$)/,"")}var $parent=selector&&$(selector);return $parent&&$parent.length?$parent:$this.parent()}var old=$.fn.dropdown;$.fn.dropdown=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.dropdown");if(!data)$this.data("bs.dropdown",data=new Dropdown(this));if(typeof option=="string")data[option].call($this)})};$.fn.dropdown.Constructor=Dropdown;$.fn.dropdown.noConflict=function(){$.fn.dropdown=old;return this};$(document).on("click.bs.dropdown.data-api",clearMenus).on("click.bs.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.bs.dropdown.data-api",toggle,Dropdown.prototype.toggle).on("keydown.bs.dropdown.data-api",toggle+", [role=menu], [role=listbox]",Dropdown.prototype.keydown)}(jQuery);+function($){"use strict";var Modal=function(element,options){this.options=options;this.$element=$(element);this.$backdrop=this.isShown=null;if(this.options.remote){this.$element.find(".modal-content").load(this.options.remote,$.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))}};Modal.DEFAULTS={backdrop:true,keyboard:true,show:true};Modal.prototype.toggle=function(_relatedTarget){return this[!this.isShown?"show":"hide"](_relatedTarget)};Modal.prototype.show=function(_relatedTarget){var that=this;var e=$.Event("show.bs.modal",{relatedTarget:_relatedTarget});this.$element.trigger(e);if(this.isShown||e.isDefaultPrevented())return;this.isShown=true;this.escape();this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',$.proxy(this.hide,this));this.backdrop(function(){var transition=$.support.transition&&that.$element.hasClass("fade");if(!that.$element.parent().length){that.$element.appendTo(document.body)}that.$element.show().scrollTop(0);if(transition){that.$element[0].offsetWidth}that.$element.addClass("in").attr("aria-hidden",false);that.enforceFocus();var e=$.Event("shown.bs.modal",{relatedTarget:_relatedTarget});transition?that.$element.find(".modal-dialog").one($.support.transition.end,function(){that.$element.focus().trigger(e)}).emulateTransitionEnd(300):that.$element.focus().trigger(e)})};Modal.prototype.hide=function(e){if(e)e.preventDefault();e=$.Event("hide.bs.modal");this.$element.trigger(e);if(!this.isShown||e.isDefaultPrevented())return;this.isShown=false;this.escape();$(document).off("focusin.bs.modal");this.$element.removeClass("in").attr("aria-hidden",true).off("click.dismiss.bs.modal");$.support.transition&&this.$element.hasClass("fade")?this.$element.one($.support.transition.end,$.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal()};Modal.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(e){if(this.$element[0]!==e.target&&!this.$element.has(e.target).length){this.$element.focus()}},this))};Modal.prototype.escape=function(){if(this.isShown&&this.options.keyboard){this.$element.on("keyup.dismiss.bs.modal",$.proxy(function(e){e.which==27&&this.hide()},this))}else if(!this.isShown){this.$element.off("keyup.dismiss.bs.modal")}};Modal.prototype.hideModal=function(){var that=this;this.$element.hide();this.backdrop(function(){that.removeBackdrop();that.$element.trigger("hidden.bs.modal")})};Modal.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=null};Modal.prototype.backdrop=function(callback){var animate=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var doAnimate=$.support.transition&&animate;this.$backdrop=$('<div class="modal-backdrop '+animate+'" />').appendTo(document.body);this.$element.on("click.dismiss.bs.modal",$.proxy(function(e){if(e.target!==e.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus.call(this.$element[0]):this.hide.call(this)},this));if(doAnimate)this.$backdrop[0].offsetWidth;this.$backdrop.addClass("in");if(!callback)return;doAnimate?this.$backdrop.one($.support.transition.end,callback).emulateTransitionEnd(150):callback()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");$.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one($.support.transition.end,callback).emulateTransitionEnd(150):callback()}else if(callback){callback()}};var old=$.fn.modal;$.fn.modal=function(option,_relatedTarget){return this.each(function(){var $this=$(this);var data=$this.data("bs.modal");var options=$.extend({},Modal.DEFAULTS,$this.data(),typeof option=="object"&&option);if(!data)$this.data("bs.modal",data=new Modal(this,options));if(typeof option=="string")data[option](_relatedTarget);else if(options.show)data.show(_relatedTarget)})};$.fn.modal.Constructor=Modal;$.fn.modal.noConflict=function(){$.fn.modal=old;return this};$(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(e){var $this=$(this);var href=$this.attr("href");var $target=$($this.attr("data-target")||href&&href.replace(/.*(?=#[^\s]+$)/,""));var option=$target.data("bs.modal")?"toggle":$.extend({remote:!/#/.test(href)&&href},$target.data(),$this.data());if($this.is("a"))e.preventDefault();$target.modal(option,this).one("hide",function(){$this.is(":visible")&&$this.focus()})});$(document).on("show.bs.modal",".modal",function(){$(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){$(document.body).removeClass("modal-open")})}(jQuery);+function($){"use strict";var Tooltip=function(element,options){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null;this.init("tooltip",element,options)};Tooltip.DEFAULTS={animation:true,placement:"top",selector:false,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:false,container:false};Tooltip.prototype.init=function(type,element,options){this.enabled=true;this.type=type;this.$element=$(element);this.options=this.getOptions(options);var triggers=this.options.trigger.split(" ");for(var i=triggers.length;i--;){var trigger=triggers[i];if(trigger=="click"){this.$element.on("click."+this.type,this.options.selector,$.proxy(this.toggle,this))}else if(trigger!="manual"){var eventIn=trigger=="hover"?"mouseenter":"focusin";var eventOut=trigger=="hover"?"mouseleave":"focusout";this.$element.on(eventIn+"."+this.type,this.options.selector,$.proxy(this.enter,this));this.$element.on(eventOut+"."+this.type,this.options.selector,$.proxy(this.leave,this))}}this.options.selector?this._options=$.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()};Tooltip.prototype.getDefaults=function(){return Tooltip.DEFAULTS};Tooltip.prototype.getOptions=function(options){options=$.extend({},this.getDefaults(),this.$element.data(),options);if(options.delay&&typeof options.delay=="number"){options.delay={show:options.delay,hide:options.delay}}return options};Tooltip.prototype.getDelegateOptions=function(){var options={};var defaults=this.getDefaults();this._options&&$.each(this._options,function(key,value){if(defaults[key]!=value)options[key]=value});return options};Tooltip.prototype.enter=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(self.timeout);self.hoverState="in";if(!self.options.delay||!self.options.delay.show)return self.show();self.timeout=setTimeout(function(){if(self.hoverState=="in")self.show()},self.options.delay.show)};Tooltip.prototype.leave=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(self.timeout);self.hoverState="out";if(!self.options.delay||!self.options.delay.hide)return self.hide();self.timeout=setTimeout(function(){if(self.hoverState=="out")self.hide()},self.options.delay.hide)};Tooltip.prototype.show=function(){var e=$.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);if(e.isDefaultPrevented())return;var that=this;var $tip=this.tip();this.setContent();if(this.options.animation)$tip.addClass("fade");var placement=typeof this.options.placement=="function"?this.options.placement.call(this,$tip[0],this.$element[0]):this.options.placement;var autoToken=/\s?auto?\s?/i;var autoPlace=autoToken.test(placement);if(autoPlace)placement=placement.replace(autoToken,"")||"top";$tip.detach().css({top:0,left:0,display:"block"}).addClass(placement);this.options.container?$tip.appendTo(this.options.container):$tip.insertAfter(this.$element);var pos=this.getPosition();var actualWidth=$tip[0].offsetWidth;var actualHeight=$tip[0].offsetHeight;if(autoPlace){var $parent=this.$element.parent();var orgPlacement=placement;var docScroll=document.documentElement.scrollTop||document.body.scrollTop;var parentWidth=this.options.container=="body"?window.innerWidth:$parent.outerWidth();var parentHeight=this.options.container=="body"?window.innerHeight:$parent.outerHeight();var parentLeft=this.options.container=="body"?0:$parent.offset().left;placement=placement=="bottom"&&pos.top+pos.height+actualHeight-docScroll>parentHeight?"top":placement=="top"&&pos.top-docScroll-actualHeight<0?"bottom":placement=="right"&&pos.right+actualWidth>parentWidth?"left":placement=="left"&&pos.left-actualWidth<parentLeft?"right":placement;$tip.removeClass(orgPlacement).addClass(placement)}var calculatedOffset=this.getCalculatedOffset(placement,pos,actualWidth,actualHeight);this.applyPlacement(calculatedOffset,placement);this.hoverState=null;var complete=function(){that.$element.trigger("shown.bs."+that.type)};$.support.transition&&this.$tip.hasClass("fade")?$tip.one($.support.transition.end,complete).emulateTransitionEnd(150):complete()}};Tooltip.prototype.applyPlacement=function(offset,placement){var replace;var $tip=this.tip();var width=$tip[0].offsetWidth;var height=$tip[0].offsetHeight;var marginTop=parseInt($tip.css("margin-top"),10);var marginLeft=parseInt($tip.css("margin-left"),10);if(isNaN(marginTop))marginTop=0;if(isNaN(marginLeft))marginLeft=0;offset.top=offset.top+marginTop;offset.left=offset.left+marginLeft;$.offset.setOffset($tip[0],$.extend({using:function(props){$tip.css({top:Math.round(props.top),left:Math.round(props.left)})}},offset),0);$tip.addClass("in");var actualWidth=$tip[0].offsetWidth;var actualHeight=$tip[0].offsetHeight;if(placement=="top"&&actualHeight!=height){replace=true;offset.top=offset.top+height-actualHeight}if(/bottom|top/.test(placement)){var delta=0;if(offset.left<0){delta=offset.left*-2;offset.left=0;$tip.offset(offset);actualWidth=$tip[0].offsetWidth;actualHeight=$tip[0].offsetHeight}this.replaceArrow(delta-width+actualWidth,actualWidth,"left")}else{this.replaceArrow(actualHeight-height,actualHeight,"top")}if(replace)$tip.offset(offset)};Tooltip.prototype.replaceArrow=function(delta,dimension,position){this.arrow().css(position,delta?50*(1-delta/dimension)+"%":"")};Tooltip.prototype.setContent=function(){var $tip=this.tip();var title=this.getTitle();$tip.find(".tooltip-inner")[this.options.html?"html":"text"](title);$tip.removeClass("fade in top bottom left right")};Tooltip.prototype.hide=function(){var that=this;var $tip=this.tip();var e=$.Event("hide.bs."+this.type);function complete(){if(that.hoverState!="in")$tip.detach();that.$element.trigger("hidden.bs."+that.type)}this.$element.trigger(e);if(e.isDefaultPrevented())return;$tip.removeClass("in");$.support.transition&&this.$tip.hasClass("fade")?$tip.one($.support.transition.end,complete).emulateTransitionEnd(150):complete();this.hoverState=null;return this};Tooltip.prototype.fixTitle=function(){var $e=this.$element;if($e.attr("title")||typeof $e.attr("data-original-title")!="string"){$e.attr("data-original-title",$e.attr("title")||"").attr("title","")}};Tooltip.prototype.hasContent=function(){return this.getTitle()};Tooltip.prototype.getPosition=function(){var el=this.$element[0];return $.extend({},typeof el.getBoundingClientRect=="function"?el.getBoundingClientRect():{width:el.offsetWidth,height:el.offsetHeight},this.$element.offset())};Tooltip.prototype.getCalculatedOffset=function(placement,pos,actualWidth,actualHeight){return placement=="bottom"?{top:pos.top+pos.height,left:pos.left+pos.width/2-actualWidth/2}:placement=="top"?{top:pos.top-actualHeight,left:pos.left+pos.width/2-actualWidth/2}:placement=="left"?{top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth}:{top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width}};Tooltip.prototype.getTitle=function(){var title;var $e=this.$element;var o=this.options;title=$e.attr("data-original-title")||(typeof o.title=="function"?o.title.call($e[0]):o.title);return title};Tooltip.prototype.tip=function(){return this.$tip=this.$tip||$(this.options.template)};Tooltip.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")};Tooltip.prototype.validate=function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null}};Tooltip.prototype.enable=function(){this.enabled=true};Tooltip.prototype.disable=function(){this.enabled=false};Tooltip.prototype.toggleEnabled=function(){this.enabled=!this.enabled};Tooltip.prototype.toggle=function(e){var self=e?$(e.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;self.tip().hasClass("in")?self.leave(self):self.enter(self)};Tooltip.prototype.destroy=function(){clearTimeout(this.timeout);this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var old=$.fn.tooltip;$.fn.tooltip=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.tooltip");var options=typeof option=="object"&&option;if(!data&&option=="destroy")return;if(!data)$this.data("bs.tooltip",data=new Tooltip(this,options));if(typeof option=="string")data[option]()})};$.fn.tooltip.Constructor=Tooltip;$.fn.tooltip.noConflict=function(){$.fn.tooltip=old;return this}}(jQuery);+function($){"use strict";var Popover=function(element,options){this.init("popover",element,options)};if(!$.fn.tooltip)throw new Error("Popover requires tooltip.js");Popover.DEFAULTS=$.extend({},$.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'});Popover.prototype=$.extend({},$.fn.tooltip.Constructor.prototype);Popover.prototype.constructor=Popover;Popover.prototype.getDefaults=function(){return Popover.DEFAULTS};Popover.prototype.setContent=function(){var $tip=this.tip();var title=this.getTitle();var content=this.getContent();$tip.find(".popover-title")[this.options.html?"html":"text"](title);$tip.find(".popover-content")[this.options.html?typeof content=="string"?"html":"append":"text"](content);$tip.removeClass("fade top bottom left right in");if(!$tip.find(".popover-title").html())$tip.find(".popover-title").hide()};Popover.prototype.hasContent=function(){return this.getTitle()||this.getContent()};Popover.prototype.getContent=function(){var $e=this.$element;var o=this.options;return $e.attr("data-content")||(typeof o.content=="function"?o.content.call($e[0]):o.content)};Popover.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};Popover.prototype.tip=function(){if(!this.$tip)this.$tip=$(this.options.template);return this.$tip};var old=$.fn.popover;$.fn.popover=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.popover");var options=typeof option=="object"&&option;if(!data&&option=="destroy")return;if(!data)$this.data("bs.popover",data=new Popover(this,options));if(typeof option=="string")data[option]()})};$.fn.popover.Constructor=Popover;$.fn.popover.noConflict=function(){$.fn.popover=old;return this}}(jQuery);+function($){"use strict";function ScrollSpy(element,options){var href;var process=$.proxy(this.process,this);this.$element=$(element).is("body")?$(window):$(element);this.$body=$("body");this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",process);this.options=$.extend({},ScrollSpy.DEFAULTS,options);this.selector=(this.options.target||(href=$(element).attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a";this.offsets=$([]);this.targets=$([]);this.activeTarget=null;this.refresh();this.process()}ScrollSpy.DEFAULTS={offset:10};ScrollSpy.prototype.refresh=function(){var offsetMethod=this.$element[0]==window?"offset":"position";this.offsets=$([]);this.targets=$([]);var self=this;var $targets=this.$body.find(this.selector).map(function(){var $el=$(this);var href=$el.data("target")||$el.attr("href");var $href=/^#./.test(href)&&$(href);return $href&&$href.length&&$href.is(":visible")&&[[$href[offsetMethod]().top+(!$.isWindow(self.$scrollElement.get(0))&&self.$scrollElement.scrollTop()),href]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){self.offsets.push(this[0]);self.targets.push(this[1])})};ScrollSpy.prototype.process=function(){var scrollTop=this.$scrollElement.scrollTop()+this.options.offset;var scrollHeight=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight;var maxScroll=scrollHeight-this.$scrollElement.height();var offsets=this.offsets;var targets=this.targets;var activeTarget=this.activeTarget;var i;if(scrollTop>=maxScroll){return activeTarget!=(i=targets.last()[0])&&this.activate(i)}if(activeTarget&&scrollTop<=offsets[0]){return activeTarget!=(i=targets[0])&&this.activate(i)}for(i=offsets.length;i--;){activeTarget!=targets[i]&&scrollTop>=offsets[i]&&(!offsets[i+1]||scrollTop<=offsets[i+1])&&this.activate(targets[i])}};ScrollSpy.prototype.activate=function(target){this.activeTarget=target;$(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var selector=this.selector+'[data-target="'+target+'"],'+this.selector+'[href="'+target+'"]';var active=$(selector).parents("li").addClass("active");if(active.parent(".dropdown-menu").length){active=active.closest("li.dropdown").addClass("active")}active.trigger("activate.bs.scrollspy")};var old=$.fn.scrollspy;$.fn.scrollspy=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.scrollspy");var options=typeof option=="object"&&option;if(!data)$this.data("bs.scrollspy",data=new ScrollSpy(this,options));if(typeof option=="string")data[option]()})};$.fn.scrollspy.Constructor=ScrollSpy;$.fn.scrollspy.noConflict=function(){$.fn.scrollspy=old;return this};$(window).on("load",function(){$('[data-spy="scroll"]').each(function(){var $spy=$(this);$spy.scrollspy($spy.data())})})}(jQuery);+function($){"use strict";var Tab=function(element){this.element=$(element)};Tab.prototype.show=function(){var $this=this.element;var $ul=$this.closest("ul:not(.dropdown-menu)");var selector=$this.data("target");if(!selector){selector=$this.attr("href");selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,"")}if($this.parent("li").hasClass("active"))return;var previous=$ul.find(".active:last a")[0];var e=$.Event("show.bs.tab",{relatedTarget:previous});$this.trigger(e);if(e.isDefaultPrevented())return;var $target=$(selector);this.activate($this.parent("li"),$ul);this.activate($target,$target.parent(),function(){$this.trigger({type:"shown.bs.tab",relatedTarget:previous})})};Tab.prototype.activate=function(element,container,callback){var $active=container.find("> .active");var transition=callback&&$.support.transition&&$active.hasClass("fade");function next(){$active.removeClass("active").find("> .dropdown-menu > .active").removeClass("active");element.addClass("active");if(transition){element[0].offsetWidth;element.addClass("in")}else{element.removeClass("fade")}if(element.parent(".dropdown-menu")){element.closest("li.dropdown").addClass("active")}callback&&callback()}transition?$active.one($.support.transition.end,next).emulateTransitionEnd(150):next();$active.removeClass("in")};var old=$.fn.tab;$.fn.tab=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.tab");if(!data)$this.data("bs.tab",data=new Tab(this));if(typeof option=="string")data[option]()})};$.fn.tab.Constructor=Tab;$.fn.tab.noConflict=function(){$.fn.tab=old;return this};$(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault();$(this).tab("show")})}(jQuery);+function($){"use strict";var Affix=function(element,options){this.options=$.extend({},Affix.DEFAULTS,options);this.$window=$(window).on("scroll.bs.affix.data-api",$.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",$.proxy(this.checkPositionWithEventLoop,this));this.$element=$(element);this.affixed=this.unpin=this.pinnedOffset=null;this.checkPosition()};Affix.RESET="affix affix-top affix-bottom";Affix.DEFAULTS={offset:0};Affix.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(Affix.RESET).addClass("affix");var scrollTop=this.$window.scrollTop();var position=this.$element.offset();return this.pinnedOffset=position.top-scrollTop};Affix.prototype.checkPositionWithEventLoop=function(){setTimeout($.proxy(this.checkPosition,this),1)};Affix.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var scrollHeight=$(document).height();var scrollTop=this.$window.scrollTop();var position=this.$element.offset();var offset=this.options.offset;var offsetTop=offset.top;var offsetBottom=offset.bottom;if(this.affixed=="top")position.top+=scrollTop;if(typeof offset!="object")offsetBottom=offsetTop=offset;if(typeof offsetTop=="function")offsetTop=offset.top(this.$element);if(typeof offsetBottom=="function")offsetBottom=offset.bottom(this.$element);var affix=this.unpin!=null&&scrollTop+this.unpin<=position.top?false:offsetBottom!=null&&position.top+this.$element.height()>=scrollHeight-offsetBottom?"bottom":offsetTop!=null&&scrollTop<=offsetTop?"top":false;if(this.affixed===affix)return;if(this.unpin)this.$element.css("top","");var affixType="affix"+(affix?"-"+affix:"");var e=$.Event(affixType+".bs.affix");this.$element.trigger(e);if(e.isDefaultPrevented())return;this.affixed=affix;this.unpin=affix=="bottom"?this.getPinnedOffset():null;this.$element.removeClass(Affix.RESET).addClass(affixType).trigger($.Event(affixType.replace("affix","affixed")));if(affix=="bottom"){this.$element.offset({top:scrollHeight-offsetBottom-this.$element.height()})}};var old=$.fn.affix;$.fn.affix=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.affix");var options=typeof option=="object"&&option;if(!data)$this.data("bs.affix",data=new Affix(this,options));if(typeof option=="string")data[option]()})};$.fn.affix.Constructor=Affix;$.fn.affix.noConflict=function(){$.fn.affix=old;return this};$(window).on("load",function(){$('[data-spy="affix"]').each(function(){var $spy=$(this);var data=$spy.data();data.offset=data.offset||{};if(data.offsetBottom)data.offset.bottom=data.offsetBottom;if(data.offsetTop)data.offset.top=data.offsetTop;$spy.affix(data)})})}(jQuery);(function($){var DataTable=function(element,options){this.$element=$(element);this.options=options;this.pendingRequest=null;this.enabled=true;this.columns=[];this.rows=[];this.buttons=[];this.localStorageId="datatable_"+(options.id||options.url.replace(/\W/gi,"_"));for(var column in this.options.columns){if(typeof this.options.columns[column].sortable===undefined)this.options.columns[column].sortable=true}this.$default=this.$element.children().length?this.$element.children():$("<div></div>").addClass("alert alert-danger").html(i18n.no_results_found);this.$element.addClass("clearfix");if(localStorage){localStorage[this.localStorageId]="false"}if(this.options.tablePreRender&&typeof this.options.tablePreRender==="function")this.options.tablePreRender.call(this);_initToolbar.call(this);if(this.options.autoLoad===true)this.render()};DataTable.prototype={constructor:DataTable,render:function(){var o=this.options,$e=this.$element;this.loading(true);this.columns=[];this.rows=[];this.buttons=[];this.$wrapper=undefined;this.$table=undefined;this.$header=undefined;this.$body=undefined;this.$footer=undefined;this.$pagination=undefined;if(this.$toolbar)this.$toolbar.remove();this.$top_details=$("<div></div>").attr("id","dt-top-details");this.$bottom_details=$("<div></div>").attr("id","dt-bottom-details");var that=this;if(o.debug)console.log($.extend({},o.post,{currentPage:o.currentPage,perPage:o.perPage,sort:o.sort,filter:o.filter}));if(o.url!==""){var req_data=typeof o.post==="function"?o.post():o.post;if(this.pendingRequest)this.pendingRequest.abort();this.pendingRequest=$.ajax({url:o.url,type:"GET",dataType:"json",data:$.extend({},req_data,{currentPage:o.currentPage,perPage:o.perPage,sortColumn:o.sort.length>0?o.sort[0][0]:null,sortOrder:o.sort.length>0?o.sort[0][1]:null,filter:o.filter}),success:function(res,status,xhr){that.pendingRequest=null;if(o.dataAdapter)res=o.dataAdapter(res,o);that.resultset=res;if(!res||res===undefined||!res.data||res.data.length==0&&!o.forceTable){showError.call(that,res);return}$e.empty();o.sort=res.sort;o.filter=res.filter;o.totalRows=res.totalRows;if(res.currentPage)o.currentPage=parseInt(res.currentPage);_retrieveColumns.call(that,localStorage[that.localStorageId]);$e.append(that.table());$e.prepend(that.$top_details);$e.append(that.$bottom_details);if(o.showHeader)that.header();if(o.showFooter)that.footer();that.body();if(o.showTopPagination&&that.pagination())that.$top_details.append(that.pagination().clone(true));if(o.showPagination&&that.pagination())that.$bottom_details.append(that.pagination().clone(true));if(!o.hideDetails)that.details();_initToolbar.call(that);if(o.tableCallback&&typeof o.tableCallback==="function")o.tableCallback.call(that);that.loading(false)},error:function(xhr,status,e){that.pendingRequest=null;if(status!=="abort")console.error("Datatable: error while loading data: "+e);showError.call(that,null,status,e);that.loading(false)}})}},loading:function(show){var $e=this.$element;var o=this.options;if(o.customLoading){o.customLoading(this,show);return}if(!this.$loading){this.$loading=$("<div></div>").css({position:"absolute",top:parseInt($e.position().top)+5+(o.loadingYOffset||0),left:parseInt($e.position().left)+parseInt($e.css("marginLeft"))+Math.floor($e.width()/4),width:Math.floor($e.width()/2)+"px"}).append($("<div></div>").addClass("progress progress-striped").append($("<div></div>").addClass("progress-bar progress-bar-info").attr("style","width: 40%"))).appendTo(document.body)}if(show){$e.css({opacity:.2})}else{$e.css({opacity:1});this.$loading.remove();this.$loading=undefined}},toolbar:function(){var o=this.options,$e=this.$element,that=this;this.$toolbar=$("<div></div>").addClass("dt-toolbar btn-toolbar pull-right");this.$button_group=$("<div></div>").addClass("btn-group").appendTo(this.$toolbar);for(var i=0;i<o.buttons.length;i++){this.buttons.push(o.buttons[i])}$.each(this.buttons,function(){that.$button_group.append(this)});if(o.sectionHeader){this.$section_header=$(o.sectionHeader);this.$section_header.append(this.$toolbar)}else if(o.title!==""&&!this.$section_header){this.$section_header=$("<h2></h2>").html(o.title).append(this.$toolbar);$e.before(this.$section_header)}else{if(!this.$toolbar_container){this.$toolbar_container=$("<div></div>").addClass("dt-toolbar-container clearfix")}$e.prepend(this.$toolbar_container.append(this.$toolbar))}return this.$toolbar},details:function(){var o=this.options,res=this.resultset,start=0,end=0,that=this;start=o.currentPage*o.perPage-o.perPage+1;if(start<1)start=1;end=o.currentPage*o.perPage;if(end>o.totalRows)end=o.totalRows;$('<div class="pull-left"><p>'+i18n.showing_x_to_y_rows.sformat(start,end,o.totalRows)+"</p></div>").prependTo(this.$bottom_details)},table:function(){var $e=this.$element,o=this.options;if(!this.$table_wrapper){this.$wrapper=$("<div></div>").addClass("dt-table-wrapper")}if(!this.$table){this.$table=$("<table></table>").addClass(o.class)}this.$wrapper.append(this.$table);return this.$wrapper},header:function(){var o=this.options,res=this.resultset;if(!this.$header){this.$header=$("<thead></thead>");var row=$("<tr></tr>");for(var column in o.columns){var $cell=this.column(column),colprop=$cell.data("column_properties");if(colprop.sortable&&!colprop.custom)$cell.click(this,this.sort).css({cursor:"pointer"});for(var i=0;i<o.sort.length;i++){if(o.sort[i][0]==colprop.field){if(o.sort[i][1]=="asc"){$cell.append($(o.ascending));colprop.sortOrder="asc"}else if(o.sort[i][1]=="desc"){$cell.append($(o.descending));colprop.sortOrder="desc"}}}row.append($cell);this.$header.append(row);this.columns.push($cell)}if(o.headerCallback&&typeof o.headerCallback==="function")o.headerCallback.call(this);this.$table.append(this.$header)}return this.$header},footer:function(){var o=this.options,res=this.resultset;if(!this.$footer){this.$footer=$("<tfoot></tfoot>");for(column in o.columns){var $cell=$("<td></td>");$cell.data("cell_properties",o.columns[column]).addClass(o.columns[column].classname);this.$footer.append($cell)}if(o.footerCallback&&typeof o.footerCallback==="function")o.footerCallback.call(this,this.resultset.footer);this.$table.append(this.$footer)}return this.$footer},body:function(){var res=this.resultset,o=this.options;if(!this.$body){this.$body=$("<tbody></tbody>");for(var i=0;i<res.data.length;i++){var row=this.row(res.data[i]);this.$body.append(row);this.rows.push(row)}if(o.showFilterRow)this.$body.prepend(this.filter());this.$table.append(this.$body)}return this.$body},filter:function(){var $row=$("<tr></tr>"),o=this.options,that=this;$row.addClass("dt-filter-row");for(var column in o.columns){var $cell=$("<td></td>").addClass(o.columns[column].classname);if(o.columns[column].hidden)$cell.hide();if(o.columns[column].filter&&o.columns[column].field){$cell.append($("<input/>").attr("name","filter_"+o.columns[column].field).data("filter",o.columns[column].field).val(o.filter[o.columns[column].field]||"").change(function(e){runFilter.call(this,that)}))}$row.append($cell)}return $row},row:function(rowdata){var $row=$("<tr></tr>"),o=this.options;for(var column in o.columns){var cell=this.cell(rowdata,column);$row.append(cell)}if(o.rowCallback&&typeof o.rowCallback==="function")$row=o.rowCallback($row,rowdata);return $row},cell:function(data,column){var celldata=data[this.options.columns[column].field]||this.options.columns[column].custom,$cell=$("<td></td>"),o=this.options;if(o.columns[column].callback&&typeof o.columns[column].callback==="function")celldata=o.columns[column].callback.call($cell,data,o.columns[column]);$cell.data("cell_properties",o.columns[column]).addClass(o.columns[column].classname).append(celldata||"&nbsp;");if(o.columns[column].css)$cell.css(o.columns[column].css);if(o.columns[column].hidden)$cell.hide();return $cell},column:function(column){var $cell=$("<th></th>"),o=this.options,classname="dt-column_"+column+Math.floor(Math.random()*1e3+1);o.columns[column].classname=classname;$cell.data("column_properties",o.columns[column]).addClass(classname).text(o.columns[column].title);if(o.columns[column].css)$cell.css(o.columns[column].css);if(o.columns[column].hidden)$cell.hide();return $cell},sort:function(e){var colprop=$(this).data("column_properties"),that=e.data,o=e.data.options,found=false;colprop.sortOrder=colprop.sortOrder?colprop.sortOrder=="asc"?"desc":"":"asc";if(o.allowMultipleSort){for(var i=0;i<o.sort.length;i++){if(o.sort[i][0]==colprop.field){o.sort[i][1]=colprop.sortOrder;if(colprop.sortOrder==="")o.sort.splice(i,1);found=true}}if(!found)o.sort.push([colprop.field,colprop.sortOrder])}else{o.sort=[];o.sort.push([colprop.field,colprop.sortOrder])}if(o.debug)console.log(o.sort);that.render()},pagination:function(){var $e=this.$element,that=this,o=this.options,res=this.resultset;if(o.perPage>=res.totalRows)return;if(!this.$pagination){this.$pagination=$("<div></div>").addClass("pull-right");o.pageCount=Math.ceil(res.totalRows/o.perPage);var $pager=$("<ul></ul>").addClass("pagination"),$first=$("<li></li>").append($("<a></a>").attr("href","#").data("page",1).html("&laquo;").click(function(){o.currentPage=1;that.render();return false})),$previous=$("<li></li>").append($("<a></a>").attr("href","#").data("page",o.currentPage-1).html("&lt;").click(function(){o.currentPage-=1;o.currentPage=o.currentPage>=1?o.currentPage:1;that.render();return false})),$next=$("<li></li>").append($("<a></a>").attr("href","#").data("page",o.currentPage+1).html("&gt;").click(function(){o.currentPage+=1;o.currentPage=o.currentPage<=o.pageCount?o.currentPage:o.pageCount;that.render();return false})),$last=$("<li></li>").append($("<a></a>").attr("href","#").data("page",o.pageCount).html("&raquo;").click(function(){o.currentPage=o.pageCount;that.render();return false}));var totalPages=o.pagePadding*2,start,end;if(totalPages>=o.pageCount){start=1;end=o.pageCount}else{start=o.currentPage-o.pagePadding;if(start<=0)start=1;end=start+totalPages;if(end>o.pageCount){end=o.pageCount;start=end-totalPages}}for(var i=start;i<=end;i++){var $link=$("<li></li>").append($("<a></a>").attr("href","#").data("page",i).text(i).click(function(){o.currentPage=$(this).data("page");that.render();return false}));if(i==o.currentPage)$link.addClass("active");$pager.append($link)}if(o.currentPage==1){$first.addClass("disabled");$previous.addClass("disabled")}if(o.currentPage==o.pageCount){$next.addClass("disabled");$last.addClass("disabled")}$pager.prepend($first,$previous);$pager.append($next,$last);this.$pagination.append($pager)}return this.$pagination},remove:function(){var $e=this.$element;if(this.$section_header)this.$section_header.remove();$e.data("datatable",null);$e.empty()}};function _initToolbar(){var o=this.options;if(!o.hidePerPage)_initPerPage.call(this);if(o.filterModal)_initFilterModal.call(this);if(o.allowTableinfo)_initTableInfo.call(this);this.toolbar()}function _initColumnModal(){var o=this.options,$e=this.$element,$top_details=this.$top_details,$toggle=$("<a></a>");var that=this;if(!this.$column_modal){var randId=Math.floor(Math.random()*100+1);this.$column_modal=$("<div></div>").attr("id","dt-column-modal_"+randId).attr("tabindex","-1").attr("role","dialog").attr("aria-labelledby","dt-column-modal-label_"+randId).attr("aria-hidden","true").addClass("modal fade").hide();this.$column_modalheader=$("<div></div>").addClass("modal-header").append($("<button></button>").addClass("close").data("dismiss","modal").attr("aria-hidden","true").html("&times;").click(function(){that.$column_modal.modal("hide")})).append($("<h3></h3>").addClass("modal-title").attr("id","dt-column-modal-label_"+randId).text("Toggle Columns"));this.$column_modalfooter=$("<div></div>").addClass("modal-footer").append($('<div class="pull-left"></div>').append($('<div class="btn-group"></div>').append($("<button></button>").addClass("btn btn-info").append($("<span></span>").addClass("glyphicon glyphicon-check").text("All")).click(function(){$(this).closest(".modal").find("button.on-off").each(function(){if($(this).data("column-hidden")){$(this).click()}});return false}),$("<button></button>").addClass("btn btn-warning").append($("<span></span>").addClass("glyphicon glyphicon-unchecked").text("None")).click(function(){$(this).closest(".modal").find("button.on-off").each(function(){if(!$(this).data("column-hidden")){$(this).click()}});return false}))),o.allowSaveColumns?$("<button></button>").addClass("btn btn-primary").text("Save").click(function(){_saveColumns.call(that);return false}):"",$("<button></button>").addClass("btn btn-default").data("dismiss","modal").append($("<span></span>")).text("Close").click(function(){that.$column_modal.modal("hide");return false}));this.$column_modalbody=$("<div></div>").addClass("modal-body");this.$column_modaldialog=$("<div></div>").addClass("modal-dialog").append($("<div></div>").addClass("modal-content").append(this.$column_modalheader,this.$column_modalbody,this.$column_modalfooter));this.$column_modal.append(this.$column_modaldialog).appendTo(document.body)}$toggle.addClass("btn").data("toggle","modal").data("content","Choose which columns you would like to display.").data("target","#"+this.$column_modal.attr("id")).attr("href","#"+this.$column_modal.attr("id")).append($("<span></span>").addClass("glyphicon glyphicon-cog")).click(function(e){that.$column_modal.on("show.bs.modal",function(){if(o.debug)console.log(that);_updateColumnModalBody.call(that,that.$column_modalbody)}).modal();return false}).popover({trigger:"hover",placement:"top"});this.buttons.unshift($toggle);if(o.debug)console.log($toggle);return this.$column_modal}function _initFilterModal(){var o=this.options,$e=this.$element,$toggle=$("<a></a>");$toggle.addClass("btn").data("toggle","modal").attr("href","#").data("content","Open the filter dialog.").extend($("<span></span>").addClass("glyphicon glyphicon-filter")).click(function(){if($(o.filterModal).hasClass("modal"))$(o.filterModal).modal();else if($(o.filterModal).is(":visible"))$(o.filterModal).hide();else $(o.filterModal).show();return false}).popover({trigger:"hover",placement:"top"});this.buttons.unshift($toggle)}function _initPerPage(){var o=this.options,$e=this.$element,that=this;var $perpage_select=$("<a></a>").addClass("btn dropdown-toggle").data("content",i18n.change_number_of_rows+".").attr("data-toggle","dropdown").html(o.perPage+"&nbsp;").css({fontWeight:"normal"}).append($("<span></span>").addClass("caret")).popover({trigger:"hover",placement:"top"});this.buttons.push($perpage_select);var $perpage_values=$("<ul></ul>").addClass("dropdown-menu").css({fontSize:"initial",fontWeight:"normal"}).append($('<li data-value="10"><a href="#">10</a></li>').click(function(){_updatePerPage.call(this,that);return false}),$('<li data-value="20"><a href="#">20</a></li>').click(function(){_updatePerPage.call(this,that);return false}),$('<li data-value="50"><a href="#">50</a></li>').click(function(){_updatePerPage.call(this,that);return false}),$('<li data-value="100"><a href="#">100</a></li>').click(function(){_updatePerPage.call(this,that);return false}),$('<li data-value="200"><a href="#">200</a></li>').click(function(){_updatePerPage.call(this,that);return false}));this.buttons.push($perpage_values)}function _initTableInfo(){var o=this.options,$e=this.$element,$info=$("<a></a>");$info.addClass("btn").attr("href","#").append($("<span></span>").addClass("glyphicon glyphicon-info-sign")).click(function(){return false});var $page_sort=[],$page_filter=[];$.each(o.sort,function(i,v){if(!v.length)return;var heading;for(var column in o.columns){if(o.columns[column].field==v[0])heading=o.columns[column].title}$page_sort.push(heading+" "+v[1].toUpperCase())});$.each(o.filter,function(k,v){var heading;for(var column in o.columns){if(o.columns[column].field==k)heading=o.columns[column].title}$page_filter.push((heading||k)+" = '"+v+"'")});$($info).data("content",$("<dl></dl>").append($page_sort.length>0?'<dt><i class="icon-th-list"></i> Sort:</dt><dd>'+$page_sort.join(", ")+"</dd>":"",$page_filter.length>0?'<dt><i class="icon-filter"></i> Filter:</dt><dd>'+$page_filter.join(", ")+"</dd>":"")).popover({placement:"bottom"});this.buttons.unshift($info)}function _initOverflowToggle(){var o=this.options,$wrapper=this.$wrapper,$overflow=$("<a></a>");$overflow.addClass("btn").attr("href","#").attr("title","Toggle the size of the table to fit the data or to fit the screen.").append($("<span></span>").addClass("glyphicon glyphicon-resize-full")).click(function(){if($wrapper)_toggleOverflow.call(this,$wrapper);return false});if(!this.resultset||!this.resultset.data||this.resultset.data.length==0)$overflow.addClass("disabled");this.buttons.push($overflow)}function _toggleOverflow(el){if(el.css("overflow")=="scroll"){$(this).children("span.glyphicon").attr("class","glyphicon glyphicon-resize-full");el.css({overflow:"visible",width:"auto"})}else{$(this).children("span.glyphicon").attr("class","glyphicon glyphicon-resize-small");el.css({overflow:"scroll",width:el.width()})}}function _updatePerPage(that){var o=that.options;o.perPage=$(this).data("value");var offset=o.currentPage*o.perPage;while(offset>o.totalRows){o.currentPage--;offset=o.currentPage*o.perPage}if(o.currentPage<1)o.currentPage=1;if($(this).popover)$(this).popover("hide");that.render();return false}function showError(data,status,err_msg){var o=this.options,$e=this.$element;$e.empty();_initToolbar.call(this);if(o.tableCallback&&typeof o.tableCallback==="function")o.tableCallback.call(this);this.loading(false);var custom_no_res=null;if(o.noResultsCallback)custom_no_res=o.noResultsCallback(this,data);if(custom_no_res){$e.append(custom_no_res)}else if(err_msg&&status!="abort"){$e.append($("<div></div>").addClass("alert alert-danger").html(err_msg))}else if(data&&typeof data.error==="string"){$e.append($("<div></div>").addClass("alert alert-danger").html(data.error))}else if(o.noResultsMessage){var msg=o.noResultsMessage(this,data);$e.append($("<div></div>").addClass("alert alert-danger").html(msg))}else if(this.$default)$e.append(this.$default)}function runFilter(that){var o=that.options;o.filter[$(this).data("filter")]=$(this).val();if(o.debug)console.log(o.filter);that.render()}function _updateColumnModalBody(body){var o=this.options,$container=$("<form></form>").addClass("form-inline"),that=this;for(var column in o.columns){if(o.columns[column].title==="")continue;var $item=$("<div></div></br>").addClass("form-group").append($("<label></label>").addClass("control-label").append(o.columns[column].title,$("<button></button>").addClass("on-off btn "+(o.columns[column].hidden?"btn-info":"btn-warning")).data("column",column).data("column-hidden",o.columns[column].hidden).text(o.columns[column].hidden?"ON":"OFF").click(function(){_toggleColumn.call(this,that);return false})));$container.append($item)}body.empty();body.append($container)}function _toggleColumn(that){var o=that.options,column=$(this).data("column"),$column=$("."+o.columns[column].classname);if($column.is(":visible")){$column.hide();o.columns[column].hidden=true;$(this).removeClass("btn-warning").addClass("btn-info").text("ON").data("column-hidden",true)}else{$column.show();o.columns[column].hidden=false;$(this).removeClass("btn-info").addClass("btn-warning").text("OFF").data("column-hidden",false)}return false}function _saveColumns(){var o=this.options,columns=[];if(localStorage){localStorage[this.localStorageId]=JSON.stringify(o.columns)}$.ajax({url:o.url,type:"POST",dataType:"json",data:$.extend({},o.post,{action:"save-columns",columns:JSON.stringify(o.columns),sort:JSON.stringify(o.sort),filter:JSON.stringify(o.filter)}),success:function(res){if(o.debug)console.log("columns saved")}});this.$column_modal.modal("hide")}function _retrieveColumns(data){var o=this.options,columns=data?JSON.parse(data):[],res=this.resultset;if(!res.columns)res.columns=[];for(column in o.columns){o.columns[column]=$.extend({},o.columns[column],res.columns[column],columns[column])}}$.fn.datatable=function(options){$.fn.datatable.init.call(this,options,DataTable,"datatable");return this};$.fn.datatable.init=function(options,Constructor,name){var datatable;if(options===true){return this.data(name)}else if(typeof options=="string"){datatable=this.data(name);if(datatable){datatable[options]()}return this}options=$.extend({},$.fn[name].defaults,options);function get(el){var datatable=$.data(el,name);if(!datatable){datatable=new Constructor(el,$.fn.datatable.elementOptions(el,options));$.data(el,name,datatable)}return datatable}this.each(function(){get(this)});return this};$.fn.datatable.DataTable=DataTable;$.fn.datatable.elementOptions=function(el,options){return $.metadata?$.extend({},options,$(el).metadata()):options};$.fn.datatable.defaults={debug:false,id:undefined,title:"Data Table Results",class:"table table-striped table-bordered",perPage:10,pagePadding:2,sort:[],filter:{},post:{},buttons:[],sectionHeader:undefined,totalRows:0,currentPage:1,showPagination:true,showTopPagination:false,showHeader:true,showFooter:false,showFilterRow:false,filterModal:undefined,allowExport:false,allowOverflow:true,allowMultipleSort:false,allowSaveColumns:true,toggleColumns:true,url:"",columns:[],ascending:$("<span></span>").addClass("glyphicon glyphicon-chevron-up"),descending:$("<span></span>").addClass("glyphicon glyphicon-chevron-down"),rowCallback:undefined,tableCallback:undefined,headerCallback:undefined,footerCallback:undefined,tablePreRender:undefined,autoLoad:true}})(window.jQuery);(function(root,factory){"use strict";if(typeof module!=="undefined"&&module.exports){module.exports=factory(require("jquery"))}else if(typeof define==="function"&&define.amd){define(["jquery"],function($){return factory($)})}else{factory(root.jQuery)}})(this,function($){"use strict";var Typeahead=function(element,options){this.$element=$(element);this.options=$.extend({},Typeahead.defaults,options);this.matcher=this.options.matcher||this.matcher;this.sorter=this.options.sorter||this.sorter;this.select=this.options.select||this.select;this.autoSelect=typeof this.options.autoSelect=="boolean"?this.options.autoSelect:true;this.highlighter=this.options.highlighter||this.highlighter;this.render=this.options.render||this.render;this.updater=this.options.updater||this.updater;this.displayText=this.options.displayText||this.displayText;this.source=this.options.source;this.delay=this.options.delay;this.$menu=$(this.options.menu);this.$appendTo=this.options.appendTo?$(this.options.appendTo):null;this.fitToElement=typeof this.options.fitToElement=="boolean"?this.options.fitToElement:false;this.shown=false;this.listen();this.showHintOnFocus=typeof this.options.showHintOnFocus=="boolean"||this.options.showHintOnFocus==="all"?this.options.showHintOnFocus:false;this.afterSelect=this.options.afterSelect;this.addItem=false;this.value=this.$element.val()||this.$element.text()};Typeahead.prototype={constructor:Typeahead,select:function(){var val=this.$menu.find(".active").data("value");this.$element.data("active",val);if(this.autoSelect||val){var newVal=this.updater(val);if(!newVal){newVal=""}this.$element.val(this.displayText(newVal)||newVal).text(this.displayText(newVal)||newVal).change();this.afterSelect(newVal)}return this.hide()},updater:function(item){return item},setSource:function(source){this.source=source},show:function(){var pos=$.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});var scrollHeight=typeof this.options.scrollHeight=="function"?this.options.scrollHeight.call():this.options.scrollHeight;var element;if(this.shown){element=this.$menu}else if(this.$appendTo){element=this.$menu.appendTo(this.$appendTo);this.hasSameParent=this.$appendTo.is(this.$element.parent())}else{element=this.$menu.insertAfter(this.$element);this.hasSameParent=true}if(!this.hasSameParent){element.css("position","fixed");var offset=this.$element.offset();pos.top=offset.top;pos.left=offset.left}var dropup=$(element).parent().hasClass("dropup");var newTop=dropup?"auto":pos.top+pos.height+scrollHeight;var right=$(element).hasClass("dropdown-menu-right");var newLeft=right?"auto":pos.left;element.css({top:newTop,left:newLeft}).show();if(this.options.fitToElement===true){element.css("width",this.$element.outerWidth()+"px")}this.shown=true;return this},hide:function(){this.$menu.hide();this.shown=false;return this},lookup:function(query){var items;if(typeof query!="undefined"&&query!==null){this.query=query}else{this.query=this.$element.val()||this.$element.text()||""}if(this.query.length<this.options.minLength&&!this.options.showHintOnFocus){return this.shown?this.hide():this}var worker=$.proxy(function(){if($.isFunction(this.source)){this.source(this.query,$.proxy(this.process,this))}else if(this.source){this.process(this.source)}},this);clearTimeout(this.lookupWorker);this.lookupWorker=setTimeout(worker,this.delay)},process:function(items){var that=this;items=$.grep(items,function(item){return that.matcher(item)});items=this.sorter(items);if(!items.length&&!this.options.addItem){return this.shown?this.hide():this}if(items.length>0){this.$element.data("active",items[0])}else{this.$element.data("active",null)}if(this.options.addItem){items.push(this.options.addItem)}if(this.options.items=="all"){return this.render(items).show()}else{return this.render(items.slice(0,this.options.items)).show()}},matcher:function(item){var it=this.displayText(item);return~it.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(items){var beginswith=[];var caseSensitive=[];var caseInsensitive=[];var item;while(item=items.shift()){var it=this.displayText(item);if(!it.toLowerCase().indexOf(this.query.toLowerCase()))beginswith.push(item);else if(~it.indexOf(this.query))caseSensitive.push(item);else caseInsensitive.push(item)}return beginswith.concat(caseSensitive,caseInsensitive)},highlighter:function(item){var html=$("<div></div>");var query=this.query;var i=item.toLowerCase().indexOf(query.toLowerCase());var len=query.length;var leftPart;var middlePart;var rightPart;var strong;if(len===0){return html.text(item).html()}while(i>-1){leftPart=item.substr(0,i);middlePart=item.substr(i,len);rightPart=item.substr(i+len);strong=$("<strong></strong>").text(middlePart);html.append(document.createTextNode(leftPart)).append(strong);item=rightPart;i=item.toLowerCase().indexOf(query.toLowerCase())}return html.append(document.createTextNode(item)).html()},render:function(items){var that=this;var self=this;var activeFound=false;var data=[];var _category=that.options.separator;$.each(items,function(key,value){if(key>0&&value[_category]!==items[key-1][_category]){data.push({__type:"divider"})}if(value[_category]&&(key===0||value[_category]!==items[key-1][_category])){data.push({__type:"category",name:value[_category]})}data.push(value)});items=$(data).map(function(i,item){if((item.__type||false)=="category"){return $(that.options.headerHtml).text(item.name)[0]}if((item.__type||false)=="divider"){return $(that.options.headerDivider)[0]}var text=self.displayText(item);i=$(that.options.item).data("value",item);i.find("a").html(that.highlighter(text,item));if(text==self.$element.val()){i.addClass("active");self.$element.data("active",item);activeFound=true}return i[0]});if(this.autoSelect&&!activeFound){items.filter(":not(.dropdown-header)").first().addClass("active");this.$element.data("active",items.first().data("value"))}this.$menu.html(items);return this},displayText:function(item){return typeof item!=="undefined"&&typeof item.name!="undefined"?item.name:item},next:function(event){var active=this.$menu.find(".active").removeClass("active");var next=active.next();if(!next.length){next=$(this.$menu.find("li")[0])}next.addClass("active")},prev:function(event){var active=this.$menu.find(".active").removeClass("active");var prev=active.prev();if(!prev.length){prev=this.$menu.find("li").last()}prev.addClass("active")},listen:function(){this.$element.on("focus",$.proxy(this.focus,this)).on("blur",$.proxy(this.blur,this)).on("keypress",$.proxy(this.keypress,this)).on("input",$.proxy(this.input,this)).on("keyup",$.proxy(this.keyup,this));if(this.eventSupported("keydown")){this.$element.on("keydown",$.proxy(this.keydown,this))}this.$menu.on("click",$.proxy(this.click,this)).on("mouseenter","li",$.proxy(this.mouseenter,this)).on("mouseleave","li",$.proxy(this.mouseleave,this)).on("mousedown",$.proxy(this.mousedown,this))},destroy:function(){this.$element.data("typeahead",null);this.$element.data("active",null);this.$element.off("focus").off("blur").off("keypress").off("input").off("keyup");if(this.eventSupported("keydown")){this.$element.off("keydown")}this.$menu.remove();this.destroyed=true},eventSupported:function(eventName){var isSupported=eventName in this.$element;if(!isSupported){this.$element.setAttribute(eventName,"return;");isSupported=typeof this.$element[eventName]==="function"}return isSupported},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:if(e.shiftKey)return;e.preventDefault();this.prev();break;case 40:if(e.shiftKey)return;e.preventDefault();this.next();break}},keydown:function(e){this.suppressKeyPressRepeat=~$.inArray(e.keyCode,[40,38,9,13,27]);if(!this.shown&&e.keyCode==40){this.lookup()}else{this.move(e)}},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},input:function(e){var currentValue=this.$element.val()||this.$element.text();if(this.value!==currentValue){this.value=currentValue;this.lookup()}},keyup:function(e){if(this.destroyed){return}switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break}},focus:function(e){if(!this.focused){this.focused=true;if(this.options.showHintOnFocus&&this.skipShowHintOnFocus!==true){if(this.options.showHintOnFocus==="all"){this.lookup("")}else{this.lookup()}}}if(this.skipShowHintOnFocus){this.skipShowHintOnFocus=false}},blur:function(e){if(!this.mousedover&&!this.mouseddown&&this.shown){this.hide();this.focused=false}else if(this.mouseddown){this.skipShowHintOnFocus=true;this.$element.focus();this.mouseddown=false}},click:function(e){e.preventDefault();this.skipShowHintOnFocus=true;this.select();this.$element.focus();this.hide()},mouseenter:function(e){this.mousedover=true;this.$menu.find(".active").removeClass("active");$(e.currentTarget).addClass("active")},mouseleave:function(e){this.mousedover=false;if(!this.focused&&this.shown)this.hide()},mousedown:function(e){this.mouseddown=true;this.$menu.one("mouseup",function(e){this.mouseddown=false}.bind(this))}};var old=$.fn.typeahead;$.fn.typeahead=function(option){var arg=arguments;if(typeof option=="string"&&option=="getActive"){return this.data("active")}return this.each(function(){var $this=$(this);var data=$this.data("typeahead");var options=typeof option=="object"&&option;if(!data)$this.data("typeahead",data=new Typeahead(this,options));if(typeof option=="string"&&data[option]){if(arg.length>1){data[option].apply(data,Array.prototype.slice.call(arg,1))}else{data[option]()}}})};Typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu" role="listbox"></ul>',item:'<li><a class="dropdown-item" href="#" role="option"></a></li>',minLength:1,scrollHeight:0,autoSelect:true,afterSelect:$.noop,addItem:false,delay:0,separator:"category",headerHtml:'<li class="dropdown-header"></li>',headerDivider:'<li class="divider" role="separator"></li>'};$.fn.typeahead.Constructor=Typeahead;$.fn.typeahead.noConflict=function(){$.fn.typeahead=old;return this};$(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(e){var $this=$(this);if($this.data("typeahead"))return;$this.typeahead($this.data())})});!function(){var d3={version:"3.5.17"};var d3_arraySlice=[].slice,d3_array=function(list){return d3_arraySlice.call(list)};var d3_document=this.document;function d3_documentElement(node){return node&&(node.ownerDocument||node.document||node).documentElement}function d3_window(node){return node&&(node.ownerDocument&&node.ownerDocument.defaultView||node.document&&node||node.defaultView)}if(d3_document){try{d3_array(d3_document.documentElement.childNodes)[0].nodeType}catch(e){d3_array=function(list){var i=list.length,array=new Array(i);while(i--)array[i]=list[i];return array}}}if(!Date.now)Date.now=function(){return+new Date};if(d3_document){try{d3_document.createElement("DIV").style.setProperty("opacity",0,"")}catch(error){var d3_element_prototype=this.Element.prototype,d3_element_setAttribute=d3_element_prototype.setAttribute,d3_element_setAttributeNS=d3_element_prototype.setAttributeNS,d3_style_prototype=this.CSSStyleDeclaration.prototype,d3_style_setProperty=d3_style_prototype.setProperty;d3_element_prototype.setAttribute=function(name,value){d3_element_setAttribute.call(this,name,value+"")};d3_element_prototype.setAttributeNS=function(space,local,value){d3_element_setAttributeNS.call(this,space,local,value+"")};d3_style_prototype.setProperty=function(name,value,priority){d3_style_setProperty.call(this,name,value+"",priority)}}}d3.ascending=d3_ascending;function d3_ascending(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN};d3.min=function(array,f){var i=-1,n=array.length,a,b;if(arguments.length===1){while(++i<n)if((b=array[i])!=null&&b>=b){a=b;break}while(++i<n)if((b=array[i])!=null&&a>b)a=b}else{while(++i<n)if((b=f.call(array,array[i],i))!=null&&b>=b){a=b;break}while(++i<n)if((b=f.call(array,array[i],i))!=null&&a>b)a=b}return a};d3.max=function(array,f){var i=-1,n=array.length,a,b;if(arguments.length===1){while(++i<n)if((b=array[i])!=null&&b>=b){a=b;break}while(++i<n)if((b=array[i])!=null&&b>a)a=b}else{while(++i<n)if((b=f.call(array,array[i],i))!=null&&b>=b){a=b;break}while(++i<n)if((b=f.call(array,array[i],i))!=null&&b>a)a=b}return a};d3.extent=function(array,f){var i=-1,n=array.length,a,b,c;if(arguments.length===1){while(++i<n)if((b=array[i])!=null&&b>=b){a=c=b;break}while(++i<n)if((b=array[i])!=null){if(a>b)a=b;if(c<b)c=b}}else{while(++i<n)if((b=f.call(array,array[i],i))!=null&&b>=b){a=c=b;break}while(++i<n)if((b=f.call(array,array[i],i))!=null){if(a>b)a=b;if(c<b)c=b}}return[a,c]};function d3_number(x){return x===null?NaN:+x}function d3_numeric(x){return!isNaN(x)}d3.sum=function(array,f){var s=0,n=array.length,a,i=-1;if(arguments.length===1){while(++i<n)if(d3_numeric(a=+array[i]))s+=a}else{while(++i<n)if(d3_numeric(a=+f.call(array,array[i],i)))s+=a}return s};d3.mean=function(array,f){var s=0,n=array.length,a,i=-1,j=n;if(arguments.length===1){while(++i<n)if(d3_numeric(a=d3_number(array[i])))s+=a;else--j}else{while(++i<n)if(d3_numeric(a=d3_number(f.call(array,array[i],i))))s+=a;else--j}if(j)return s/j};d3.quantile=function(values,p){var H=(values.length-1)*p+1,h=Math.floor(H),v=+values[h-1],e=H-h;return e?v+e*(values[h]-v):v};d3.median=function(array,f){var numbers=[],n=array.length,a,i=-1;if(arguments.length===1){while(++i<n)if(d3_numeric(a=d3_number(array[i])))numbers.push(a)}else{while(++i<n)if(d3_numeric(a=d3_number(f.call(array,array[i],i))))numbers.push(a)}if(numbers.length)return d3.quantile(numbers.sort(d3_ascending),.5)};d3.variance=function(array,f){var n=array.length,m=0,a,d,s=0,i=-1,j=0;if(arguments.length===1){while(++i<n){if(d3_numeric(a=d3_number(array[i]))){d=a-m;m+=d/++j;s+=d*(a-m)}}}else{while(++i<n){if(d3_numeric(a=d3_number(f.call(array,array[i],i)))){d=a-m;m+=d/++j;s+=d*(a-m)}}}if(j>1)return s/(j-1)};d3.deviation=function(){var v=d3.variance.apply(this,arguments);return v?Math.sqrt(v):v};function d3_bisector(compare){return{left:function(a,x,lo,hi){if(arguments.length<3)lo=0;if(arguments.length<4)hi=a.length;while(lo<hi){var mid=lo+hi>>>1;if(compare(a[mid],x)<0)lo=mid+1;else hi=mid}return lo},right:function(a,x,lo,hi){if(arguments.length<3)lo=0;if(arguments.length<4)hi=a.length;while(lo<hi){var mid=lo+hi>>>1;if(compare(a[mid],x)>0)hi=mid;else lo=mid+1}return lo}}}var d3_bisect=d3_bisector(d3_ascending);d3.bisectLeft=d3_bisect.left;d3.bisect=d3.bisectRight=d3_bisect.right;d3.bisector=function(f){return d3_bisector(f.length===1?function(d,x){return d3_ascending(f(d),x)}:f)};d3.shuffle=function(array,i0,i1){if((m=arguments.length)<3){i1=array.length;if(m<2)i0=0}var m=i1-i0,t,i;while(m){i=Math.random()*m--|0;t=array[m+i0],array[m+i0]=array[i+i0],array[i+i0]=t}return array};d3.permute=function(array,indexes){var i=indexes.length,permutes=new Array(i);while(i--)permutes[i]=array[indexes[i]];return permutes};d3.pairs=function(array){var i=0,n=array.length-1,p0,p1=array[0],pairs=new Array(n<0?0:n);while(i<n)pairs[i]=[p0=p1,p1=array[++i]];return pairs};d3.transpose=function(matrix){if(!(n=matrix.length))return[];for(var i=-1,m=d3.min(matrix,d3_transposeLength),transpose=new Array(m);++i<m;){for(var j=-1,n,row=transpose[i]=new Array(n);++j<n;){row[j]=matrix[j][i]}}return transpose};function d3_transposeLength(d){return d.length}d3.zip=function(){return d3.transpose(arguments)};d3.keys=function(map){var keys=[];for(var key in map)keys.push(key);return keys};d3.values=function(map){var values=[];for(var key in map)values.push(map[key]);return values};d3.entries=function(map){var entries=[];for(var key in map)entries.push({key:key,value:map[key]});return entries};d3.merge=function(arrays){var n=arrays.length,m,i=-1,j=0,merged,array;while(++i<n)j+=arrays[i].length;merged=new Array(j);while(--n>=0){array=arrays[n];m=array.length;while(--m>=0){merged[--j]=array[m]}}return merged};var abs=Math.abs;d3.range=function(start,stop,step){if(arguments.length<3){step=1;if(arguments.length<2){stop=start;start=0}}if((stop-start)/step===Infinity)throw new Error("infinite range");var range=[],k=d3_range_integerScale(abs(step)),i=-1,j;start*=k,stop*=k,step*=k;if(step<0)while((j=start+step*++i)>stop)range.push(j/k);else while((j=start+step*++i)<stop)range.push(j/k);return range};function d3_range_integerScale(x){var k=1;while(x*k%1)k*=10;return k}function d3_class(ctor,properties){for(var key in properties){Object.defineProperty(ctor.prototype,key,{value:properties[key],enumerable:false})}}d3.map=function(object,f){var map=new d3_Map;if(object instanceof d3_Map){object.forEach(function(key,value){map.set(key,value)})}else if(Array.isArray(object)){var i=-1,n=object.length,o;if(arguments.length===1)while(++i<n)map.set(i,object[i]);else while(++i<n)map.set(f.call(object,o=object[i],i),o)}else{for(var key in object)map.set(key,object[key])}return map};function d3_Map(){this._=Object.create(null)}var d3_map_proto="__proto__",d3_map_zero="\0";d3_class(d3_Map,{has:d3_map_has,get:function(key){return this._[d3_map_escape(key)]},set:function(key,value){return this._[d3_map_escape(key)]=value},remove:d3_map_remove,keys:d3_map_keys,values:function(){var values=[];for(var key in this._)values.push(this._[key]);return values},entries:function(){var entries=[];for(var key in this._)entries.push({key:d3_map_unescape(key),value:this._[key]});return entries},size:d3_map_size,empty:d3_map_empty,forEach:function(f){for(var key in this._)f.call(this,d3_map_unescape(key),this._[key])}});function d3_map_escape(key){return(key+="")===d3_map_proto||key[0]===d3_map_zero?d3_map_zero+key:key}function d3_map_unescape(key){return(key+="")[0]===d3_map_zero?key.slice(1):key}function d3_map_has(key){return d3_map_escape(key)in this._}function d3_map_remove(key){return(key=d3_map_escape(key))in this._&&delete this._[key]}function d3_map_keys(){var keys=[];for(var key in this._)keys.push(d3_map_unescape(key));return keys}function d3_map_size(){var size=0;for(var key in this._)++size;return size}function d3_map_empty(){for(var key in this._)return false;return true}d3.nest=function(){var nest={},keys=[],sortKeys=[],sortValues,rollup;function map(mapType,array,depth){if(depth>=keys.length)return rollup?rollup.call(nest,array):sortValues?array.sort(sortValues):array;var i=-1,n=array.length,key=keys[depth++],keyValue,object,setter,valuesByKey=new d3_Map,values;while(++i<n){if(values=valuesByKey.get(keyValue=key(object=array[i]))){values.push(object)}else{valuesByKey.set(keyValue,[object])}}if(mapType){object=mapType();setter=function(keyValue,values){object.set(keyValue,map(mapType,values,depth))}}else{object={};setter=function(keyValue,values){object[keyValue]=map(mapType,values,depth)}}valuesByKey.forEach(setter);return object}function entries(map,depth){if(depth>=keys.length)return map;var array=[],sortKey=sortKeys[depth++];map.forEach(function(key,keyMap){array.push({key:key,values:entries(keyMap,depth)})});return sortKey?array.sort(function(a,b){return sortKey(a.key,b.key)}):array}nest.map=function(array,mapType){return map(mapType,array,0)};nest.entries=function(array){return entries(map(d3.map,array,0),0)};nest.key=function(d){keys.push(d);return nest};nest.sortKeys=function(order){sortKeys[keys.length-1]=order;return nest};nest.sortValues=function(order){sortValues=order;return nest};nest.rollup=function(f){rollup=f;return nest};return nest};d3.set=function(array){var set=new d3_Set;if(array)for(var i=0,n=array.length;i<n;++i)set.add(array[i]);return set};function d3_Set(){this._=Object.create(null)}d3_class(d3_Set,{has:d3_map_has,add:function(key){this._[d3_map_escape(key+="")]=true;return key},remove:d3_map_remove,values:d3_map_keys,size:d3_map_size,empty:d3_map_empty,forEach:function(f){for(var key in this._)f.call(this,d3_map_unescape(key))}});d3.behavior={};function d3_identity(d){return d}d3.rebind=function(target,source){var i=1,n=arguments.length,method;while(++i<n)target[method=arguments[i]]=d3_rebind(target,source,source[method]);return target};function d3_rebind(target,source,method){return function(){var value=method.apply(source,arguments);return value===source?target:value}}function d3_vendorSymbol(object,name){if(name in object)return name;name=name.charAt(0).toUpperCase()+name.slice(1);for(var i=0,n=d3_vendorPrefixes.length;i<n;++i){var prefixName=d3_vendorPrefixes[i]+name;if(prefixName in object)return prefixName}}var d3_vendorPrefixes=["webkit","ms","moz","Moz","o","O"];function d3_noop(){}d3.dispatch=function(){var dispatch=new d3_dispatch,i=-1,n=arguments.length;while(++i<n)dispatch[arguments[i]]=d3_dispatch_event(dispatch);return dispatch};function d3_dispatch(){}d3_dispatch.prototype.on=function(type,listener){var i=type.indexOf("."),name="";if(i>=0){name=type.slice(i+1);type=type.slice(0,i)}if(type)return arguments.length<2?this[type].on(name):this[type].on(name,listener);if(arguments.length===2){if(listener==null)for(type in this){if(this.hasOwnProperty(type))this[type].on(name,null)}return this}};function d3_dispatch_event(dispatch){var listeners=[],listenerByName=new d3_Map;function event(){var z=listeners,i=-1,n=z.length,l;while(++i<n)if(l=z[i].on)l.apply(this,arguments);return dispatch}event.on=function(name,listener){var l=listenerByName.get(name),i;if(arguments.length<2)return l&&l.on;if(l){l.on=null;listeners=listeners.slice(0,i=listeners.indexOf(l)).concat(listeners.slice(i+1));listenerByName.remove(name)}if(listener)listeners.push(listenerByName.set(name,{on:listener}));return dispatch};return event}d3.event=null;function d3_eventPreventDefault(){d3.event.preventDefault()}function d3_eventSource(){var e=d3.event,s;while(s=e.sourceEvent)e=s;return e}function d3_eventDispatch(target){var dispatch=new d3_dispatch,i=0,n=arguments.length;while(++i<n)dispatch[arguments[i]]=d3_dispatch_event(dispatch);dispatch.of=function(thiz,argumentz){return function(e1){try{var e0=e1.sourceEvent=d3.event;e1.target=target;d3.event=e1;dispatch[e1.type].apply(thiz,argumentz)}finally{d3.event=e0}}};return dispatch}d3.requote=function(s){return s.replace(d3_requote_re,"\\$&")};var d3_requote_re=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;var d3_subclass={}.__proto__?function(object,prototype){object.__proto__=prototype}:function(object,prototype){for(var property in prototype)object[property]=prototype[property]};function d3_selection(groups){d3_subclass(groups,d3_selectionPrototype);return groups}var d3_select=function(s,n){return n.querySelector(s)},d3_selectAll=function(s,n){return n.querySelectorAll(s)},d3_selectMatches=function(n,s){var d3_selectMatcher=n.matches||n[d3_vendorSymbol(n,"matchesSelector")];d3_selectMatches=function(n,s){return d3_selectMatcher.call(n,s)};return d3_selectMatches(n,s)};if(typeof Sizzle==="function"){d3_select=function(s,n){return Sizzle(s,n)[0]||null};d3_selectAll=Sizzle;d3_selectMatches=Sizzle.matchesSelector}d3.selection=function(){return d3.select(d3_document.documentElement)};var d3_selectionPrototype=d3.selection.prototype=[];d3_selectionPrototype.select=function(selector){var subgroups=[],subgroup,subnode,group,node;selector=d3_selection_selector(selector);for(var j=-1,m=this.length;++j<m;){subgroups.push(subgroup=[]);subgroup.parentNode=(group=this[j]).parentNode;for(var i=-1,n=group.length;++i<n;){if(node=group[i]){subgroup.push(subnode=selector.call(node,node.__data__,i,j));if(subnode&&"__data__"in node)subnode.__data__=node.__data__}else{subgroup.push(null)}}}return d3_selection(subgroups)};function d3_selection_selector(selector){return typeof selector==="function"?selector:function(){return d3_select(selector,this)}}d3_selectionPrototype.selectAll=function(selector){var subgroups=[],subgroup,node;selector=d3_selection_selectorAll(selector);for(var j=-1,m=this.length;++j<m;){for(var group=this[j],i=-1,n=group.length;++i<n;){if(node=group[i]){subgroups.push(subgroup=d3_array(selector.call(node,node.__data__,i,j)));subgroup.parentNode=node}}}return d3_selection(subgroups)};function d3_selection_selectorAll(selector){return typeof selector==="function"?selector:function(){return d3_selectAll(selector,this)}}var d3_nsXhtml="http://www.w3.org/1999/xhtml";var d3_nsPrefix={svg:"http://www.w3.org/2000/svg",xhtml:d3_nsXhtml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:d3_nsPrefix,qualify:function(name){var i=name.indexOf(":"),prefix=name;if(i>=0&&(prefix=name.slice(0,i))!=="xmlns")name=name.slice(i+1);return d3_nsPrefix.hasOwnProperty(prefix)?{space:d3_nsPrefix[prefix],local:name}:name}};d3_selectionPrototype.attr=function(name,value){if(arguments.length<2){if(typeof name==="string"){var node=this.node();name=d3.ns.qualify(name);return name.local?node.getAttributeNS(name.space,name.local):node.getAttribute(name)}for(value in name)this.each(d3_selection_attr(value,name[value]));return this}return this.each(d3_selection_attr(name,value))};function d3_selection_attr(name,value){name=d3.ns.qualify(name);function attrNull(){this.removeAttribute(name)}function attrNullNS(){this.removeAttributeNS(name.space,name.local)}function attrConstant(){this.setAttribute(name,value)}function attrConstantNS(){this.setAttributeNS(name.space,name.local,value)}function attrFunction(){var x=value.apply(this,arguments);if(x==null)this.removeAttribute(name);else this.setAttribute(name,x)}function attrFunctionNS(){var x=value.apply(this,arguments);if(x==null)this.removeAttributeNS(name.space,name.local);else this.setAttributeNS(name.space,name.local,x)}return value==null?name.local?attrNullNS:attrNull:typeof value==="function"?name.local?attrFunctionNS:attrFunction:name.local?attrConstantNS:attrConstant}function d3_collapse(s){return s.trim().replace(/\s+/g," ")}d3_selectionPrototype.classed=function(name,value){if(arguments.length<2){if(typeof name==="string"){var node=this.node(),n=(name=d3_selection_classes(name)).length,i=-1;if(value=node.classList){while(++i<n)if(!value.contains(name[i]))return false}else{value=node.getAttribute("class");while(++i<n)if(!d3_selection_classedRe(name[i]).test(value))return false}return true}for(value in name)this.each(d3_selection_classed(value,name[value]));return this}return this.each(d3_selection_classed(name,value))};function d3_selection_classedRe(name){return new RegExp("(?:^|\\s+)"+d3.requote(name)+"(?:\\s+|$)","g")}function d3_selection_classes(name){return(name+"").trim().split(/^|\s+/)}function d3_selection_classed(name,value){name=d3_selection_classes(name).map(d3_selection_classedName);var n=name.length;function classedConstant(){var i=-1;while(++i<n)name[i](this,value)}function classedFunction(){var i=-1,x=value.apply(this,arguments);while(++i<n)name[i](this,x)}return typeof value==="function"?classedFunction:classedConstant}function d3_selection_classedName(name){var re=d3_selection_classedRe(name);return function(node,value){if(c=node.classList)return value?c.add(name):c.remove(name);var c=node.getAttribute("class")||"";if(value){re.lastIndex=0;if(!re.test(c))node.setAttribute("class",d3_collapse(c+" "+name))}else{node.setAttribute("class",d3_collapse(c.replace(re," ")))}}}d3_selectionPrototype.style=function(name,value,priority){var n=arguments.length;if(n<3){if(typeof name!=="string"){if(n<2)value="";for(priority in name)this.each(d3_selection_style(priority,name[priority],value));return this}if(n<2){var node=this.node();return d3_window(node).getComputedStyle(node,null).getPropertyValue(name)}priority=""}return this.each(d3_selection_style(name,value,priority))};function d3_selection_style(name,value,priority){function styleNull(){this.style.removeProperty(name)}function styleConstant(){this.style.setProperty(name,value,priority)}function styleFunction(){var x=value.apply(this,arguments);if(x==null)this.style.removeProperty(name);else this.style.setProperty(name,x,priority)}return value==null?styleNull:typeof value==="function"?styleFunction:styleConstant}d3_selectionPrototype.property=function(name,value){if(arguments.length<2){if(typeof name==="string")return this.node()[name];for(value in name)this.each(d3_selection_property(value,name[value]));return this}return this.each(d3_selection_property(name,value))};function d3_selection_property(name,value){function propertyNull(){delete this[name]}function propertyConstant(){this[name]=value}function propertyFunction(){var x=value.apply(this,arguments);if(x==null)delete this[name];else this[name]=x}return value==null?propertyNull:typeof value==="function"?propertyFunction:propertyConstant}d3_selectionPrototype.text=function(value){return arguments.length?this.each(typeof value==="function"?function(){var v=value.apply(this,arguments);this.textContent=v==null?"":v}:value==null?function(){this.textContent=""}:function(){this.textContent=value}):this.node().textContent};d3_selectionPrototype.html=function(value){return arguments.length?this.each(typeof value==="function"?function(){var v=value.apply(this,arguments);this.innerHTML=v==null?"":v}:value==null?function(){this.innerHTML=""}:function(){this.innerHTML=value}):this.node().innerHTML};d3_selectionPrototype.append=function(name){name=d3_selection_creator(name);return this.select(function(){return this.appendChild(name.apply(this,arguments))})};function d3_selection_creator(name){function create(){var document=this.ownerDocument,namespace=this.namespaceURI;return namespace===d3_nsXhtml&&document.documentElement.namespaceURI===d3_nsXhtml?document.createElement(name):document.createElementNS(namespace,name)}function createNS(){return this.ownerDocument.createElementNS(name.space,name.local)}return typeof name==="function"?name:(name=d3.ns.qualify(name)).local?createNS:create}d3_selectionPrototype.insert=function(name,before){name=d3_selection_creator(name);before=d3_selection_selector(before);return this.select(function(){return this.insertBefore(name.apply(this,arguments),before.apply(this,arguments)||null)})};d3_selectionPrototype.remove=function(){return this.each(d3_selectionRemove)};function d3_selectionRemove(){var parent=this.parentNode;if(parent)parent.removeChild(this)}d3_selectionPrototype.data=function(value,key){var i=-1,n=this.length,group,node;if(!arguments.length){value=new Array(n=(group=this[0]).length);while(++i<n){if(node=group[i]){value[i]=node.__data__}}return value}function bind(group,groupData){var i,n=group.length,m=groupData.length,n0=Math.min(n,m),updateNodes=new Array(m),enterNodes=new Array(m),exitNodes=new Array(n),node,nodeData;if(key){var nodeByKeyValue=new d3_Map,keyValues=new Array(n),keyValue;for(i=-1;++i<n;){if(node=group[i]){if(nodeByKeyValue.has(keyValue=key.call(node,node.__data__,i))){exitNodes[i]=node}else{nodeByKeyValue.set(keyValue,node)}keyValues[i]=keyValue}}for(i=-1;++i<m;){if(!(node=nodeByKeyValue.get(keyValue=key.call(groupData,nodeData=groupData[i],i)))){enterNodes[i]=d3_selection_dataNode(nodeData)}else if(node!==true){updateNodes[i]=node;node.__data__=nodeData}nodeByKeyValue.set(keyValue,true)}for(i=-1;++i<n;){if(i in keyValues&&nodeByKeyValue.get(keyValues[i])!==true){exitNodes[i]=group[i]}}}else{for(i=-1;++i<n0;){node=group[i];nodeData=groupData[i];if(node){node.__data__=nodeData;updateNodes[i]=node}else{enterNodes[i]=d3_selection_dataNode(nodeData)}}for(;i<m;++i){enterNodes[i]=d3_selection_dataNode(groupData[i])}for(;i<n;++i){exitNodes[i]=group[i]}}enterNodes.update=updateNodes;enterNodes.parentNode=updateNodes.parentNode=exitNodes.parentNode=group.parentNode;enter.push(enterNodes);update.push(updateNodes);exit.push(exitNodes)}var enter=d3_selection_enter([]),update=d3_selection([]),exit=d3_selection([]);if(typeof value==="function"){while(++i<n){bind(group=this[i],value.call(group,group.parentNode.__data__,i))}}else{while(++i<n){bind(group=this[i],value)}}update.enter=function(){return enter};update.exit=function(){return exit};return update};function d3_selection_dataNode(data){return{__data__:data}}d3_selectionPrototype.datum=function(value){return arguments.length?this.property("__data__",value):this.property("__data__")};d3_selectionPrototype.filter=function(filter){var subgroups=[],subgroup,group,node;if(typeof filter!=="function")filter=d3_selection_filter(filter);for(var j=0,m=this.length;j<m;j++){subgroups.push(subgroup=[]);subgroup.parentNode=(group=this[j]).parentNode;for(var i=0,n=group.length;i<n;i++){if((node=group[i])&&filter.call(node,node.__data__,i,j)){subgroup.push(node)}}}return d3_selection(subgroups)};function d3_selection_filter(selector){return function(){return d3_selectMatches(this,selector)}}d3_selectionPrototype.order=function(){for(var j=-1,m=this.length;++j<m;){for(var group=this[j],i=group.length-1,next=group[i],node;--i>=0;){if(node=group[i]){if(next&&next!==node.nextSibling)next.parentNode.insertBefore(node,next);next=node}}}return this};d3_selectionPrototype.sort=function(comparator){comparator=d3_selection_sortComparator.apply(this,arguments);for(var j=-1,m=this.length;++j<m;)this[j].sort(comparator);return this.order()};function d3_selection_sortComparator(comparator){if(!arguments.length)comparator=d3_ascending;return function(a,b){return a&&b?comparator(a.__data__,b.__data__):!a-!b}}d3_selectionPrototype.each=function(callback){return d3_selection_each(this,function(node,i,j){callback.call(node,node.__data__,i,j)})};function d3_selection_each(groups,callback){for(var j=0,m=groups.length;j<m;j++){for(var group=groups[j],i=0,n=group.length,node;i<n;i++){if(node=group[i])callback(node,i,j)}}return groups}d3_selectionPrototype.call=function(callback){var args=d3_array(arguments);callback.apply(args[0]=this,args);return this};d3_selectionPrototype.empty=function(){return!this.node()};d3_selectionPrototype.node=function(){for(var j=0,m=this.length;j<m;j++){for(var group=this[j],i=0,n=group.length;i<n;i++){var node=group[i];if(node)return node}}return null};d3_selectionPrototype.size=function(){var n=0;d3_selection_each(this,function(){++n});return n};function d3_selection_enter(selection){d3_subclass(selection,d3_selection_enterPrototype);return selection}var d3_selection_enterPrototype=[];d3.selection.enter=d3_selection_enter;d3.selection.enter.prototype=d3_selection_enterPrototype;d3_selection_enterPrototype.append=d3_selectionPrototype.append;d3_selection_enterPrototype.empty=d3_selectionPrototype.empty;d3_selection_enterPrototype.node=d3_selectionPrototype.node;d3_selection_enterPrototype.call=d3_selectionPrototype.call;d3_selection_enterPrototype.size=d3_selectionPrototype.size;d3_selection_enterPrototype.select=function(selector){var subgroups=[],subgroup,subnode,upgroup,group,node;for(var j=-1,m=this.length;++j<m;){upgroup=(group=this[j]).update;subgroups.push(subgroup=[]);subgroup.parentNode=group.parentNode;for(var i=-1,n=group.length;++i<n;){if(node=group[i]){subgroup.push(upgroup[i]=subnode=selector.call(group.parentNode,node.__data__,i,j));subnode.__data__=node.__data__}else{subgroup.push(null)}}}return d3_selection(subgroups)};d3_selection_enterPrototype.insert=function(name,before){if(arguments.length<2)before=d3_selection_enterInsertBefore(this);return d3_selectionPrototype.insert.call(this,name,before)};function d3_selection_enterInsertBefore(enter){var i0,j0;return function(d,i,j){var group=enter[j].update,n=group.length,node;if(j!=j0)j0=j,i0=0;if(i>=i0)i0=i+1;while(!(node=group[i0])&&++i0<n);return node}}d3.select=function(node){var group;if(typeof node==="string"){group=[d3_select(node,d3_document)];group.parentNode=d3_document.documentElement}else{group=[node];group.parentNode=d3_documentElement(node)}return d3_selection([group])};d3.selectAll=function(nodes){var group;if(typeof nodes==="string"){group=d3_array(d3_selectAll(nodes,d3_document));group.parentNode=d3_document.documentElement}else{group=d3_array(nodes);group.parentNode=null}return d3_selection([group])};d3_selectionPrototype.on=function(type,listener,capture){var n=arguments.length;if(n<3){if(typeof type!=="string"){if(n<2)listener=false;for(capture in type)this.each(d3_selection_on(capture,type[capture],listener));return this}if(n<2)return(n=this.node()["__on"+type])&&n._;capture=false}return this.each(d3_selection_on(type,listener,capture))};function d3_selection_on(type,listener,capture){var name="__on"+type,i=type.indexOf("."),wrap=d3_selection_onListener;if(i>0)type=type.slice(0,i);var filter=d3_selection_onFilters.get(type);if(filter)type=filter,wrap=d3_selection_onFilter;function onRemove(){var l=this[name];if(l){this.removeEventListener(type,l,l.$);delete this[name]}}function onAdd(){var l=wrap(listener,d3_array(arguments));onRemove.call(this);this.addEventListener(type,this[name]=l,l.$=capture);l._=listener}function removeAll(){var re=new RegExp("^__on([^.]+)"+d3.requote(type)+"$"),match;for(var name in this){if(match=name.match(re)){var l=this[name];this.removeEventListener(match[1],l,l.$);delete this[name]}}}return i?listener?onAdd:onRemove:listener?d3_noop:removeAll}var d3_selection_onFilters=d3.map({mouseenter:"mouseover",mouseleave:"mouseout"});if(d3_document){d3_selection_onFilters.forEach(function(k){if("on"+k in d3_document)d3_selection_onFilters.remove(k)})}function d3_selection_onListener(listener,argumentz){return function(e){var o=d3.event;d3.event=e;argumentz[0]=this.__data__;try{listener.apply(this,argumentz)}finally{d3.event=o}}}function d3_selection_onFilter(listener,argumentz){var l=d3_selection_onListener(listener,argumentz);return function(e){var target=this,related=e.relatedTarget;if(!related||related!==target&&!(related.compareDocumentPosition(target)&8)){l.call(target,e)}}}var d3_event_dragSelect,d3_event_dragId=0;function d3_event_dragSuppress(node){var name=".dragsuppress-"+ ++d3_event_dragId,click="click"+name,w=d3.select(d3_window(node)).on("touchmove"+name,d3_eventPreventDefault).on("dragstart"+name,d3_eventPreventDefault).on("selectstart"+name,d3_eventPreventDefault);if(d3_event_dragSelect==null){d3_event_dragSelect="onselectstart"in node?false:d3_vendorSymbol(node.style,"userSelect")}if(d3_event_dragSelect){var style=d3_documentElement(node).style,select=style[d3_event_dragSelect];style[d3_event_dragSelect]="none"}return function(suppressClick){w.on(name,null);if(d3_event_dragSelect)style[d3_event_dragSelect]=select;if(suppressClick){var off=function(){w.on(click,null)};w.on(click,function(){d3_eventPreventDefault();off()},true);setTimeout(off,0)}}}d3.mouse=function(container){return d3_mousePoint(container,d3_eventSource())};var d3_mouse_bug44083=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function d3_mousePoint(container,e){if(e.changedTouches)e=e.changedTouches[0];var svg=container.ownerSVGElement||container;if(svg.createSVGPoint){var point=svg.createSVGPoint();if(d3_mouse_bug44083<0){var window=d3_window(container);if(window.scrollX||window.scrollY){svg=d3.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var ctm=svg[0][0].getScreenCTM();d3_mouse_bug44083=!(ctm.f||ctm.e);svg.remove()}}if(d3_mouse_bug44083)point.x=e.pageX,point.y=e.pageY;else point.x=e.clientX,point.y=e.clientY;point=point.matrixTransform(container.getScreenCTM().inverse());return[point.x,point.y]}var rect=container.getBoundingClientRect();return[e.clientX-rect.left-container.clientLeft,e.clientY-rect.top-container.clientTop]}d3.touch=function(container,touches,identifier){if(arguments.length<3)identifier=touches,touches=d3_eventSource().changedTouches;if(touches)for(var i=0,n=touches.length,touch;i<n;++i){if((touch=touches[i]).identifier===identifier){return d3_mousePoint(container,touch)}}};d3.behavior.drag=function(){var event=d3_eventDispatch(drag,"drag","dragstart","dragend"),origin=null,mousedown=dragstart(d3_noop,d3.mouse,d3_window,"mousemove","mouseup"),touchstart=dragstart(d3_behavior_dragTouchId,d3.touch,d3_identity,"touchmove","touchend");function drag(){this.on("mousedown.drag",mousedown).on("touchstart.drag",touchstart)}function dragstart(id,position,subject,move,end){return function(){var that=this,target=d3.event.target.correspondingElement||d3.event.target,parent=that.parentNode,dispatch=event.of(that,arguments),dragged=0,dragId=id(),dragName=".drag"+(dragId==null?"":"-"+dragId),dragOffset,dragSubject=d3.select(subject(target)).on(move+dragName,moved).on(end+dragName,ended),dragRestore=d3_event_dragSuppress(target),position0=position(parent,dragId);if(origin){dragOffset=origin.apply(that,arguments);dragOffset=[dragOffset.x-position0[0],dragOffset.y-position0[1]]}else{dragOffset=[0,0]}dispatch({type:"dragstart"});function moved(){var position1=position(parent,dragId),dx,dy;if(!position1)return;dx=position1[0]-position0[0];dy=position1[1]-position0[1];dragged|=dx|dy;position0=position1;dispatch({type:"drag",x:position1[0]+dragOffset[0],y:position1[1]+dragOffset[1],dx:dx,dy:dy})}function ended(){if(!position(parent,dragId))return;dragSubject.on(move+dragName,null).on(end+dragName,null);dragRestore(dragged);dispatch({type:"dragend"})}}}drag.origin=function(x){if(!arguments.length)return origin;origin=x;return drag};return d3.rebind(drag,event,"on")};function d3_behavior_dragTouchId(){return d3.event.changedTouches[0].identifier}d3.touches=function(container,touches){if(arguments.length<2)touches=d3_eventSource().touches;return touches?d3_array(touches).map(function(touch){var point=d3_mousePoint(container,touch);point.identifier=touch.identifier;return point}):[]};var ε=1e-6,ε2=ε*ε,π=Math.PI,τ=2*π,τε=τ-ε,halfπ=π/2,d3_radians=π/180,d3_degrees=180/π;function d3_sgn(x){return x>0?1:x<0?-1:0}function d3_cross2d(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(b[1]-a[1])*(c[0]-a[0])}function d3_acos(x){return x>1?0:x<-1?π:Math.acos(x)}function d3_asin(x){return x>1?halfπ:x<-1?-halfπ:Math.asin(x)}function d3_sinh(x){return((x=Math.exp(x))-1/x)/2}function d3_cosh(x){return((x=Math.exp(x))+1/x)/2}function d3_tanh(x){return((x=Math.exp(2*x))-1)/(x+1)}function d3_haversin(x){return(x=Math.sin(x/2))*x}var ρ=Math.SQRT2,ρ2=2,ρ4=4;d3.interpolateZoom=function(p0,p1){var ux0=p0[0],uy0=p0[1],w0=p0[2],ux1=p1[0],uy1=p1[1],w1=p1[2],dx=ux1-ux0,dy=uy1-uy0,d2=dx*dx+dy*dy,i,S;if(d2<ε2){S=Math.log(w1/w0)/ρ;i=function(t){return[ux0+t*dx,uy0+t*dy,w0*Math.exp(ρ*t*S)]}}else{var d1=Math.sqrt(d2),b0=(w1*w1-w0*w0+ρ4*d2)/(2*w0*ρ2*d1),b1=(w1*w1-w0*w0-ρ4*d2)/(2*w1*ρ2*d1),r0=Math.log(Math.sqrt(b0*b0+1)-b0),r1=Math.log(Math.sqrt(b1*b1+1)-b1);S=(r1-r0)/ρ;i=function(t){var s=t*S,coshr0=d3_cosh(r0),u=w0/(ρ2*d1)*(coshr0*d3_tanh(ρ*s+r0)-d3_sinh(r0));return[ux0+u*dx,uy0+u*dy,w0*coshr0/d3_cosh(ρ*s+r0)]}}i.duration=S*1e3;return i};d3.behavior.zoom=function(){var view={x:0,y:0,k:1},translate0,center0,center,size=[960,500],scaleExtent=d3_behavior_zoomInfinity,duration=250,zooming=0,mousedown="mousedown.zoom",mousemove="mousemove.zoom",mouseup="mouseup.zoom",mousewheelTimer,touchstart="touchstart.zoom",touchtime,event=d3_eventDispatch(zoom,"zoomstart","zoom","zoomend"),x0,x1,y0,y1;if(!d3_behavior_zoomWheel){d3_behavior_zoomWheel="onwheel"in d3_document?(d3_behavior_zoomDelta=function(){return-d3.event.deltaY*(d3.event.deltaMode?120:1)},"wheel"):"onmousewheel"in d3_document?(d3_behavior_zoomDelta=function(){return d3.event.wheelDelta},"mousewheel"):(d3_behavior_zoomDelta=function(){return-d3.event.detail},"MozMousePixelScroll")}function zoom(g){g.on(mousedown,mousedowned).on(d3_behavior_zoomWheel+".zoom",mousewheeled).on("dblclick.zoom",dblclicked).on(touchstart,touchstarted)}zoom.event=function(g){g.each(function(){var dispatch=event.of(this,arguments),view1=view;if(d3_transitionInheritId){d3.select(this).transition().each("start.zoom",function(){view=this.__chart__||{x:0,y:0,k:1};zoomstarted(dispatch)}).tween("zoom:zoom",function(){var dx=size[0],dy=size[1],cx=center0?center0[0]:dx/2,cy=center0?center0[1]:dy/2,i=d3.interpolateZoom([(cx-view.x)/view.k,(cy-view.y)/view.k,dx/view.k],[(cx-view1.x)/view1.k,(cy-view1.y)/view1.k,dx/view1.k]);return function(t){var l=i(t),k=dx/l[2];this.__chart__=view={x:cx-l[0]*k,y:cy-l[1]*k,k:k};zoomed(dispatch)}}).each("interrupt.zoom",function(){zoomended(dispatch)}).each("end.zoom",function(){zoomended(dispatch)})}else{this.__chart__=view;zoomstarted(dispatch);zoomed(dispatch);zoomended(dispatch)}})};zoom.translate=function(_){if(!arguments.length)return[view.x,view.y];view={x:+_[0],y:+_[1],k:view.k};rescale();return zoom};zoom.scale=function(_){if(!arguments.length)return view.k;view={x:view.x,y:view.y,k:null};scaleTo(+_);rescale();return zoom};zoom.scaleExtent=function(_){if(!arguments.length)return scaleExtent;scaleExtent=_==null?d3_behavior_zoomInfinity:[+_[0],+_[1]];return zoom};zoom.center=function(_){if(!arguments.length)return center;center=_&&[+_[0],+_[1]];return zoom};zoom.size=function(_){if(!arguments.length)return size;size=_&&[+_[0],+_[1]];return zoom};zoom.duration=function(_){if(!arguments.length)return duration;duration=+_;return zoom};zoom.x=function(z){if(!arguments.length)return x1;x1=z;x0=z.copy();view={x:0,y:0,k:1};return zoom};zoom.y=function(z){if(!arguments.length)return y1;y1=z;y0=z.copy();view={x:0,y:0,k:1};return zoom};function location(p){return[(p[0]-view.x)/view.k,(p[1]-view.y)/view.k]}function point(l){return[l[0]*view.k+view.x,l[1]*view.k+view.y]}function scaleTo(s){view.k=Math.max(scaleExtent[0],Math.min(scaleExtent[1],s))}function translateTo(p,l){l=point(l);view.x+=p[0]-l[0];view.y+=p[1]-l[1]}function zoomTo(that,p,l,k){that.__chart__={x:view.x,y:view.y,k:view.k};scaleTo(Math.pow(2,k));translateTo(center0=p,l);that=d3.select(that);if(duration>0)that=that.transition().duration(duration);that.call(zoom.event)}function rescale(){if(x1)x1.domain(x0.range().map(function(x){return(x-view.x)/view.k}).map(x0.invert));if(y1)y1.domain(y0.range().map(function(y){return(y-view.y)/view.k}).map(y0.invert))}function zoomstarted(dispatch){if(!zooming++)dispatch({type:"zoomstart"})}function zoomed(dispatch){rescale();dispatch({type:"zoom",scale:view.k,translate:[view.x,view.y]})}function zoomended(dispatch){if(!--zooming)dispatch({type:"zoomend"}),center0=null}function mousedowned(){var that=this,dispatch=event.of(that,arguments),dragged=0,subject=d3.select(d3_window(that)).on(mousemove,moved).on(mouseup,ended),location0=location(d3.mouse(that)),dragRestore=d3_event_dragSuppress(that);d3_selection_interrupt.call(that);zoomstarted(dispatch);function moved(){dragged=1;translateTo(d3.mouse(that),location0);zoomed(dispatch)}function ended(){subject.on(mousemove,null).on(mouseup,null);dragRestore(dragged);zoomended(dispatch)}}function touchstarted(){var that=this,dispatch=event.of(that,arguments),locations0={},distance0=0,scale0,zoomName=".zoom-"+d3.event.changedTouches[0].identifier,touchmove="touchmove"+zoomName,touchend="touchend"+zoomName,targets=[],subject=d3.select(that),dragRestore=d3_event_dragSuppress(that);started();zoomstarted(dispatch);subject.on(mousedown,null).on(touchstart,started);function relocate(){var touches=d3.touches(that);scale0=view.k;touches.forEach(function(t){if(t.identifier in locations0)locations0[t.identifier]=location(t)});return touches}function started(){var target=d3.event.target;d3.select(target).on(touchmove,moved).on(touchend,ended);targets.push(target);var changed=d3.event.changedTouches;for(var i=0,n=changed.length;i<n;++i){locations0[changed[i].identifier]=null}var touches=relocate(),now=Date.now();if(touches.length===1){if(now-touchtime<500){var p=touches[0];zoomTo(that,p,locations0[p.identifier],Math.floor(Math.log(view.k)/Math.LN2)+1);d3_eventPreventDefault()}touchtime=now}else if(touches.length>1){var p=touches[0],q=touches[1],dx=p[0]-q[0],dy=p[1]-q[1];distance0=dx*dx+dy*dy}}function moved(){var touches=d3.touches(that),p0,l0,p1,l1;d3_selection_interrupt.call(that);for(var i=0,n=touches.length;i<n;++i,l1=null){p1=touches[i];if(l1=locations0[p1.identifier]){if(l0)break;p0=p1,l0=l1}}if(l1){var distance1=(distance1=p1[0]-p0[0])*distance1+(distance1=p1[1]-p0[1])*distance1,scale1=distance0&&Math.sqrt(distance1/distance0);p0=[(p0[0]+p1[0])/2,(p0[1]+p1[1])/2];l0=[(l0[0]+l1[0])/2,(l0[1]+l1[1])/2];scaleTo(scale1*scale0)}touchtime=null;translateTo(p0,l0);zoomed(dispatch)}function ended(){if(d3.event.touches.length){var changed=d3.event.changedTouches;for(var i=0,n=changed.length;i<n;++i){delete locations0[changed[i].identifier]}for(var identifier in locations0){return void relocate()}}d3.selectAll(targets).on(zoomName,null);subject.on(mousedown,mousedowned).on(touchstart,touchstarted);dragRestore();zoomended(dispatch)}}function mousewheeled(){var dispatch=event.of(this,arguments);if(mousewheelTimer)clearTimeout(mousewheelTimer);else d3_selection_interrupt.call(this),translate0=location(center0=center||d3.mouse(this)),zoomstarted(dispatch);mousewheelTimer=setTimeout(function(){mousewheelTimer=null;zoomended(dispatch)},50);d3_eventPreventDefault();scaleTo(Math.pow(2,d3_behavior_zoomDelta()*.002)*view.k);translateTo(center0,translate0);zoomed(dispatch)}function dblclicked(){var p=d3.mouse(this),k=Math.log(view.k)/Math.LN2;zoomTo(this,p,location(p),d3.event.shiftKey?Math.ceil(k)-1:Math.floor(k)+1)}return d3.rebind(zoom,event,"on")};var d3_behavior_zoomInfinity=[0,Infinity],d3_behavior_zoomDelta,d3_behavior_zoomWheel;d3.color=d3_color;function d3_color(){}d3_color.prototype.toString=function(){return this.rgb()+""};d3.hsl=d3_hsl;function d3_hsl(h,s,l){return this instanceof d3_hsl?void(this.h=+h,this.s=+s,this.l=+l):arguments.length<2?h instanceof d3_hsl?new d3_hsl(h.h,h.s,h.l):d3_rgb_parse(""+h,d3_rgb_hsl,d3_hsl):new d3_hsl(h,s,l)}var d3_hslPrototype=d3_hsl.prototype=new d3_color;d3_hslPrototype.brighter=function(k){k=Math.pow(.7,arguments.length?k:1);return new d3_hsl(this.h,this.s,this.l/k)};d3_hslPrototype.darker=function(k){k=Math.pow(.7,arguments.length?k:1);return new d3_hsl(this.h,this.s,k*this.l)};d3_hslPrototype.rgb=function(){return d3_hsl_rgb(this.h,this.s,this.l)};function d3_hsl_rgb(h,s,l){var m1,m2;h=isNaN(h)?0:(h%=360)<0?h+360:h;s=isNaN(s)?0:s<0?0:s>1?1:s;l=l<0?0:l>1?1:l;m2=l<=.5?l*(1+s):l+s-l*s;m1=2*l-m2;function v(h){if(h>360)h-=360;else if(h<0)h+=360;if(h<60)return m1+(m2-m1)*h/60;if(h<180)return m2;if(h<240)return m1+(m2-m1)*(240-h)/60;return m1}function vv(h){return Math.round(v(h)*255)}return new d3_rgb(vv(h+120),vv(h),vv(h-120))}d3.hcl=d3_hcl;function d3_hcl(h,c,l){return this instanceof d3_hcl?void(this.h=+h,this.c=+c,this.l=+l):arguments.length<2?h instanceof d3_hcl?new d3_hcl(h.h,h.c,h.l):h instanceof d3_lab?d3_lab_hcl(h.l,h.a,h.b):d3_lab_hcl((h=d3_rgb_lab((h=d3.rgb(h)).r,h.g,h.b)).l,h.a,h.b):new d3_hcl(h,c,l)}var d3_hclPrototype=d3_hcl.prototype=new d3_color;d3_hclPrototype.brighter=function(k){return new d3_hcl(this.h,this.c,Math.min(100,this.l+d3_lab_K*(arguments.length?k:1)))};d3_hclPrototype.darker=function(k){return new d3_hcl(this.h,this.c,Math.max(0,this.l-d3_lab_K*(arguments.length?k:1)))};d3_hclPrototype.rgb=function(){return d3_hcl_lab(this.h,this.c,this.l).rgb()};function d3_hcl_lab(h,c,l){if(isNaN(h))h=0;if(isNaN(c))c=0;return new d3_lab(l,Math.cos(h*=d3_radians)*c,Math.sin(h)*c)}d3.lab=d3_lab;function d3_lab(l,a,b){return this instanceof d3_lab?void(this.l=+l,this.a=+a,this.b=+b):arguments.length<2?l instanceof d3_lab?new d3_lab(l.l,l.a,l.b):l instanceof d3_hcl?d3_hcl_lab(l.h,l.c,l.l):d3_rgb_lab((l=d3_rgb(l)).r,l.g,l.b):new d3_lab(l,a,b)}var d3_lab_K=18;var d3_lab_X=.95047,d3_lab_Y=1,d3_lab_Z=1.08883;var d3_labPrototype=d3_lab.prototype=new d3_color;d3_labPrototype.brighter=function(k){return new d3_lab(Math.min(100,this.l+d3_lab_K*(arguments.length?k:1)),this.a,this.b)};d3_labPrototype.darker=function(k){return new d3_lab(Math.max(0,this.l-d3_lab_K*(arguments.length?k:1)),this.a,this.b)};d3_labPrototype.rgb=function(){return d3_lab_rgb(this.l,this.a,this.b)};function d3_lab_rgb(l,a,b){var y=(l+16)/116,x=y+a/500,z=y-b/200;x=d3_lab_xyz(x)*d3_lab_X;y=d3_lab_xyz(y)*d3_lab_Y;z=d3_lab_xyz(z)*d3_lab_Z;return new d3_rgb(d3_xyz_rgb(3.2404542*x-1.5371385*y-.4985314*z),d3_xyz_rgb(-.969266*x+1.8760108*y+.041556*z),d3_xyz_rgb(.0556434*x-.2040259*y+1.0572252*z))}function d3_lab_hcl(l,a,b){return l>0?new d3_hcl(Math.atan2(b,a)*d3_degrees,Math.sqrt(a*a+b*b),l):new d3_hcl(NaN,NaN,l)}function d3_lab_xyz(x){return x>.206893034?x*x*x:(x-4/29)/7.787037}function d3_xyz_lab(x){return x>.008856?Math.pow(x,1/3):7.787037*x+4/29}function d3_xyz_rgb(r){return Math.round(255*(r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055))}d3.rgb=d3_rgb;function d3_rgb(r,g,b){return this instanceof d3_rgb?void(this.r=~~r,this.g=~~g,this.b=~~b):arguments.length<2?r instanceof d3_rgb?new d3_rgb(r.r,r.g,r.b):d3_rgb_parse(""+r,d3_rgb,d3_hsl_rgb):new d3_rgb(r,g,b)}function d3_rgbNumber(value){return new d3_rgb(value>>16,value>>8&255,value&255)}function d3_rgbString(value){return d3_rgbNumber(value)+""}var d3_rgbPrototype=d3_rgb.prototype=new d3_color;d3_rgbPrototype.brighter=function(k){k=Math.pow(.7,arguments.length?k:1);var r=this.r,g=this.g,b=this.b,i=30;if(!r&&!g&&!b)return new d3_rgb(i,i,i);if(r&&r<i)r=i;if(g&&g<i)g=i;if(b&&b<i)b=i;return new d3_rgb(Math.min(255,r/k),Math.min(255,g/k),Math.min(255,b/k))};d3_rgbPrototype.darker=function(k){k=Math.pow(.7,arguments.length?k:1);return new d3_rgb(k*this.r,k*this.g,k*this.b)};d3_rgbPrototype.hsl=function(){return d3_rgb_hsl(this.r,this.g,this.b)};d3_rgbPrototype.toString=function(){return"#"+d3_rgb_hex(this.r)+d3_rgb_hex(this.g)+d3_rgb_hex(this.b)};function d3_rgb_hex(v){return v<16?"0"+Math.max(0,v).toString(16):Math.min(255,v).toString(16)}function d3_rgb_parse(format,rgb,hsl){var r=0,g=0,b=0,m1,m2,color;m1=/([a-z]+)\((.*)\)/.exec(format=format.toLowerCase());if(m1){m2=m1[2].split(",");switch(m1[1]){case"hsl":{return hsl(parseFloat(m2[0]),parseFloat(m2[1])/100,parseFloat(m2[2])/100)}case"rgb":{return rgb(d3_rgb_parseNumber(m2[0]),d3_rgb_parseNumber(m2[1]),d3_rgb_parseNumber(m2[2]))}}}if(color=d3_rgb_names.get(format)){return rgb(color.r,color.g,color.b)}if(format!=null&&format.charAt(0)==="#"&&!isNaN(color=parseInt(format.slice(1),16))){if(format.length===4){r=(color&3840)>>4;r=r>>4|r;g=color&240;g=g>>4|g;b=color&15;b=b<<4|b}else if(format.length===7){r=(color&16711680)>>16;g=(color&65280)>>8;b=color&255}}return rgb(r,g,b)}function d3_rgb_hsl(r,g,b){var min=Math.min(r/=255,g/=255,b/=255),max=Math.max(r,g,b),d=max-min,h,s,l=(max+min)/2;if(d){s=l<.5?d/(max+min):d/(2-max-min);if(r==max)h=(g-b)/d+(g<b?6:0);else if(g==max)h=(b-r)/d+2;else h=(r-g)/d+4;h*=60}else{h=NaN;s=l>0&&l<1?0:h}return new d3_hsl(h,s,l)}function d3_rgb_lab(r,g,b){r=d3_rgb_xyz(r);g=d3_rgb_xyz(g);b=d3_rgb_xyz(b);var x=d3_xyz_lab((.4124564*r+.3575761*g+.1804375*b)/d3_lab_X),y=d3_xyz_lab((.2126729*r+.7151522*g+.072175*b)/d3_lab_Y),z=d3_xyz_lab((.0193339*r+.119192*g+.9503041*b)/d3_lab_Z);return d3_lab(116*y-16,500*(x-y),200*(y-z))}function d3_rgb_xyz(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function d3_rgb_parseNumber(c){var f=parseFloat(c);return c.charAt(c.length-1)==="%"?Math.round(f*2.55):f}var d3_rgb_names=d3.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});d3_rgb_names.forEach(function(key,value){d3_rgb_names.set(key,d3_rgbNumber(value))});function d3_functor(v){return typeof v==="function"?v:function(){return v}}d3.functor=d3_functor;d3.xhr=d3_xhrType(d3_identity);function d3_xhrType(response){return function(url,mimeType,callback){if(arguments.length===2&&typeof mimeType==="function")callback=mimeType,mimeType=null;return d3_xhr(url,mimeType,response,callback)}}function d3_xhr(url,mimeType,response,callback){var xhr={},dispatch=d3.dispatch("beforesend","progress","load","error"),headers={},request=new XMLHttpRequest,responseType=null;if(this.XDomainRequest&&!("withCredentials"in request)&&/^(http(s)?:)?\/\//.test(url))request=new XDomainRequest;"onload"in request?request.onload=request.onerror=respond:request.onreadystatechange=function(){request.readyState>3&&respond()};function respond(){var status=request.status,result;if(!status&&d3_xhrHasResponse(request)||status>=200&&status<300||status===304){try{result=response.call(xhr,request)}catch(e){dispatch.error.call(xhr,e);return}dispatch.load.call(xhr,result)}else{dispatch.error.call(xhr,request)}}request.onprogress=function(event){var o=d3.event;d3.event=event;try{dispatch.progress.call(xhr,request)}finally{d3.event=o}};xhr.header=function(name,value){name=(name+"").toLowerCase();if(arguments.length<2)return headers[name];if(value==null)delete headers[name];else headers[name]=value+"";return xhr};xhr.mimeType=function(value){if(!arguments.length)return mimeType;mimeType=value==null?null:value+"";return xhr};xhr.responseType=function(value){if(!arguments.length)return responseType;responseType=value;return xhr};xhr.response=function(value){response=value;return xhr};["get","post"].forEach(function(method){xhr[method]=function(){return xhr.send.apply(xhr,[method].concat(d3_array(arguments)))}});xhr.send=function(method,data,callback){if(arguments.length===2&&typeof data==="function")callback=data,data=null;request.open(method,url,true);if(mimeType!=null&&!("accept"in headers))headers["accept"]=mimeType+",*/*";if(request.setRequestHeader)for(var name in headers)request.setRequestHeader(name,headers[name]);if(mimeType!=null&&request.overrideMimeType)request.overrideMimeType(mimeType);if(responseType!=null)request.responseType=responseType;if(callback!=null)xhr.on("error",callback).on("load",function(request){callback(null,request)});dispatch.beforesend.call(xhr,request);request.send(data==null?null:data);return xhr};xhr.abort=function(){request.abort();return xhr};d3.rebind(xhr,dispatch,"on");return callback==null?xhr:xhr.get(d3_xhr_fixCallback(callback))}function d3_xhr_fixCallback(callback){return callback.length===1?function(error,request){callback(error==null?request:null)}:callback}function d3_xhrHasResponse(request){var type=request.responseType;return type&&type!=="text"?request.response:request.responseText}d3.dsv=function(delimiter,mimeType){var reFormat=new RegExp('["'+delimiter+"\n]"),delimiterCode=delimiter.charCodeAt(0);function dsv(url,row,callback){if(arguments.length<3)callback=row,row=null;var xhr=d3_xhr(url,mimeType,row==null?response:typedResponse(row),callback);xhr.row=function(_){return arguments.length?xhr.response((row=_)==null?response:typedResponse(_)):row};return xhr}function response(request){return dsv.parse(request.responseText)}function typedResponse(f){return function(request){return dsv.parse(request.responseText,f)}}dsv.parse=function(text,f){var o;return dsv.parseRows(text,function(row,i){if(o)return o(row,i-1);var a=new Function("d","return {"+row.map(function(name,i){return JSON.stringify(name)+": d["+i+"]"}).join(",")+"}");o=f?function(row,i){return f(a(row),i)}:a})};dsv.parseRows=function(text,f){var EOL={},EOF={},rows=[],N=text.length,I=0,n=0,t,eol;function token(){if(I>=N)return EOF;if(eol)return eol=false,EOL;var j=I;if(text.charCodeAt(j)===34){var i=j;while(i++<N){if(text.charCodeAt(i)===34){if(text.charCodeAt(i+1)!==34)break;++i}}I=i+2;var c=text.charCodeAt(i+1);if(c===13){eol=true;if(text.charCodeAt(i+2)===10)++I}else if(c===10){eol=true}return text.slice(j+1,i).replace(/""/g,'"')}while(I<N){var c=text.charCodeAt(I++),k=1;if(c===10)eol=true;else if(c===13){eol=true;if(text.charCodeAt(I)===10)++I,++k}else if(c!==delimiterCode)continue;return text.slice(j,I-k)}return text.slice(j)}while((t=token())!==EOF){var a=[];while(t!==EOL&&t!==EOF){a.push(t);t=token()}if(f&&(a=f(a,n++))==null)continue;rows.push(a)}return rows};dsv.format=function(rows){if(Array.isArray(rows[0]))return dsv.formatRows(rows);var fieldSet=new d3_Set,fields=[];rows.forEach(function(row){for(var field in row){if(!fieldSet.has(field)){fields.push(fieldSet.add(field))}}});return[fields.map(formatValue).join(delimiter)].concat(rows.map(function(row){return fields.map(function(field){return formatValue(row[field])}).join(delimiter)})).join("\n")};dsv.formatRows=function(rows){return rows.map(formatRow).join("\n")};function formatRow(row){return row.map(formatValue).join(delimiter)}function formatValue(text){return reFormat.test(text)?'"'+text.replace(/\"/g,'""')+'"':text}return dsv};d3.csv=d3.dsv(",","text/csv");d3.tsv=d3.dsv("\t","text/tab-separated-values");var d3_timer_queueHead,d3_timer_queueTail,d3_timer_interval,d3_timer_timeout,d3_timer_frame=this[d3_vendorSymbol(this,"requestAnimationFrame")]||function(callback){setTimeout(callback,17)};d3.timer=function(){d3_timer.apply(this,arguments)};function d3_timer(callback,delay,then){var n=arguments.length;if(n<2)delay=0;if(n<3)then=Date.now();var time=then+delay,timer={c:callback,t:time,n:null};if(d3_timer_queueTail)d3_timer_queueTail.n=timer;else d3_timer_queueHead=timer;d3_timer_queueTail=timer;if(!d3_timer_interval){d3_timer_timeout=clearTimeout(d3_timer_timeout);d3_timer_interval=1;d3_timer_frame(d3_timer_step)}return timer}function d3_timer_step(){var now=d3_timer_mark(),delay=d3_timer_sweep()-now;if(delay>24){if(isFinite(delay)){clearTimeout(d3_timer_timeout);d3_timer_timeout=setTimeout(d3_timer_step,delay)}d3_timer_interval=0}else{d3_timer_interval=1;d3_timer_frame(d3_timer_step)}}d3.timer.flush=function(){d3_timer_mark();d3_timer_sweep()};function d3_timer_mark(){var now=Date.now(),timer=d3_timer_queueHead;while(timer){if(now>=timer.t&&timer.c(now-timer.t))timer.c=null;timer=timer.n}return now}function d3_timer_sweep(){var t0,t1=d3_timer_queueHead,time=Infinity;while(t1){if(t1.c){if(t1.t<time)time=t1.t;t1=(t0=t1).n}else{t1=t0?t0.n=t1.n:d3_timer_queueHead=t1.n}}d3_timer_queueTail=t0;return time}function d3_format_precision(x,p){return p-(x?Math.ceil(Math.log(x)/Math.LN10):1)}d3.round=function(x,n){return n?Math.round(x*(n=Math.pow(10,n)))/n:Math.round(x)};var d3_formatPrefixes=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);d3.formatPrefix=function(value,precision){var i=0;if(value=+value){if(value<0)value*=-1;if(precision)value=d3.round(value,d3_format_precision(value,precision));i=1+Math.floor(1e-12+Math.log(value)/Math.LN10);i=Math.max(-24,Math.min(24,Math.floor((i-1)/3)*3))}return d3_formatPrefixes[8+i/3]};function d3_formatPrefix(d,i){var k=Math.pow(10,abs(8-i)*3);return{scale:i>8?function(d){return d/k}:function(d){return d*k},symbol:d}}function d3_locale_numberFormat(locale){var locale_decimal=locale.decimal,locale_thousands=locale.thousands,locale_grouping=locale.grouping,locale_currency=locale.currency,formatGroup=locale_grouping&&locale_thousands?function(value,width){var i=value.length,t=[],j=0,g=locale_grouping[0],length=0;while(i>0&&g>0){if(length+g+1>width)g=Math.max(1,width-length);t.push(value.substring(i-=g,i+g));if((length+=g+1)>width)break;g=locale_grouping[j=(j+1)%locale_grouping.length]}return t.reverse().join(locale_thousands)}:d3_identity;return function(specifier){var match=d3_format_re.exec(specifier),fill=match[1]||" ",align=match[2]||">",sign=match[3]||"-",symbol=match[4]||"",zfill=match[5],width=+match[6],comma=match[7],precision=match[8],type=match[9],scale=1,prefix="",suffix="",integer=false,exponent=true;if(precision)precision=+precision.substring(1);if(zfill||fill==="0"&&align==="="){zfill=fill="0";align="="}switch(type){case"n":comma=true;type="g";break;case"%":scale=100;suffix="%";type="f";break;case"p":scale=100;suffix="%";type="r";break;case"b":case"o":case"x":case"X":if(symbol==="#")prefix="0"+type.toLowerCase();case"c":exponent=false;case"d":integer=true;precision=0;break;case"s":scale=-1;type="r";break}if(symbol==="$")prefix=locale_currency[0],suffix=locale_currency[1];if(type=="r"&&!precision)type="g";if(precision!=null){if(type=="g")precision=Math.max(1,Math.min(21,precision));else if(type=="e"||type=="f")precision=Math.max(0,Math.min(20,precision))}type=d3_format_types.get(type)||d3_format_typeDefault;var zcomma=zfill&&comma;return function(value){var fullSuffix=suffix;if(integer&&value%1)return"";var negative=value<0||value===0&&1/value<0?(value=-value,"-"):sign==="-"?"":sign;if(scale<0){var unit=d3.formatPrefix(value,precision);value=unit.scale(value);fullSuffix=unit.symbol+suffix}else{value*=scale}value=type(value,precision);var i=value.lastIndexOf("."),before,after;if(i<0){var j=exponent?value.lastIndexOf("e"):-1;if(j<0)before=value,after="";else before=value.substring(0,j),after=value.substring(j)}else{before=value.substring(0,i);after=locale_decimal+value.substring(i+1)}if(!zfill&&comma)before=formatGroup(before,Infinity);var length=prefix.length+before.length+after.length+(zcomma?0:negative.length),padding=length<width?new Array(length=width-length+1).join(fill):"";if(zcomma)before=formatGroup(padding+before,padding.length?width-after.length:Infinity);negative+=prefix;value=before+after;return(align==="<"?negative+value+padding:align===">"?padding+negative+value:align==="^"?padding.substring(0,length>>=1)+negative+value+padding.substring(length):negative+(zcomma?value:padding+value))+fullSuffix}}}var d3_format_re=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;var d3_format_types=d3.map({b:function(x){return x.toString(2)},c:function(x){return String.fromCharCode(x)},o:function(x){return x.toString(8)},x:function(x){return x.toString(16)},X:function(x){return x.toString(16).toUpperCase()},g:function(x,p){return x.toPrecision(p)},e:function(x,p){return x.toExponential(p)},f:function(x,p){return x.toFixed(p)},r:function(x,p){return(x=d3.round(x,d3_format_precision(x,p))).toFixed(Math.max(0,Math.min(20,d3_format_precision(x*(1+1e-15),p))))}});function d3_format_typeDefault(x){return x+""}var d3_time=d3.time={},d3_date=Date;function d3_date_utc(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}d3_date_utc.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){d3_time_prototype.setUTCDate.apply(this._,arguments)},setDay:function(){d3_time_prototype.setUTCDay.apply(this._,arguments)},setFullYear:function(){d3_time_prototype.setUTCFullYear.apply(this._,arguments)},setHours:function(){d3_time_prototype.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){d3_time_prototype.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){d3_time_prototype.setUTCMinutes.apply(this._,arguments)},setMonth:function(){d3_time_prototype.setUTCMonth.apply(this._,arguments)},setSeconds:function(){d3_time_prototype.setUTCSeconds.apply(this._,arguments)},setTime:function(){d3_time_prototype.setTime.apply(this._,arguments)}};var d3_time_prototype=Date.prototype;function d3_time_interval(local,step,number){function round(date){var d0=local(date),d1=offset(d0,1);return date-d0<d1-date?d0:d1}function ceil(date){step(date=local(new d3_date(date-1)),1);return date}function offset(date,k){step(date=new d3_date(+date),k);return date}function range(t0,t1,dt){var time=ceil(t0),times=[];if(dt>1){while(time<t1){if(!(number(time)%dt))times.push(new Date(+time));step(time,1)}}else{while(time<t1)times.push(new Date(+time)),step(time,1)}return times}function range_utc(t0,t1,dt){try{d3_date=d3_date_utc;var utc=new d3_date_utc;utc._=t0;return range(utc,t1,dt)}finally{d3_date=Date}}local.floor=local;local.round=round;local.ceil=ceil;local.offset=offset;local.range=range;var utc=local.utc=d3_time_interval_utc(local);utc.floor=utc;utc.round=d3_time_interval_utc(round);utc.ceil=d3_time_interval_utc(ceil);utc.offset=d3_time_interval_utc(offset);utc.range=range_utc;return local}function d3_time_interval_utc(method){return function(date,k){try{d3_date=d3_date_utc;var utc=new d3_date_utc;utc._=date;return method(utc,k)._}finally{d3_date=Date}}}d3_time.year=d3_time_interval(function(date){date=d3_time.day(date);date.setMonth(0,1);return date},function(date,offset){date.setFullYear(date.getFullYear()+offset)},function(date){return date.getFullYear()});d3_time.years=d3_time.year.range;d3_time.years.utc=d3_time.year.utc.range;d3_time.day=d3_time_interval(function(date){var day=new d3_date(2e3,0);day.setFullYear(date.getFullYear(),date.getMonth(),date.getDate());return day},function(date,offset){date.setDate(date.getDate()+offset)},function(date){return date.getDate()-1});d3_time.days=d3_time.day.range;d3_time.days.utc=d3_time.day.utc.range;d3_time.dayOfYear=function(date){var year=d3_time.year(date);return Math.floor((date-year-(date.getTimezoneOffset()-year.getTimezoneOffset())*6e4)/864e5)};["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(day,i){i=7-i;var interval=d3_time[day]=d3_time_interval(function(date){(date=d3_time.day(date)).setDate(date.getDate()-(date.getDay()+i)%7);return date},function(date,offset){date.setDate(date.getDate()+Math.floor(offset)*7)},function(date){var day=d3_time.year(date).getDay();return Math.floor((d3_time.dayOfYear(date)+(day+i)%7)/7)-(day!==i)});d3_time[day+"s"]=interval.range;d3_time[day+"s"].utc=interval.utc.range;d3_time[day+"OfYear"]=function(date){var day=d3_time.year(date).getDay();return Math.floor((d3_time.dayOfYear(date)+(day+i)%7)/7)}});d3_time.week=d3_time.sunday;d3_time.weeks=d3_time.sunday.range;d3_time.weeks.utc=d3_time.sunday.utc.range;d3_time.weekOfYear=d3_time.sundayOfYear;function d3_locale_timeFormat(locale){var locale_dateTime=locale.dateTime,locale_date=locale.date,locale_time=locale.time,locale_periods=locale.periods,locale_days=locale.days,locale_shortDays=locale.shortDays,locale_months=locale.months,locale_shortMonths=locale.shortMonths;function d3_time_format(template){var n=template.length;function format(date){var string=[],i=-1,j=0,c,p,f;while(++i<n){if(template.charCodeAt(i)===37){string.push(template.slice(j,i));if((p=d3_time_formatPads[c=template.charAt(++i)])!=null)c=template.charAt(++i);if(f=d3_time_formats[c])c=f(date,p==null?c==="e"?" ":"0":p);string.push(c);j=i+1}}string.push(template.slice(j,i));return string.join("")}format.parse=function(string){var d={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=d3_time_parse(d,template,string,0);if(i!=string.length)return null;if("p"in d)d.H=d.H%12+d.p*12;var localZ=d.Z!=null&&d3_date!==d3_date_utc,date=new(localZ?d3_date_utc:d3_date);if("j"in d)date.setFullYear(d.y,0,d.j);else if("W"in d||"U"in d){if(!("w"in d))d.w="W"in d?1:0;date.setFullYear(d.y,0,1);date.setFullYear(d.y,0,"W"in d?(d.w+6)%7+d.W*7-(date.getDay()+5)%7:d.w+d.U*7-(date.getDay()+6)%7)}else date.setFullYear(d.y,d.m,d.d);date.setHours(d.H+(d.Z/100|0),d.M+d.Z%100,d.S,d.L);return localZ?date._:date};format.toString=function(){return template};return format}function d3_time_parse(date,template,string,j){var c,p,t,i=0,n=template.length,m=string.length;while(i<n){if(j>=m)return-1;c=template.charCodeAt(i++);if(c===37){t=template.charAt(i++);p=d3_time_parsers[t in d3_time_formatPads?template.charAt(i++):t];if(!p||(j=p(date,string,j))<0)return-1}else if(c!=string.charCodeAt(j++)){return-1}}return j}d3_time_format.utc=function(template){var local=d3_time_format(template);function format(date){try{d3_date=d3_date_utc;var utc=new d3_date;utc._=date;return local(utc)}finally{d3_date=Date}}format.parse=function(string){try{d3_date=d3_date_utc;var date=local.parse(string);return date&&date._}finally{d3_date=Date}};format.toString=local.toString;return format};d3_time_format.multi=d3_time_format.utc.multi=d3_time_formatMulti;var d3_time_periodLookup=d3.map(),d3_time_dayRe=d3_time_formatRe(locale_days),d3_time_dayLookup=d3_time_formatLookup(locale_days),d3_time_dayAbbrevRe=d3_time_formatRe(locale_shortDays),d3_time_dayAbbrevLookup=d3_time_formatLookup(locale_shortDays),d3_time_monthRe=d3_time_formatRe(locale_months),d3_time_monthLookup=d3_time_formatLookup(locale_months),d3_time_monthAbbrevRe=d3_time_formatRe(locale_shortMonths),d3_time_monthAbbrevLookup=d3_time_formatLookup(locale_shortMonths);locale_periods.forEach(function(p,i){d3_time_periodLookup.set(p.toLowerCase(),i)});var d3_time_formats={a:function(d){return locale_shortDays[d.getDay()]},A:function(d){return locale_days[d.getDay()]},b:function(d){return locale_shortMonths[d.getMonth()]},B:function(d){return locale_months[d.getMonth()]},c:d3_time_format(locale_dateTime),d:function(d,p){return d3_time_formatPad(d.getDate(),p,2)},e:function(d,p){return d3_time_formatPad(d.getDate(),p,2)},H:function(d,p){return d3_time_formatPad(d.getHours(),p,2)},I:function(d,p){return d3_time_formatPad(d.getHours()%12||12,p,2)},j:function(d,p){return d3_time_formatPad(1+d3_time.dayOfYear(d),p,3)},L:function(d,p){return d3_time_formatPad(d.getMilliseconds(),p,3)},m:function(d,p){return d3_time_formatPad(d.getMonth()+1,p,2)},M:function(d,p){return d3_time_formatPad(d.getMinutes(),p,2)},p:function(d){return locale_periods[+(d.getHours()>=12)]},S:function(d,p){return d3_time_formatPad(d.getSeconds(),p,2)},U:function(d,p){return d3_time_formatPad(d3_time.sundayOfYear(d),p,2)},w:function(d){return d.getDay()},W:function(d,p){return d3_time_formatPad(d3_time.mondayOfYear(d),p,2)},x:d3_time_format(locale_date),X:d3_time_format(locale_time),y:function(d,p){return d3_time_formatPad(d.getFullYear()%100,p,2)},Y:function(d,p){return d3_time_formatPad(d.getFullYear()%1e4,p,4)},Z:d3_time_zone,"%":function(){return"%"}};var d3_time_parsers={a:d3_time_parseWeekdayAbbrev,A:d3_time_parseWeekday,b:d3_time_parseMonthAbbrev,B:d3_time_parseMonth,c:d3_time_parseLocaleFull,d:d3_time_parseDay,e:d3_time_parseDay,H:d3_time_parseHour24,I:d3_time_parseHour24,j:d3_time_parseDayOfYear,L:d3_time_parseMilliseconds,m:d3_time_parseMonthNumber,M:d3_time_parseMinutes,p:d3_time_parseAmPm,S:d3_time_parseSeconds,U:d3_time_parseWeekNumberSunday,w:d3_time_parseWeekdayNumber,W:d3_time_parseWeekNumberMonday,x:d3_time_parseLocaleDate,X:d3_time_parseLocaleTime,y:d3_time_parseYear,Y:d3_time_parseFullYear,Z:d3_time_parseZone,"%":d3_time_parseLiteralPercent};function d3_time_parseWeekdayAbbrev(date,string,i){d3_time_dayAbbrevRe.lastIndex=0;var n=d3_time_dayAbbrevRe.exec(string.slice(i));return n?(date.w=d3_time_dayAbbrevLookup.get(n[0].toLowerCase()),i+n[0].length):-1}function d3_time_parseWeekday(date,string,i){d3_time_dayRe.lastIndex=0;var n=d3_time_dayRe.exec(string.slice(i));return n?(date.w=d3_time_dayLookup.get(n[0].toLowerCase()),i+n[0].length):-1}function d3_time_parseMonthAbbrev(date,string,i){d3_time_monthAbbrevRe.lastIndex=0;var n=d3_time_monthAbbrevRe.exec(string.slice(i));return n?(date.m=d3_time_monthAbbrevLookup.get(n[0].toLowerCase()),i+n[0].length):-1}function d3_time_parseMonth(date,string,i){d3_time_monthRe.lastIndex=0;var n=d3_time_monthRe.exec(string.slice(i));return n?(date.m=d3_time_monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1}function d3_time_parseLocaleFull(date,string,i){return d3_time_parse(date,d3_time_formats.c.toString(),string,i)}function d3_time_parseLocaleDate(date,string,i){return d3_time_parse(date,d3_time_formats.x.toString(),string,i)}function d3_time_parseLocaleTime(date,string,i){return d3_time_parse(date,d3_time_formats.X.toString(),string,i)}function d3_time_parseAmPm(date,string,i){var n=d3_time_periodLookup.get(string.slice(i,i+=2).toLowerCase());return n==null?-1:(date.p=n,i)}return d3_time_format}var d3_time_formatPads={"-":"",_:" ",0:"0"},d3_time_numberRe=/^\s*\d+/,d3_time_percentRe=/^%/;function d3_time_formatPad(value,fill,width){var sign=value<0?"-":"",string=(sign?-value:value)+"",length=string.length;return sign+(length<width?new Array(width-length+1).join(fill)+string:string)}function d3_time_formatRe(names){return new RegExp("^(?:"+names.map(d3.requote).join("|")+")","i")}function d3_time_formatLookup(names){var map=new d3_Map,i=-1,n=names.length;while(++i<n)map.set(names[i].toLowerCase(),i);return map}function d3_time_parseWeekdayNumber(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+1));return n?(date.w=+n[0],i+n[0].length):-1}function d3_time_parseWeekNumberSunday(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i));return n?(date.U=+n[0],i+n[0].length):-1}function d3_time_parseWeekNumberMonday(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i));return n?(date.W=+n[0],i+n[0].length):-1}function d3_time_parseFullYear(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+4));return n?(date.y=+n[0],i+n[0].length):-1}function d3_time_parseYear(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+2));return n?(date.y=d3_time_expandYear(+n[0]),i+n[0].length):-1}function d3_time_parseZone(date,string,i){return/^[+-]\d{4}$/.test(string=string.slice(i,i+5))?(date.Z=-string,i+5):-1}function d3_time_expandYear(d){return d+(d>68?1900:2e3)}function d3_time_parseMonthNumber(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+2));return n?(date.m=n[0]-1,i+n[0].length):-1}function d3_time_parseDay(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+2));return n?(date.d=+n[0],i+n[0].length):-1}function d3_time_parseDayOfYear(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+3));return n?(date.j=+n[0],i+n[0].length):-1}function d3_time_parseHour24(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+2));return n?(date.H=+n[0],i+n[0].length):-1}function d3_time_parseMinutes(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+2));return n?(date.M=+n[0],i+n[0].length):-1}function d3_time_parseSeconds(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+2));return n?(date.S=+n[0],i+n[0].length):-1}function d3_time_parseMilliseconds(date,string,i){d3_time_numberRe.lastIndex=0;var n=d3_time_numberRe.exec(string.slice(i,i+3));return n?(date.L=+n[0],i+n[0].length):-1}function d3_time_zone(d){var z=d.getTimezoneOffset(),zs=z>0?"-":"+",zh=abs(z)/60|0,zm=abs(z)%60;return zs+d3_time_formatPad(zh,"0",2)+d3_time_formatPad(zm,"0",2)}function d3_time_parseLiteralPercent(date,string,i){d3_time_percentRe.lastIndex=0;var n=d3_time_percentRe.exec(string.slice(i,i+1));return n?i+n[0].length:-1}function d3_time_formatMulti(formats){var n=formats.length,i=-1;while(++i<n)formats[i][0]=this(formats[i][0]);return function(date){var i=0,f=formats[i];while(!f[1](date))f=formats[++i];return f[0](date)}}d3.locale=function(locale){return{numberFormat:d3_locale_numberFormat(locale),timeFormat:d3_locale_timeFormat(locale)}};var d3_locale_enUS=d3.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});d3.format=d3_locale_enUS.numberFormat;d3.geo={};function d3_adder(){}d3_adder.prototype={s:0,t:0,add:function(y){d3_adderSum(y,this.t,d3_adderTemp);d3_adderSum(d3_adderTemp.s,this.s,this);if(this.s)this.t+=d3_adderTemp.t;else this.s=d3_adderTemp.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var d3_adderTemp=new d3_adder;function d3_adderSum(a,b,o){var x=o.s=a+b,bv=x-a,av=x-bv;o.t=a-av+(b-bv)}d3.geo.stream=function(object,listener){if(object&&d3_geo_streamObjectType.hasOwnProperty(object.type)){d3_geo_streamObjectType[object.type](object,listener)}else{d3_geo_streamGeometry(object,listener)}};function d3_geo_streamGeometry(geometry,listener){if(geometry&&d3_geo_streamGeometryType.hasOwnProperty(geometry.type)){d3_geo_streamGeometryType[geometry.type](geometry,listener)}}var d3_geo_streamObjectType={Feature:function(feature,listener){d3_geo_streamGeometry(feature.geometry,listener)},FeatureCollection:function(object,listener){var features=object.features,i=-1,n=features.length;while(++i<n)d3_geo_streamGeometry(features[i].geometry,listener)}};var d3_geo_streamGeometryType={Sphere:function(object,listener){listener.sphere()},Point:function(object,listener){object=object.coordinates;listener.point(object[0],object[1],object[2])},MultiPoint:function(object,listener){var coordinates=object.coordinates,i=-1,n=coordinates.length;while(++i<n)object=coordinates[i],listener.point(object[0],object[1],object[2])},LineString:function(object,listener){d3_geo_streamLine(object.coordinates,listener,0)},MultiLineString:function(object,listener){var coordinates=object.coordinates,i=-1,n=coordinates.length;while(++i<n)d3_geo_streamLine(coordinates[i],listener,0)},Polygon:function(object,listener){d3_geo_streamPolygon(object.coordinates,listener)},MultiPolygon:function(object,listener){var coordinates=object.coordinates,i=-1,n=coordinates.length;while(++i<n)d3_geo_streamPolygon(coordinates[i],listener)},GeometryCollection:function(object,listener){var geometries=object.geometries,i=-1,n=geometries.length;while(++i<n)d3_geo_streamGeometry(geometries[i],listener)}};function d3_geo_streamLine(coordinates,listener,closed){var i=-1,n=coordinates.length-closed,coordinate;listener.lineStart();while(++i<n)coordinate=coordinates[i],listener.point(coordinate[0],coordinate[1],coordinate[2]);listener.lineEnd()}function d3_geo_streamPolygon(coordinates,listener){var i=-1,n=coordinates.length;listener.polygonStart();while(++i<n)d3_geo_streamLine(coordinates[i],listener,1);listener.polygonEnd()}d3.geo.area=function(object){d3_geo_areaSum=0;d3.geo.stream(object,d3_geo_area);return d3_geo_areaSum};var d3_geo_areaSum,d3_geo_areaRingSum=new d3_adder;var d3_geo_area={sphere:function(){d3_geo_areaSum+=4*π},point:d3_noop,lineStart:d3_noop,lineEnd:d3_noop,polygonStart:function(){d3_geo_areaRingSum.reset();d3_geo_area.lineStart=d3_geo_areaRingStart},polygonEnd:function(){var area=2*d3_geo_areaRingSum;d3_geo_areaSum+=area<0?4*π+area:area;d3_geo_area.lineStart=d3_geo_area.lineEnd=d3_geo_area.point=d3_noop}};function d3_geo_areaRingStart(){var λ00,φ00,λ0,cosφ0,sinφ0;d3_geo_area.point=function(λ,φ){d3_geo_area.point=nextPoint;λ0=(λ00=λ)*d3_radians,cosφ0=Math.cos(φ=(φ00=φ)*d3_radians/2+π/4),sinφ0=Math.sin(φ)};function nextPoint(λ,φ){λ*=d3_radians;φ=φ*d3_radians/2+π/4;var dλ=λ-λ0,sdλ=dλ>=0?1:-1,adλ=sdλ*dλ,cosφ=Math.cos(φ),sinφ=Math.sin(φ),k=sinφ0*sinφ,u=cosφ0*cosφ+k*Math.cos(adλ),v=k*sdλ*Math.sin(adλ);d3_geo_areaRingSum.add(Math.atan2(v,u));λ0=λ,cosφ0=cosφ,sinφ0=sinφ}d3_geo_area.lineEnd=function(){nextPoint(λ00,φ00)}}function d3_geo_cartesian(spherical){var λ=spherical[0],φ=spherical[1],cosφ=Math.cos(φ);return[cosφ*Math.cos(λ),cosφ*Math.sin(λ),Math.sin(φ)]}function d3_geo_cartesianDot(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function d3_geo_cartesianCross(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]}function d3_geo_cartesianAdd(a,b){a[0]+=b[0];a[1]+=b[1];a[2]+=b[2]}function d3_geo_cartesianScale(vector,k){return[vector[0]*k,vector[1]*k,vector[2]*k]}function d3_geo_cartesianNormalize(d){var l=Math.sqrt(d[0]*d[0]+d[1]*d[1]+d[2]*d[2]);d[0]/=l;d[1]/=l;d[2]/=l}function d3_geo_spherical(cartesian){return[Math.atan2(cartesian[1],cartesian[0]),d3_asin(cartesian[2])]}function d3_geo_sphericalEqual(a,b){return abs(a[0]-b[0])<ε&&abs(a[1]-b[1])<ε}d3.geo.bounds=function(){var λ0,φ0,λ1,φ1,λ_,λ__,φ__,p0,dλSum,ranges,range;var bound={point:point,lineStart:lineStart,lineEnd:lineEnd,polygonStart:function(){bound.point=ringPoint;bound.lineStart=ringStart;bound.lineEnd=ringEnd;dλSum=0;d3_geo_area.polygonStart()},polygonEnd:function(){d3_geo_area.polygonEnd();bound.point=point;bound.lineStart=lineStart;bound.lineEnd=lineEnd;if(d3_geo_areaRingSum<0)λ0=-(λ1=180),φ0=-(φ1=90);else if(dλSum>ε)φ1=90;else if(dλSum<-ε)φ0=-90;range[0]=λ0,range[1]=λ1}};function point(λ,φ){ranges.push(range=[λ0=λ,λ1=λ]);if(φ<φ0)φ0=φ;if(φ>φ1)φ1=φ}function linePoint(λ,φ){var p=d3_geo_cartesian([λ*d3_radians,φ*d3_radians]);if(p0){var normal=d3_geo_cartesianCross(p0,p),equatorial=[normal[1],-normal[0],0],inflection=d3_geo_cartesianCross(equatorial,normal);d3_geo_cartesianNormalize(inflection);inflection=d3_geo_spherical(inflection);var dλ=λ-λ_,s=dλ>0?1:-1,λi=inflection[0]*d3_degrees*s,antimeridian=abs(dλ)>180;if(antimeridian^(s*λ_<λi&&λi<s*λ)){var φi=inflection[1]*d3_degrees;if(φi>φ1)φ1=φi}else if(λi=(λi+360)%360-180,antimeridian^(s*λ_<λi&&λi<s*λ)){var φi=-inflection[1]*d3_degrees;if(φi<φ0)φ0=φi}else{if(φ<φ0)φ0=φ;if(φ>φ1)φ1=φ}if(antimeridian){if(λ<λ_){if(angle(λ0,λ)>angle(λ0,λ1))λ1=λ}else{if(angle(λ,λ1)>angle(λ0,λ1))λ0=λ}}else{if(λ1>=λ0){if(λ<λ0)λ0=λ;if(λ>λ1)λ1=λ}else{if(λ>λ_){if(angle(λ0,λ)>angle(λ0,λ1))λ1=λ}else{if(angle(λ,λ1)>angle(λ0,λ1))λ0=λ}}}}else{point(λ,φ)}p0=p,λ_=λ}function lineStart(){bound.point=linePoint}function lineEnd(){range[0]=λ0,range[1]=λ1;bound.point=point;p0=null}function ringPoint(λ,φ){if(p0){var dλ=λ-λ_;dλSum+=abs(dλ)>180?dλ+(dλ>0?360:-360):dλ}else λ__=λ,φ__=φ;d3_geo_area.point(λ,φ);linePoint(λ,φ)}function ringStart(){d3_geo_area.lineStart()}function ringEnd(){ringPoint(λ__,φ__);d3_geo_area.lineEnd();if(abs(dλSum)>ε)λ0=-(λ1=180);range[0]=λ0,range[1]=λ1;p0=null}function angle(λ0,λ1){return(λ1-=λ0)<0?λ1+360:λ1}function compareRanges(a,b){return a[0]-b[0]}function withinRange(x,range){return range[0]<=range[1]?range[0]<=x&&x<=range[1]:x<range[0]||range[1]<x}return function(feature){φ1=λ1=-(λ0=φ0=Infinity);ranges=[];d3.geo.stream(feature,bound);var n=ranges.length;if(n){ranges.sort(compareRanges);for(var i=1,a=ranges[0],b,merged=[a];i<n;++i){b=ranges[i];if(withinRange(b[0],a)||withinRange(b[1],a)){if(angle(a[0],b[1])>angle(a[0],a[1]))a[1]=b[1];if(angle(b[0],a[1])>angle(a[0],a[1]))a[0]=b[0]}else{merged.push(a=b)}}var best=-Infinity,dλ;for(var n=merged.length-1,i=0,a=merged[n],b;i<=n;a=b,++i){b=merged[i];if((dλ=angle(a[1],b[0]))>best)best=dλ,λ0=b[0],λ1=a[1]}}ranges=range=null;return λ0===Infinity||φ0===Infinity?[[NaN,NaN],[NaN,NaN]]:[[λ0,φ0],[λ1,φ1]]}}();d3.geo.centroid=function(object){d3_geo_centroidW0=d3_geo_centroidW1=d3_geo_centroidX0=d3_geo_centroidY0=d3_geo_centroidZ0=d3_geo_centroidX1=d3_geo_centroidY1=d3_geo_centroidZ1=d3_geo_centroidX2=d3_geo_centroidY2=d3_geo_centroidZ2=0;d3.geo.stream(object,d3_geo_centroid);var x=d3_geo_centroidX2,y=d3_geo_centroidY2,z=d3_geo_centroidZ2,m=x*x+y*y+z*z;if(m<ε2){x=d3_geo_centroidX1,y=d3_geo_centroidY1,z=d3_geo_centroidZ1;if(d3_geo_centroidW1<ε)x=d3_geo_centroidX0,y=d3_geo_centroidY0,z=d3_geo_centroidZ0;m=x*x+y*y+z*z;if(m<ε2)return[NaN,NaN]}return[Math.atan2(y,x)*d3_degrees,d3_asin(z/Math.sqrt(m))*d3_degrees]};var d3_geo_centroidW0,d3_geo_centroidW1,d3_geo_centroidX0,d3_geo_centroidY0,d3_geo_centroidZ0,d3_geo_centroidX1,d3_geo_centroidY1,d3_geo_centroidZ1,d3_geo_centroidX2,d3_geo_centroidY2,d3_geo_centroidZ2;var d3_geo_centroid={sphere:d3_noop,point:d3_geo_centroidPoint,lineStart:d3_geo_centroidLineStart,lineEnd:d3_geo_centroidLineEnd,polygonStart:function(){d3_geo_centroid.lineStart=d3_geo_centroidRingStart},polygonEnd:function(){d3_geo_centroid.lineStart=d3_geo_centroidLineStart}};function d3_geo_centroidPoint(λ,φ){λ*=d3_radians;var cosφ=Math.cos(φ*=d3_radians);d3_geo_centroidPointXYZ(cosφ*Math.cos(λ),cosφ*Math.sin(λ),Math.sin(φ))}function d3_geo_centroidPointXYZ(x,y,z){++d3_geo_centroidW0;d3_geo_centroidX0+=(x-d3_geo_centroidX0)/d3_geo_centroidW0;d3_geo_centroidY0+=(y-d3_geo_centroidY0)/d3_geo_centroidW0;d3_geo_centroidZ0+=(z-d3_geo_centroidZ0)/d3_geo_centroidW0}function d3_geo_centroidLineStart(){var x0,y0,z0;d3_geo_centroid.point=function(λ,φ){λ*=d3_radians;var cosφ=Math.cos(φ*=d3_radians);x0=cosφ*Math.cos(λ);y0=cosφ*Math.sin(λ);z0=Math.sin(φ);d3_geo_centroid.point=nextPoint;d3_geo_centroidPointXYZ(x0,y0,z0)};function nextPoint(λ,φ){λ*=d3_radians;var cosφ=Math.cos(φ*=d3_radians),x=cosφ*Math.cos(λ),y=cosφ*Math.sin(λ),z=Math.sin(φ),w=Math.atan2(Math.sqrt((w=y0*z-z0*y)*w+(w=z0*x-x0*z)*w+(w=x0*y-y0*x)*w),x0*x+y0*y+z0*z);d3_geo_centroidW1+=w;d3_geo_centroidX1+=w*(x0+(x0=x));d3_geo_centroidY1+=w*(y0+(y0=y));d3_geo_centroidZ1+=w*(z0+(z0=z));d3_geo_centroidPointXYZ(x0,y0,z0)}}function d3_geo_centroidLineEnd(){d3_geo_centroid.point=d3_geo_centroidPoint}function d3_geo_centroidRingStart(){var λ00,φ00,x0,y0,z0;d3_geo_centroid.point=function(λ,φ){λ00=λ,φ00=φ;d3_geo_centroid.point=nextPoint;λ*=d3_radians;var cosφ=Math.cos(φ*=d3_radians);x0=cosφ*Math.cos(λ);y0=cosφ*Math.sin(λ);z0=Math.sin(φ);d3_geo_centroidPointXYZ(x0,y0,z0)};d3_geo_centroid.lineEnd=function(){nextPoint(λ00,φ00);d3_geo_centroid.lineEnd=d3_geo_centroidLineEnd;d3_geo_centroid.point=d3_geo_centroidPoint};function nextPoint(λ,φ){λ*=d3_radians;var cosφ=Math.cos(φ*=d3_radians),x=cosφ*Math.cos(λ),y=cosφ*Math.sin(λ),z=Math.sin(φ),cx=y0*z-z0*y,cy=z0*x-x0*z,cz=x0*y-y0*x,m=Math.sqrt(cx*cx+cy*cy+cz*cz),u=x0*x+y0*y+z0*z,v=m&&-d3_acos(u)/m,w=Math.atan2(m,u);d3_geo_centroidX2+=v*cx;d3_geo_centroidY2+=v*cy;d3_geo_centroidZ2+=v*cz;d3_geo_centroidW1+=w;d3_geo_centroidX1+=w*(x0+(x0=x));d3_geo_centroidY1+=w*(y0+(y0=y));d3_geo_centroidZ1+=w*(z0+(z0=z));d3_geo_centroidPointXYZ(x0,y0,z0)}}function d3_geo_compose(a,b){function compose(x,y){return x=a(x,y),b(x[0],x[1])}if(a.invert&&b.invert)compose.invert=function(x,y){return x=b.invert(x,y),x&&a.invert(x[0],x[1])};return compose}function d3_true(){return true}function d3_geo_clipPolygon(segments,compare,clipStartInside,interpolate,listener){var subject=[],clip=[];segments.forEach(function(segment){if((n=segment.length-1)<=0)return;var n,p0=segment[0],p1=segment[n];if(d3_geo_sphericalEqual(p0,p1)){listener.lineStart();for(var i=0;i<n;++i)listener.point((p0=segment[i])[0],p0[1]);listener.lineEnd();return}var a=new d3_geo_clipPolygonIntersection(p0,segment,null,true),b=new d3_geo_clipPolygonIntersection(p0,null,a,false);a.o=b;subject.push(a);clip.push(b);a=new d3_geo_clipPolygonIntersection(p1,segment,null,false);b=new d3_geo_clipPolygonIntersection(p1,null,a,true);a.o=b;subject.push(a);clip.push(b)});clip.sort(compare);d3_geo_clipPolygonLinkCircular(subject);d3_geo_clipPolygonLinkCircular(clip);if(!subject.length)return;for(var i=0,entry=clipStartInside,n=clip.length;i<n;++i){clip[i].e=entry=!entry}var start=subject[0],points,point;while(1){var current=start,isSubject=true;while(current.v)if((current=current.n)===start)return;points=current.z;listener.lineStart();do{current.v=current.o.v=true;if(current.e){if(isSubject){for(var i=0,n=points.length;i<n;++i)listener.point((point=points[i])[0],point[1])}else{interpolate(current.x,current.n.x,1,listener)}current=current.n}else{if(isSubject){points=current.p.z;for(var i=points.length-1;i>=0;--i)listener.point((point=points[i])[0],point[1])}else{interpolate(current.x,current.p.x,-1,listener)}current=current.p}current=current.o;points=current.z;isSubject=!isSubject}while(!current.v);listener.lineEnd()}}function d3_geo_clipPolygonLinkCircular(array){if(!(n=array.length))return;var n,i=0,a=array[0],b;while(++i<n){a.n=b=array[i];b.p=a;a=b}a.n=b=array[0];b.p=a}function d3_geo_clipPolygonIntersection(point,points,other,entry){this.x=point;this.z=points;this.o=other;this.e=entry;this.v=false;this.n=this.p=null}function d3_geo_clip(pointVisible,clipLine,interpolate,clipStart){return function(rotate,listener){var line=clipLine(listener),rotatedClipStart=rotate.invert(clipStart[0],clipStart[1]);var clip={point:point,lineStart:lineStart,lineEnd:lineEnd,polygonStart:function(){clip.point=pointRing;clip.lineStart=ringStart;clip.lineEnd=ringEnd;segments=[];polygon=[]},polygonEnd:function(){clip.point=point;clip.lineStart=lineStart;clip.lineEnd=lineEnd;segments=d3.merge(segments);var clipStartInside=d3_geo_pointInPolygon(rotatedClipStart,polygon);if(segments.length){if(!polygonStarted)listener.polygonStart(),polygonStarted=true;d3_geo_clipPolygon(segments,d3_geo_clipSort,clipStartInside,interpolate,listener)}else if(clipStartInside){if(!polygonStarted)listener.polygonStart(),polygonStarted=true;listener.lineStart();interpolate(null,null,1,listener);listener.lineEnd()}if(polygonStarted)listener.polygonEnd(),polygonStarted=false;segments=polygon=null},sphere:function(){listener.polygonStart();listener.lineStart();interpolate(null,null,1,listener);listener.lineEnd();listener.polygonEnd()}};function point(λ,φ){var point=rotate(λ,φ);if(pointVisible(λ=point[0],φ=point[1]))listener.point(λ,φ)}function pointLine(λ,φ){var point=rotate(λ,φ);line.point(point[0],point[1])}function lineStart(){clip.point=pointLine;line.lineStart()}function lineEnd(){clip.point=point;line.lineEnd()}var segments;var buffer=d3_geo_clipBufferListener(),ringListener=clipLine(buffer),polygonStarted=false,polygon,ring;function pointRing(λ,φ){ring.push([λ,φ]);var point=rotate(λ,φ);ringListener.point(point[0],point[1])}function ringStart(){ringListener.lineStart();ring=[]}function ringEnd(){pointRing(ring[0][0],ring[0][1]);ringListener.lineEnd();var clean=ringListener.clean(),ringSegments=buffer.buffer(),segment,n=ringSegments.length;ring.pop();polygon.push(ring);ring=null;if(!n)return;if(clean&1){segment=ringSegments[0];var n=segment.length-1,i=-1,point;if(n>0){if(!polygonStarted)listener.polygonStart(),polygonStarted=true;listener.lineStart();while(++i<n)listener.point((point=segment[i])[0],point[1]);listener.lineEnd()}return}if(n>1&&clean&2)ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));segments.push(ringSegments.filter(d3_geo_clipSegmentLength1))}return clip}}function d3_geo_clipSegmentLength1(segment){return segment.length>1}function d3_geo_clipBufferListener(){var lines=[],line;return{lineStart:function(){lines.push(line=[])},point:function(λ,φ){line.push([λ,φ])},lineEnd:d3_noop,buffer:function(){var buffer=lines;lines=[];line=null;return buffer},rejoin:function(){if(lines.length>1)lines.push(lines.pop().concat(lines.shift()))}}}function d3_geo_clipSort(a,b){return((a=a.x)[0]<0?a[1]-halfπ-ε:halfπ-a[1])-((b=b.x)[0]<0?b[1]-halfπ-ε:halfπ-b[1])}var d3_geo_clipAntimeridian=d3_geo_clip(d3_true,d3_geo_clipAntimeridianLine,d3_geo_clipAntimeridianInterpolate,[-π,-π/2]);function d3_geo_clipAntimeridianLine(listener){var λ0=NaN,φ0=NaN,sλ0=NaN,clean;return{lineStart:function(){listener.lineStart();clean=1},point:function(λ1,φ1){var sλ1=λ1>0?π:-π,dλ=abs(λ1-λ0);if(abs(dλ-π)<ε){listener.point(λ0,φ0=(φ0+φ1)/2>0?halfπ:-halfπ);listener.point(sλ0,φ0);listener.lineEnd();listener.lineStart();listener.point(sλ1,φ0);listener.point(λ1,φ0);clean=0}else if(sλ0!==sλ1&&dλ>=π){if(abs(λ0-sλ0)<ε)λ0-=sλ0*ε;if(abs(λ1-sλ1)<ε)λ1-=sλ1*ε;φ0=d3_geo_clipAntimeridianIntersect(λ0,φ0,λ1,φ1);listener.point(sλ0,φ0);listener.lineEnd();listener.lineStart();listener.point(sλ1,φ0);clean=0}listener.point(λ0=λ1,φ0=φ1);sλ0=sλ1},lineEnd:function(){listener.lineEnd();λ0=φ0=NaN},clean:function(){return 2-clean}}}function d3_geo_clipAntimeridianIntersect(λ0,φ0,λ1,φ1){var cosφ0,cosφ1,sinλ0_λ1=Math.sin(λ0-λ1);return abs(sinλ0_λ1)>ε?Math.atan((Math.sin(φ0)*(cosφ1=Math.cos(φ1))*Math.sin(λ1)-Math.sin(φ1)*(cosφ0=Math.cos(φ0))*Math.sin(λ0))/(cosφ0*cosφ1*sinλ0_λ1)):(φ0+φ1)/2}function d3_geo_clipAntimeridianInterpolate(from,to,direction,listener){var φ;if(from==null){φ=direction*halfπ;listener.point(-π,φ);listener.point(0,φ);listener.point(π,φ);listener.point(π,0);listener.point(π,-φ);listener.point(0,-φ);listener.point(-π,-φ);listener.point(-π,0);listener.point(-π,φ)}else if(abs(from[0]-to[0])>ε){var s=from[0]<to[0]?π:-π;φ=direction*s/2;listener.point(-s,φ);listener.point(0,φ);listener.point(s,φ)}else{listener.point(to[0],to[1])}}function d3_geo_pointInPolygon(point,polygon){var meridian=point[0],parallel=point[1],meridianNormal=[Math.sin(meridian),-Math.cos(meridian),0],polarAngle=0,winding=0;d3_geo_areaRingSum.reset();for(var i=0,n=polygon.length;i<n;++i){var ring=polygon[i],m=ring.length;if(!m)continue;var point0=ring[0],λ0=point0[0],φ0=point0[1]/2+π/4,sinφ0=Math.sin(φ0),cosφ0=Math.cos(φ0),j=1;while(true){if(j===m)j=0;point=ring[j];var λ=point[0],φ=point[1]/2+π/4,sinφ=Math.sin(φ),cosφ=Math.cos(φ),dλ=λ-λ0,sdλ=dλ>=0?1:-1,adλ=sdλ*dλ,antimeridian=adλ>π,k=sinφ0*sinφ;d3_geo_areaRingSum.add(Math.atan2(k*sdλ*Math.sin(adλ),cosφ0*cosφ+k*Math.cos(adλ)));polarAngle+=antimeridian?dλ+sdλ*τ:dλ;if(antimeridian^λ0>=meridian^λ>=meridian){var arc=d3_geo_cartesianCross(d3_geo_cartesian(point0),d3_geo_cartesian(point));d3_geo_cartesianNormalize(arc);var intersection=d3_geo_cartesianCross(meridianNormal,arc);d3_geo_cartesianNormalize(intersection);var φarc=(antimeridian^dλ>=0?-1:1)*d3_asin(intersection[2]);if(parallel>φarc||parallel===φarc&&(arc[0]||arc[1])){winding+=antimeridian^dλ>=0?1:-1}}if(!j++)break;λ0=λ,sinφ0=sinφ,cosφ0=cosφ,point0=point}}return(polarAngle<-ε||polarAngle<ε&&d3_geo_areaRingSum<-ε)^winding&1}function d3_geo_clipCircle(radius){var cr=Math.cos(radius),smallRadius=cr>0,notHemisphere=abs(cr)>ε,interpolate=d3_geo_circleInterpolate(radius,6*d3_radians);return d3_geo_clip(visible,clipLine,interpolate,smallRadius?[0,-radius]:[-π,radius-π]);function visible(λ,φ){return Math.cos(λ)*Math.cos(φ)>cr}function clipLine(listener){var point0,c0,v0,v00,clean;return{lineStart:function(){v00=v0=false;clean=1},point:function(λ,φ){var point1=[λ,φ],point2,v=visible(λ,φ),c=smallRadius?v?0:code(λ,φ):v?code(λ+(λ<0?π:-π),φ):0;if(!point0&&(v00=v0=v))listener.lineStart();if(v!==v0){point2=intersect(point0,point1);if(d3_geo_sphericalEqual(point0,point2)||d3_geo_sphericalEqual(point1,point2)){point1[0]+=ε;point1[1]+=ε;v=visible(point1[0],point1[1])}}if(v!==v0){clean=0;if(v){listener.lineStart();point2=intersect(point1,point0);listener.point(point2[0],point2[1])}else{point2=intersect(point0,point1);listener.point(point2[0],point2[1]);listener.lineEnd()}point0=point2}else if(notHemisphere&&point0&&smallRadius^v){var t;if(!(c&c0)&&(t=intersect(point1,point0,true))){clean=0;if(smallRadius){listener.lineStart();listener.point(t[0][0],t[0][1]);listener.point(t[1][0],t[1][1]);listener.lineEnd()}else{listener.point(t[1][0],t[1][1]);listener.lineEnd();listener.lineStart();listener.point(t[0][0],t[0][1])}}}if(v&&(!point0||!d3_geo_sphericalEqual(point0,point1))){listener.point(point1[0],point1[1])}point0=point1,v0=v,c0=c},lineEnd:function(){if(v0)listener.lineEnd();point0=null},clean:function(){return clean|(v00&&v0)<<1}}}function intersect(a,b,two){var pa=d3_geo_cartesian(a),pb=d3_geo_cartesian(b);var n1=[1,0,0],n2=d3_geo_cartesianCross(pa,pb),n2n2=d3_geo_cartesianDot(n2,n2),n1n2=n2[0],determinant=n2n2-n1n2*n1n2;if(!determinant)return!two&&a;var c1=cr*n2n2/determinant,c2=-cr*n1n2/determinant,n1xn2=d3_geo_cartesianCross(n1,n2),A=d3_geo_cartesianScale(n1,c1),B=d3_geo_cartesianScale(n2,c2);d3_geo_cartesianAdd(A,B);var u=n1xn2,w=d3_geo_cartesianDot(A,u),uu=d3_geo_cartesianDot(u,u),t2=w*w-uu*(d3_geo_cartesianDot(A,A)-1);if(t2<0)return;var t=Math.sqrt(t2),q=d3_geo_cartesianScale(u,(-w-t)/uu);d3_geo_cartesianAdd(q,A);q=d3_geo_spherical(q);if(!two)return q;var λ0=a[0],λ1=b[0],φ0=a[1],φ1=b[1],z;if(λ1<λ0)z=λ0,λ0=λ1,λ1=z;var δλ=λ1-λ0,polar=abs(δλ-π)<ε,meridian=polar||δλ<ε;if(!polar&&φ1<φ0)z=φ0,φ0=φ1,φ1=z;if(meridian?polar?φ0+φ1>0^q[1]<(abs(q[0]-λ0)<ε?φ0:φ1):φ0<=q[1]&&q[1]<=φ1:δλ>π^(λ0<=q[0]&&q[0]<=λ1)){var q1=d3_geo_cartesianScale(u,(-w+t)/uu);d3_geo_cartesianAdd(q1,A);return[q,d3_geo_spherical(q1)]}}function code(λ,φ){var r=smallRadius?radius:π-radius,code=0;if(λ<-r)code|=1;else if(λ>r)code|=2;if(φ<-r)code|=4;else if(φ>r)code|=8;return code}}function d3_geom_clipLine(x0,y0,x1,y1){return function(line){var a=line.a,b=line.b,ax=a.x,ay=a.y,bx=b.x,by=b.y,t0=0,t1=1,dx=bx-ax,dy=by-ay,r;r=x0-ax;if(!dx&&r>0)return;r/=dx;if(dx<0){if(r<t0)return;if(r<t1)t1=r}else if(dx>0){if(r>t1)return;if(r>t0)t0=r}r=x1-ax;if(!dx&&r<0)return;r/=dx;if(dx<0){if(r>t1)return;if(r>t0)t0=r}else if(dx>0){if(r<t0)return;if(r<t1)t1=r}r=y0-ay;if(!dy&&r>0)return;r/=dy;if(dy<0){if(r<t0)return;if(r<t1)t1=r}else if(dy>0){if(r>t1)return;if(r>t0)t0=r}r=y1-ay;if(!dy&&r<0)return;r/=dy;if(dy<0){if(r>t1)return;if(r>t0)t0=r}else if(dy>0){if(r<t0)return;if(r<t1)t1=r}if(t0>0)line.a={x:ax+t0*dx,y:ay+t0*dy};if(t1<1)line.b={x:ax+t1*dx,y:ay+t1*dy};return line}}var d3_geo_clipExtentMAX=1e9;d3.geo.clipExtent=function(){var x0,y0,x1,y1,stream,clip,clipExtent={stream:function(output){if(stream)stream.valid=false;stream=clip(output);stream.valid=true;return stream},extent:function(_){if(!arguments.length)return[[x0,y0],[x1,y1]];clip=d3_geo_clipExtent(x0=+_[0][0],y0=+_[0][1],x1=+_[1][0],y1=+_[1][1]);if(stream)stream.valid=false,stream=null;return clipExtent}};return clipExtent.extent([[0,0],[960,500]])};function d3_geo_clipExtent(x0,y0,x1,y1){return function(listener){var listener_=listener,bufferListener=d3_geo_clipBufferListener(),clipLine=d3_geom_clipLine(x0,y0,x1,y1),segments,polygon,ring;var clip={point:point,lineStart:lineStart,lineEnd:lineEnd,polygonStart:function(){listener=bufferListener;segments=[];polygon=[];clean=true},polygonEnd:function(){listener=listener_;segments=d3.merge(segments);var clipStartInside=insidePolygon([x0,y1]),inside=clean&&clipStartInside,visible=segments.length;if(inside||visible){listener.polygonStart();if(inside){listener.lineStart();interpolate(null,null,1,listener);listener.lineEnd()}if(visible){d3_geo_clipPolygon(segments,compare,clipStartInside,interpolate,listener)}listener.polygonEnd()}segments=polygon=ring=null}};function insidePolygon(p){var wn=0,n=polygon.length,y=p[1];for(var i=0;i<n;++i){for(var j=1,v=polygon[i],m=v.length,a=v[0],b;j<m;++j){b=v[j];if(a[1]<=y){if(b[1]>y&&d3_cross2d(a,b,p)>0)++wn}else{if(b[1]<=y&&d3_cross2d(a,b,p)<0)--wn}a=b}}return wn!==0}function interpolate(from,to,direction,listener){var a=0,a1=0;if(from==null||(a=corner(from,direction))!==(a1=corner(to,direction))||comparePoints(from,to)<0^direction>0){do{listener.point(a===0||a===3?x0:x1,a>1?y1:y0)}while((a=(a+direction+4)%4)!==a1)}else{listener.point(to[0],to[1])}}function pointVisible(x,y){return x0<=x&&x<=x1&&y0<=y&&y<=y1}function point(x,y){if(pointVisible(x,y))listener.point(x,y)}var x__,y__,v__,x_,y_,v_,first,clean;function lineStart(){clip.point=linePoint;if(polygon)polygon.push(ring=[]);first=true;v_=false;x_=y_=NaN}function lineEnd(){if(segments){linePoint(x__,y__);if(v__&&v_)bufferListener.rejoin();segments.push(bufferListener.buffer())}clip.point=point;if(v_)listener.lineEnd()}function linePoint(x,y){x=Math.max(-d3_geo_clipExtentMAX,Math.min(d3_geo_clipExtentMAX,x));y=Math.max(-d3_geo_clipExtentMAX,Math.min(d3_geo_clipExtentMAX,y));var v=pointVisible(x,y);if(polygon)ring.push([x,y]);if(first){x__=x,y__=y,v__=v;first=false;if(v){listener.lineStart();listener.point(x,y)}}else{if(v&&v_)listener.point(x,y);else{var l={a:{x:x_,y:y_},b:{x:x,y:y}};if(clipLine(l)){if(!v_){listener.lineStart();listener.point(l.a.x,l.a.y)}listener.point(l.b.x,l.b.y);if(!v)listener.lineEnd();clean=false}else if(v){listener.lineStart();listener.point(x,y);clean=false}}}x_=x,y_=y,v_=v}return clip};function corner(p,direction){return abs(p[0]-x0)<ε?direction>0?0:3:abs(p[0]-x1)<ε?direction>0?2:1:abs(p[1]-y0)<ε?direction>0?1:0:direction>0?3:2}function compare(a,b){return comparePoints(a.x,b.x)}function comparePoints(a,b){var ca=corner(a,1),cb=corner(b,1);return ca!==cb?ca-cb:ca===0?b[1]-a[1]:ca===1?a[0]-b[0]:ca===2?a[1]-b[1]:b[0]-a[0]}}function d3_geo_conic(projectAt){var φ0=0,φ1=π/3,m=d3_geo_projectionMutator(projectAt),p=m(φ0,φ1);p.parallels=function(_){if(!arguments.length)return[φ0/π*180,φ1/π*180];return m(φ0=_[0]*π/180,φ1=_[1]*π/180)};return p}function d3_geo_conicEqualArea(φ0,φ1){var sinφ0=Math.sin(φ0),n=(sinφ0+Math.sin(φ1))/2,C=1+sinφ0*(2*n-sinφ0),ρ0=Math.sqrt(C)/n;function forward(λ,φ){var ρ=Math.sqrt(C-2*n*Math.sin(φ))/n;return[ρ*Math.sin(λ*=n),ρ0-ρ*Math.cos(λ)]}forward.invert=function(x,y){var ρ0_y=ρ0-y;return[Math.atan2(x,ρ0_y)/n,d3_asin((C-(x*x+ρ0_y*ρ0_y)*n*n)/(2*n))]};return forward}(d3.geo.conicEqualArea=function(){return d3_geo_conic(d3_geo_conicEqualArea)}).raw=d3_geo_conicEqualArea;d3.geo.albers=function(){return d3.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)};d3.geo.albersUsa=function(){var lower48=d3.geo.albers();var alaska=d3.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]);var hawaii=d3.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]);var point,pointStream={point:function(x,y){point=[x,y]}},lower48Point,alaskaPoint,hawaiiPoint;function albersUsa(coordinates){var x=coordinates[0],y=coordinates[1];point=null;(lower48Point(x,y),point)||(alaskaPoint(x,y),point)||hawaiiPoint(x,y);return point}albersUsa.invert=function(coordinates){var k=lower48.scale(),t=lower48.translate(),x=(coordinates[0]-t[0])/k,y=(coordinates[1]-t[1])/k;return(y>=.12&&y<.234&&x>=-.425&&x<-.214?alaska:y>=.166&&y<.234&&x>=-.214&&x<-.115?hawaii:lower48).invert(coordinates)};albersUsa.stream=function(stream){var lower48Stream=lower48.stream(stream),alaskaStream=alaska.stream(stream),hawaiiStream=hawaii.stream(stream);return{point:function(x,y){lower48Stream.point(x,y);alaskaStream.point(x,y);hawaiiStream.point(x,y)},sphere:function(){lower48Stream.sphere();alaskaStream.sphere();hawaiiStream.sphere()},lineStart:function(){lower48Stream.lineStart();alaskaStream.lineStart();hawaiiStream.lineStart()},lineEnd:function(){lower48Stream.lineEnd();alaskaStream.lineEnd();hawaiiStream.lineEnd()},polygonStart:function(){lower48Stream.polygonStart();alaskaStream.polygonStart();hawaiiStream.polygonStart()},polygonEnd:function(){lower48Stream.polygonEnd();alaskaStream.polygonEnd();hawaiiStream.polygonEnd()}}};albersUsa.precision=function(_){if(!arguments.length)return lower48.precision();lower48.precision(_);alaska.precision(_);hawaii.precision(_);return albersUsa};albersUsa.scale=function(_){if(!arguments.length)return lower48.scale();lower48.scale(_);alaska.scale(_*.35);hawaii.scale(_);return albersUsa.translate(lower48.translate())};albersUsa.translate=function(_){if(!arguments.length)return lower48.translate();var k=lower48.scale(),x=+_[0],y=+_[1];lower48Point=lower48.translate(_).clipExtent([[x-.455*k,y-.238*k],[x+.455*k,y+.238*k]]).stream(pointStream).point;alaskaPoint=alaska.translate([x-.307*k,y+.201*k]).clipExtent([[x-.425*k+ε,y+.12*k+ε],[x-.214*k-ε,y+.234*k-ε]]).stream(pointStream).point;hawaiiPoint=hawaii.translate([x-.205*k,y+.212*k]).clipExtent([[x-.214*k+ε,y+.166*k+ε],[x-.115*k-ε,y+.234*k-ε]]).stream(pointStream).point;return albersUsa};return albersUsa.scale(1070)};var d3_geo_pathAreaSum,d3_geo_pathAreaPolygon,d3_geo_pathArea={point:d3_noop,lineStart:d3_noop,lineEnd:d3_noop,polygonStart:function(){d3_geo_pathAreaPolygon=0;d3_geo_pathArea.lineStart=d3_geo_pathAreaRingStart},polygonEnd:function(){d3_geo_pathArea.lineStart=d3_geo_pathArea.lineEnd=d3_geo_pathArea.point=d3_noop;d3_geo_pathAreaSum+=abs(d3_geo_pathAreaPolygon/2)}};function d3_geo_pathAreaRingStart(){var x00,y00,x0,y0;d3_geo_pathArea.point=function(x,y){d3_geo_pathArea.point=nextPoint;x00=x0=x,y00=y0=y};function nextPoint(x,y){d3_geo_pathAreaPolygon+=y0*x-x0*y;x0=x,y0=y}d3_geo_pathArea.lineEnd=function(){nextPoint(x00,y00)}}var d3_geo_pathBoundsX0,d3_geo_pathBoundsY0,d3_geo_pathBoundsX1,d3_geo_pathBoundsY1;var d3_geo_pathBounds={point:d3_geo_pathBoundsPoint,lineStart:d3_noop,lineEnd:d3_noop,polygonStart:d3_noop,polygonEnd:d3_noop};function d3_geo_pathBoundsPoint(x,y){if(x<d3_geo_pathBoundsX0)d3_geo_pathBoundsX0=x;if(x>d3_geo_pathBoundsX1)d3_geo_pathBoundsX1=x;if(y<d3_geo_pathBoundsY0)d3_geo_pathBoundsY0=y;if(y>d3_geo_pathBoundsY1)d3_geo_pathBoundsY1=y}function d3_geo_pathBuffer(){var pointCircle=d3_geo_pathBufferCircle(4.5),buffer=[];var stream={point:point,lineStart:function(){stream.point=pointLineStart},lineEnd:lineEnd,polygonStart:function(){stream.lineEnd=lineEndPolygon},polygonEnd:function(){stream.lineEnd=lineEnd;stream.point=point},pointRadius:function(_){pointCircle=d3_geo_pathBufferCircle(_);return stream},result:function(){if(buffer.length){var result=buffer.join("");buffer=[];return result}}};function point(x,y){buffer.push("M",x,",",y,pointCircle)}function pointLineStart(x,y){buffer.push("M",x,",",y);stream.point=pointLine}function pointLine(x,y){buffer.push("L",x,",",y)}function lineEnd(){stream.point=point}function lineEndPolygon(){buffer.push("Z")}return stream}function d3_geo_pathBufferCircle(radius){return"m0,"+radius+"a"+radius+","+radius+" 0 1,1 0,"+-2*radius+"a"+radius+","+radius+" 0 1,1 0,"+2*radius+"z"}var d3_geo_pathCentroid={point:d3_geo_pathCentroidPoint,lineStart:d3_geo_pathCentroidLineStart,lineEnd:d3_geo_pathCentroidLineEnd,polygonStart:function(){d3_geo_pathCentroid.lineStart=d3_geo_pathCentroidRingStart},polygonEnd:function(){d3_geo_pathCentroid.point=d3_geo_pathCentroidPoint;d3_geo_pathCentroid.lineStart=d3_geo_pathCentroidLineStart;d3_geo_pathCentroid.lineEnd=d3_geo_pathCentroidLineEnd}};function d3_geo_pathCentroidPoint(x,y){d3_geo_centroidX0+=x;d3_geo_centroidY0+=y;++d3_geo_centroidZ0}function d3_geo_pathCentroidLineStart(){var x0,y0;d3_geo_pathCentroid.point=function(x,y){d3_geo_pathCentroid.point=nextPoint;d3_geo_pathCentroidPoint(x0=x,y0=y)};function nextPoint(x,y){var dx=x-x0,dy=y-y0,z=Math.sqrt(dx*dx+dy*dy);d3_geo_centroidX1+=z*(x0+x)/2;d3_geo_centroidY1+=z*(y0+y)/2;d3_geo_centroidZ1+=z;d3_geo_pathCentroidPoint(x0=x,y0=y)}}function d3_geo_pathCentroidLineEnd(){d3_geo_pathCentroid.point=d3_geo_pathCentroidPoint}function d3_geo_pathCentroidRingStart(){var x00,y00,x0,y0;d3_geo_pathCentroid.point=function(x,y){d3_geo_pathCentroid.point=nextPoint;d3_geo_pathCentroidPoint(x00=x0=x,y00=y0=y)};function nextPoint(x,y){var dx=x-x0,dy=y-y0,z=Math.sqrt(dx*dx+dy*dy);d3_geo_centroidX1+=z*(x0+x)/2;d3_geo_centroidY1+=z*(y0+y)/2;d3_geo_centroidZ1+=z;z=y0*x-x0*y;d3_geo_centroidX2+=z*(x0+x);d3_geo_centroidY2+=z*(y0+y);d3_geo_centroidZ2+=z*3;d3_geo_pathCentroidPoint(x0=x,y0=y)}d3_geo_pathCentroid.lineEnd=function(){nextPoint(x00,y00)}}function d3_geo_pathContext(context){var pointRadius=4.5;var stream={point:point,lineStart:function(){stream.point=pointLineStart},lineEnd:lineEnd,polygonStart:function(){stream.lineEnd=lineEndPolygon},polygonEnd:function(){stream.lineEnd=lineEnd;stream.point=point},pointRadius:function(_){pointRadius=_;return stream},result:d3_noop};function point(x,y){context.moveTo(x+pointRadius,y);context.arc(x,y,pointRadius,0,τ)}function pointLineStart(x,y){context.moveTo(x,y);stream.point=pointLine}function pointLine(x,y){context.lineTo(x,y)}function lineEnd(){stream.point=point}function lineEndPolygon(){context.closePath()}return stream}function d3_geo_resample(project){var δ2=.5,cosMinDistance=Math.cos(30*d3_radians),maxDepth=16;function resample(stream){return(maxDepth?resampleRecursive:resampleNone)(stream)}function resampleNone(stream){return d3_geo_transformPoint(stream,function(x,y){x=project(x,y);stream.point(x[0],x[1])})}function resampleRecursive(stream){var λ00,φ00,x00,y00,a00,b00,c00,λ0,x0,y0,a0,b0,c0;var resample={point:point,lineStart:lineStart,lineEnd:lineEnd,polygonStart:function(){stream.polygonStart();resample.lineStart=ringStart},polygonEnd:function(){stream.polygonEnd();resample.lineStart=lineStart}};function point(x,y){x=project(x,y);stream.point(x[0],x[1])}function lineStart(){x0=NaN;resample.point=linePoint;stream.lineStart()}function linePoint(λ,φ){var c=d3_geo_cartesian([λ,φ]),p=project(λ,φ);resampleLineTo(x0,y0,λ0,a0,b0,c0,x0=p[0],y0=p[1],λ0=λ,a0=c[0],b0=c[1],c0=c[2],maxDepth,stream);stream.point(x0,y0)}function lineEnd(){resample.point=point;stream.lineEnd()}function ringStart(){lineStart();resample.point=ringPoint;resample.lineEnd=ringEnd}function ringPoint(λ,φ){linePoint(λ00=λ,φ00=φ),x00=x0,y00=y0,a00=a0,b00=b0,c00=c0;resample.point=linePoint}function ringEnd(){resampleLineTo(x0,y0,λ0,a0,b0,c0,x00,y00,λ00,a00,b00,c00,maxDepth,stream);resample.lineEnd=lineEnd;lineEnd()}return resample}function resampleLineTo(x0,y0,λ0,a0,b0,c0,x1,y1,λ1,a1,b1,c1,depth,stream){var dx=x1-x0,dy=y1-y0,d2=dx*dx+dy*dy;if(d2>4*δ2&&depth--){var a=a0+a1,b=b0+b1,c=c0+c1,m=Math.sqrt(a*a+b*b+c*c),φ2=Math.asin(c/=m),λ2=abs(abs(c)-1)<ε||abs(λ0-λ1)<ε?(λ0+λ1)/2:Math.atan2(b,a),p=project(λ2,φ2),x2=p[0],y2=p[1],dx2=x2-x0,dy2=y2-y0,dz=dy*dx2-dx*dy2;if(dz*dz/d2>δ2||abs((dx*dx2+dy*dy2)/d2-.5)>.3||a0*a1+b0*b1+c0*c1<cosMinDistance){resampleLineTo(x0,y0,λ0,a0,b0,c0,x2,y2,λ2,a/=m,b/=m,c,depth,stream);stream.point(x2,y2);resampleLineTo(x2,y2,λ2,a,b,c,x1,y1,λ1,a1,b1,c1,depth,stream)}}}resample.precision=function(_){if(!arguments.length)return Math.sqrt(δ2);maxDepth=(δ2=_*_)>0&&16;return resample};return resample}d3.geo.path=function(){var pointRadius=4.5,projection,context,projectStream,contextStream,cacheStream;function path(object){if(object){if(typeof pointRadius==="function")contextStream.pointRadius(+pointRadius.apply(this,arguments));if(!cacheStream||!cacheStream.valid)cacheStream=projectStream(contextStream);d3.geo.stream(object,cacheStream)}return contextStream.result()}path.area=function(object){d3_geo_pathAreaSum=0;d3.geo.stream(object,projectStream(d3_geo_pathArea));return d3_geo_pathAreaSum};path.centroid=function(object){d3_geo_centroidX0=d3_geo_centroidY0=d3_geo_centroidZ0=d3_geo_centroidX1=d3_geo_centroidY1=d3_geo_centroidZ1=d3_geo_centroidX2=d3_geo_centroidY2=d3_geo_centroidZ2=0;d3.geo.stream(object,projectStream(d3_geo_pathCentroid));return d3_geo_centroidZ2?[d3_geo_centroidX2/d3_geo_centroidZ2,d3_geo_centroidY2/d3_geo_centroidZ2]:d3_geo_centroidZ1?[d3_geo_centroidX1/d3_geo_centroidZ1,d3_geo_centroidY1/d3_geo_centroidZ1]:d3_geo_centroidZ0?[d3_geo_centroidX0/d3_geo_centroidZ0,d3_geo_centroidY0/d3_geo_centroidZ0]:[NaN,NaN]};path.bounds=function(object){d3_geo_pathBoundsX1=d3_geo_pathBoundsY1=-(d3_geo_pathBoundsX0=d3_geo_pathBoundsY0=Infinity);d3.geo.stream(object,projectStream(d3_geo_pathBounds));return[[d3_geo_pathBoundsX0,d3_geo_pathBoundsY0],[d3_geo_pathBoundsX1,d3_geo_pathBoundsY1]]};path.projection=function(_){if(!arguments.length)return projection;projectStream=(projection=_)?_.stream||d3_geo_pathProjectStream(_):d3_identity;return reset()};path.context=function(_){if(!arguments.length)return context;contextStream=(context=_)==null?new d3_geo_pathBuffer:new d3_geo_pathContext(_);if(typeof pointRadius!=="function")contextStream.pointRadius(pointRadius);return reset()};path.pointRadius=function(_){if(!arguments.length)return pointRadius;pointRadius=typeof _==="function"?_:(contextStream.pointRadius(+_),+_);return path};function reset(){cacheStream=null;return path}return path.projection(d3.geo.albersUsa()).context(null)};function d3_geo_pathProjectStream(project){var resample=d3_geo_resample(function(x,y){return project([x*d3_degrees,y*d3_degrees])});return function(stream){return d3_geo_projectionRadians(resample(stream))}}d3.geo.transform=function(methods){return{stream:function(stream){var transform=new d3_geo_transform(stream);for(var k in methods)transform[k]=methods[k];return transform}}};function d3_geo_transform(stream){this.stream=stream}d3_geo_transform.prototype={point:function(x,y){this.stream.point(x,y)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function d3_geo_transformPoint(stream,point){return{point:point,sphere:function(){stream.sphere()},lineStart:function(){stream.lineStart()},lineEnd:function(){stream.lineEnd()},polygonStart:function(){stream.polygonStart()},polygonEnd:function(){stream.polygonEnd()}}}d3.geo.projection=d3_geo_projection;d3.geo.projectionMutator=d3_geo_projectionMutator;function d3_geo_projection(project){return d3_geo_projectionMutator(function(){return project})()}function d3_geo_projectionMutator(projectAt){var project,rotate,projectRotate,projectResample=d3_geo_resample(function(x,y){x=project(x,y);return[x[0]*k+δx,δy-x[1]*k]}),k=150,x=480,y=250,λ=0,φ=0,δλ=0,δφ=0,δγ=0,δx,δy,preclip=d3_geo_clipAntimeridian,postclip=d3_identity,clipAngle=null,clipExtent=null,stream;function projection(point){point=projectRotate(point[0]*d3_radians,point[1]*d3_radians);return[point[0]*k+δx,δy-point[1]*k]}function invert(point){point=projectRotate.invert((point[0]-δx)/k,(δy-point[1])/k);return point&&[point[0]*d3_degrees,point[1]*d3_degrees]}projection.stream=function(output){if(stream)stream.valid=false;stream=d3_geo_projectionRadians(preclip(rotate,projectResample(postclip(output))));stream.valid=true;return stream};projection.clipAngle=function(_){if(!arguments.length)return clipAngle;preclip=_==null?(clipAngle=_,d3_geo_clipAntimeridian):d3_geo_clipCircle((clipAngle=+_)*d3_radians);return invalidate()};projection.clipExtent=function(_){if(!arguments.length)return clipExtent;clipExtent=_;postclip=_?d3_geo_clipExtent(_[0][0],_[0][1],_[1][0],_[1][1]):d3_identity;return invalidate()};projection.scale=function(_){if(!arguments.length)return k;k=+_;return reset()};projection.translate=function(_){if(!arguments.length)return[x,y];x=+_[0];y=+_[1];return reset()};projection.center=function(_){if(!arguments.length)return[λ*d3_degrees,φ*d3_degrees];λ=_[0]%360*d3_radians;φ=_[1]%360*d3_radians;return reset()};projection.rotate=function(_){if(!arguments.length)return[δλ*d3_degrees,δφ*d3_degrees,δγ*d3_degrees];δλ=_[0]%360*d3_radians;δφ=_[1]%360*d3_radians;δγ=_.length>2?_[2]%360*d3_radians:0;return reset()};d3.rebind(projection,projectResample,"precision");function reset(){projectRotate=d3_geo_compose(rotate=d3_geo_rotation(δλ,δφ,δγ),project);var center=project(λ,φ);δx=x-center[0]*k;δy=y+center[1]*k;return invalidate()}function invalidate(){if(stream)stream.valid=false,stream=null;return projection}return function(){project=projectAt.apply(this,arguments);projection.invert=project.invert&&invert;return reset()}}function d3_geo_projectionRadians(stream){return d3_geo_transformPoint(stream,function(x,y){stream.point(x*d3_radians,y*d3_radians)})}function d3_geo_equirectangular(λ,φ){return[λ,φ]}(d3.geo.equirectangular=function(){return d3_geo_projection(d3_geo_equirectangular)}).raw=d3_geo_equirectangular.invert=d3_geo_equirectangular;d3.geo.rotation=function(rotate){rotate=d3_geo_rotation(rotate[0]%360*d3_radians,rotate[1]*d3_radians,rotate.length>2?rotate[2]*d3_radians:0);function forward(coordinates){coordinates=rotate(coordinates[0]*d3_radians,coordinates[1]*d3_radians);return coordinates[0]*=d3_degrees,coordinates[1]*=d3_degrees,coordinates}forward.invert=function(coordinates){coordinates=rotate.invert(coordinates[0]*d3_radians,coordinates[1]*d3_radians);return coordinates[0]*=d3_degrees,coordinates[1]*=d3_degrees,coordinates};return forward};function d3_geo_identityRotation(λ,φ){return[λ>π?λ-τ:λ<-π?λ+τ:λ,φ]}d3_geo_identityRotation.invert=d3_geo_equirectangular;function d3_geo_rotation(δλ,δφ,δγ){return δλ?δφ||δγ?d3_geo_compose(d3_geo_rotationλ(δλ),d3_geo_rotationφγ(δφ,δγ)):d3_geo_rotationλ(δλ):δφ||δγ?d3_geo_rotationφγ(δφ,δγ):d3_geo_identityRotation}function d3_geo_forwardRotationλ(δλ){return function(λ,φ){return λ+=δλ,[λ>π?λ-τ:λ<-π?λ+τ:λ,φ]}}function d3_geo_rotationλ(δλ){var rotation=d3_geo_forwardRotationλ(δλ);rotation.invert=d3_geo_forwardRotationλ(-δλ);return rotation}function d3_geo_rotationφγ(δφ,δγ){var cosδφ=Math.cos(δφ),sinδφ=Math.sin(δφ),cosδγ=Math.cos(δγ),sinδγ=Math.sin(δγ);function rotation(λ,φ){var cosφ=Math.cos(φ),x=Math.cos(λ)*cosφ,y=Math.sin(λ)*cosφ,z=Math.sin(φ),k=z*cosδφ+x*sinδφ;return[Math.atan2(y*cosδγ-k*sinδγ,x*cosδφ-z*sinδφ),d3_asin(k*cosδγ+y*sinδγ)]}rotation.invert=function(λ,φ){var cosφ=Math.cos(φ),x=Math.cos(λ)*cosφ,y=Math.sin(λ)*cosφ,z=Math.sin(φ),k=z*cosδγ-y*sinδγ;return[Math.atan2(y*cosδγ+z*sinδγ,x*cosδφ+k*sinδφ),d3_asin(k*cosδφ-x*sinδφ)]};return rotation}d3.geo.circle=function(){var origin=[0,0],angle,precision=6,interpolate;function circle(){var center=typeof origin==="function"?origin.apply(this,arguments):origin,rotate=d3_geo_rotation(-center[0]*d3_radians,-center[1]*d3_radians,0).invert,ring=[];interpolate(null,null,1,{point:function(x,y){ring.push(x=rotate(x,y));x[0]*=d3_degrees,x[1]*=d3_degrees}});return{type:"Polygon",coordinates:[ring]}}circle.origin=function(x){if(!arguments.length)return origin;origin=x;return circle};circle.angle=function(x){if(!arguments.length)return angle;interpolate=d3_geo_circleInterpolate((angle=+x)*d3_radians,precision*d3_radians);return circle};circle.precision=function(_){if(!arguments.length)return precision;interpolate=d3_geo_circleInterpolate(angle*d3_radians,(precision=+_)*d3_radians);return circle};return circle.angle(90)};function d3_geo_circleInterpolate(radius,precision){var cr=Math.cos(radius),sr=Math.sin(radius);return function(from,to,direction,listener){var step=direction*precision;if(from!=null){from=d3_geo_circleAngle(cr,from);to=d3_geo_circleAngle(cr,to);if(direction>0?from<to:from>to)from+=direction*τ}else{from=radius+direction*τ;to=radius-.5*step}for(var point,t=from;direction>0?t>to:t<to;t-=step){listener.point((point=d3_geo_spherical([cr,-sr*Math.cos(t),-sr*Math.sin(t)]))[0],point[1])}}}function d3_geo_circleAngle(cr,point){var a=d3_geo_cartesian(point);a[0]-=cr;d3_geo_cartesianNormalize(a);var angle=d3_acos(-a[1]);return((-a[2]<0?-angle:angle)+2*Math.PI-ε)%(2*Math.PI)}d3.geo.distance=function(a,b){var Δλ=(b[0]-a[0])*d3_radians,φ0=a[1]*d3_radians,φ1=b[1]*d3_radians,sinΔλ=Math.sin(Δλ),cosΔλ=Math.cos(Δλ),sinφ0=Math.sin(φ0),cosφ0=Math.cos(φ0),sinφ1=Math.sin(φ1),cosφ1=Math.cos(φ1),t;return Math.atan2(Math.sqrt((t=cosφ1*sinΔλ)*t+(t=cosφ0*sinφ1-sinφ0*cosφ1*cosΔλ)*t),sinφ0*sinφ1+cosφ0*cosφ1*cosΔλ)};d3.geo.graticule=function(){var x1,x0,X1,X0,y1,y0,Y1,Y0,dx=10,dy=dx,DX=90,DY=360,x,y,X,Y,precision=2.5;function graticule(){return{type:"MultiLineString",coordinates:lines()}}function lines(){return d3.range(Math.ceil(X0/DX)*DX,X1,DX).map(X).concat(d3.range(Math.ceil(Y0/DY)*DY,Y1,DY).map(Y)).concat(d3.range(Math.ceil(x0/dx)*dx,x1,dx).filter(function(x){return abs(x%DX)>ε}).map(x)).concat(d3.range(Math.ceil(y0/dy)*dy,y1,dy).filter(function(y){return abs(y%DY)>ε}).map(y))}graticule.lines=function(){return lines().map(function(coordinates){return{type:"LineString",coordinates:coordinates}})};graticule.outline=function(){return{type:"Polygon",coordinates:[X(X0).concat(Y(Y1).slice(1),X(X1).reverse().slice(1),Y(Y0).reverse().slice(1))]}};graticule.extent=function(_){if(!arguments.length)return graticule.minorExtent();return graticule.majorExtent(_).minorExtent(_)};graticule.majorExtent=function(_){if(!arguments.length)return[[X0,Y0],[X1,Y1]];X0=+_[0][0],X1=+_[1][0];Y0=+_[0][1],Y1=+_[1][1];if(X0>X1)_=X0,X0=X1,X1=_;if(Y0>Y1)_=Y0,Y0=Y1,Y1=_;return graticule.precision(precision)};graticule.minorExtent=function(_){if(!arguments.length)return[[x0,y0],[x1,y1]];x0=+_[0][0],x1=+_[1][0];y0=+_[0][1],y1=+_[1][1];if(x0>x1)_=x0,x0=x1,x1=_;if(y0>y1)_=y0,y0=y1,y1=_;return graticule.precision(precision)};graticule.step=function(_){if(!arguments.length)return graticule.minorStep();return graticule.majorStep(_).minorStep(_)};graticule.majorStep=function(_){if(!arguments.length)return[DX,DY];DX=+_[0],DY=+_[1];return graticule};graticule.minorStep=function(_){if(!arguments.length)return[dx,dy];dx=+_[0],dy=+_[1];return graticule};graticule.precision=function(_){if(!arguments.length)return precision;precision=+_;x=d3_geo_graticuleX(y0,y1,90);y=d3_geo_graticuleY(x0,x1,precision);X=d3_geo_graticuleX(Y0,Y1,90);Y=d3_geo_graticuleY(X0,X1,precision);return graticule};return graticule.majorExtent([[-180,-90+ε],[180,90-ε]]).minorExtent([[-180,-80-ε],[180,80+ε]])};function d3_geo_graticuleX(y0,y1,dy){var y=d3.range(y0,y1-ε,dy).concat(y1);return function(x){return y.map(function(y){return[x,y]})}}function d3_geo_graticuleY(x0,x1,dx){var x=d3.range(x0,x1-ε,dx).concat(x1);return function(y){return x.map(function(x){return[x,y]})}}function d3_source(d){return d.source}function d3_target(d){return d.target}d3.geo.greatArc=function(){var source=d3_source,source_,target=d3_target,target_;function greatArc(){return{type:"LineString",coordinates:[source_||source.apply(this,arguments),target_||target.apply(this,arguments)]}}greatArc.distance=function(){return d3.geo.distance(source_||source.apply(this,arguments),target_||target.apply(this,arguments))};greatArc.source=function(_){if(!arguments.length)return source;source=_,source_=typeof _==="function"?null:_;return greatArc};greatArc.target=function(_){if(!arguments.length)return target;target=_,target_=typeof _==="function"?null:_;return greatArc};greatArc.precision=function(){return arguments.length?greatArc:0};return greatArc};d3.geo.interpolate=function(source,target){return d3_geo_interpolate(source[0]*d3_radians,source[1]*d3_radians,target[0]*d3_radians,target[1]*d3_radians)};function d3_geo_interpolate(x0,y0,x1,y1){var cy0=Math.cos(y0),sy0=Math.sin(y0),cy1=Math.cos(y1),sy1=Math.sin(y1),kx0=cy0*Math.cos(x0),ky0=cy0*Math.sin(x0),kx1=cy1*Math.cos(x1),ky1=cy1*Math.sin(x1),d=2*Math.asin(Math.sqrt(d3_haversin(y1-y0)+cy0*cy1*d3_haversin(x1-x0))),k=1/Math.sin(d);var interpolate=d?function(t){var B=Math.sin(t*=d)*k,A=Math.sin(d-t)*k,x=A*kx0+B*kx1,y=A*ky0+B*ky1,z=A*sy0+B*sy1;return[Math.atan2(y,x)*d3_degrees,Math.atan2(z,Math.sqrt(x*x+y*y))*d3_degrees]}:function(){return[x0*d3_degrees,y0*d3_degrees]};interpolate.distance=d;return interpolate}d3.geo.length=function(object){d3_geo_lengthSum=0;d3.geo.stream(object,d3_geo_length);return d3_geo_lengthSum};var d3_geo_lengthSum;var d3_geo_length={sphere:d3_noop,point:d3_noop,lineStart:d3_geo_lengthLineStart,lineEnd:d3_noop,polygonStart:d3_noop,polygonEnd:d3_noop};function d3_geo_lengthLineStart(){var λ0,sinφ0,cosφ0;d3_geo_length.point=function(λ,φ){λ0=λ*d3_radians,sinφ0=Math.sin(φ*=d3_radians),cosφ0=Math.cos(φ);d3_geo_length.point=nextPoint};d3_geo_length.lineEnd=function(){d3_geo_length.point=d3_geo_length.lineEnd=d3_noop};function nextPoint(λ,φ){var sinφ=Math.sin(φ*=d3_radians),cosφ=Math.cos(φ),t=abs((λ*=d3_radians)-λ0),cosΔλ=Math.cos(t);d3_geo_lengthSum+=Math.atan2(Math.sqrt((t=cosφ*Math.sin(t))*t+(t=cosφ0*sinφ-sinφ0*cosφ*cosΔλ)*t),sinφ0*sinφ+cosφ0*cosφ*cosΔλ);λ0=λ,sinφ0=sinφ,cosφ0=cosφ}}function d3_geo_azimuthal(scale,angle){function azimuthal(λ,φ){var cosλ=Math.cos(λ),cosφ=Math.cos(φ),k=scale(cosλ*cosφ);return[k*cosφ*Math.sin(λ),k*Math.sin(φ)]}azimuthal.invert=function(x,y){var ρ=Math.sqrt(x*x+y*y),c=angle(ρ),sinc=Math.sin(c),cosc=Math.cos(c);return[Math.atan2(x*sinc,ρ*cosc),Math.asin(ρ&&y*sinc/ρ)]};return azimuthal}var d3_geo_azimuthalEqualArea=d3_geo_azimuthal(function(cosλcosφ){return Math.sqrt(2/(1+cosλcosφ))},function(ρ){return 2*Math.asin(ρ/2)});(d3.geo.azimuthalEqualArea=function(){return d3_geo_projection(d3_geo_azimuthalEqualArea)}).raw=d3_geo_azimuthalEqualArea;var d3_geo_azimuthalEquidistant=d3_geo_azimuthal(function(cosλcosφ){var c=Math.acos(cosλcosφ);return c&&c/Math.sin(c)},d3_identity);(d3.geo.azimuthalEquidistant=function(){return d3_geo_projection(d3_geo_azimuthalEquidistant)}).raw=d3_geo_azimuthalEquidistant;function d3_geo_conicConformal(φ0,φ1){var cosφ0=Math.cos(φ0),t=function(φ){return Math.tan(π/4+φ/2)},n=φ0===φ1?Math.sin(φ0):Math.log(cosφ0/Math.cos(φ1))/Math.log(t(φ1)/t(φ0)),F=cosφ0*Math.pow(t(φ0),n)/n;if(!n)return d3_geo_mercator;function forward(λ,φ){if(F>0){if(φ<-halfπ+ε)φ=-halfπ+ε}else{if(φ>halfπ-ε)φ=halfπ-ε}var ρ=F/Math.pow(t(φ),n);return[ρ*Math.sin(n*λ),F-ρ*Math.cos(n*λ)]}forward.invert=function(x,y){var ρ0_y=F-y,ρ=d3_sgn(n)*Math.sqrt(x*x+ρ0_y*ρ0_y);return[Math.atan2(x,ρ0_y)/n,2*Math.atan(Math.pow(F/ρ,1/n))-halfπ]};return forward}(d3.geo.conicConformal=function(){return d3_geo_conic(d3_geo_conicConformal)}).raw=d3_geo_conicConformal;function d3_geo_conicEquidistant(φ0,φ1){var cosφ0=Math.cos(φ0),n=φ0===φ1?Math.sin(φ0):(cosφ0-Math.cos(φ1))/(φ1-φ0),G=cosφ0/n+φ0;if(abs(n)<ε)return d3_geo_equirectangular;function forward(λ,φ){var ρ=G-φ;return[ρ*Math.sin(n*λ),G-ρ*Math.cos(n*λ)]}forward.invert=function(x,y){var ρ0_y=G-y;return[Math.atan2(x,ρ0_y)/n,G-d3_sgn(n)*Math.sqrt(x*x+ρ0_y*ρ0_y)]};return forward}(d3.geo.conicEquidistant=function(){return d3_geo_conic(d3_geo_conicEquidistant)}).raw=d3_geo_conicEquidistant;var d3_geo_gnomonic=d3_geo_azimuthal(function(cosλcosφ){return 1/cosλcosφ},Math.atan);(d3.geo.gnomonic=function(){return d3_geo_projection(d3_geo_gnomonic)}).raw=d3_geo_gnomonic;function d3_geo_mercator(λ,φ){return[λ,Math.log(Math.tan(π/4+φ/2))]}d3_geo_mercator.invert=function(x,y){return[x,2*Math.atan(Math.exp(y))-halfπ]};function d3_geo_mercatorProjection(project){var m=d3_geo_projection(project),scale=m.scale,translate=m.translate,clipExtent=m.clipExtent,clipAuto;m.scale=function(){var v=scale.apply(m,arguments);return v===m?clipAuto?m.clipExtent(null):m:v};m.translate=function(){var v=translate.apply(m,arguments);return v===m?clipAuto?m.clipExtent(null):m:v};m.clipExtent=function(_){var v=clipExtent.apply(m,arguments);if(v===m){if(clipAuto=_==null){var k=π*scale(),t=translate();clipExtent([[t[0]-k,t[1]-k],[t[0]+k,t[1]+k]])}}else if(clipAuto){v=null}return v};return m.clipExtent(null)}(d3.geo.mercator=function(){return d3_geo_mercatorProjection(d3_geo_mercator)}).raw=d3_geo_mercator;var d3_geo_orthographic=d3_geo_azimuthal(function(){return 1},Math.asin);(d3.geo.orthographic=function(){return d3_geo_projection(d3_geo_orthographic)}).raw=d3_geo_orthographic;var d3_geo_stereographic=d3_geo_azimuthal(function(cosλcosφ){return 1/(1+cosλcosφ)},function(ρ){return 2*Math.atan(ρ)});(d3.geo.stereographic=function(){return d3_geo_projection(d3_geo_stereographic)}).raw=d3_geo_stereographic;function d3_geo_transverseMercator(λ,φ){return[Math.log(Math.tan(π/4+φ/2)),-λ]}d3_geo_transverseMercator.invert=function(x,y){return[-y,2*Math.atan(Math.exp(x))-halfπ]};(d3.geo.transverseMercator=function(){var projection=d3_geo_mercatorProjection(d3_geo_transverseMercator),center=projection.center,rotate=projection.rotate;projection.center=function(_){return _?center([-_[1],_[0]]):(_=center(),[_[1],-_[0]])};projection.rotate=function(_){return _?rotate([_[0],_[1],_.length>2?_[2]+90:90]):(_=rotate(),[_[0],_[1],_[2]-90])};return rotate([0,0,90])}).raw=d3_geo_transverseMercator;d3.geom={};function d3_geom_pointX(d){return d[0]}function d3_geom_pointY(d){return d[1]}d3.geom.hull=function(vertices){var x=d3_geom_pointX,y=d3_geom_pointY;if(arguments.length)return hull(vertices);function hull(data){if(data.length<3)return[];var fx=d3_functor(x),fy=d3_functor(y),i,n=data.length,points=[],flippedPoints=[];for(i=0;i<n;i++){points.push([+fx.call(this,data[i],i),+fy.call(this,data[i],i),i])}points.sort(d3_geom_hullOrder);for(i=0;i<n;i++)flippedPoints.push([points[i][0],-points[i][1]]);var upper=d3_geom_hullUpper(points),lower=d3_geom_hullUpper(flippedPoints);var skipLeft=lower[0]===upper[0],skipRight=lower[lower.length-1]===upper[upper.length-1],polygon=[];for(i=upper.length-1;i>=0;--i)polygon.push(data[points[upper[i]][2]]);for(i=+skipLeft;i<lower.length-skipRight;++i)polygon.push(data[points[lower[i]][2]]);return polygon}hull.x=function(_){return arguments.length?(x=_,hull):x};hull.y=function(_){return arguments.length?(y=_,hull):y};return hull};function d3_geom_hullUpper(points){var n=points.length,hull=[0,1],hs=2;for(var i=2;i<n;i++){while(hs>1&&d3_cross2d(points[hull[hs-2]],points[hull[hs-1]],points[i])<=0)--hs;hull[hs++]=i}return hull.slice(0,hs)}function d3_geom_hullOrder(a,b){return a[0]-b[0]||a[1]-b[1]}d3.geom.polygon=function(coordinates){d3_subclass(coordinates,d3_geom_polygonPrototype);return coordinates};var d3_geom_polygonPrototype=d3.geom.polygon.prototype=[];d3_geom_polygonPrototype.area=function(){var i=-1,n=this.length,a,b=this[n-1],area=0;while(++i<n){a=b;b=this[i];area+=a[1]*b[0]-a[0]*b[1]}return area*.5};d3_geom_polygonPrototype.centroid=function(k){var i=-1,n=this.length,x=0,y=0,a,b=this[n-1],c;if(!arguments.length)k=-1/(6*this.area());while(++i<n){a=b;b=this[i];c=a[0]*b[1]-b[0]*a[1];x+=(a[0]+b[0])*c;y+=(a[1]+b[1])*c}return[x*k,y*k]};d3_geom_polygonPrototype.clip=function(subject){var input,closed=d3_geom_polygonClosed(subject),i=-1,n=this.length-d3_geom_polygonClosed(this),j,m,a=this[n-1],b,c,d;while(++i<n){input=subject.slice();subject.length=0;b=this[i];c=input[(m=input.length-closed)-1];j=-1;while(++j<m){d=input[j];if(d3_geom_polygonInside(d,a,b)){if(!d3_geom_polygonInside(c,a,b)){subject.push(d3_geom_polygonIntersect(c,d,a,b))}subject.push(d)}else if(d3_geom_polygonInside(c,a,b)){subject.push(d3_geom_polygonIntersect(c,d,a,b))}c=d}if(closed)subject.push(subject[0]);a=b}return subject};function d3_geom_polygonInside(p,a,b){return(b[0]-a[0])*(p[1]-a[1])<(b[1]-a[1])*(p[0]-a[0])}function d3_geom_polygonIntersect(c,d,a,b){var x1=c[0],x3=a[0],x21=d[0]-x1,x43=b[0]-x3,y1=c[1],y3=a[1],y21=d[1]-y1,y43=b[1]-y3,ua=(x43*(y1-y3)-y43*(x1-x3))/(y43*x21-x43*y21);return[x1+ua*x21,y1+ua*y21]}function d3_geom_polygonClosed(coordinates){var a=coordinates[0],b=coordinates[coordinates.length-1];return!(a[0]-b[0]||a[1]-b[1])}var d3_geom_voronoiEdges,d3_geom_voronoiCells,d3_geom_voronoiBeaches,d3_geom_voronoiBeachPool=[],d3_geom_voronoiFirstCircle,d3_geom_voronoiCircles,d3_geom_voronoiCirclePool=[];function d3_geom_voronoiBeach(){d3_geom_voronoiRedBlackNode(this);this.edge=this.site=this.circle=null}function d3_geom_voronoiCreateBeach(site){var beach=d3_geom_voronoiBeachPool.pop()||new d3_geom_voronoiBeach;beach.site=site;return beach}function d3_geom_voronoiDetachBeach(beach){d3_geom_voronoiDetachCircle(beach);d3_geom_voronoiBeaches.remove(beach);d3_geom_voronoiBeachPool.push(beach);d3_geom_voronoiRedBlackNode(beach)}function d3_geom_voronoiRemoveBeach(beach){var circle=beach.circle,x=circle.x,y=circle.cy,vertex={x:x,y:y},previous=beach.P,next=beach.N,disappearing=[beach];d3_geom_voronoiDetachBeach(beach);var lArc=previous;while(lArc.circle&&abs(x-lArc.circle.x)<ε&&abs(y-lArc.circle.cy)<ε){previous=lArc.P;disappearing.unshift(lArc);d3_geom_voronoiDetachBeach(lArc);lArc=previous}disappearing.unshift(lArc);d3_geom_voronoiDetachCircle(lArc);var rArc=next;while(rArc.circle&&abs(x-rArc.circle.x)<ε&&abs(y-rArc.circle.cy)<ε){next=rArc.N;disappearing.push(rArc);d3_geom_voronoiDetachBeach(rArc);rArc=next}disappearing.push(rArc);d3_geom_voronoiDetachCircle(rArc);var nArcs=disappearing.length,iArc;for(iArc=1;iArc<nArcs;++iArc){rArc=disappearing[iArc];lArc=disappearing[iArc-1];d3_geom_voronoiSetEdgeEnd(rArc.edge,lArc.site,rArc.site,vertex)}lArc=disappearing[0];rArc=disappearing[nArcs-1];rArc.edge=d3_geom_voronoiCreateEdge(lArc.site,rArc.site,null,vertex);d3_geom_voronoiAttachCircle(lArc);d3_geom_voronoiAttachCircle(rArc)}function d3_geom_voronoiAddBeach(site){var x=site.x,directrix=site.y,lArc,rArc,dxl,dxr,node=d3_geom_voronoiBeaches._;while(node){dxl=d3_geom_voronoiLeftBreakPoint(node,directrix)-x;if(dxl>ε)node=node.L;else{dxr=x-d3_geom_voronoiRightBreakPoint(node,directrix);if(dxr>ε){if(!node.R){lArc=node;break}node=node.R}else{if(dxl>-ε){lArc=node.P;rArc=node}else if(dxr>-ε){lArc=node;rArc=node.N}else{lArc=rArc=node}break}}}var newArc=d3_geom_voronoiCreateBeach(site);d3_geom_voronoiBeaches.insert(lArc,newArc);if(!lArc&&!rArc)return;if(lArc===rArc){d3_geom_voronoiDetachCircle(lArc);rArc=d3_geom_voronoiCreateBeach(lArc.site);d3_geom_voronoiBeaches.insert(newArc,rArc);newArc.edge=rArc.edge=d3_geom_voronoiCreateEdge(lArc.site,newArc.site);d3_geom_voronoiAttachCircle(lArc);d3_geom_voronoiAttachCircle(rArc);return}if(!rArc){newArc.edge=d3_geom_voronoiCreateEdge(lArc.site,newArc.site);return}d3_geom_voronoiDetachCircle(lArc);d3_geom_voronoiDetachCircle(rArc);var lSite=lArc.site,ax=lSite.x,ay=lSite.y,bx=site.x-ax,by=site.y-ay,rSite=rArc.site,cx=rSite.x-ax,cy=rSite.y-ay,d=2*(bx*cy-by*cx),hb=bx*bx+by*by,hc=cx*cx+cy*cy,vertex={x:(cy*hb-by*hc)/d+ax,y:(bx*hc-cx*hb)/d+ay};d3_geom_voronoiSetEdgeEnd(rArc.edge,lSite,rSite,vertex);newArc.edge=d3_geom_voronoiCreateEdge(lSite,site,null,vertex);rArc.edge=d3_geom_voronoiCreateEdge(site,rSite,null,vertex);d3_geom_voronoiAttachCircle(lArc);d3_geom_voronoiAttachCircle(rArc)}function d3_geom_voronoiLeftBreakPoint(arc,directrix){var site=arc.site,rfocx=site.x,rfocy=site.y,pby2=rfocy-directrix;if(!pby2)return rfocx;var lArc=arc.P;if(!lArc)return-Infinity;site=lArc.site;var lfocx=site.x,lfocy=site.y,plby2=lfocy-directrix;if(!plby2)return lfocx;var hl=lfocx-rfocx,aby2=1/pby2-1/plby2,b=hl/plby2;if(aby2)return(-b+Math.sqrt(b*b-2*aby2*(hl*hl/(-2*plby2)-lfocy+plby2/2+rfocy-pby2/2)))/aby2+rfocx;return(rfocx+lfocx)/2}function d3_geom_voronoiRightBreakPoint(arc,directrix){var rArc=arc.N;if(rArc)return d3_geom_voronoiLeftBreakPoint(rArc,directrix);var site=arc.site;return site.y===directrix?site.x:Infinity}function d3_geom_voronoiCell(site){this.site=site;this.edges=[]}d3_geom_voronoiCell.prototype.prepare=function(){var halfEdges=this.edges,iHalfEdge=halfEdges.length,edge;while(iHalfEdge--){edge=halfEdges[iHalfEdge].edge;if(!edge.b||!edge.a)halfEdges.splice(iHalfEdge,1)}halfEdges.sort(d3_geom_voronoiHalfEdgeOrder);return halfEdges.length};function d3_geom_voronoiCloseCells(extent){var x0=extent[0][0],x1=extent[1][0],y0=extent[0][1],y1=extent[1][1],x2,y2,x3,y3,cells=d3_geom_voronoiCells,iCell=cells.length,cell,iHalfEdge,halfEdges,nHalfEdges,start,end;while(iCell--){cell=cells[iCell];if(!cell||!cell.prepare())continue;halfEdges=cell.edges;nHalfEdges=halfEdges.length;iHalfEdge=0;while(iHalfEdge<nHalfEdges){end=halfEdges[iHalfEdge].end(),x3=end.x,y3=end.y;start=halfEdges[++iHalfEdge%nHalfEdges].start(),x2=start.x,y2=start.y;if(abs(x3-x2)>ε||abs(y3-y2)>ε){halfEdges.splice(iHalfEdge,0,new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site,end,abs(x3-x0)<ε&&y1-y3>ε?{x:x0,y:abs(x2-x0)<ε?y2:y1}:abs(y3-y1)<ε&&x1-x3>ε?{x:abs(y2-y1)<ε?x2:x1,y:y1}:abs(x3-x1)<ε&&y3-y0>ε?{x:x1,y:abs(x2-x1)<ε?y2:y0}:abs(y3-y0)<ε&&x3-x0>ε?{x:abs(y2-y0)<ε?x2:x0,y:y0}:null),cell.site,null));++nHalfEdges}}}}function d3_geom_voronoiHalfEdgeOrder(a,b){return b.angle-a.angle}function d3_geom_voronoiCircle(){d3_geom_voronoiRedBlackNode(this);this.x=this.y=this.arc=this.site=this.cy=null}function d3_geom_voronoiAttachCircle(arc){var lArc=arc.P,rArc=arc.N;if(!lArc||!rArc)return;var lSite=lArc.site,cSite=arc.site,rSite=rArc.site;if(lSite===rSite)return;var bx=cSite.x,by=cSite.y,ax=lSite.x-bx,ay=lSite.y-by,cx=rSite.x-bx,cy=rSite.y-by;var d=2*(ax*cy-ay*cx);if(d>=-ε2)return;var ha=ax*ax+ay*ay,hc=cx*cx+cy*cy,x=(cy*ha-ay*hc)/d,y=(ax*hc-cx*ha)/d,cy=y+by;var circle=d3_geom_voronoiCirclePool.pop()||new d3_geom_voronoiCircle;circle.arc=arc;circle.site=cSite;circle.x=x+bx;circle.y=cy+Math.sqrt(x*x+y*y);circle.cy=cy;arc.circle=circle;var before=null,node=d3_geom_voronoiCircles._;while(node){if(circle.y<node.y||circle.y===node.y&&circle.x<=node.x){if(node.L)node=node.L;else{before=node.P;break}}else{if(node.R)node=node.R;else{before=node;break}}}d3_geom_voronoiCircles.insert(before,circle);if(!before)d3_geom_voronoiFirstCircle=circle}function d3_geom_voronoiDetachCircle(arc){var circle=arc.circle;if(circle){if(!circle.P)d3_geom_voronoiFirstCircle=circle.N;d3_geom_voronoiCircles.remove(circle);d3_geom_voronoiCirclePool.push(circle);d3_geom_voronoiRedBlackNode(circle);arc.circle=null}}function d3_geom_voronoiClipEdges(extent){var edges=d3_geom_voronoiEdges,clip=d3_geom_clipLine(extent[0][0],extent[0][1],extent[1][0],extent[1][1]),i=edges.length,e;while(i--){e=edges[i];if(!d3_geom_voronoiConnectEdge(e,extent)||!clip(e)||abs(e.a.x-e.b.x)<ε&&abs(e.a.y-e.b.y)<ε){e.a=e.b=null;edges.splice(i,1)}}}function d3_geom_voronoiConnectEdge(edge,extent){var vb=edge.b;if(vb)return true;var va=edge.a,x0=extent[0][0],x1=extent[1][0],y0=extent[0][1],y1=extent[1][1],lSite=edge.l,rSite=edge.r,lx=lSite.x,ly=lSite.y,rx=rSite.x,ry=rSite.y,fx=(lx+rx)/2,fy=(ly+ry)/2,fm,fb;if(ry===ly){if(fx<x0||fx>=x1)return;if(lx>rx){if(!va)va={x:fx,y:y0};else if(va.y>=y1)return;vb={x:fx,y:y1}}else{if(!va)va={x:fx,y:y1};else if(va.y<y0)return;vb={x:fx,y:y0}}}else{fm=(lx-rx)/(ry-ly);fb=fy-fm*fx;if(fm<-1||fm>1){if(lx>rx){if(!va)va={x:(y0-fb)/fm,y:y0};else if(va.y>=y1)return;vb={x:(y1-fb)/fm,y:y1}}else{if(!va)va={x:(y1-fb)/fm,y:y1};else if(va.y<y0)return;vb={x:(y0-fb)/fm,y:y0}}}else{if(ly<ry){if(!va)va={x:x0,y:fm*x0+fb};else if(va.x>=x1)return;vb={x:x1,y:fm*x1+fb}}else{if(!va)va={x:x1,y:fm*x1+fb};else if(va.x<x0)return;vb={x:x0,y:fm*x0+fb}}}}edge.a=va;edge.b=vb;return true}function d3_geom_voronoiEdge(lSite,rSite){this.l=lSite;this.r=rSite;this.a=this.b=null}function d3_geom_voronoiCreateEdge(lSite,rSite,va,vb){var edge=new d3_geom_voronoiEdge(lSite,rSite);d3_geom_voronoiEdges.push(edge);if(va)d3_geom_voronoiSetEdgeEnd(edge,lSite,rSite,va);if(vb)d3_geom_voronoiSetEdgeEnd(edge,rSite,lSite,vb);d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge,lSite,rSite));d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge,rSite,lSite));return edge}function d3_geom_voronoiCreateBorderEdge(lSite,va,vb){var edge=new d3_geom_voronoiEdge(lSite,null);edge.a=va;edge.b=vb;d3_geom_voronoiEdges.push(edge);return edge}function d3_geom_voronoiSetEdgeEnd(edge,lSite,rSite,vertex){if(!edge.a&&!edge.b){edge.a=vertex;edge.l=lSite;edge.r=rSite}else if(edge.l===rSite){edge.b=vertex}else{edge.a=vertex}}function d3_geom_voronoiHalfEdge(edge,lSite,rSite){var va=edge.a,vb=edge.b;this.edge=edge;this.site=lSite;this.angle=rSite?Math.atan2(rSite.y-lSite.y,rSite.x-lSite.x):edge.l===lSite?Math.atan2(vb.x-va.x,va.y-vb.y):Math.atan2(va.x-vb.x,vb.y-va.y)}d3_geom_voronoiHalfEdge.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}};function d3_geom_voronoiRedBlackTree(){this._=null}function d3_geom_voronoiRedBlackNode(node){node.U=node.C=node.L=node.R=node.P=node.N=null}d3_geom_voronoiRedBlackTree.prototype={insert:function(after,node){var parent,grandpa,uncle;if(after){node.P=after;node.N=after.N;if(after.N)after.N.P=node;after.N=node;if(after.R){after=after.R;while(after.L)after=after.L;after.L=node}else{after.R=node}parent=after}else if(this._){after=d3_geom_voronoiRedBlackFirst(this._);node.P=null;node.N=after;after.P=after.L=node;parent=after}else{node.P=node.N=null;this._=node;parent=null}node.L=node.R=null;node.U=parent;node.C=true;after=node;while(parent&&parent.C){grandpa=parent.U;if(parent===grandpa.L){uncle=grandpa.R;if(uncle&&uncle.C){parent.C=uncle.C=false;grandpa.C=true;after=grandpa}else{if(after===parent.R){d3_geom_voronoiRedBlackRotateLeft(this,parent);after=parent;parent=after.U}parent.C=false;grandpa.C=true;d3_geom_voronoiRedBlackRotateRight(this,grandpa)}}else{uncle=grandpa.L;if(uncle&&uncle.C){parent.C=uncle.C=false;grandpa.C=true;after=grandpa}else{if(after===parent.L){d3_geom_voronoiRedBlackRotateRight(this,parent);after=parent;parent=after.U}parent.C=false;grandpa.C=true;d3_geom_voronoiRedBlackRotateLeft(this,grandpa)}}parent=after.U}this._.C=false},remove:function(node){if(node.N)node.N.P=node.P;if(node.P)node.P.N=node.N;node.N=node.P=null;var parent=node.U,sibling,left=node.L,right=node.R,next,red;if(!left)next=right;else if(!right)next=left;else next=d3_geom_voronoiRedBlackFirst(right);if(parent){if(parent.L===node)parent.L=next;else parent.R=next}else{this._=next}if(left&&right){red=next.C;next.C=node.C;next.L=left;left.U=next;if(next!==right){parent=next.U;next.U=node.U;node=next.R;parent.L=node;next.R=right;right.U=next}else{next.U=parent;parent=next;node=next.R}}else{red=node.C;node=next}if(node)node.U=parent;if(red)return;if(node&&node.C){node.C=false;return}do{if(node===this._)break;if(node===parent.L){sibling=parent.R;if(sibling.C){sibling.C=false;parent.C=true;d3_geom_voronoiRedBlackRotateLeft(this,parent);sibling=parent.R}if(sibling.L&&sibling.L.C||sibling.R&&sibling.R.C){if(!sibling.R||!sibling.R.C){sibling.L.C=false;sibling.C=true;d3_geom_voronoiRedBlackRotateRight(this,sibling);sibling=parent.R}sibling.C=parent.C;parent.C=sibling.R.C=false;d3_geom_voronoiRedBlackRotateLeft(this,parent);node=this._;break}}else{sibling=parent.L;if(sibling.C){sibling.C=false;parent.C=true;d3_geom_voronoiRedBlackRotateRight(this,parent);sibling=parent.L}if(sibling.L&&sibling.L.C||sibling.R&&sibling.R.C){if(!sibling.L||!sibling.L.C){sibling.R.C=false;sibling.C=true;d3_geom_voronoiRedBlackRotateLeft(this,sibling);sibling=parent.L}sibling.C=parent.C;parent.C=sibling.L.C=false;d3_geom_voronoiRedBlackRotateRight(this,parent);node=this._;break}}sibling.C=true;node=parent;parent=parent.U}while(!node.C);if(node)node.C=false}};function d3_geom_voronoiRedBlackRotateLeft(tree,node){var p=node,q=node.R,parent=p.U;if(parent){if(parent.L===p)parent.L=q;else parent.R=q}else{tree._=q}q.U=parent;p.U=q;p.R=q.L;if(p.R)p.R.U=p;q.L=p}function d3_geom_voronoiRedBlackRotateRight(tree,node){var p=node,q=node.L,parent=p.U;if(parent){if(parent.L===p)parent.L=q;else parent.R=q}else{tree._=q}q.U=parent;p.U=q;p.L=q.R;if(p.L)p.L.U=p;q.R=p}function d3_geom_voronoiRedBlackFirst(node){while(node.L)node=node.L;return node}function d3_geom_voronoi(sites,bbox){var site=sites.sort(d3_geom_voronoiVertexOrder).pop(),x0,y0,circle;d3_geom_voronoiEdges=[];d3_geom_voronoiCells=new Array(sites.length);d3_geom_voronoiBeaches=new d3_geom_voronoiRedBlackTree;d3_geom_voronoiCircles=new d3_geom_voronoiRedBlackTree;while(true){circle=d3_geom_voronoiFirstCircle;if(site&&(!circle||site.y<circle.y||site.y===circle.y&&site.x<circle.x)){if(site.x!==x0||site.y!==y0){d3_geom_voronoiCells[site.i]=new d3_geom_voronoiCell(site);d3_geom_voronoiAddBeach(site);x0=site.x,y0=site.y}site=sites.pop()}else if(circle){d3_geom_voronoiRemoveBeach(circle.arc)}else{break}}if(bbox)d3_geom_voronoiClipEdges(bbox),d3_geom_voronoiCloseCells(bbox);var diagram={cells:d3_geom_voronoiCells,edges:d3_geom_voronoiEdges};d3_geom_voronoiBeaches=d3_geom_voronoiCircles=d3_geom_voronoiEdges=d3_geom_voronoiCells=null;return diagram}function d3_geom_voronoiVertexOrder(a,b){return b.y-a.y||b.x-a.x}d3.geom.voronoi=function(points){var x=d3_geom_pointX,y=d3_geom_pointY,fx=x,fy=y,clipExtent=d3_geom_voronoiClipExtent;if(points)return voronoi(points);function voronoi(data){var polygons=new Array(data.length),x0=clipExtent[0][0],y0=clipExtent[0][1],x1=clipExtent[1][0],y1=clipExtent[1][1];d3_geom_voronoi(sites(data),clipExtent).cells.forEach(function(cell,i){var edges=cell.edges,site=cell.site,polygon=polygons[i]=edges.length?edges.map(function(e){var s=e.start();return[s.x,s.y]}):site.x>=x0&&site.x<=x1&&site.y>=y0&&site.y<=y1?[[x0,y1],[x1,y1],[x1,y0],[x0,y0]]:[];polygon.point=data[i]});return polygons}function sites(data){return data.map(function(d,i){return{x:Math.round(fx(d,i)/ε)*ε,y:Math.round(fy(d,i)/ε)*ε,i:i}})}voronoi.links=function(data){return d3_geom_voronoi(sites(data)).edges.filter(function(edge){return edge.l&&edge.r}).map(function(edge){return{source:data[edge.l.i],target:data[edge.r.i]}})};voronoi.triangles=function(data){var triangles=[];d3_geom_voronoi(sites(data)).cells.forEach(function(cell,i){var site=cell.site,edges=cell.edges.sort(d3_geom_voronoiHalfEdgeOrder),j=-1,m=edges.length,e0,s0,e1=edges[m-1].edge,s1=e1.l===site?e1.r:e1.l;while(++j<m){e0=e1;s0=s1;e1=edges[j].edge;s1=e1.l===site?e1.r:e1.l;if(i<s0.i&&i<s1.i&&d3_geom_voronoiTriangleArea(site,s0,s1)<0){triangles.push([data[i],data[s0.i],data[s1.i]])}}});return triangles};voronoi.x=function(_){return arguments.length?(fx=d3_functor(x=_),voronoi):x};voronoi.y=function(_){return arguments.length?(fy=d3_functor(y=_),voronoi):y};voronoi.clipExtent=function(_){if(!arguments.length)return clipExtent===d3_geom_voronoiClipExtent?null:clipExtent;clipExtent=_==null?d3_geom_voronoiClipExtent:_;return voronoi};voronoi.size=function(_){if(!arguments.length)return clipExtent===d3_geom_voronoiClipExtent?null:clipExtent&&clipExtent[1];return voronoi.clipExtent(_&&[[0,0],_])};return voronoi};var d3_geom_voronoiClipExtent=[[-1e6,-1e6],[1e6,1e6]];function d3_geom_voronoiTriangleArea(a,b,c){return(a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y)}d3.geom.delaunay=function(vertices){return d3.geom.voronoi().triangles(vertices)};d3.geom.quadtree=function(points,x1,y1,x2,y2){var x=d3_geom_pointX,y=d3_geom_pointY,compat;if(compat=arguments.length){x=d3_geom_quadtreeCompatX;y=d3_geom_quadtreeCompatY;if(compat===3){y2=y1;x2=x1;y1=x1=0}return quadtree(points)}function quadtree(data){var d,fx=d3_functor(x),fy=d3_functor(y),xs,ys,i,n,x1_,y1_,x2_,y2_;if(x1!=null){x1_=x1,y1_=y1,x2_=x2,y2_=y2}else{x2_=y2_=-(x1_=y1_=Infinity);xs=[],ys=[];n=data.length;if(compat)for(i=0;i<n;++i){d=data[i];if(d.x<x1_)x1_=d.x;if(d.y<y1_)y1_=d.y;if(d.x>x2_)x2_=d.x;if(d.y>y2_)y2_=d.y;xs.push(d.x);ys.push(d.y)}else for(i=0;i<n;++i){var x_=+fx(d=data[i],i),y_=+fy(d,i);if(x_<x1_)x1_=x_;if(y_<y1_)y1_=y_;if(x_>x2_)x2_=x_;if(y_>y2_)y2_=y_;xs.push(x_);ys.push(y_)}}var dx=x2_-x1_,dy=y2_-y1_;if(dx>dy)y2_=y1_+dx;else x2_=x1_+dy;function insert(n,d,x,y,x1,y1,x2,y2){if(isNaN(x)||isNaN(y))return;if(n.leaf){var nx=n.x,ny=n.y;if(nx!=null){if(abs(nx-x)+abs(ny-y)<.01){insertChild(n,d,x,y,x1,y1,x2,y2)}else{var nPoint=n.point;n.x=n.y=n.point=null;insertChild(n,nPoint,nx,ny,x1,y1,x2,y2);insertChild(n,d,x,y,x1,y1,x2,y2)}}else{n.x=x,n.y=y,n.point=d}}else{insertChild(n,d,x,y,x1,y1,x2,y2)}}function insertChild(n,d,x,y,x1,y1,x2,y2){var xm=(x1+x2)*.5,ym=(y1+y2)*.5,right=x>=xm,below=y>=ym,i=below<<1|right;n.leaf=false;n=n.nodes[i]||(n.nodes[i]=d3_geom_quadtreeNode());if(right)x1=xm;else x2=xm;if(below)y1=ym;else y2=ym;insert(n,d,x,y,x1,y1,x2,y2)}var root=d3_geom_quadtreeNode();root.add=function(d){insert(root,d,+fx(d,++i),+fy(d,i),x1_,y1_,x2_,y2_)};root.visit=function(f){d3_geom_quadtreeVisit(f,root,x1_,y1_,x2_,y2_)};root.find=function(point){return d3_geom_quadtreeFind(root,point[0],point[1],x1_,y1_,x2_,y2_)};i=-1;if(x1==null){while(++i<n){insert(root,data[i],xs[i],ys[i],x1_,y1_,x2_,y2_)}--i}else data.forEach(root.add);xs=ys=data=d=null;return root}quadtree.x=function(_){return arguments.length?(x=_,quadtree):x};quadtree.y=function(_){return arguments.length?(y=_,quadtree):y};quadtree.extent=function(_){if(!arguments.length)return x1==null?null:[[x1,y1],[x2,y2]];if(_==null)x1=y1=x2=y2=null;else x1=+_[0][0],y1=+_[0][1],x2=+_[1][0],y2=+_[1][1];return quadtree};quadtree.size=function(_){if(!arguments.length)return x1==null?null:[x2-x1,y2-y1];if(_==null)x1=y1=x2=y2=null;else x1=y1=0,x2=+_[0],y2=+_[1];return quadtree};return quadtree};function d3_geom_quadtreeCompatX(d){return d.x}function d3_geom_quadtreeCompatY(d){return d.y}function d3_geom_quadtreeNode(){return{leaf:true,nodes:[],point:null,x:null,y:null}}function d3_geom_quadtreeVisit(f,node,x1,y1,x2,y2){if(!f(node,x1,y1,x2,y2)){var sx=(x1+x2)*.5,sy=(y1+y2)*.5,children=node.nodes;if(children[0])d3_geom_quadtreeVisit(f,children[0],x1,y1,sx,sy);if(children[1])d3_geom_quadtreeVisit(f,children[1],sx,y1,x2,sy);if(children[2])d3_geom_quadtreeVisit(f,children[2],x1,sy,sx,y2);if(children[3])d3_geom_quadtreeVisit(f,children[3],sx,sy,x2,y2)}}function d3_geom_quadtreeFind(root,x,y,x0,y0,x3,y3){var minDistance2=Infinity,closestPoint;(function find(node,x1,y1,x2,y2){if(x1>x3||y1>y3||x2<x0||y2<y0)return;if(point=node.point){var point,dx=x-node.x,dy=y-node.y,distance2=dx*dx+dy*dy;if(distance2<minDistance2){var distance=Math.sqrt(minDistance2=distance2);x0=x-distance,y0=y-distance;x3=x+distance,y3=y+distance;closestPoint=point}}var children=node.nodes,xm=(x1+x2)*.5,ym=(y1+y2)*.5,right=x>=xm,below=y>=ym;for(var i=below<<1|right,j=i+4;i<j;++i){if(node=children[i&3])switch(i&3){case 0:find(node,x1,y1,xm,ym);break;case 1:find(node,xm,y1,x2,ym);break;case 2:find(node,x1,ym,xm,y2);break;case 3:find(node,xm,ym,x2,y2);break}}})(root,x0,y0,x3,y3);return closestPoint}d3.interpolateRgb=d3_interpolateRgb;function d3_interpolateRgb(a,b){a=d3.rgb(a);b=d3.rgb(b);var ar=a.r,ag=a.g,ab=a.b,br=b.r-ar,bg=b.g-ag,bb=b.b-ab;return function(t){return"#"+d3_rgb_hex(Math.round(ar+br*t))+d3_rgb_hex(Math.round(ag+bg*t))+d3_rgb_hex(Math.round(ab+bb*t))}}d3.interpolateObject=d3_interpolateObject;function d3_interpolateObject(a,b){var i={},c={},k;for(k in a){if(k in b){i[k]=d3_interpolate(a[k],b[k])}else{c[k]=a[k]}}for(k in b){if(!(k in a)){c[k]=b[k]}}return function(t){for(k in i)c[k]=i[k](t);return c}}d3.interpolateNumber=d3_interpolateNumber;function d3_interpolateNumber(a,b){a=+a,b=+b;return function(t){return a*(1-t)+b*t}}d3.interpolateString=d3_interpolateString;function d3_interpolateString(a,b){var bi=d3_interpolate_numberA.lastIndex=d3_interpolate_numberB.lastIndex=0,am,bm,bs,i=-1,s=[],q=[];a=a+"",b=b+"";while((am=d3_interpolate_numberA.exec(a))&&(bm=d3_interpolate_numberB.exec(b))){if((bs=bm.index)>bi){bs=b.slice(bi,bs);if(s[i])s[i]+=bs;else s[++i]=bs}if((am=am[0])===(bm=bm[0])){if(s[i])s[i]+=bm;else s[++i]=bm}else{s[++i]=null;q.push({i:i,x:d3_interpolateNumber(am,bm)})}bi=d3_interpolate_numberB.lastIndex}if(bi<b.length){bs=b.slice(bi);if(s[i])s[i]+=bs;else s[++i]=bs}return s.length<2?q[0]?(b=q[0].x,function(t){return b(t)+""}):function(){return b}:(b=q.length,function(t){for(var i=0,o;i<b;++i)s[(o=q[i]).i]=o.x(t);return s.join("")})}var d3_interpolate_numberA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,d3_interpolate_numberB=new RegExp(d3_interpolate_numberA.source,"g");d3.interpolate=d3_interpolate;function d3_interpolate(a,b){var i=d3.interpolators.length,f;while(--i>=0&&!(f=d3.interpolators[i](a,b)));return f}d3.interpolators=[function(a,b){var t=typeof b;return(t==="string"?d3_rgb_names.has(b.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(b)?d3_interpolateRgb:d3_interpolateString:b instanceof d3_color?d3_interpolateRgb:Array.isArray(b)?d3_interpolateArray:t==="object"&&isNaN(b)?d3_interpolateObject:d3_interpolateNumber)(a,b)}];d3.interpolateArray=d3_interpolateArray;function d3_interpolateArray(a,b){var x=[],c=[],na=a.length,nb=b.length,n0=Math.min(a.length,b.length),i;for(i=0;i<n0;++i)x.push(d3_interpolate(a[i],b[i]));for(;i<na;++i)c[i]=a[i];for(;i<nb;++i)c[i]=b[i];return function(t){for(i=0;i<n0;++i)c[i]=x[i](t);return c}}var d3_ease_default=function(){return d3_identity};var d3_ease=d3.map({linear:d3_ease_default,poly:d3_ease_poly,quad:function(){return d3_ease_quad},cubic:function(){return d3_ease_cubic},sin:function(){return d3_ease_sin},exp:function(){return d3_ease_exp},circle:function(){return d3_ease_circle},elastic:d3_ease_elastic,back:d3_ease_back,bounce:function(){return d3_ease_bounce}});var d3_ease_mode=d3.map({in:d3_identity,out:d3_ease_reverse,"in-out":d3_ease_reflect,"out-in":function(f){return d3_ease_reflect(d3_ease_reverse(f))}});d3.ease=function(name){var i=name.indexOf("-"),t=i>=0?name.slice(0,i):name,m=i>=0?name.slice(i+1):"in";t=d3_ease.get(t)||d3_ease_default;m=d3_ease_mode.get(m)||d3_identity;return d3_ease_clamp(m(t.apply(null,d3_arraySlice.call(arguments,1))))};function d3_ease_clamp(f){return function(t){return t<=0?0:t>=1?1:f(t)}}function d3_ease_reverse(f){return function(t){return 1-f(1-t)}}function d3_ease_reflect(f){return function(t){return.5*(t<.5?f(2*t):2-f(2-2*t))}}function d3_ease_quad(t){return t*t}function d3_ease_cubic(t){return t*t*t}function d3_ease_cubicInOut(t){if(t<=0)return 0;if(t>=1)return 1;var t2=t*t,t3=t2*t;return 4*(t<.5?t3:3*(t-t2)+t3-.75)}function d3_ease_poly(e){return function(t){return Math.pow(t,e)}}function d3_ease_sin(t){return 1-Math.cos(t*halfπ)}function d3_ease_exp(t){return Math.pow(2,10*(t-1))}function d3_ease_circle(t){return 1-Math.sqrt(1-t*t)}function d3_ease_elastic(a,p){var s;if(arguments.length<2)p=.45;if(arguments.length)s=p/τ*Math.asin(1/a);else a=1,s=p/4;return function(t){return 1+a*Math.pow(2,-10*t)*Math.sin((t-s)*τ/p)}}function d3_ease_back(s){if(!s)s=1.70158;return function(t){return t*t*((s+1)*t-s)}}function d3_ease_bounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}d3.interpolateHcl=d3_interpolateHcl;function d3_interpolateHcl(a,b){a=d3.hcl(a);b=d3.hcl(b);var ah=a.h,ac=a.c,al=a.l,bh=b.h-ah,bc=b.c-ac,bl=b.l-al;if(isNaN(bc))bc=0,ac=isNaN(ac)?b.c:ac;if(isNaN(bh))bh=0,ah=isNaN(ah)?b.h:ah;else if(bh>180)bh-=360;else if(bh<-180)bh+=360;return function(t){return d3_hcl_lab(ah+bh*t,ac+bc*t,al+bl*t)+""}}d3.interpolateHsl=d3_interpolateHsl;function d3_interpolateHsl(a,b){a=d3.hsl(a);b=d3.hsl(b);var ah=a.h,as=a.s,al=a.l,bh=b.h-ah,bs=b.s-as,bl=b.l-al;if(isNaN(bs))bs=0,as=isNaN(as)?b.s:as;if(isNaN(bh))bh=0,ah=isNaN(ah)?b.h:ah;else if(bh>180)bh-=360;else if(bh<-180)bh+=360;return function(t){return d3_hsl_rgb(ah+bh*t,as+bs*t,al+bl*t)+""}}d3.interpolateLab=d3_interpolateLab;function d3_interpolateLab(a,b){a=d3.lab(a);b=d3.lab(b);var al=a.l,aa=a.a,ab=a.b,bl=b.l-al,ba=b.a-aa,bb=b.b-ab;return function(t){return d3_lab_rgb(al+bl*t,aa+ba*t,ab+bb*t)+""}}d3.interpolateRound=d3_interpolateRound;function d3_interpolateRound(a,b){b-=a;return function(t){return Math.round(a+b*t)}}d3.transform=function(string){var g=d3_document.createElementNS(d3.ns.prefix.svg,"g");return(d3.transform=function(string){if(string!=null){g.setAttribute("transform",string);var t=g.transform.baseVal.consolidate()}return new d3_transform(t?t.matrix:d3_transformIdentity)})(string)};function d3_transform(m){var r0=[m.a,m.b],r1=[m.c,m.d],kx=d3_transformNormalize(r0),kz=d3_transformDot(r0,r1),ky=d3_transformNormalize(d3_transformCombine(r1,r0,-kz))||0;if(r0[0]*r1[1]<r1[0]*r0[1]){r0[0]*=-1;r0[1]*=-1;kx*=-1;kz*=-1}this.rotate=(kx?Math.atan2(r0[1],r0[0]):Math.atan2(-r1[0],r1[1]))*d3_degrees;this.translate=[m.e,m.f];this.scale=[kx,ky];this.skew=ky?Math.atan2(kz,ky)*d3_degrees:0}d3_transform.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};function d3_transformDot(a,b){return a[0]*b[0]+a[1]*b[1]}function d3_transformNormalize(a){var k=Math.sqrt(d3_transformDot(a,a));if(k){a[0]/=k;a[1]/=k}return k}function d3_transformCombine(a,b,k){a[0]+=k*b[0];a[1]+=k*b[1];return a}var d3_transformIdentity={a:1,b:0,c:0,d:1,e:0,f:0};d3.interpolateTransform=d3_interpolateTransform;function d3_interpolateTransformPop(s){return s.length?s.pop()+",":""}function d3_interpolateTranslate(ta,tb,s,q){if(ta[0]!==tb[0]||ta[1]!==tb[1]){var i=s.push("translate(",null,",",null,")");q.push({i:i-4,x:d3_interpolateNumber(ta[0],tb[0])},{i:i-2,x:d3_interpolateNumber(ta[1],tb[1])})}else if(tb[0]||tb[1]){s.push("translate("+tb+")")}}function d3_interpolateRotate(ra,rb,s,q){if(ra!==rb){if(ra-rb>180)rb+=360;else if(rb-ra>180)ra+=360;q.push({i:s.push(d3_interpolateTransformPop(s)+"rotate(",null,")")-2,x:d3_interpolateNumber(ra,rb)})}else if(rb){s.push(d3_interpolateTransformPop(s)+"rotate("+rb+")")}}function d3_interpolateSkew(wa,wb,s,q){if(wa!==wb){q.push({i:s.push(d3_interpolateTransformPop(s)+"skewX(",null,")")-2,x:d3_interpolateNumber(wa,wb)})}else if(wb){s.push(d3_interpolateTransformPop(s)+"skewX("+wb+")")}}function d3_interpolateScale(ka,kb,s,q){if(ka[0]!==kb[0]||ka[1]!==kb[1]){var i=s.push(d3_interpolateTransformPop(s)+"scale(",null,",",null,")");q.push({i:i-4,x:d3_interpolateNumber(ka[0],kb[0])},{i:i-2,x:d3_interpolateNumber(ka[1],kb[1])})}else if(kb[0]!==1||kb[1]!==1){s.push(d3_interpolateTransformPop(s)+"scale("+kb+")")}}function d3_interpolateTransform(a,b){var s=[],q=[];a=d3.transform(a),b=d3.transform(b);d3_interpolateTranslate(a.translate,b.translate,s,q);d3_interpolateRotate(a.rotate,b.rotate,s,q);d3_interpolateSkew(a.skew,b.skew,s,q);d3_interpolateScale(a.scale,b.scale,s,q);a=b=null;return function(t){var i=-1,n=q.length,o;while(++i<n)s[(o=q[i]).i]=o.x(t);return s.join("")}}function d3_uninterpolateNumber(a,b){b=(b-=a=+a)||1/b;return function(x){return(x-a)/b}}function d3_uninterpolateClamp(a,b){b=(b-=a=+a)||1/b;return function(x){return Math.max(0,Math.min(1,(x-a)/b))}}d3.layout={};d3.layout.bundle=function(){return function(links){var paths=[],i=-1,n=links.length;while(++i<n)paths.push(d3_layout_bundlePath(links[i]));return paths}};function d3_layout_bundlePath(link){var start=link.source,end=link.target,lca=d3_layout_bundleLeastCommonAncestor(start,end),points=[start];while(start!==lca){start=start.parent;points.push(start)}var k=points.length;while(end!==lca){points.splice(k,0,end);end=end.parent}return points}function d3_layout_bundleAncestors(node){var ancestors=[],parent=node.parent;while(parent!=null){ancestors.push(node);node=parent;parent=parent.parent}ancestors.push(node);return ancestors}function d3_layout_bundleLeastCommonAncestor(a,b){if(a===b)return a;var aNodes=d3_layout_bundleAncestors(a),bNodes=d3_layout_bundleAncestors(b),aNode=aNodes.pop(),bNode=bNodes.pop(),sharedNode=null;while(aNode===bNode){sharedNode=aNode;aNode=aNodes.pop();bNode=bNodes.pop()}return sharedNode}d3.layout.chord=function(){var chord={},chords,groups,matrix,n,padding=0,sortGroups,sortSubgroups,sortChords;function relayout(){var subgroups={},groupSums=[],groupIndex=d3.range(n),subgroupIndex=[],k,x,x0,i,j;chords=[];groups=[];k=0,i=-1;while(++i<n){x=0,j=-1;while(++j<n){x+=matrix[i][j]}groupSums.push(x);subgroupIndex.push(d3.range(n));k+=x}if(sortGroups){groupIndex.sort(function(a,b){return sortGroups(groupSums[a],groupSums[b])})}if(sortSubgroups){subgroupIndex.forEach(function(d,i){d.sort(function(a,b){return sortSubgroups(matrix[i][a],matrix[i][b])})})}k=(τ-padding*n)/k;x=0,i=-1;while(++i<n){x0=x,j=-1;while(++j<n){var di=groupIndex[i],dj=subgroupIndex[di][j],v=matrix[di][dj],a0=x,a1=x+=v*k;subgroups[di+"-"+dj]={index:di,subindex:dj,startAngle:a0,endAngle:a1,value:v}}groups[di]={index:di,startAngle:x0,endAngle:x,value:groupSums[di]};x+=padding}i=-1;while(++i<n){j=i-1;while(++j<n){var source=subgroups[i+"-"+j],target=subgroups[j+"-"+i];if(source.value||target.value){chords.push(source.value<target.value?{source:target,target:source}:{source:source,target:target})}}}if(sortChords)resort()}function resort(){chords.sort(function(a,b){return sortChords((a.source.value+a.target.value)/2,(b.source.value+b.target.value)/2)})}chord.matrix=function(x){if(!arguments.length)return matrix;n=(matrix=x)&&matrix.length;chords=groups=null;return chord};chord.padding=function(x){if(!arguments.length)return padding;padding=x;chords=groups=null;return chord};chord.sortGroups=function(x){if(!arguments.length)return sortGroups;sortGroups=x;chords=groups=null;return chord};chord.sortSubgroups=function(x){if(!arguments.length)return sortSubgroups;sortSubgroups=x;chords=null;return chord};chord.sortChords=function(x){if(!arguments.length)return sortChords;sortChords=x;if(chords)resort();return chord};chord.chords=function(){if(!chords)relayout();return chords};chord.groups=function(){if(!groups)relayout();return groups};return chord};d3.layout.force=function(){var force={},event=d3.dispatch("start","tick","end"),timer,size=[1,1],drag,alpha,friction=.9,linkDistance=d3_layout_forceLinkDistance,linkStrength=d3_layout_forceLinkStrength,charge=-30,chargeDistance2=d3_layout_forceChargeDistance2,gravity=.1,theta2=.64,nodes=[],links=[],distances,strengths,charges;function repulse(node){return function(quad,x1,_,x2){if(quad.point!==node){var dx=quad.cx-node.x,dy=quad.cy-node.y,dw=x2-x1,dn=dx*dx+dy*dy;if(dw*dw/theta2<dn){if(dn<chargeDistance2){var k=quad.charge/dn;node.px-=dx*k;node.py-=dy*k}return true}if(quad.point&&dn&&dn<chargeDistance2){var k=quad.pointCharge/dn;node.px-=dx*k;node.py-=dy*k}}return!quad.charge}}force.tick=function(){if((alpha*=.99)<.005){timer=null;event.end({type:"end",alpha:alpha=0});return true}var n=nodes.length,m=links.length,q,i,o,s,t,l,k,x,y;for(i=0;i<m;++i){o=links[i];s=o.source;t=o.target;x=t.x-s.x;y=t.y-s.y;if(l=x*x+y*y){l=alpha*strengths[i]*((l=Math.sqrt(l))-distances[i])/l;x*=l;y*=l;t.x-=x*(k=s.weight+t.weight?s.weight/(s.weight+t.weight):.5);t.y-=y*k;s.x+=x*(k=1-k);s.y+=y*k}}if(k=alpha*gravity){x=size[0]/2;y=size[1]/2;i=-1;if(k)while(++i<n){o=nodes[i];o.x+=(x-o.x)*k;o.y+=(y-o.y)*k}}if(charge){d3_layout_forceAccumulate(q=d3.geom.quadtree(nodes),alpha,charges);i=-1;while(++i<n){if(!(o=nodes[i]).fixed){q.visit(repulse(o))}}}i=-1;while(++i<n){o=nodes[i];if(o.fixed){o.x=o.px;o.y=o.py}else{o.x-=(o.px-(o.px=o.x))*friction;o.y-=(o.py-(o.py=o.y))*friction}}event.tick({type:"tick",alpha:alpha})};force.nodes=function(x){if(!arguments.length)return nodes;nodes=x;return force};force.links=function(x){if(!arguments.length)return links;links=x;return force};force.size=function(x){if(!arguments.length)return size;size=x;return force};force.linkDistance=function(x){if(!arguments.length)return linkDistance;linkDistance=typeof x==="function"?x:+x;return force};force.distance=force.linkDistance;force.linkStrength=function(x){if(!arguments.length)return linkStrength;linkStrength=typeof x==="function"?x:+x;return force};force.friction=function(x){if(!arguments.length)return friction;friction=+x;return force};force.charge=function(x){if(!arguments.length)return charge;charge=typeof x==="function"?x:+x;return force};force.chargeDistance=function(x){if(!arguments.length)return Math.sqrt(chargeDistance2);chargeDistance2=x*x;return force};force.gravity=function(x){if(!arguments.length)return gravity;gravity=+x;return force};force.theta=function(x){if(!arguments.length)return Math.sqrt(theta2);theta2=x*x;return force};force.alpha=function(x){if(!arguments.length)return alpha;x=+x;if(alpha){if(x>0){alpha=x}else{timer.c=null,timer.t=NaN,timer=null;event.end({type:"end",alpha:alpha=0})}}else if(x>0){event.start({type:"start",alpha:alpha=x});timer=d3_timer(force.tick)}return force};force.start=function(){var i,n=nodes.length,m=links.length,w=size[0],h=size[1],neighbors,o;for(i=0;i<n;++i){(o=nodes[i]).index=i;o.weight=0}for(i=0;i<m;++i){o=links[i];if(typeof o.source=="number")o.source=nodes[o.source];if(typeof o.target=="number")o.target=nodes[o.target];++o.source.weight;++o.target.weight}for(i=0;i<n;++i){o=nodes[i];if(isNaN(o.x))o.x=position("x",w);if(isNaN(o.y))o.y=position("y",h);if(isNaN(o.px))o.px=o.x;if(isNaN(o.py))o.py=o.y}distances=[];if(typeof linkDistance==="function")for(i=0;i<m;++i)distances[i]=+linkDistance.call(this,links[i],i);else for(i=0;i<m;++i)distances[i]=linkDistance;strengths=[];if(typeof linkStrength==="function")for(i=0;i<m;++i)strengths[i]=+linkStrength.call(this,links[i],i);else for(i=0;i<m;++i)strengths[i]=linkStrength;charges=[];if(typeof charge==="function")for(i=0;i<n;++i)charges[i]=+charge.call(this,nodes[i],i);else for(i=0;i<n;++i)charges[i]=charge;function position(dimension,size){if(!neighbors){neighbors=new Array(n);for(j=0;j<n;++j){neighbors[j]=[]}for(j=0;j<m;++j){var o=links[j];neighbors[o.source.index].push(o.target);neighbors[o.target.index].push(o.source)}}var candidates=neighbors[i],j=-1,l=candidates.length,x;while(++j<l)if(!isNaN(x=candidates[j][dimension]))return x;return Math.random()*size}return force.resume()};force.resume=function(){return force.alpha(.1)};force.stop=function(){return force.alpha(0)};force.drag=function(){if(!drag)drag=d3.behavior.drag().origin(d3_identity).on("dragstart.force",d3_layout_forceDragstart).on("drag.force",dragmove).on("dragend.force",d3_layout_forceDragend);if(!arguments.length)return drag;this.on("mouseover.force",d3_layout_forceMouseover).on("mouseout.force",d3_layout_forceMouseout).call(drag)};function dragmove(d){d.px=d3.event.x,d.py=d3.event.y;force.resume()}return d3.rebind(force,event,"on")};function d3_layout_forceDragstart(d){d.fixed|=2}function d3_layout_forceDragend(d){d.fixed&=~6}function d3_layout_forceMouseover(d){d.fixed|=4;d.px=d.x,d.py=d.y}function d3_layout_forceMouseout(d){d.fixed&=~4}function d3_layout_forceAccumulate(quad,alpha,charges){var cx=0,cy=0;quad.charge=0;if(!quad.leaf){var nodes=quad.nodes,n=nodes.length,i=-1,c;while(++i<n){c=nodes[i];if(c==null)continue;d3_layout_forceAccumulate(c,alpha,charges);quad.charge+=c.charge;cx+=c.charge*c.cx;cy+=c.charge*c.cy}}if(quad.point){if(!quad.leaf){quad.point.x+=Math.random()-.5;quad.point.y+=Math.random()-.5}var k=alpha*charges[quad.point.index];quad.charge+=quad.pointCharge=k;cx+=k*quad.point.x;cy+=k*quad.point.y}quad.cx=cx/quad.charge;quad.cy=cy/quad.charge}var d3_layout_forceLinkDistance=20,d3_layout_forceLinkStrength=1,d3_layout_forceChargeDistance2=Infinity;d3.layout.hierarchy=function(){var sort=d3_layout_hierarchySort,children=d3_layout_hierarchyChildren,value=d3_layout_hierarchyValue;function hierarchy(root){var stack=[root],nodes=[],node;root.depth=0;while((node=stack.pop())!=null){nodes.push(node);if((childs=children.call(hierarchy,node,node.depth))&&(n=childs.length)){var n,childs,child;while(--n>=0){stack.push(child=childs[n]);child.parent=node;child.depth=node.depth+1}if(value)node.value=0;node.children=childs}else{if(value)node.value=+value.call(hierarchy,node,node.depth)||0;delete node.children}}d3_layout_hierarchyVisitAfter(root,function(node){var childs,parent;if(sort&&(childs=node.children))childs.sort(sort);if(value&&(parent=node.parent))parent.value+=node.value});return nodes}hierarchy.sort=function(x){if(!arguments.length)return sort;sort=x;return hierarchy};hierarchy.children=function(x){if(!arguments.length)return children;children=x;return hierarchy};hierarchy.value=function(x){if(!arguments.length)return value;value=x;return hierarchy};hierarchy.revalue=function(root){if(value){d3_layout_hierarchyVisitBefore(root,function(node){if(node.children)node.value=0});d3_layout_hierarchyVisitAfter(root,function(node){var parent;if(!node.children)node.value=+value.call(hierarchy,node,node.depth)||0;if(parent=node.parent)parent.value+=node.value})}return root};return hierarchy};function d3_layout_hierarchyRebind(object,hierarchy){d3.rebind(object,hierarchy,"sort","children","value");object.nodes=object;object.links=d3_layout_hierarchyLinks;return object}function d3_layout_hierarchyVisitBefore(node,callback){var nodes=[node];while((node=nodes.pop())!=null){callback(node);if((children=node.children)&&(n=children.length)){var n,children;while(--n>=0)nodes.push(children[n])}}}function d3_layout_hierarchyVisitAfter(node,callback){var nodes=[node],nodes2=[];while((node=nodes.pop())!=null){nodes2.push(node);if((children=node.children)&&(n=children.length)){var i=-1,n,children;while(++i<n)nodes.push(children[i])}}while((node=nodes2.pop())!=null){callback(node)}}function d3_layout_hierarchyChildren(d){return d.children}function d3_layout_hierarchyValue(d){return d.value}function d3_layout_hierarchySort(a,b){return b.value-a.value}function d3_layout_hierarchyLinks(nodes){return d3.merge(nodes.map(function(parent){return(parent.children||[]).map(function(child){return{source:parent,target:child}})}))}d3.layout.partition=function(){var hierarchy=d3.layout.hierarchy(),size=[1,1];function position(node,x,dx,dy){var children=node.children;node.x=x;node.y=node.depth*dy;node.dx=dx;node.dy=dy;if(children&&(n=children.length)){var i=-1,n,c,d;dx=node.value?dx/node.value:0;while(++i<n){position(c=children[i],x,d=c.value*dx,dy);x+=d}}}function depth(node){var children=node.children,d=0;if(children&&(n=children.length)){var i=-1,n;while(++i<n)d=Math.max(d,depth(children[i]))}return 1+d}function partition(d,i){var nodes=hierarchy.call(this,d,i);position(nodes[0],0,size[0],size[1]/depth(nodes[0]));return nodes}partition.size=function(x){if(!arguments.length)return size;size=x;return partition};return d3_layout_hierarchyRebind(partition,hierarchy)};d3.layout.pie=function(){var value=Number,sort=d3_layout_pieSortByValue,startAngle=0,endAngle=τ,padAngle=0;function pie(data){var n=data.length,values=data.map(function(d,i){return+value.call(pie,d,i)}),a=+(typeof startAngle==="function"?startAngle.apply(this,arguments):startAngle),da=(typeof endAngle==="function"?endAngle.apply(this,arguments):endAngle)-a,p=Math.min(Math.abs(da)/n,+(typeof padAngle==="function"?padAngle.apply(this,arguments):padAngle)),pa=p*(da<0?-1:1),sum=d3.sum(values),k=sum?(da-n*pa)/sum:0,index=d3.range(n),arcs=[],v;if(sort!=null)index.sort(sort===d3_layout_pieSortByValue?function(i,j){return values[j]-values[i]}:function(i,j){return sort(data[i],data[j])});index.forEach(function(i){arcs[i]={data:data[i],value:v=values[i],startAngle:a,endAngle:a+=v*k+pa,padAngle:p}});return arcs}pie.value=function(_){if(!arguments.length)return value;value=_;return pie};pie.sort=function(_){if(!arguments.length)return sort;sort=_;return pie};pie.startAngle=function(_){if(!arguments.length)return startAngle;startAngle=_;return pie};pie.endAngle=function(_){if(!arguments.length)return endAngle;endAngle=_;return pie};pie.padAngle=function(_){if(!arguments.length)return padAngle;padAngle=_;return pie};return pie};var d3_layout_pieSortByValue={};d3.layout.stack=function(){var values=d3_identity,order=d3_layout_stackOrderDefault,offset=d3_layout_stackOffsetZero,out=d3_layout_stackOut,x=d3_layout_stackX,y=d3_layout_stackY;function stack(data,index){if(!(n=data.length))return data;var series=data.map(function(d,i){return values.call(stack,d,i)});var points=series.map(function(d){return d.map(function(v,i){return[x.call(stack,v,i),y.call(stack,v,i)]})});var orders=order.call(stack,points,index);series=d3.permute(series,orders);points=d3.permute(points,orders);var offsets=offset.call(stack,points,index);var m=series[0].length,n,i,j,o;for(j=0;j<m;++j){out.call(stack,series[0][j],o=offsets[j],points[0][j][1]);for(i=1;i<n;++i){out.call(stack,series[i][j],o+=points[i-1][j][1],points[i][j][1])}}return data}stack.values=function(x){if(!arguments.length)return values;values=x;return stack};stack.order=function(x){if(!arguments.length)return order;order=typeof x==="function"?x:d3_layout_stackOrders.get(x)||d3_layout_stackOrderDefault;return stack};stack.offset=function(x){if(!arguments.length)return offset;offset=typeof x==="function"?x:d3_layout_stackOffsets.get(x)||d3_layout_stackOffsetZero;return stack};stack.x=function(z){if(!arguments.length)return x;x=z;return stack};stack.y=function(z){if(!arguments.length)return y;y=z;return stack};stack.out=function(z){if(!arguments.length)return out;out=z;return stack};return stack};function d3_layout_stackX(d){return d.x}function d3_layout_stackY(d){return d.y}function d3_layout_stackOut(d,y0,y){d.y0=y0;d.y=y}var d3_layout_stackOrders=d3.map({"inside-out":function(data){var n=data.length,i,j,max=data.map(d3_layout_stackMaxIndex),sums=data.map(d3_layout_stackReduceSum),index=d3.range(n).sort(function(a,b){return max[a]-max[b]}),top=0,bottom=0,tops=[],bottoms=[];for(i=0;i<n;++i){j=index[i];if(top<bottom){top+=sums[j];tops.push(j)}else{bottom+=sums[j];bottoms.push(j)}}return bottoms.reverse().concat(tops)},reverse:function(data){return d3.range(data.length).reverse()},default:d3_layout_stackOrderDefault});var d3_layout_stackOffsets=d3.map({silhouette:function(data){var n=data.length,m=data[0].length,sums=[],max=0,i,j,o,y0=[];for(j=0;j<m;++j){for(i=0,o=0;i<n;i++)o+=data[i][j][1];if(o>max)max=o;sums.push(o)}for(j=0;j<m;++j){y0[j]=(max-sums[j])/2}return y0},wiggle:function(data){var n=data.length,x=data[0],m=x.length,i,j,k,s1,s2,s3,dx,o,o0,y0=[];y0[0]=o=o0=0;for(j=1;j<m;++j){for(i=0,s1=0;i<n;++i)s1+=data[i][j][1];for(i=0,s2=0,dx=x[j][0]-x[j-1][0];i<n;++i){for(k=0,s3=(data[i][j][1]-data[i][j-1][1])/(2*dx);k<i;++k){s3+=(data[k][j][1]-data[k][j-1][1])/dx}s2+=s3*data[i][j][1]}y0[j]=o-=s1?s2/s1*dx:0;if(o<o0)o0=o}for(j=0;j<m;++j)y0[j]-=o0;return y0},expand:function(data){var n=data.length,m=data[0].length,k=1/n,i,j,o,y0=[];for(j=0;j<m;++j){for(i=0,o=0;i<n;i++)o+=data[i][j][1];if(o)for(i=0;i<n;i++)data[i][j][1]/=o;else for(i=0;i<n;i++)data[i][j][1]=k}for(j=0;j<m;++j)y0[j]=0;return y0},zero:d3_layout_stackOffsetZero});function d3_layout_stackOrderDefault(data){return d3.range(data.length)}function d3_layout_stackOffsetZero(data){var j=-1,m=data[0].length,y0=[];while(++j<m)y0[j]=0;return y0}function d3_layout_stackMaxIndex(array){var i=1,j=0,v=array[0][1],k,n=array.length;for(;i<n;++i){if((k=array[i][1])>v){j=i;v=k}}return j}function d3_layout_stackReduceSum(d){return d.reduce(d3_layout_stackSum,0)}function d3_layout_stackSum(p,d){return p+d[1]}d3.layout.histogram=function(){var frequency=true,valuer=Number,ranger=d3_layout_histogramRange,binner=d3_layout_histogramBinSturges;function histogram(data,i){var bins=[],values=data.map(valuer,this),range=ranger.call(this,values,i),thresholds=binner.call(this,range,values,i),bin,i=-1,n=values.length,m=thresholds.length-1,k=frequency?1:1/n,x;while(++i<m){bin=bins[i]=[];bin.dx=thresholds[i+1]-(bin.x=thresholds[i]);bin.y=0}if(m>0){i=-1;while(++i<n){x=values[i];if(x>=range[0]&&x<=range[1]){bin=bins[d3.bisect(thresholds,x,1,m)-1];bin.y+=k;bin.push(data[i])}}}return bins}histogram.value=function(x){if(!arguments.length)return valuer;valuer=x;return histogram};histogram.range=function(x){if(!arguments.length)return ranger;ranger=d3_functor(x);return histogram};histogram.bins=function(x){if(!arguments.length)return binner;binner=typeof x==="number"?function(range){return d3_layout_histogramBinFixed(range,x)}:d3_functor(x);return histogram};histogram.frequency=function(x){if(!arguments.length)return frequency;frequency=!!x;return histogram};return histogram};function d3_layout_histogramBinSturges(range,values){return d3_layout_histogramBinFixed(range,Math.ceil(Math.log(values.length)/Math.LN2+1))}function d3_layout_histogramBinFixed(range,n){var x=-1,b=+range[0],m=(range[1]-b)/n,f=[];while(++x<=n)f[x]=m*x+b;return f}function d3_layout_histogramRange(values){return[d3.min(values),d3.max(values)]}d3.layout.pack=function(){var hierarchy=d3.layout.hierarchy().sort(d3_layout_packSort),padding=0,size=[1,1],radius;function pack(d,i){var nodes=hierarchy.call(this,d,i),root=nodes[0],w=size[0],h=size[1],r=radius==null?Math.sqrt:typeof radius==="function"?radius:function(){return radius};root.x=root.y=0;d3_layout_hierarchyVisitAfter(root,function(d){d.r=+r(d.value)});d3_layout_hierarchyVisitAfter(root,d3_layout_packSiblings);if(padding){var dr=padding*(radius?1:Math.max(2*root.r/w,2*root.r/h))/2;d3_layout_hierarchyVisitAfter(root,function(d){d.r+=dr});d3_layout_hierarchyVisitAfter(root,d3_layout_packSiblings);d3_layout_hierarchyVisitAfter(root,function(d){d.r-=dr})}d3_layout_packTransform(root,w/2,h/2,radius?1:1/Math.max(2*root.r/w,2*root.r/h));return nodes}pack.size=function(_){if(!arguments.length)return size;size=_;return pack};pack.radius=function(_){if(!arguments.length)return radius;radius=_==null||typeof _==="function"?_:+_;return pack};pack.padding=function(_){if(!arguments.length)return padding;padding=+_;return pack};return d3_layout_hierarchyRebind(pack,hierarchy)};function d3_layout_packSort(a,b){return a.value-b.value}function d3_layout_packInsert(a,b){var c=a._pack_next;a._pack_next=b;b._pack_prev=a;b._pack_next=c;c._pack_prev=b}function d3_layout_packSplice(a,b){a._pack_next=b;b._pack_prev=a}function d3_layout_packIntersects(a,b){var dx=b.x-a.x,dy=b.y-a.y,dr=a.r+b.r;return.999*dr*dr>dx*dx+dy*dy}function d3_layout_packSiblings(node){if(!(nodes=node.children)||!(n=nodes.length))return;var nodes,xMin=Infinity,xMax=-Infinity,yMin=Infinity,yMax=-Infinity,a,b,c,i,j,k,n;function bound(node){xMin=Math.min(node.x-node.r,xMin);xMax=Math.max(node.x+node.r,xMax);yMin=Math.min(node.y-node.r,yMin);yMax=Math.max(node.y+node.r,yMax)}nodes.forEach(d3_layout_packLink);a=nodes[0];a.x=-a.r;a.y=0;bound(a);if(n>1){b=nodes[1];b.x=b.r;b.y=0;bound(b);if(n>2){c=nodes[2];d3_layout_packPlace(a,b,c);bound(c);d3_layout_packInsert(a,c);a._pack_prev=c;d3_layout_packInsert(c,b);b=a._pack_next;for(i=3;i<n;i++){d3_layout_packPlace(a,b,c=nodes[i]);var isect=0,s1=1,s2=1;for(j=b._pack_next;j!==b;j=j._pack_next,s1++){if(d3_layout_packIntersects(j,c)){isect=1;break}}if(isect==1){for(k=a._pack_prev;k!==j._pack_prev;k=k._pack_prev,s2++){if(d3_layout_packIntersects(k,c)){break}}}if(isect){if(s1<s2||s1==s2&&b.r<a.r)d3_layout_packSplice(a,b=j);else d3_layout_packSplice(a=k,b);i--}else{d3_layout_packInsert(a,c);b=c;bound(c)}}}}var cx=(xMin+xMax)/2,cy=(yMin+yMax)/2,cr=0;for(i=0;i<n;i++){c=nodes[i];c.x-=cx;c.y-=cy;cr=Math.max(cr,c.r+Math.sqrt(c.x*c.x+c.y*c.y))}node.r=cr;nodes.forEach(d3_layout_packUnlink)}function d3_layout_packLink(node){node._pack_next=node._pack_prev=node}function d3_layout_packUnlink(node){delete node._pack_next;delete node._pack_prev}function d3_layout_packTransform(node,x,y,k){var children=node.children;node.x=x+=k*node.x;node.y=y+=k*node.y;node.r*=k;if(children){var i=-1,n=children.length;while(++i<n)d3_layout_packTransform(children[i],x,y,k)}}function d3_layout_packPlace(a,b,c){var db=a.r+c.r,dx=b.x-a.x,dy=b.y-a.y;if(db&&(dx||dy)){var da=b.r+c.r,dc=dx*dx+dy*dy;da*=da;db*=db;var x=.5+(db-da)/(2*dc),y=Math.sqrt(Math.max(0,2*da*(db+dc)-(db-=dc)*db-da*da))/(2*dc);c.x=a.x+x*dx+y*dy;c.y=a.y+x*dy-y*dx}else{c.x=a.x+db;c.y=a.y}}d3.layout.tree=function(){var hierarchy=d3.layout.hierarchy().sort(null).value(null),separation=d3_layout_treeSeparation,size=[1,1],nodeSize=null;function tree(d,i){var nodes=hierarchy.call(this,d,i),root0=nodes[0],root1=wrapTree(root0);d3_layout_hierarchyVisitAfter(root1,firstWalk),root1.parent.m=-root1.z;d3_layout_hierarchyVisitBefore(root1,secondWalk);if(nodeSize)d3_layout_hierarchyVisitBefore(root0,sizeNode);else{var left=root0,right=root0,bottom=root0;d3_layout_hierarchyVisitBefore(root0,function(node){if(node.x<left.x)left=node;if(node.x>right.x)right=node;if(node.depth>bottom.depth)bottom=node});var tx=separation(left,right)/2-left.x,kx=size[0]/(right.x+separation(right,left)/2+tx),ky=size[1]/(bottom.depth||1);d3_layout_hierarchyVisitBefore(root0,function(node){node.x=(node.x+tx)*kx;node.y=node.depth*ky})}return nodes}function wrapTree(root0){var root1={A:null,children:[root0]},queue=[root1],node1;while((node1=queue.pop())!=null){for(var children=node1.children,child,i=0,n=children.length;i<n;++i){queue.push((children[i]=child={_:children[i],parent:node1,children:(child=children[i].children)&&child.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:i}).a=child)}}return root1.children[0]}function firstWalk(v){var children=v.children,siblings=v.parent.children,w=v.i?siblings[v.i-1]:null;if(children.length){d3_layout_treeShift(v);var midpoint=(children[0].z+children[children.length-1].z)/2;if(w){v.z=w.z+separation(v._,w._);v.m=v.z-midpoint}else{v.z=midpoint}}else if(w){v.z=w.z+separation(v._,w._)}v.parent.A=apportion(v,w,v.parent.A||siblings[0])}function secondWalk(v){v._.x=v.z+v.parent.m;v.m+=v.parent.m}function apportion(v,w,ancestor){if(w){var vip=v,vop=v,vim=w,vom=vip.parent.children[0],sip=vip.m,sop=vop.m,sim=vim.m,som=vom.m,shift;while(vim=d3_layout_treeRight(vim),vip=d3_layout_treeLeft(vip),vim&&vip){vom=d3_layout_treeLeft(vom);vop=d3_layout_treeRight(vop);vop.a=v;shift=vim.z+sim-vip.z-sip+separation(vim._,vip._);if(shift>0){d3_layout_treeMove(d3_layout_treeAncestor(vim,v,ancestor),v,shift);sip+=shift;sop+=shift}sim+=vim.m;sip+=vip.m;som+=vom.m;sop+=vop.m}if(vim&&!d3_layout_treeRight(vop)){vop.t=vim;vop.m+=sim-sop}if(vip&&!d3_layout_treeLeft(vom)){vom.t=vip;vom.m+=sip-som;ancestor=v}}return ancestor}function sizeNode(node){node.x*=size[0];node.y=node.depth*size[1]}tree.separation=function(x){if(!arguments.length)return separation;separation=x;return tree};tree.size=function(x){if(!arguments.length)return nodeSize?null:size;nodeSize=(size=x)==null?sizeNode:null;return tree};tree.nodeSize=function(x){if(!arguments.length)return nodeSize?size:null;nodeSize=(size=x)==null?null:sizeNode;return tree};return d3_layout_hierarchyRebind(tree,hierarchy)};function d3_layout_treeSeparation(a,b){return a.parent==b.parent?1:2}function d3_layout_treeLeft(v){var children=v.children;return children.length?children[0]:v.t}function d3_layout_treeRight(v){var children=v.children,n;return(n=children.length)?children[n-1]:v.t}function d3_layout_treeMove(wm,wp,shift){var change=shift/(wp.i-wm.i);wp.c-=change;wp.s+=shift;wm.c+=change;wp.z+=shift;wp.m+=shift}function d3_layout_treeShift(v){var shift=0,change=0,children=v.children,i=children.length,w;while(--i>=0){w=children[i];w.z+=shift;w.m+=shift;shift+=w.s+(change+=w.c)}}function d3_layout_treeAncestor(vim,v,ancestor){return vim.a.parent===v.parent?vim.a:ancestor}d3.layout.cluster=function(){var hierarchy=d3.layout.hierarchy().sort(null).value(null),separation=d3_layout_treeSeparation,size=[1,1],nodeSize=false;function cluster(d,i){var nodes=hierarchy.call(this,d,i),root=nodes[0],previousNode,x=0;d3_layout_hierarchyVisitAfter(root,function(node){var children=node.children;if(children&&children.length){node.x=d3_layout_clusterX(children);node.y=d3_layout_clusterY(children)}else{node.x=previousNode?x+=separation(node,previousNode):0;node.y=0;previousNode=node}});var left=d3_layout_clusterLeft(root),right=d3_layout_clusterRight(root),x0=left.x-separation(left,right)/2,x1=right.x+separation(right,left)/2;d3_layout_hierarchyVisitAfter(root,nodeSize?function(node){node.x=(node.x-root.x)*size[0];node.y=(root.y-node.y)*size[1]}:function(node){node.x=(node.x-x0)/(x1-x0)*size[0];node.y=(1-(root.y?node.y/root.y:1))*size[1]});return nodes}cluster.separation=function(x){if(!arguments.length)return separation;separation=x;return cluster};cluster.size=function(x){if(!arguments.length)return nodeSize?null:size;nodeSize=(size=x)==null;return cluster};cluster.nodeSize=function(x){if(!arguments.length)return nodeSize?size:null;nodeSize=(size=x)!=null;return cluster};return d3_layout_hierarchyRebind(cluster,hierarchy)};function d3_layout_clusterY(children){return 1+d3.max(children,function(child){return child.y})}function d3_layout_clusterX(children){return children.reduce(function(x,child){return x+child.x},0)/children.length}function d3_layout_clusterLeft(node){var children=node.children;return children&&children.length?d3_layout_clusterLeft(children[0]):node}function d3_layout_clusterRight(node){var children=node.children,n;return children&&(n=children.length)?d3_layout_clusterRight(children[n-1]):node}d3.layout.treemap=function(){var hierarchy=d3.layout.hierarchy(),round=Math.round,size=[1,1],padding=null,pad=d3_layout_treemapPadNull,sticky=false,stickies,mode="squarify",ratio=.5*(1+Math.sqrt(5));function scale(children,k){var i=-1,n=children.length,child,area;while(++i<n){area=(child=children[i]).value*(k<0?0:k);child.area=isNaN(area)||area<=0?0:area}}function squarify(node){var children=node.children;if(children&&children.length){var rect=pad(node),row=[],remaining=children.slice(),child,best=Infinity,score,u=mode==="slice"?rect.dx:mode==="dice"?rect.dy:mode==="slice-dice"?node.depth&1?rect.dy:rect.dx:Math.min(rect.dx,rect.dy),n;scale(remaining,rect.dx*rect.dy/node.value);row.area=0;while((n=remaining.length)>0){row.push(child=remaining[n-1]);row.area+=child.area;if(mode!=="squarify"||(score=worst(row,u))<=best){remaining.pop();best=score}else{row.area-=row.pop().area;position(row,u,rect,false);u=Math.min(rect.dx,rect.dy);row.length=row.area=0;best=Infinity}}if(row.length){position(row,u,rect,true);row.length=row.area=0}children.forEach(squarify)}}function stickify(node){var children=node.children;if(children&&children.length){var rect=pad(node),remaining=children.slice(),child,row=[];scale(remaining,rect.dx*rect.dy/node.value);row.area=0;while(child=remaining.pop()){row.push(child);row.area+=child.area;if(child.z!=null){position(row,child.z?rect.dx:rect.dy,rect,!remaining.length);row.length=row.area=0}}children.forEach(stickify)}}function worst(row,u){var s=row.area,r,rmax=0,rmin=Infinity,i=-1,n=row.length;while(++i<n){if(!(r=row[i].area))continue;if(r<rmin)rmin=r;if(r>rmax)rmax=r}s*=s;u*=u;return s?Math.max(u*rmax*ratio/s,s/(u*rmin*ratio)):Infinity}function position(row,u,rect,flush){var i=-1,n=row.length,x=rect.x,y=rect.y,v=u?round(row.area/u):0,o;if(u==rect.dx){if(flush||v>rect.dy)v=rect.dy;while(++i<n){o=row[i];o.x=x;o.y=y;o.dy=v;x+=o.dx=Math.min(rect.x+rect.dx-x,v?round(o.area/v):0)}o.z=true;o.dx+=rect.x+rect.dx-x;rect.y+=v;rect.dy-=v}else{if(flush||v>rect.dx)v=rect.dx;while(++i<n){o=row[i];o.x=x;o.y=y;o.dx=v;y+=o.dy=Math.min(rect.y+rect.dy-y,v?round(o.area/v):0)}o.z=false;o.dy+=rect.y+rect.dy-y;rect.x+=v;rect.dx-=v}}function treemap(d){var nodes=stickies||hierarchy(d),root=nodes[0];root.x=root.y=0;if(root.value)root.dx=size[0],root.dy=size[1];else root.dx=root.dy=0;if(stickies)hierarchy.revalue(root);scale([root],root.dx*root.dy/root.value);(stickies?stickify:squarify)(root);if(sticky)stickies=nodes;return nodes}treemap.size=function(x){if(!arguments.length)return size;size=x;return treemap};treemap.padding=function(x){if(!arguments.length)return padding;function padFunction(node){var p=x.call(treemap,node,node.depth);return p==null?d3_layout_treemapPadNull(node):d3_layout_treemapPad(node,typeof p==="number"?[p,p,p,p]:p)}function padConstant(node){return d3_layout_treemapPad(node,x)}var type;pad=(padding=x)==null?d3_layout_treemapPadNull:(type=typeof x)==="function"?padFunction:type==="number"?(x=[x,x,x,x],padConstant):padConstant;return treemap};treemap.round=function(x){if(!arguments.length)return round!=Number;round=x?Math.round:Number;return treemap};treemap.sticky=function(x){if(!arguments.length)return sticky;sticky=x;stickies=null;return treemap};treemap.ratio=function(x){if(!arguments.length)return ratio;ratio=x;return treemap};treemap.mode=function(x){if(!arguments.length)return mode;mode=x+"";return treemap};return d3_layout_hierarchyRebind(treemap,hierarchy)};function d3_layout_treemapPadNull(node){return{x:node.x,y:node.y,dx:node.dx,dy:node.dy}}function d3_layout_treemapPad(node,padding){var x=node.x+padding[3],y=node.y+padding[0],dx=node.dx-padding[1]-padding[3],dy=node.dy-padding[0]-padding[2];if(dx<0){x+=dx/2;dx=0}if(dy<0){y+=dy/2;dy=0}return{x:x,y:y,dx:dx,dy:dy}}d3.random={normal:function(µ,σ){var n=arguments.length;if(n<2)σ=1;if(n<1)µ=0;return function(){var x,y,r;do{x=Math.random()*2-1;y=Math.random()*2-1;r=x*x+y*y}while(!r||r>1);return µ+σ*x*Math.sqrt(-2*Math.log(r)/r)}},logNormal:function(){var random=d3.random.normal.apply(d3,arguments);return function(){return Math.exp(random())}},bates:function(m){var random=d3.random.irwinHall(m);return function(){return random()/m}},irwinHall:function(m){return function(){for(var s=0,j=0;j<m;j++)s+=Math.random();return s}}};d3.scale={};function d3_scaleExtent(domain){var start=domain[0],stop=domain[domain.length-1];return start<stop?[start,stop]:[stop,start]}function d3_scaleRange(scale){return scale.rangeExtent?scale.rangeExtent():d3_scaleExtent(scale.range())}function d3_scale_bilinear(domain,range,uninterpolate,interpolate){var u=uninterpolate(domain[0],domain[1]),i=interpolate(range[0],range[1]);return function(x){return i(u(x))}}function d3_scale_nice(domain,nice){var i0=0,i1=domain.length-1,x0=domain[i0],x1=domain[i1],dx;if(x1<x0){dx=i0,i0=i1,i1=dx;dx=x0,x0=x1,x1=dx}domain[i0]=nice.floor(x0);domain[i1]=nice.ceil(x1);return domain}function d3_scale_niceStep(step){return step?{floor:function(x){return Math.floor(x/step)*step},ceil:function(x){return Math.ceil(x/step)*step}}:d3_scale_niceIdentity}var d3_scale_niceIdentity={floor:d3_identity,ceil:d3_identity};function d3_scale_polylinear(domain,range,uninterpolate,interpolate){var u=[],i=[],j=0,k=Math.min(domain.length,range.length)-1;if(domain[k]<domain[0]){domain=domain.slice().reverse();range=range.slice().reverse()}while(++j<=k){u.push(uninterpolate(domain[j-1],domain[j]));i.push(interpolate(range[j-1],range[j]))}return function(x){var j=d3.bisect(domain,x,1,k)-1;return i[j](u[j](x))}}d3.scale.linear=function(){return d3_scale_linear([0,1],[0,1],d3_interpolate,false)};function d3_scale_linear(domain,range,interpolate,clamp){var output,input;function rescale(){var linear=Math.min(domain.length,range.length)>2?d3_scale_polylinear:d3_scale_bilinear,uninterpolate=clamp?d3_uninterpolateClamp:d3_uninterpolateNumber;output=linear(domain,range,uninterpolate,interpolate);input=linear(range,domain,uninterpolate,d3_interpolate);return scale}function scale(x){return output(x)}scale.invert=function(y){return input(y)};scale.domain=function(x){if(!arguments.length)return domain;domain=x.map(Number);return rescale()};scale.range=function(x){if(!arguments.length)return range;range=x;return rescale()};scale.rangeRound=function(x){return scale.range(x).interpolate(d3_interpolateRound)};scale.clamp=function(x){if(!arguments.length)return clamp;clamp=x;return rescale()};scale.interpolate=function(x){if(!arguments.length)return interpolate;interpolate=x;return rescale()};scale.ticks=function(m){return d3_scale_linearTicks(domain,m)};scale.tickFormat=function(m,format){return d3_scale_linearTickFormat(domain,m,format)};scale.nice=function(m){d3_scale_linearNice(domain,m);return rescale()};scale.copy=function(){return d3_scale_linear(domain,range,interpolate,clamp)};return rescale()}function d3_scale_linearRebind(scale,linear){return d3.rebind(scale,linear,"range","rangeRound","interpolate","clamp")}function d3_scale_linearNice(domain,m){d3_scale_nice(domain,d3_scale_niceStep(d3_scale_linearTickRange(domain,m)[2]));d3_scale_nice(domain,d3_scale_niceStep(d3_scale_linearTickRange(domain,m)[2]));return domain}function d3_scale_linearTickRange(domain,m){if(m==null)m=10;var extent=d3_scaleExtent(domain),span=extent[1]-extent[0],step=Math.pow(10,Math.floor(Math.log(span/m)/Math.LN10)),err=m/span*step;if(err<=.15)step*=10;else if(err<=.35)step*=5;else if(err<=.75)step*=2;extent[0]=Math.ceil(extent[0]/step)*step;extent[1]=Math.floor(extent[1]/step)*step+step*.5;extent[2]=step;return extent}function d3_scale_linearTicks(domain,m){return d3.range.apply(d3,d3_scale_linearTickRange(domain,m))}function d3_scale_linearTickFormat(domain,m,format){var range=d3_scale_linearTickRange(domain,m);if(format){var match=d3_format_re.exec(format);match.shift();if(match[8]==="s"){var prefix=d3.formatPrefix(Math.max(abs(range[0]),abs(range[1])));if(!match[7])match[7]="."+d3_scale_linearPrecision(prefix.scale(range[2]));match[8]="f";format=d3.format(match.join(""));return function(d){return format(prefix.scale(d))+prefix.symbol}}if(!match[7])match[7]="."+d3_scale_linearFormatPrecision(match[8],range);format=match.join("")}else{format=",."+d3_scale_linearPrecision(range[2])+"f"}return d3.format(format)}var d3_scale_linearFormatSignificant={s:1,g:1,p:1,r:1,e:1};function d3_scale_linearPrecision(value){return-Math.floor(Math.log(value)/Math.LN10+.01)}function d3_scale_linearFormatPrecision(type,range){var p=d3_scale_linearPrecision(range[2]);return type in d3_scale_linearFormatSignificant?Math.abs(p-d3_scale_linearPrecision(Math.max(abs(range[0]),abs(range[1]))))+ +(type!=="e"):p-(type==="%")*2}d3.scale.log=function(){return d3_scale_log(d3.scale.linear().domain([0,1]),10,true,[1,10])};function d3_scale_log(linear,base,positive,domain){function log(x){return(positive?Math.log(x<0?0:x):-Math.log(x>0?0:-x))/Math.log(base)}function pow(x){return positive?Math.pow(base,x):-Math.pow(base,-x)}function scale(x){return linear(log(x))}scale.invert=function(x){return pow(linear.invert(x))};scale.domain=function(x){if(!arguments.length)return domain;positive=x[0]>=0;linear.domain((domain=x.map(Number)).map(log));return scale};scale.base=function(_){if(!arguments.length)return base;base=+_;linear.domain(domain.map(log));return scale};scale.nice=function(){var niced=d3_scale_nice(domain.map(log),positive?Math:d3_scale_logNiceNegative);linear.domain(niced);domain=niced.map(pow);return scale};scale.ticks=function(){var extent=d3_scaleExtent(domain),ticks=[],u=extent[0],v=extent[1],i=Math.floor(log(u)),j=Math.ceil(log(v)),n=base%1?2:base;if(isFinite(j-i)){if(positive){for(;i<j;i++)for(var k=1;k<n;k++)ticks.push(pow(i)*k);ticks.push(pow(i))}else{ticks.push(pow(i));for(;i++<j;)for(var k=n-1;k>0;k--)ticks.push(pow(i)*k)}for(i=0;ticks[i]<u;i++){}for(j=ticks.length;ticks[j-1]>v;j--){}ticks=ticks.slice(i,j)}return ticks};scale.tickFormat=function(n,format){if(!arguments.length)return d3_scale_logFormat;if(arguments.length<2)format=d3_scale_logFormat;else if(typeof format!=="function")format=d3.format(format);var k=Math.max(1,base*n/scale.ticks().length);return function(d){var i=d/pow(Math.round(log(d)));if(i*base<base-.5)i*=base;return i<=k?format(d):""}};scale.copy=function(){return d3_scale_log(linear.copy(),base,positive,domain)};return d3_scale_linearRebind(scale,linear)}var d3_scale_logFormat=d3.format(".0e"),d3_scale_logNiceNegative={floor:function(x){return-Math.ceil(-x)},ceil:function(x){return-Math.floor(-x)}};d3.scale.pow=function(){return d3_scale_pow(d3.scale.linear(),1,[0,1])};function d3_scale_pow(linear,exponent,domain){var powp=d3_scale_powPow(exponent),powb=d3_scale_powPow(1/exponent);function scale(x){return linear(powp(x))}scale.invert=function(x){return powb(linear.invert(x))};scale.domain=function(x){if(!arguments.length)return domain;linear.domain((domain=x.map(Number)).map(powp));return scale};scale.ticks=function(m){return d3_scale_linearTicks(domain,m)};scale.tickFormat=function(m,format){return d3_scale_linearTickFormat(domain,m,format)};scale.nice=function(m){return scale.domain(d3_scale_linearNice(domain,m))};scale.exponent=function(x){if(!arguments.length)return exponent;powp=d3_scale_powPow(exponent=x);powb=d3_scale_powPow(1/exponent);linear.domain(domain.map(powp));return scale};scale.copy=function(){return d3_scale_pow(linear.copy(),exponent,domain)};return d3_scale_linearRebind(scale,linear)}function d3_scale_powPow(e){return function(x){return x<0?-Math.pow(-x,e):Math.pow(x,e)}}d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)};d3.scale.ordinal=function(){return d3_scale_ordinal([],{t:"range",a:[[]]})};function d3_scale_ordinal(domain,ranger){var index,range,rangeBand;function scale(x){return range[((index.get(x)||(ranger.t==="range"?index.set(x,domain.push(x)):NaN))-1)%range.length]}function steps(start,step){return d3.range(domain.length).map(function(i){return start+step*i})}scale.domain=function(x){if(!arguments.length)return domain;domain=[];index=new d3_Map;var i=-1,n=x.length,xi;while(++i<n)if(!index.has(xi=x[i]))index.set(xi,domain.push(xi));return scale[ranger.t].apply(scale,ranger.a)};scale.range=function(x){if(!arguments.length)return range;range=x;rangeBand=0;ranger={t:"range",a:arguments};return scale};scale.rangePoints=function(x,padding){if(arguments.length<2)padding=0;var start=x[0],stop=x[1],step=domain.length<2?(start=(start+stop)/2,0):(stop-start)/(domain.length-1+padding);range=steps(start+step*padding/2,step);rangeBand=0;ranger={t:"rangePoints",a:arguments};return scale};scale.rangeRoundPoints=function(x,padding){if(arguments.length<2)padding=0;var start=x[0],stop=x[1],step=domain.length<2?(start=stop=Math.round((start+stop)/2),0):(stop-start)/(domain.length-1+padding)|0;range=steps(start+Math.round(step*padding/2+(stop-start-(domain.length-1+padding)*step)/2),step);rangeBand=0;ranger={t:"rangeRoundPoints",a:arguments};return scale};scale.rangeBands=function(x,padding,outerPadding){if(arguments.length<2)padding=0;if(arguments.length<3)outerPadding=padding;var reverse=x[1]<x[0],start=x[reverse-0],stop=x[1-reverse],step=(stop-start)/(domain.length-padding+2*outerPadding);range=steps(start+step*outerPadding,step);if(reverse)range.reverse();rangeBand=step*(1-padding);ranger={t:"rangeBands",a:arguments};return scale};scale.rangeRoundBands=function(x,padding,outerPadding){if(arguments.length<2)padding=0;if(arguments.length<3)outerPadding=padding;var reverse=x[1]<x[0],start=x[reverse-0],stop=x[1-reverse],step=Math.floor((stop-start)/(domain.length-padding+2*outerPadding));range=steps(start+Math.round((stop-start-(domain.length-padding)*step)/2),step);if(reverse)range.reverse();rangeBand=Math.round(step*(1-padding));ranger={t:"rangeRoundBands",a:arguments};return scale};scale.rangeBand=function(){return rangeBand};scale.rangeExtent=function(){return d3_scaleExtent(ranger.a[0])};scale.copy=function(){return d3_scale_ordinal(domain,ranger)};return scale.domain(domain)}d3.scale.category10=function(){return d3.scale.ordinal().range(d3_category10)};d3.scale.category20=function(){return d3.scale.ordinal().range(d3_category20)};d3.scale.category20b=function(){return d3.scale.ordinal().range(d3_category20b)};d3.scale.category20c=function(){return d3.scale.ordinal().range(d3_category20c)};var d3_category10=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(d3_rgbString);var d3_category20=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(d3_rgbString);var d3_category20b=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(d3_rgbString);var d3_category20c=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(d3_rgbString);d3.scale.quantile=function(){return d3_scale_quantile([],[])};function d3_scale_quantile(domain,range){var thresholds;function rescale(){var k=0,q=range.length;thresholds=[];while(++k<q)thresholds[k-1]=d3.quantile(domain,k/q);return scale}function scale(x){if(!isNaN(x=+x))return range[d3.bisect(thresholds,x)]}scale.domain=function(x){if(!arguments.length)return domain;domain=x.map(d3_number).filter(d3_numeric).sort(d3_ascending);return rescale()};scale.range=function(x){if(!arguments.length)return range;range=x;return rescale()};scale.quantiles=function(){return thresholds};scale.invertExtent=function(y){y=range.indexOf(y);return y<0?[NaN,NaN]:[y>0?thresholds[y-1]:domain[0],y<thresholds.length?thresholds[y]:domain[domain.length-1]]};scale.copy=function(){return d3_scale_quantile(domain,range)};return rescale()}d3.scale.quantize=function(){return d3_scale_quantize(0,1,[0,1])};function d3_scale_quantize(x0,x1,range){var kx,i;function scale(x){return range[Math.max(0,Math.min(i,Math.floor(kx*(x-x0))))]}function rescale(){kx=range.length/(x1-x0);i=range.length-1;return scale}scale.domain=function(x){if(!arguments.length)return[x0,x1];x0=+x[0];x1=+x[x.length-1];return rescale()};scale.range=function(x){if(!arguments.length)return range;range=x;return rescale()};scale.invertExtent=function(y){y=range.indexOf(y);y=y<0?NaN:y/kx+x0;return[y,y+1/kx]};scale.copy=function(){return d3_scale_quantize(x0,x1,range)};return rescale()}d3.scale.threshold=function(){return d3_scale_threshold([.5],[0,1])};function d3_scale_threshold(domain,range){function scale(x){if(x<=x)return range[d3.bisect(domain,x)]}scale.domain=function(_){if(!arguments.length)return domain;domain=_;return scale};scale.range=function(_){if(!arguments.length)return range;range=_;return scale};scale.invertExtent=function(y){y=range.indexOf(y);return[domain[y-1],domain[y]]};scale.copy=function(){return d3_scale_threshold(domain,range)};return scale}d3.scale.identity=function(){return d3_scale_identity([0,1])};function d3_scale_identity(domain){function identity(x){return+x}identity.invert=identity;identity.domain=identity.range=function(x){if(!arguments.length)return domain;domain=x.map(identity);return identity};identity.ticks=function(m){return d3_scale_linearTicks(domain,m)};identity.tickFormat=function(m,format){return d3_scale_linearTickFormat(domain,m,format)};identity.copy=function(){return d3_scale_identity(domain)};return identity}d3.svg={};function d3_zero(){return 0}d3.svg.arc=function(){var innerRadius=d3_svg_arcInnerRadius,outerRadius=d3_svg_arcOuterRadius,cornerRadius=d3_zero,padRadius=d3_svg_arcAuto,startAngle=d3_svg_arcStartAngle,endAngle=d3_svg_arcEndAngle,padAngle=d3_svg_arcPadAngle;function arc(){var r0=Math.max(0,+innerRadius.apply(this,arguments)),r1=Math.max(0,+outerRadius.apply(this,arguments)),a0=startAngle.apply(this,arguments)-halfπ,a1=endAngle.apply(this,arguments)-halfπ,da=Math.abs(a1-a0),cw=a0>a1?0:1;if(r1<r0)rc=r1,r1=r0,r0=rc;if(da>=τε)return circleSegment(r1,cw)+(r0?circleSegment(r0,1-cw):"")+"Z";var rc,cr,rp,ap,p0=0,p1=0,x0,y0,x1,y1,x2,y2,x3,y3,path=[];if(ap=(+padAngle.apply(this,arguments)||0)/2){rp=padRadius===d3_svg_arcAuto?Math.sqrt(r0*r0+r1*r1):+padRadius.apply(this,arguments);if(!cw)p1*=-1;if(r1)p1=d3_asin(rp/r1*Math.sin(ap));if(r0)p0=d3_asin(rp/r0*Math.sin(ap))}if(r1){x0=r1*Math.cos(a0+p1);y0=r1*Math.sin(a0+p1);x1=r1*Math.cos(a1-p1);y1=r1*Math.sin(a1-p1);var l1=Math.abs(a1-a0-2*p1)<=π?0:1;if(p1&&d3_svg_arcSweep(x0,y0,x1,y1)===cw^l1){var h1=(a0+a1)/2;x0=r1*Math.cos(h1);y0=r1*Math.sin(h1);x1=y1=null}}else{x0=y0=0}if(r0){x2=r0*Math.cos(a1-p0);y2=r0*Math.sin(a1-p0);x3=r0*Math.cos(a0+p0);y3=r0*Math.sin(a0+p0);var l0=Math.abs(a0-a1+2*p0)<=π?0:1;if(p0&&d3_svg_arcSweep(x2,y2,x3,y3)===1-cw^l0){var h0=(a0+a1)/2;x2=r0*Math.cos(h0);y2=r0*Math.sin(h0);x3=y3=null}}else{x2=y2=0}if(da>ε&&(rc=Math.min(Math.abs(r1-r0)/2,+cornerRadius.apply(this,arguments)))>.001){cr=r0<r1^cw?0:1;var rc1=rc,rc0=rc;if(da<π){var oc=x3==null?[x2,y2]:x1==null?[x0,y0]:d3_geom_polygonIntersect([x0,y0],[x3,y3],[x1,y1],[x2,y2]),ax=x0-oc[0],ay=y0-oc[1],bx=x1-oc[0],by=y1-oc[1],kc=1/Math.sin(Math.acos((ax*bx+ay*by)/(Math.sqrt(ax*ax+ay*ay)*Math.sqrt(bx*bx+by*by)))/2),lc=Math.sqrt(oc[0]*oc[0]+oc[1]*oc[1]);rc0=Math.min(rc,(r0-lc)/(kc-1));rc1=Math.min(rc,(r1-lc)/(kc+1))}if(x1!=null){var t30=d3_svg_arcCornerTangents(x3==null?[x2,y2]:[x3,y3],[x0,y0],r1,rc1,cw),t12=d3_svg_arcCornerTangents([x1,y1],[x2,y2],r1,rc1,cw);if(rc===rc1){path.push("M",t30[0],"A",rc1,",",rc1," 0 0,",cr," ",t30[1],"A",r1,",",r1," 0 ",1-cw^d3_svg_arcSweep(t30[1][0],t30[1][1],t12[1][0],t12[1][1]),",",cw," ",t12[1],"A",rc1,",",rc1," 0 0,",cr," ",t12[0])}else{path.push("M",t30[0],"A",rc1,",",rc1," 0 1,",cr," ",t12[0])}}else{path.push("M",x0,",",y0)}if(x3!=null){var t03=d3_svg_arcCornerTangents([x0,y0],[x3,y3],r0,-rc0,cw),t21=d3_svg_arcCornerTangents([x2,y2],x1==null?[x0,y0]:[x1,y1],r0,-rc0,cw);if(rc===rc0){path.push("L",t21[0],"A",rc0,",",rc0," 0 0,",cr," ",t21[1],"A",r0,",",r0," 0 ",cw^d3_svg_arcSweep(t21[1][0],t21[1][1],t03[1][0],t03[1][1]),",",1-cw," ",t03[1],"A",rc0,",",rc0," 0 0,",cr," ",t03[0])}else{path.push("L",t21[0],"A",rc0,",",rc0," 0 0,",cr," ",t03[0])}}else{path.push("L",x2,",",y2)}}else{path.push("M",x0,",",y0);if(x1!=null)path.push("A",r1,",",r1," 0 ",l1,",",cw," ",x1,",",y1);path.push("L",x2,",",y2);if(x3!=null)path.push("A",r0,",",r0," 0 ",l0,",",1-cw," ",x3,",",y3)}path.push("Z");return path.join("")}function circleSegment(r1,cw){return"M0,"+r1+"A"+r1+","+r1+" 0 1,"+cw+" 0,"+-r1+"A"+r1+","+r1+" 0 1,"+cw+" 0,"+r1}arc.innerRadius=function(v){if(!arguments.length)return innerRadius;innerRadius=d3_functor(v);return arc};arc.outerRadius=function(v){if(!arguments.length)return outerRadius;outerRadius=d3_functor(v);return arc};arc.cornerRadius=function(v){if(!arguments.length)return cornerRadius;cornerRadius=d3_functor(v);return arc};arc.padRadius=function(v){if(!arguments.length)return padRadius;padRadius=v==d3_svg_arcAuto?d3_svg_arcAuto:d3_functor(v);return arc};arc.startAngle=function(v){if(!arguments.length)return startAngle;startAngle=d3_functor(v);return arc};arc.endAngle=function(v){if(!arguments.length)return endAngle;endAngle=d3_functor(v);return arc};arc.padAngle=function(v){if(!arguments.length)return padAngle;padAngle=d3_functor(v);return arc};arc.centroid=function(){var r=(+innerRadius.apply(this,arguments)+ +outerRadius.apply(this,arguments))/2,a=(+startAngle.apply(this,arguments)+ +endAngle.apply(this,arguments))/2-halfπ;return[Math.cos(a)*r,Math.sin(a)*r]};return arc};var d3_svg_arcAuto="auto";function d3_svg_arcInnerRadius(d){return d.innerRadius}function d3_svg_arcOuterRadius(d){return d.outerRadius}function d3_svg_arcStartAngle(d){return d.startAngle}function d3_svg_arcEndAngle(d){return d.endAngle}function d3_svg_arcPadAngle(d){return d&&d.padAngle}function d3_svg_arcSweep(x0,y0,x1,y1){return(x0-x1)*y0-(y0-y1)*x0>0?0:1}function d3_svg_arcCornerTangents(p0,p1,r1,rc,cw){var x01=p0[0]-p1[0],y01=p0[1]-p1[1],lo=(cw?rc:-rc)/Math.sqrt(x01*x01+y01*y01),ox=lo*y01,oy=-lo*x01,x1=p0[0]+ox,y1=p0[1]+oy,x2=p1[0]+ox,y2=p1[1]+oy,x3=(x1+x2)/2,y3=(y1+y2)/2,dx=x2-x1,dy=y2-y1,d2=dx*dx+dy*dy,r=r1-rc,D=x1*y2-x2*y1,d=(dy<0?-1:1)*Math.sqrt(Math.max(0,r*r*d2-D*D)),cx0=(D*dy-dx*d)/d2,cy0=(-D*dx-dy*d)/d2,cx1=(D*dy+dx*d)/d2,cy1=(-D*dx+dy*d)/d2,dx0=cx0-x3,dy0=cy0-y3,dx1=cx1-x3,dy1=cy1-y3;if(dx0*dx0+dy0*dy0>dx1*dx1+dy1*dy1)cx0=cx1,cy0=cy1;return[[cx0-ox,cy0-oy],[cx0*r1/r,cy0*r1/r]]}function d3_svg_line(projection){var x=d3_geom_pointX,y=d3_geom_pointY,defined=d3_true,interpolate=d3_svg_lineLinear,interpolateKey=interpolate.key,tension=.7;function line(data){var segments=[],points=[],i=-1,n=data.length,d,fx=d3_functor(x),fy=d3_functor(y);function segment(){segments.push("M",interpolate(projection(points),tension))}while(++i<n){if(defined.call(this,d=data[i],i)){points.push([+fx.call(this,d,i),+fy.call(this,d,i)])}else if(points.length){segment();points=[]}}if(points.length)segment();return segments.length?segments.join(""):null}line.x=function(_){if(!arguments.length)return x;x=_;return line};line.y=function(_){if(!arguments.length)return y;y=_;return line};line.defined=function(_){if(!arguments.length)return defined;defined=_;return line};line.interpolate=function(_){if(!arguments.length)return interpolateKey;if(typeof _==="function")interpolateKey=interpolate=_;else interpolateKey=(interpolate=d3_svg_lineInterpolators.get(_)||d3_svg_lineLinear).key;return line};line.tension=function(_){if(!arguments.length)return tension;tension=_;return line};return line}d3.svg.line=function(){return d3_svg_line(d3_identity)};var d3_svg_lineInterpolators=d3.map({linear:d3_svg_lineLinear,"linear-closed":d3_svg_lineLinearClosed,step:d3_svg_lineStep,"step-before":d3_svg_lineStepBefore,"step-after":d3_svg_lineStepAfter,basis:d3_svg_lineBasis,"basis-open":d3_svg_lineBasisOpen,"basis-closed":d3_svg_lineBasisClosed,bundle:d3_svg_lineBundle,cardinal:d3_svg_lineCardinal,"cardinal-open":d3_svg_lineCardinalOpen,"cardinal-closed":d3_svg_lineCardinalClosed,monotone:d3_svg_lineMonotone});d3_svg_lineInterpolators.forEach(function(key,value){value.key=key;value.closed=/-closed$/.test(key)});function d3_svg_lineLinear(points){return points.length>1?points.join("L"):points+"Z"}function d3_svg_lineLinearClosed(points){return points.join("L")+"Z"}function d3_svg_lineStep(points){var i=0,n=points.length,p=points[0],path=[p[0],",",p[1]];while(++i<n)path.push("H",(p[0]+(p=points[i])[0])/2,"V",p[1]);if(n>1)path.push("H",p[0]);return path.join("")}function d3_svg_lineStepBefore(points){var i=0,n=points.length,p=points[0],path=[p[0],",",p[1]];while(++i<n)path.push("V",(p=points[i])[1],"H",p[0]);return path.join("")}function d3_svg_lineStepAfter(points){var i=0,n=points.length,p=points[0],path=[p[0],",",p[1]];while(++i<n)path.push("H",(p=points[i])[0],"V",p[1]);return path.join("")}function d3_svg_lineCardinalOpen(points,tension){return points.length<4?d3_svg_lineLinear(points):points[1]+d3_svg_lineHermite(points.slice(1,-1),d3_svg_lineCardinalTangents(points,tension))}function d3_svg_lineCardinalClosed(points,tension){return points.length<3?d3_svg_lineLinearClosed(points):points[0]+d3_svg_lineHermite((points.push(points[0]),points),d3_svg_lineCardinalTangents([points[points.length-2]].concat(points,[points[1]]),tension))}function d3_svg_lineCardinal(points,tension){return points.length<3?d3_svg_lineLinear(points):points[0]+d3_svg_lineHermite(points,d3_svg_lineCardinalTangents(points,tension))}function d3_svg_lineHermite(points,tangents){if(tangents.length<1||points.length!=tangents.length&&points.length!=tangents.length+2){return d3_svg_lineLinear(points)}var quad=points.length!=tangents.length,path="",p0=points[0],p=points[1],t0=tangents[0],t=t0,pi=1;if(quad){path+="Q"+(p[0]-t0[0]*2/3)+","+(p[1]-t0[1]*2/3)+","+p[0]+","+p[1];p0=points[1];pi=2}if(tangents.length>1){t=tangents[1];p=points[pi];pi++;path+="C"+(p0[0]+t0[0])+","+(p0[1]+t0[1])+","+(p[0]-t[0])+","+(p[1]-t[1])+","+p[0]+","+p[1];for(var i=2;i<tangents.length;i++,pi++){p=points[pi];t=tangents[i];path+="S"+(p[0]-t[0])+","+(p[1]-t[1])+","+p[0]+","+p[1]}}if(quad){var lp=points[pi];path+="Q"+(p[0]+t[0]*2/3)+","+(p[1]+t[1]*2/3)+","+lp[0]+","+lp[1]}return path}function d3_svg_lineCardinalTangents(points,tension){var tangents=[],a=(1-tension)/2,p0,p1=points[0],p2=points[1],i=1,n=points.length;while(++i<n){p0=p1;p1=p2;p2=points[i];tangents.push([a*(p2[0]-p0[0]),a*(p2[1]-p0[1])])}return tangents}function d3_svg_lineBasis(points){if(points.length<3)return d3_svg_lineLinear(points);var i=1,n=points.length,pi=points[0],x0=pi[0],y0=pi[1],px=[x0,x0,x0,(pi=points[1])[0]],py=[y0,y0,y0,pi[1]],path=[x0,",",y0,"L",d3_svg_lineDot4(d3_svg_lineBasisBezier3,px),",",d3_svg_lineDot4(d3_svg_lineBasisBezier3,py)];points.push(points[n-1]);while(++i<=n){pi=points[i];px.shift();px.push(pi[0]);py.shift();py.push(pi[1]);d3_svg_lineBasisBezier(path,px,py)}points.pop();path.push("L",pi);return path.join("")}function d3_svg_lineBasisOpen(points){if(points.length<4)return d3_svg_lineLinear(points);var path=[],i=-1,n=points.length,pi,px=[0],py=[0];while(++i<3){pi=points[i];px.push(pi[0]);py.push(pi[1])}path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3,px)+","+d3_svg_lineDot4(d3_svg_lineBasisBezier3,py));--i;while(++i<n){pi=points[i];px.shift();px.push(pi[0]);py.shift();py.push(pi[1]);d3_svg_lineBasisBezier(path,px,py)}return path.join("")}function d3_svg_lineBasisClosed(points){var path,i=-1,n=points.length,m=n+4,pi,px=[],py=[];while(++i<4){pi=points[i%n];px.push(pi[0]);py.push(pi[1])}path=[d3_svg_lineDot4(d3_svg_lineBasisBezier3,px),",",d3_svg_lineDot4(d3_svg_lineBasisBezier3,py)];--i;while(++i<m){pi=points[i%n];px.shift();px.push(pi[0]);py.shift();py.push(pi[1]);d3_svg_lineBasisBezier(path,px,py)}return path.join("")}function d3_svg_lineBundle(points,tension){var n=points.length-1;if(n){var x0=points[0][0],y0=points[0][1],dx=points[n][0]-x0,dy=points[n][1]-y0,i=-1,p,t;while(++i<=n){p=points[i];t=i/n;p[0]=tension*p[0]+(1-tension)*(x0+t*dx);p[1]=tension*p[1]+(1-tension)*(y0+t*dy)}}return d3_svg_lineBasis(points)}function d3_svg_lineDot4(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}var d3_svg_lineBasisBezier1=[0,2/3,1/3,0],d3_svg_lineBasisBezier2=[0,1/3,2/3,0],d3_svg_lineBasisBezier3=[0,1/6,2/3,1/6];function d3_svg_lineBasisBezier(path,x,y){path.push("C",d3_svg_lineDot4(d3_svg_lineBasisBezier1,x),",",d3_svg_lineDot4(d3_svg_lineBasisBezier1,y),",",d3_svg_lineDot4(d3_svg_lineBasisBezier2,x),",",d3_svg_lineDot4(d3_svg_lineBasisBezier2,y),",",d3_svg_lineDot4(d3_svg_lineBasisBezier3,x),",",d3_svg_lineDot4(d3_svg_lineBasisBezier3,y))}function d3_svg_lineSlope(p0,p1){return(p1[1]-p0[1])/(p1[0]-p0[0])}function d3_svg_lineFiniteDifferences(points){var i=0,j=points.length-1,m=[],p0=points[0],p1=points[1],d=m[0]=d3_svg_lineSlope(p0,p1);while(++i<j){m[i]=(d+(d=d3_svg_lineSlope(p0=p1,p1=points[i+1])))/2}m[i]=d;return m}function d3_svg_lineMonotoneTangents(points){var tangents=[],d,a,b,s,m=d3_svg_lineFiniteDifferences(points),i=-1,j=points.length-1;while(++i<j){d=d3_svg_lineSlope(points[i],points[i+1]);if(abs(d)<ε){m[i]=m[i+1]=0}else{a=m[i]/d;b=m[i+1]/d;s=a*a+b*b;if(s>9){s=d*3/Math.sqrt(s);m[i]=s*a;m[i+1]=s*b}}}i=-1;while(++i<=j){s=(points[Math.min(j,i+1)][0]-points[Math.max(0,i-1)][0])/(6*(1+m[i]*m[i]));tangents.push([s||0,m[i]*s||0])}return tangents}function d3_svg_lineMonotone(points){return points.length<3?d3_svg_lineLinear(points):points[0]+d3_svg_lineHermite(points,d3_svg_lineMonotoneTangents(points))}d3.svg.line.radial=function(){var line=d3_svg_line(d3_svg_lineRadial);line.radius=line.x,delete line.x;line.angle=line.y,delete line.y;return line};function d3_svg_lineRadial(points){var point,i=-1,n=points.length,r,a;while(++i<n){point=points[i];r=point[0];a=point[1]-halfπ;point[0]=r*Math.cos(a);point[1]=r*Math.sin(a)}return points}function d3_svg_area(projection){var x0=d3_geom_pointX,x1=d3_geom_pointX,y0=0,y1=d3_geom_pointY,defined=d3_true,interpolate=d3_svg_lineLinear,interpolateKey=interpolate.key,interpolateReverse=interpolate,L="L",tension=.7;function area(data){var segments=[],points0=[],points1=[],i=-1,n=data.length,d,fx0=d3_functor(x0),fy0=d3_functor(y0),fx1=x0===x1?function(){return x}:d3_functor(x1),fy1=y0===y1?function(){return y}:d3_functor(y1),x,y;function segment(){segments.push("M",interpolate(projection(points1),tension),L,interpolateReverse(projection(points0.reverse()),tension),"Z")}while(++i<n){if(defined.call(this,d=data[i],i)){points0.push([x=+fx0.call(this,d,i),y=+fy0.call(this,d,i)]);points1.push([+fx1.call(this,d,i),+fy1.call(this,d,i)])}else if(points0.length){segment();points0=[];points1=[]}}if(points0.length)segment();return segments.length?segments.join(""):null}area.x=function(_){if(!arguments.length)return x1;x0=x1=_;return area};area.x0=function(_){if(!arguments.length)return x0;x0=_;return area};area.x1=function(_){if(!arguments.length)return x1;x1=_;return area};area.y=function(_){if(!arguments.length)return y1;y0=y1=_;return area};area.y0=function(_){if(!arguments.length)return y0;y0=_;return area};area.y1=function(_){if(!arguments.length)return y1;y1=_;return area};area.defined=function(_){if(!arguments.length)return defined;defined=_;return area};area.interpolate=function(_){if(!arguments.length)return interpolateKey;if(typeof _==="function")interpolateKey=interpolate=_;else interpolateKey=(interpolate=d3_svg_lineInterpolators.get(_)||d3_svg_lineLinear).key;interpolateReverse=interpolate.reverse||interpolate;L=interpolate.closed?"M":"L";return area};area.tension=function(_){if(!arguments.length)return tension;tension=_;return area};return area}d3_svg_lineStepBefore.reverse=d3_svg_lineStepAfter;d3_svg_lineStepAfter.reverse=d3_svg_lineStepBefore;d3.svg.area=function(){return d3_svg_area(d3_identity)};d3.svg.area.radial=function(){var area=d3_svg_area(d3_svg_lineRadial);area.radius=area.x,delete area.x;area.innerRadius=area.x0,delete area.x0;area.outerRadius=area.x1,delete area.x1;area.angle=area.y,delete area.y;area.startAngle=area.y0,delete area.y0;area.endAngle=area.y1,delete area.y1;return area};d3.svg.chord=function(){var source=d3_source,target=d3_target,radius=d3_svg_chordRadius,startAngle=d3_svg_arcStartAngle,endAngle=d3_svg_arcEndAngle;function chord(d,i){var s=subgroup(this,source,d,i),t=subgroup(this,target,d,i);return"M"+s.p0+arc(s.r,s.p1,s.a1-s.a0)+(equals(s,t)?curve(s.r,s.p1,s.r,s.p0):curve(s.r,s.p1,t.r,t.p0)+arc(t.r,t.p1,t.a1-t.a0)+curve(t.r,t.p1,s.r,s.p0))+"Z"}function subgroup(self,f,d,i){var subgroup=f.call(self,d,i),r=radius.call(self,subgroup,i),a0=startAngle.call(self,subgroup,i)-halfπ,a1=endAngle.call(self,subgroup,i)-halfπ;return{r:r,a0:a0,a1:a1,p0:[r*Math.cos(a0),r*Math.sin(a0)],p1:[r*Math.cos(a1),r*Math.sin(a1)]}}function equals(a,b){return a.a0==b.a0&&a.a1==b.a1}function arc(r,p,a){return"A"+r+","+r+" 0 "+ +(a>π)+",1 "+p}function curve(r0,p0,r1,p1){return"Q 0,0 "+p1}chord.radius=function(v){if(!arguments.length)return radius;radius=d3_functor(v);return chord};chord.source=function(v){if(!arguments.length)return source;source=d3_functor(v);return chord};chord.target=function(v){if(!arguments.length)return target;target=d3_functor(v);return chord};chord.startAngle=function(v){if(!arguments.length)return startAngle;startAngle=d3_functor(v);return chord};chord.endAngle=function(v){if(!arguments.length)return endAngle;endAngle=d3_functor(v);return chord};return chord};function d3_svg_chordRadius(d){return d.radius}d3.svg.diagonal=function(){var source=d3_source,target=d3_target,projection=d3_svg_diagonalProjection;function diagonal(d,i){var p0=source.call(this,d,i),p3=target.call(this,d,i),m=(p0.y+p3.y)/2,p=[p0,{x:p0.x,y:m},{x:p3.x,y:m},p3];p=p.map(projection);return"M"+p[0]+"C"+p[1]+" "+p[2]+" "+p[3]}diagonal.source=function(x){if(!arguments.length)return source;source=d3_functor(x);return diagonal};diagonal.target=function(x){if(!arguments.length)return target;target=d3_functor(x);return diagonal};diagonal.projection=function(x){if(!arguments.length)return projection;projection=x;return diagonal};return diagonal};function d3_svg_diagonalProjection(d){return[d.x,d.y]}d3.svg.diagonal.radial=function(){var diagonal=d3.svg.diagonal(),projection=d3_svg_diagonalProjection,projection_=diagonal.projection;diagonal.projection=function(x){return arguments.length?projection_(d3_svg_diagonalRadialProjection(projection=x)):projection};return diagonal};function d3_svg_diagonalRadialProjection(projection){return function(){var d=projection.apply(this,arguments),r=d[0],a=d[1]-halfπ;return[r*Math.cos(a),r*Math.sin(a)]}}d3.svg.symbol=function(){var type=d3_svg_symbolType,size=d3_svg_symbolSize;function symbol(d,i){return(d3_svg_symbols.get(type.call(this,d,i))||d3_svg_symbolCircle)(size.call(this,d,i))}symbol.type=function(x){if(!arguments.length)return type;type=d3_functor(x);return symbol};symbol.size=function(x){if(!arguments.length)return size;size=d3_functor(x);return symbol};return symbol};function d3_svg_symbolSize(){return 64}function d3_svg_symbolType(){return"circle"}function d3_svg_symbolCircle(size){var r=Math.sqrt(size/π);return"M0,"+r+"A"+r+","+r+" 0 1,1 0,"+-r+"A"+r+","+r+" 0 1,1 0,"+r+"Z"}var d3_svg_symbols=d3.map({circle:d3_svg_symbolCircle,cross:function(size){var r=Math.sqrt(size/5)/2;return"M"+-3*r+","+-r+"H"+-r+"V"+-3*r+"H"+r+"V"+-r+"H"+3*r+"V"+r+"H"+r+"V"+3*r+"H"+-r+"V"+r+"H"+-3*r+"Z"},diamond:function(size){var ry=Math.sqrt(size/(2*d3_svg_symbolTan30)),rx=ry*d3_svg_symbolTan30;return"M0,"+-ry+"L"+rx+",0"+" 0,"+ry+" "+-rx+",0"+"Z"},square:function(size){var r=Math.sqrt(size)/2;return"M"+-r+","+-r+"L"+r+","+-r+" "+r+","+r+" "+-r+","+r+"Z"},"triangle-down":function(size){var rx=Math.sqrt(size/d3_svg_symbolSqrt3),ry=rx*d3_svg_symbolSqrt3/2;return"M0,"+ry+"L"+rx+","+-ry+" "+-rx+","+-ry+"Z"},"triangle-up":function(size){var rx=Math.sqrt(size/d3_svg_symbolSqrt3),ry=rx*d3_svg_symbolSqrt3/2;return"M0,"+-ry+"L"+rx+","+ry+" "+-rx+","+ry+"Z"}});d3.svg.symbolTypes=d3_svg_symbols.keys();var d3_svg_symbolSqrt3=Math.sqrt(3),d3_svg_symbolTan30=Math.tan(30*d3_radians);d3_selectionPrototype.transition=function(name){var id=d3_transitionInheritId||++d3_transitionId,ns=d3_transitionNamespace(name),subgroups=[],subgroup,node,transition=d3_transitionInherit||{time:Date.now(),ease:d3_ease_cubicInOut,delay:0,duration:250};for(var j=-1,m=this.length;++j<m;){subgroups.push(subgroup=[]);for(var group=this[j],i=-1,n=group.length;++i<n;){if(node=group[i])d3_transitionNode(node,i,ns,id,transition);subgroup.push(node)}}return d3_transition(subgroups,ns,id)};d3_selectionPrototype.interrupt=function(name){return this.each(name==null?d3_selection_interrupt:d3_selection_interruptNS(d3_transitionNamespace(name)))};var d3_selection_interrupt=d3_selection_interruptNS(d3_transitionNamespace());function d3_selection_interruptNS(ns){return function(){var lock,activeId,active;if((lock=this[ns])&&(active=lock[activeId=lock.active])){active.timer.c=null;active.timer.t=NaN;if(--lock.count)delete lock[activeId];else delete this[ns];lock.active+=.5;active.event&&active.event.interrupt.call(this,this.__data__,active.index)}}}function d3_transition(groups,ns,id){d3_subclass(groups,d3_transitionPrototype);groups.namespace=ns;groups.id=id;return groups}var d3_transitionPrototype=[],d3_transitionId=0,d3_transitionInheritId,d3_transitionInherit;d3_transitionPrototype.call=d3_selectionPrototype.call;d3_transitionPrototype.empty=d3_selectionPrototype.empty;d3_transitionPrototype.node=d3_selectionPrototype.node;d3_transitionPrototype.size=d3_selectionPrototype.size;d3.transition=function(selection,name){return selection&&selection.transition?d3_transitionInheritId?selection.transition(name):selection:d3.selection().transition(selection)};d3.transition.prototype=d3_transitionPrototype;d3_transitionPrototype.select=function(selector){var id=this.id,ns=this.namespace,subgroups=[],subgroup,subnode,node;selector=d3_selection_selector(selector);for(var j=-1,m=this.length;++j<m;){subgroups.push(subgroup=[]);for(var group=this[j],i=-1,n=group.length;++i<n;){if((node=group[i])&&(subnode=selector.call(node,node.__data__,i,j))){if("__data__"in node)subnode.__data__=node.__data__;d3_transitionNode(subnode,i,ns,id,node[ns][id]);subgroup.push(subnode)}else{subgroup.push(null)}}}return d3_transition(subgroups,ns,id)};d3_transitionPrototype.selectAll=function(selector){var id=this.id,ns=this.namespace,subgroups=[],subgroup,subnodes,node,subnode,transition;selector=d3_selection_selectorAll(selector);for(var j=-1,m=this.length;++j<m;){for(var group=this[j],i=-1,n=group.length;++i<n;){if(node=group[i]){transition=node[ns][id];subnodes=selector.call(node,node.__data__,i,j);subgroups.push(subgroup=[]);for(var k=-1,o=subnodes.length;++k<o;){if(subnode=subnodes[k])d3_transitionNode(subnode,k,ns,id,transition);subgroup.push(subnode)}}}}return d3_transition(subgroups,ns,id)};d3_transitionPrototype.filter=function(filter){var subgroups=[],subgroup,group,node;if(typeof filter!=="function")filter=d3_selection_filter(filter);for(var j=0,m=this.length;j<m;j++){subgroups.push(subgroup=[]);for(var group=this[j],i=0,n=group.length;i<n;i++){if((node=group[i])&&filter.call(node,node.__data__,i,j)){subgroup.push(node)}}}return d3_transition(subgroups,this.namespace,this.id)};d3_transitionPrototype.tween=function(name,tween){var id=this.id,ns=this.namespace;if(arguments.length<2)return this.node()[ns][id].tween.get(name);return d3_selection_each(this,tween==null?function(node){node[ns][id].tween.remove(name)}:function(node){node[ns][id].tween.set(name,tween)})};function d3_transition_tween(groups,name,value,tween){var id=groups.id,ns=groups.namespace;return d3_selection_each(groups,typeof value==="function"?function(node,i,j){node[ns][id].tween.set(name,tween(value.call(node,node.__data__,i,j)))}:(value=tween(value),function(node){node[ns][id].tween.set(name,value)}))}d3_transitionPrototype.attr=function(nameNS,value){if(arguments.length<2){for(value in nameNS)this.attr(value,nameNS[value]);return this}var interpolate=nameNS=="transform"?d3_interpolateTransform:d3_interpolate,name=d3.ns.qualify(nameNS);function attrNull(){this.removeAttribute(name)}function attrNullNS(){this.removeAttributeNS(name.space,name.local)}function attrTween(b){return b==null?attrNull:(b+="",function(){var a=this.getAttribute(name),i;return a!==b&&(i=interpolate(a,b),function(t){this.setAttribute(name,i(t))})})}function attrTweenNS(b){return b==null?attrNullNS:(b+="",function(){var a=this.getAttributeNS(name.space,name.local),i;return a!==b&&(i=interpolate(a,b),function(t){this.setAttributeNS(name.space,name.local,i(t))})})}return d3_transition_tween(this,"attr."+nameNS,value,name.local?attrTweenNS:attrTween)};d3_transitionPrototype.attrTween=function(nameNS,tween){var name=d3.ns.qualify(nameNS);function attrTween(d,i){var f=tween.call(this,d,i,this.getAttribute(name));return f&&function(t){this.setAttribute(name,f(t))}}function attrTweenNS(d,i){var f=tween.call(this,d,i,this.getAttributeNS(name.space,name.local));return f&&function(t){this.setAttributeNS(name.space,name.local,f(t))}}return this.tween("attr."+nameNS,name.local?attrTweenNS:attrTween)};d3_transitionPrototype.style=function(name,value,priority){var n=arguments.length;if(n<3){if(typeof name!=="string"){if(n<2)value="";for(priority in name)this.style(priority,name[priority],value);return this}priority=""}function styleNull(){this.style.removeProperty(name)}function styleString(b){return b==null?styleNull:(b+="",function(){var a=d3_window(this).getComputedStyle(this,null).getPropertyValue(name),i;return a!==b&&(i=d3_interpolate(a,b),function(t){this.style.setProperty(name,i(t),priority)})})}return d3_transition_tween(this,"style."+name,value,styleString)};d3_transitionPrototype.styleTween=function(name,tween,priority){if(arguments.length<3)priority="";function styleTween(d,i){var f=tween.call(this,d,i,d3_window(this).getComputedStyle(this,null).getPropertyValue(name));return f&&function(t){this.style.setProperty(name,f(t),priority)}}return this.tween("style."+name,styleTween)};d3_transitionPrototype.text=function(value){return d3_transition_tween(this,"text",value,d3_transition_text)};function d3_transition_text(b){if(b==null)b="";return function(){this.textContent=b}}d3_transitionPrototype.remove=function(){var ns=this.namespace;return this.each("end.transition",function(){var p;if(this[ns].count<2&&(p=this.parentNode))p.removeChild(this)})};d3_transitionPrototype.ease=function(value){var id=this.id,ns=this.namespace;if(arguments.length<1)return this.node()[ns][id].ease;if(typeof value!=="function")value=d3.ease.apply(d3,arguments);return d3_selection_each(this,function(node){node[ns][id].ease=value})};d3_transitionPrototype.delay=function(value){var id=this.id,ns=this.namespace;if(arguments.length<1)return this.node()[ns][id].delay;return d3_selection_each(this,typeof value==="function"?function(node,i,j){node[ns][id].delay=+value.call(node,node.__data__,i,j)}:(value=+value,function(node){node[ns][id].delay=value}))};d3_transitionPrototype.duration=function(value){var id=this.id,ns=this.namespace;if(arguments.length<1)return this.node()[ns][id].duration;return d3_selection_each(this,typeof value==="function"?function(node,i,j){node[ns][id].duration=Math.max(1,value.call(node,node.__data__,i,j))}:(value=Math.max(1,value),function(node){node[ns][id].duration=value}))};d3_transitionPrototype.each=function(type,listener){var id=this.id,ns=this.namespace;if(arguments.length<2){var inherit=d3_transitionInherit,inheritId=d3_transitionInheritId;try{d3_transitionInheritId=id;d3_selection_each(this,function(node,i,j){d3_transitionInherit=node[ns][id];type.call(node,node.__data__,i,j)})}finally{d3_transitionInherit=inherit;d3_transitionInheritId=inheritId}}else{d3_selection_each(this,function(node){var transition=node[ns][id];(transition.event||(transition.event=d3.dispatch("start","end","interrupt"))).on(type,listener)})}return this};d3_transitionPrototype.transition=function(){var id0=this.id,id1=++d3_transitionId,ns=this.namespace,subgroups=[],subgroup,group,node,transition;for(var j=0,m=this.length;j<m;j++){subgroups.push(subgroup=[]);for(var group=this[j],i=0,n=group.length;i<n;i++){if(node=group[i]){transition=node[ns][id0];d3_transitionNode(node,i,ns,id1,{time:transition.time,ease:transition.ease,delay:transition.delay+transition.duration,duration:transition.duration})}subgroup.push(node)}}return d3_transition(subgroups,ns,id1)};function d3_transitionNamespace(name){return name==null?"__transition__":"__transition_"+name+"__"}function d3_transitionNode(node,i,ns,id,inherit){var lock=node[ns]||(node[ns]={active:0,count:0}),transition=lock[id],time,timer,duration,ease,tweens;function schedule(elapsed){var delay=transition.delay;timer.t=delay+time;if(delay<=elapsed)return start(elapsed-delay);timer.c=start}function start(elapsed){var activeId=lock.active,active=lock[activeId];if(active){active.timer.c=null;active.timer.t=NaN;--lock.count;delete lock[activeId];active.event&&active.event.interrupt.call(node,node.__data__,active.index)}for(var cancelId in lock){if(+cancelId<id){var cancel=lock[cancelId];cancel.timer.c=null;cancel.timer.t=NaN;--lock.count;delete lock[cancelId]}}timer.c=tick;d3_timer(function(){if(timer.c&&tick(elapsed||1)){timer.c=null;timer.t=NaN}return 1},0,time);lock.active=id;transition.event&&transition.event.start.call(node,node.__data__,i);tweens=[];transition.tween.forEach(function(key,value){if(value=value.call(node,node.__data__,i)){tweens.push(value)}});ease=transition.ease;duration=transition.duration}function tick(elapsed){var t=elapsed/duration,e=ease(t),n=tweens.length;while(n>0){tweens[--n].call(node,e)}if(t>=1){transition.event&&transition.event.end.call(node,node.__data__,i);if(--lock.count)delete lock[id];else delete node[ns];return 1}}if(!transition){time=inherit.time;timer=d3_timer(schedule,0,time);transition=lock[id]={tween:new d3_Map,time:time,timer:timer,delay:inherit.delay,duration:inherit.duration,ease:inherit.ease,index:i};inherit=null;++lock.count}}d3.svg.axis=function(){var scale=d3.scale.linear(),orient=d3_svg_axisDefaultOrient,innerTickSize=6,outerTickSize=6,tickPadding=3,tickArguments_=[10],tickValues=null,tickFormat_;function axis(g){g.each(function(){var g=d3.select(this);var scale0=this.__chart__||scale,scale1=this.__chart__=scale.copy();var ticks=tickValues==null?scale1.ticks?scale1.ticks.apply(scale1,tickArguments_):scale1.domain():tickValues,tickFormat=tickFormat_==null?scale1.tickFormat?scale1.tickFormat.apply(scale1,tickArguments_):d3_identity:tickFormat_,tick=g.selectAll(".tick").data(ticks,scale1),tickEnter=tick.enter().insert("g",".domain").attr("class","tick").style("opacity",ε),tickExit=d3.transition(tick.exit()).style("opacity",ε).remove(),tickUpdate=d3.transition(tick.order()).style("opacity",1),tickSpacing=Math.max(innerTickSize,0)+tickPadding,tickTransform;var range=d3_scaleRange(scale1),path=g.selectAll(".domain").data([0]),pathUpdate=(path.enter().append("path").attr("class","domain"),d3.transition(path));tickEnter.append("line");tickEnter.append("text");var lineEnter=tickEnter.select("line"),lineUpdate=tickUpdate.select("line"),text=tick.select("text").text(tickFormat),textEnter=tickEnter.select("text"),textUpdate=tickUpdate.select("text"),sign=orient==="top"||orient==="left"?-1:1,x1,x2,y1,y2;if(orient==="bottom"||orient==="top"){tickTransform=d3_svg_axisX,x1="x",y1="y",x2="x2",y2="y2";text.attr("dy",sign<0?"0em":".71em").style("text-anchor","middle");pathUpdate.attr("d","M"+range[0]+","+sign*outerTickSize+"V0H"+range[1]+"V"+sign*outerTickSize)}else{tickTransform=d3_svg_axisY,x1="y",y1="x",x2="y2",y2="x2";text.attr("dy",".32em").style("text-anchor",sign<0?"end":"start");pathUpdate.attr("d","M"+sign*outerTickSize+","+range[0]+"H0V"+range[1]+"H"+sign*outerTickSize)}lineEnter.attr(y2,sign*innerTickSize);textEnter.attr(y1,sign*tickSpacing);lineUpdate.attr(x2,0).attr(y2,sign*innerTickSize);textUpdate.attr(x1,0).attr(y1,sign*tickSpacing);if(scale1.rangeBand){var x=scale1,dx=x.rangeBand()/2;scale0=scale1=function(d){return x(d)+dx}}else if(scale0.rangeBand){scale0=scale1}else{tickExit.call(tickTransform,scale1,scale0)}tickEnter.call(tickTransform,scale0,scale1);tickUpdate.call(tickTransform,scale1,scale1)})}axis.scale=function(x){if(!arguments.length)return scale;scale=x;return axis};axis.orient=function(x){if(!arguments.length)return orient;orient=x in d3_svg_axisOrients?x+"":d3_svg_axisDefaultOrient;return axis};axis.ticks=function(){if(!arguments.length)return tickArguments_;tickArguments_=d3_array(arguments);return axis};axis.tickValues=function(x){if(!arguments.length)return tickValues;tickValues=x;return axis};axis.tickFormat=function(x){if(!arguments.length)return tickFormat_;tickFormat_=x;return axis};axis.tickSize=function(x){var n=arguments.length;if(!n)return innerTickSize;innerTickSize=+x;outerTickSize=+arguments[n-1];return axis};axis.innerTickSize=function(x){if(!arguments.length)return innerTickSize;innerTickSize=+x;return axis};axis.outerTickSize=function(x){if(!arguments.length)return outerTickSize;outerTickSize=+x;return axis};axis.tickPadding=function(x){if(!arguments.length)return tickPadding;tickPadding=+x;return axis};axis.tickSubdivide=function(){return arguments.length&&axis};return axis};var d3_svg_axisDefaultOrient="bottom",d3_svg_axisOrients={top:1,right:1,bottom:1,left:1};function d3_svg_axisX(selection,x0,x1){selection.attr("transform",function(d){var v0=x0(d);return"translate("+(isFinite(v0)?v0:x1(d))+",0)"})}function d3_svg_axisY(selection,y0,y1){selection.attr("transform",function(d){var v0=y0(d);return"translate(0,"+(isFinite(v0)?v0:y1(d))+")"})}d3.svg.brush=function(){var event=d3_eventDispatch(brush,"brushstart","brush","brushend"),x=null,y=null,xExtent=[0,0],yExtent=[0,0],xExtentDomain,yExtentDomain,xClamp=true,yClamp=true,resizes=d3_svg_brushResizes[0];function brush(g){g.each(function(){var g=d3.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",brushstart).on("touchstart.brush",brushstart);var background=g.selectAll(".background").data([0]);background.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");g.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var resize=g.selectAll(".resize").data(resizes,d3_identity);resize.exit().remove();resize.enter().append("g").attr("class",function(d){return"resize "+d}).style("cursor",function(d){return d3_svg_brushCursor[d]}).append("rect").attr("x",function(d){return/[ew]$/.test(d)?-3:null}).attr("y",function(d){return/^[ns]/.test(d)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");resize.style("display",brush.empty()?"none":null);var gUpdate=d3.transition(g),backgroundUpdate=d3.transition(background),range;if(x){range=d3_scaleRange(x);backgroundUpdate.attr("x",range[0]).attr("width",range[1]-range[0]);redrawX(gUpdate)}if(y){range=d3_scaleRange(y);backgroundUpdate.attr("y",range[0]).attr("height",range[1]-range[0]);redrawY(gUpdate)}redraw(gUpdate)})}brush.event=function(g){g.each(function(){var event_=event.of(this,arguments),extent1={x:xExtent,y:yExtent,i:xExtentDomain,j:yExtentDomain},extent0=this.__chart__||extent1;this.__chart__=extent1;if(d3_transitionInheritId){d3.select(this).transition().each("start.brush",function(){xExtentDomain=extent0.i;yExtentDomain=extent0.j;xExtent=extent0.x;yExtent=extent0.y;event_({type:"brushstart"})}).tween("brush:brush",function(){var xi=d3_interpolateArray(xExtent,extent1.x),yi=d3_interpolateArray(yExtent,extent1.y);xExtentDomain=yExtentDomain=null;return function(t){xExtent=extent1.x=xi(t);yExtent=extent1.y=yi(t);event_({type:"brush",mode:"resize"})}}).each("end.brush",function(){xExtentDomain=extent1.i;yExtentDomain=extent1.j;event_({type:"brush",mode:"resize"});event_({type:"brushend"})})}else{event_({type:"brushstart"});event_({type:"brush",mode:"resize"});event_({type:"brushend"})}})};function redraw(g){g.selectAll(".resize").attr("transform",function(d){return"translate("+xExtent[+/e$/.test(d)]+","+yExtent[+/^s/.test(d)]+")"})}function redrawX(g){g.select(".extent").attr("x",xExtent[0]);g.selectAll(".extent,.n>rect,.s>rect").attr("width",xExtent[1]-xExtent[0])}function redrawY(g){g.select(".extent").attr("y",yExtent[0]);g.selectAll(".extent,.e>rect,.w>rect").attr("height",yExtent[1]-yExtent[0])}function brushstart(){var target=this,eventTarget=d3.select(d3.event.target),event_=event.of(target,arguments),g=d3.select(target),resizing=eventTarget.datum(),resizingX=!/^(n|s)$/.test(resizing)&&x,resizingY=!/^(e|w)$/.test(resizing)&&y,dragging=eventTarget.classed("extent"),dragRestore=d3_event_dragSuppress(target),center,origin=d3.mouse(target),offset;var w=d3.select(d3_window(target)).on("keydown.brush",keydown).on("keyup.brush",keyup);if(d3.event.changedTouches){w.on("touchmove.brush",brushmove).on("touchend.brush",brushend)}else{w.on("mousemove.brush",brushmove).on("mouseup.brush",brushend)}g.interrupt().selectAll("*").interrupt();if(dragging){origin[0]=xExtent[0]-origin[0];origin[1]=yExtent[0]-origin[1]}else if(resizing){var ex=+/w$/.test(resizing),ey=+/^n/.test(resizing);offset=[xExtent[1-ex]-origin[0],yExtent[1-ey]-origin[1]];origin[0]=xExtent[ex];origin[1]=yExtent[ey]}else if(d3.event.altKey)center=origin.slice();g.style("pointer-events","none").selectAll(".resize").style("display",null);d3.select("body").style("cursor",eventTarget.style("cursor"));event_({type:"brushstart"});brushmove();function keydown(){if(d3.event.keyCode==32){if(!dragging){center=null;origin[0]-=xExtent[1];origin[1]-=yExtent[1];dragging=2}d3_eventPreventDefault()}}function keyup(){if(d3.event.keyCode==32&&dragging==2){origin[0]+=xExtent[1];origin[1]+=yExtent[1];dragging=0;d3_eventPreventDefault()}}function brushmove(){var point=d3.mouse(target),moved=false;if(offset){point[0]+=offset[0];point[1]+=offset[1]}if(!dragging){if(d3.event.altKey){if(!center)center=[(xExtent[0]+xExtent[1])/2,(yExtent[0]+yExtent[1])/2];origin[0]=xExtent[+(point[0]<center[0])];origin[1]=yExtent[+(point[1]<center[1])]}else center=null}if(resizingX&&move1(point,x,0)){redrawX(g);moved=true}if(resizingY&&move1(point,y,1)){redrawY(g);moved=true}if(moved){redraw(g);event_({type:"brush",mode:dragging?"move":"resize"})}}function move1(point,scale,i){var range=d3_scaleRange(scale),r0=range[0],r1=range[1],position=origin[i],extent=i?yExtent:xExtent,size=extent[1]-extent[0],min,max;if(dragging){r0-=position;r1-=size+position}min=(i?yClamp:xClamp)?Math.max(r0,Math.min(r1,point[i])):point[i];if(dragging){max=(min+=position)+size}else{if(center)position=Math.max(r0,Math.min(r1,2*center[i]-min));if(position<min){max=min;min=position}else{max=position}}if(extent[0]!=min||extent[1]!=max){if(i)yExtentDomain=null;else xExtentDomain=null;extent[0]=min;extent[1]=max;return true}}function brushend(){brushmove();g.style("pointer-events","all").selectAll(".resize").style("display",brush.empty()?"none":null);d3.select("body").style("cursor",null);w.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);dragRestore();event_({type:"brushend"})}}brush.x=function(z){if(!arguments.length)return x;x=z;resizes=d3_svg_brushResizes[!x<<1|!y];return brush};brush.y=function(z){if(!arguments.length)return y;y=z;resizes=d3_svg_brushResizes[!x<<1|!y];return brush};brush.clamp=function(z){if(!arguments.length)return x&&y?[xClamp,yClamp]:x?xClamp:y?yClamp:null;if(x&&y)xClamp=!!z[0],yClamp=!!z[1];else if(x)xClamp=!!z;else if(y)yClamp=!!z;return brush};brush.extent=function(z){var x0,x1,y0,y1,t;if(!arguments.length){if(x){if(xExtentDomain){x0=xExtentDomain[0],x1=xExtentDomain[1]}else{x0=xExtent[0],x1=xExtent[1];if(x.invert)x0=x.invert(x0),x1=x.invert(x1);if(x1<x0)t=x0,x0=x1,x1=t}}if(y){if(yExtentDomain){y0=yExtentDomain[0],y1=yExtentDomain[1]}else{y0=yExtent[0],y1=yExtent[1];if(y.invert)y0=y.invert(y0),y1=y.invert(y1);if(y1<y0)t=y0,y0=y1,y1=t}}return x&&y?[[x0,y0],[x1,y1]]:x?[x0,x1]:y&&[y0,y1]}if(x){x0=z[0],x1=z[1];if(y)x0=x0[0],x1=x1[0];xExtentDomain=[x0,x1];if(x.invert)x0=x(x0),x1=x(x1);if(x1<x0)t=x0,x0=x1,x1=t;if(x0!=xExtent[0]||x1!=xExtent[1])xExtent=[x0,x1]}if(y){y0=z[0],y1=z[1];if(x)y0=y0[1],y1=y1[1];yExtentDomain=[y0,y1];if(y.invert)y0=y(y0),y1=y(y1);if(y1<y0)t=y0,y0=y1,y1=t;if(y0!=yExtent[0]||y1!=yExtent[1])yExtent=[y0,y1]}return brush};brush.clear=function(){if(!brush.empty()){xExtent=[0,0],yExtent=[0,0];xExtentDomain=yExtentDomain=null}return brush};brush.empty=function(){return!!x&&xExtent[0]==xExtent[1]||!!y&&yExtent[0]==yExtent[1]};return d3.rebind(brush,event,"on")};var d3_svg_brushCursor={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};var d3_svg_brushResizes=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];var d3_time_format=d3_time.format=d3_locale_enUS.timeFormat;var d3_time_formatUtc=d3_time_format.utc;var d3_time_formatIso=d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ");d3_time_format.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?d3_time_formatIsoNative:d3_time_formatIso;function d3_time_formatIsoNative(date){return date.toISOString()}d3_time_formatIsoNative.parse=function(string){var date=new Date(string);return isNaN(date)?null:date};d3_time_formatIsoNative.toString=d3_time_formatIso.toString;d3_time.second=d3_time_interval(function(date){return new d3_date(Math.floor(date/1e3)*1e3)},function(date,offset){date.setTime(date.getTime()+Math.floor(offset)*1e3)},function(date){return date.getSeconds()});d3_time.seconds=d3_time.second.range;d3_time.seconds.utc=d3_time.second.utc.range;d3_time.minute=d3_time_interval(function(date){return new d3_date(Math.floor(date/6e4)*6e4)},function(date,offset){date.setTime(date.getTime()+Math.floor(offset)*6e4)},function(date){return date.getMinutes()});d3_time.minutes=d3_time.minute.range;d3_time.minutes.utc=d3_time.minute.utc.range;d3_time.hour=d3_time_interval(function(date){var timezone=date.getTimezoneOffset()/60;return new d3_date((Math.floor(date/36e5-timezone)+timezone)*36e5)},function(date,offset){date.setTime(date.getTime()+Math.floor(offset)*36e5)},function(date){return date.getHours()});d3_time.hours=d3_time.hour.range;d3_time.hours.utc=d3_time.hour.utc.range;d3_time.month=d3_time_interval(function(date){date=d3_time.day(date);date.setDate(1);return date},function(date,offset){date.setMonth(date.getMonth()+offset)},function(date){return date.getMonth()});d3_time.months=d3_time.month.range;d3_time.months.utc=d3_time.month.utc.range;function d3_time_scale(linear,methods,format){function scale(x){return linear(x)}scale.invert=function(x){return d3_time_scaleDate(linear.invert(x))};scale.domain=function(x){if(!arguments.length)return linear.domain().map(d3_time_scaleDate);linear.domain(x);return scale};function tickMethod(extent,count){var span=extent[1]-extent[0],target=span/count,i=d3.bisect(d3_time_scaleSteps,target);return i==d3_time_scaleSteps.length?[methods.year,d3_scale_linearTickRange(extent.map(function(d){return d/31536e6}),count)[2]]:!i?[d3_time_scaleMilliseconds,d3_scale_linearTickRange(extent,count)[2]]:methods[target/d3_time_scaleSteps[i-1]<d3_time_scaleSteps[i]/target?i-1:i]}scale.nice=function(interval,skip){var domain=scale.domain(),extent=d3_scaleExtent(domain),method=interval==null?tickMethod(extent,10):typeof interval==="number"&&tickMethod(extent,interval);if(method)interval=method[0],skip=method[1];function skipped(date){return!isNaN(date)&&!interval.range(date,d3_time_scaleDate(+date+1),skip).length}return scale.domain(d3_scale_nice(domain,skip>1?{floor:function(date){while(skipped(date=interval.floor(date)))date=d3_time_scaleDate(date-1);return date},ceil:function(date){while(skipped(date=interval.ceil(date)))date=d3_time_scaleDate(+date+1);return date}}:interval))};scale.ticks=function(interval,skip){var extent=d3_scaleExtent(scale.domain()),method=interval==null?tickMethod(extent,10):typeof interval==="number"?tickMethod(extent,interval):!interval.range&&[{range:interval},skip];if(method)interval=method[0],skip=method[1];return interval.range(extent[0],d3_time_scaleDate(+extent[1]+1),skip<1?1:skip)};scale.tickFormat=function(){return format};scale.copy=function(){return d3_time_scale(linear.copy(),methods,format)};return d3_scale_linearRebind(scale,linear)}function d3_time_scaleDate(t){return new Date(t)}var d3_time_scaleSteps=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6];var d3_time_scaleLocalMethods=[[d3_time.second,1],[d3_time.second,5],[d3_time.second,15],[d3_time.second,30],[d3_time.minute,1],[d3_time.minute,5],[d3_time.minute,15],[d3_time.minute,30],[d3_time.hour,1],[d3_time.hour,3],[d3_time.hour,6],[d3_time.hour,12],[d3_time.day,1],[d3_time.day,2],[d3_time.week,1],[d3_time.month,1],[d3_time.month,3],[d3_time.year,1]];var d3_time_scaleLocalFormat=d3_time_format.multi([[".%L",function(d){return d.getMilliseconds()}],[":%S",function(d){return d.getSeconds()}],["%I:%M",function(d){return d.getMinutes()}],["%I %p",function(d){return d.getHours()}],["%a %d",function(d){return d.getDay()&&d.getDate()!=1}],["%b %d",function(d){return d.getDate()!=1}],["%B",function(d){return d.getMonth()}],["%Y",d3_true]]);var d3_time_scaleMilliseconds={range:function(start,stop,step){return d3.range(Math.ceil(start/step)*step,+stop,step).map(d3_time_scaleDate)},floor:d3_identity,ceil:d3_identity};d3_time_scaleLocalMethods.year=d3_time.year;d3_time.scale=function(){return d3_time_scale(d3.scale.linear(),d3_time_scaleLocalMethods,d3_time_scaleLocalFormat)};var d3_time_scaleUtcMethods=d3_time_scaleLocalMethods.map(function(m){return[m[0].utc,m[1]]});var d3_time_scaleUtcFormat=d3_time_formatUtc.multi([[".%L",function(d){return d.getUTCMilliseconds()}],[":%S",function(d){return d.getUTCSeconds()}],["%I:%M",function(d){return d.getUTCMinutes()}],["%I %p",function(d){return d.getUTCHours()}],["%a %d",function(d){return d.getUTCDay()&&d.getUTCDate()!=1}],["%b %d",function(d){return d.getUTCDate()!=1}],["%B",function(d){return d.getUTCMonth()}],["%Y",d3_true]]);d3_time_scaleUtcMethods.year=d3_time.year.utc;d3_time.scale.utc=function(){return d3_time_scale(d3.scale.linear(),d3_time_scaleUtcMethods,d3_time_scaleUtcFormat)};d3.text=d3_xhrType(function(request){return request.responseText});d3.json=function(url,callback){return d3_xhr(url,"application/json",d3_json,callback)};function d3_json(request){return JSON.parse(request.responseText)}d3.html=function(url,callback){return d3_xhr(url,"text/html",d3_html,callback)};function d3_html(request){var range=d3_document.createRange();range.selectNode(d3_document.body);return range.createContextualFragment(request.responseText)}d3.xml=d3_xhrType(function(request){return request.responseXML});if(typeof define==="function"&&define.amd)this.d3=d3,define(d3);else if(typeof module==="object"&&module.exports)module.exports=d3;else this.d3=d3}();(function($,document,Math){var svgElement=function(tag,attrs){var elem=document.createElementNS("http://www.w3.org/2000/svg",tag);$.each(attrs,function(name,value){elem.setAttribute(name,value)});return elem};var svgSupported="createElementNS"in document&&svgElement("svg",{}).createSVGRect;var pixel=1/(window.devicePixelRatio||1);var peity=$.fn.peity=function(type,options){if(svgSupported){this.each(function(){var $this=$(this);var chart=$this.data("peity");if(chart){if(type)chart.type=type;$.extend(chart.opts,options)}else{var defaults=peity.defaults[type];var data={};$.each($this.data(),function(name,value){if(name in defaults)data[name]=value});var opts=$.extend({},defaults,data,options);chart=new Peity($this,type,opts);$this.change(function(){chart.draw()}).data("peity",chart)}chart.draw()})}return this};var Peity=function($el,type,opts){this.$el=$el;this.type=type;this.opts=opts};var PeityPrototype=Peity.prototype;PeityPrototype.draw=function(){peity.graphers[this.type].call(this,this.opts)};PeityPrototype.fill=function(){var fill=this.opts.fill;var func=fill;if(!$.isFunction(func)){func=function(_,i){return fill[i%fill.length]}}return func};PeityPrototype.prepare=function(width,height){var $svg;if(this.svg){$svg=$(this.svg).empty()}else{this.svg=svgElement("svg",{class:"peity"});this.$el.hide().after(this.svg);$svg=$(this.svg).data("peity",this)}this.svg.setAttribute("height",height);this.svg.setAttribute("width",width);return $svg};PeityPrototype.values=function(){return $.map(this.$el.text().split(this.opts.delimiter),function(value){return parseFloat(value)})};peity.defaults={};peity.graphers={};peity.register=function(type,defaults,grapher){this.defaults[type]=defaults;this.graphers[type]=grapher};peity.register("pie",{delimiter:null,diameter:16,fill:["#ff9900","#fff4dd","#ffc66e"]},function(opts){if(!opts.delimiter){var delimiter=this.$el.text().match(/[^0-9\.]/);opts.delimiter=delimiter?delimiter[0]:","}var values=this.values();if(opts.delimiter=="/"){var v1=values[0];var v2=values[1];values=[v1,Math.max(0,v2-v1)]}var i=0;var length=values.length;var sum=0;for(;i<length;i++){sum+=values[i]}var $svg=this.prepare(opts.width||opts.diameter,opts.height||opts.diameter);var width=$svg.width(),height=$svg.height(),cx=width/2,cy=height/2;var radius=Math.min(cx,cy);var pi=Math.PI;var fill=this.fill();var start=-pi/2;for(i=0;i<length;i++){var value=values[i],portion=value/sum,node;if(portion==0)continue;if(portion==1){node=svgElement("circle",{cx:cx,cy:cy,r:radius})}else{var slice=portion*pi*2,end=start+slice,x1=radius*Math.cos(start)+cx,y1=radius*Math.sin(start)+cy,x2=radius*Math.cos(end)+cx,y2=radius*Math.sin(end)+cy;var d=["M",cx,cy,"L",x1,y1,"A",radius,radius,0,slice>pi?1:0,1,x2,y2,"Z"];node=svgElement("path",{d:d.join(" ")});start=end}node.setAttribute("fill",fill.call(this,value,i,values));this.svg.appendChild(node)}});peity.register("line",{delimiter:",",fill:"#c6d9fd",height:16,max:null,min:0,stroke:"#4d89f9",strokeWidth:1,width:32},function(opts){var values=this.values();if(values.length==1)values.push(values[0]);var max=Math.max.apply(Math,values.concat([opts.max]));var min=Math.min.apply(Math,values.concat([opts.min]));var $svg=this.prepare(opts.width,opts.height),width=$svg.width(),height=$svg.height()-opts.strokeWidth,xQuotient=width/(values.length-1),diff=max-min,yQuotient=diff==0?height:height/diff,zero=height+min*yQuotient,coords=[0,zero];for(var i=0;i<values.length;i++){var x=i*xQuotient;var y=height-yQuotient*(values[i]-min)+opts.strokeWidth/2;coords.push(x,y)}coords.push(width,zero);var polygon=svgElement("polygon",{fill:opts.fill,points:coords.join(" ")});this.svg.appendChild(polygon);if(opts.strokeWidth){var polyline=svgElement("polyline",{fill:"transparent",points:coords.slice(2,coords.length-2).join(" "),stroke:opts.stroke,"stroke-width":opts.strokeWidth,"stroke-linecap":"square"});this.svg.appendChild(polyline)}});peity.register("bar",{delimiter:",",fill:["#4D89F9"],gap:1,height:16,max:null,min:0,width:32},function(opts){var values=this.values();var max=Math.max.apply(Math,values.concat([opts.max]));var min=Math.min.apply(Math,values.concat([opts.min]));var $svg=this.prepare(opts.width,opts.height),width=$svg.width(),height=$svg.height(),diff=max-min,yQuotient=diff==0?0:height/diff,gap=opts.gap,xQuotient=(width+gap)/values.length,fill=this.fill();for(var i=0;i<values.length;i++){var value=values[i];var y=height-yQuotient*(value-min);var h=yQuotient*value;if(h==0){h=pixel;if(min<=0&&max>0||diff==0)y-=pixel}else if(h<0){y+=h;h=-h}var rect=svgElement("rect",{fill:fill.call(this,value,i,values),x:i*xQuotient,y:y,width:xQuotient-gap,height:h});this.svg.appendChild(rect)}})})(jQuery,document,Math);(function(root,factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof module==="object"&&module.exports){var jQuery;try{jQuery=require("jquery")}catch(err){jQuery=null}module.exports=factory(jQuery)}else{root.Slider=factory(root.jQuery)}})(this,function($){var Slider;(function($){"use strict";var slice=Array.prototype.slice;function noop(){}function defineBridget($){if(!$){return}function addOptionMethod(PluginClass){if(PluginClass.prototype.option){return}PluginClass.prototype.option=function(opts){if(!$.isPlainObject(opts)){return}this.options=$.extend(true,this.options,opts)}}var logError=typeof console==="undefined"?noop:function(message){console.error(message)};function bridge(namespace,PluginClass){$.fn[namespace]=function(options){if(typeof options==="string"){var args=slice.call(arguments,1);for(var i=0,len=this.length;i<len;i++){var elem=this[i];var instance=$.data(elem,namespace);if(!instance){logError("cannot call methods on "+namespace+" prior to initialization; "+"attempted to call '"+options+"'");continue}if(!$.isFunction(instance[options])||options.charAt(0)==="_"){logError("no such method '"+options+"' for "+namespace+" instance");continue}var returnValue=instance[options].apply(instance,args);if(returnValue!==undefined&&returnValue!==instance){return returnValue}}return this}else{var objects=this.map(function(){var instance=$.data(this,namespace);if(instance){instance.option(options);instance._init()}else{instance=new PluginClass(this,options);$.data(this,namespace,instance)}return $(this)});if(!objects||objects.length>1){return objects}else{return objects[0]}}}}$.bridget=function(namespace,PluginClass){addOptionMethod(PluginClass);bridge(namespace,PluginClass)};return $.bridget}defineBridget($)})($);(function($){var ErrorMsgs={formatInvalidInputErrorMsg:function(input){return"Invalid input value '"+input+"' passed in"},callingContextNotSliderInstance:"Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"};var SliderScale={linear:{toValue:function(percentage){var rawValue=percentage/100*(this.options.max-this.options.min);if(this.options.ticks_positions.length>0){var minv,maxv,minp,maxp=0;for(var i=0;i<this.options.ticks_positions.length;i++){if(percentage<=this.options.ticks_positions[i]){minv=i>0?this.options.ticks[i-1]:0;minp=i>0?this.options.ticks_positions[i-1]:0;maxv=this.options.ticks[i];maxp=this.options.ticks_positions[i];break}}if(i>0){var partialPercentage=(percentage-minp)/(maxp-minp);rawValue=minv+partialPercentage*(maxv-minv)}}var value=this.options.min+Math.round(rawValue/this.options.step)*this.options.step;if(value<this.options.min){return this.options.min}else if(value>this.options.max){return this.options.max}else{return value}},toPercentage:function(value){if(this.options.max===this.options.min){return 0}if(this.options.ticks_positions.length>0){var minv,maxv,minp,maxp=0;for(var i=0;i<this.options.ticks.length;i++){if(value<=this.options.ticks[i]){minv=i>0?this.options.ticks[i-1]:0;minp=i>0?this.options.ticks_positions[i-1]:0;maxv=this.options.ticks[i];maxp=this.options.ticks_positions[i];break}}if(i>0){var partialPercentage=(value-minv)/(maxv-minv);return minp+partialPercentage*(maxp-minp)}}return 100*(value-this.options.min)/(this.options.max-this.options.min)}},logarithmic:{toValue:function(percentage){var min=this.options.min===0?0:Math.log(this.options.min);var max=Math.log(this.options.max);var value=Math.exp(min+(max-min)*percentage/100);value=this.options.min+Math.round((value-this.options.min)/this.options.step)*this.options.step;if(value<this.options.min){return this.options.min}else if(value>this.options.max){return this.options.max}else{return value}},toPercentage:function(value){if(this.options.max===this.options.min){return 0}else{var max=Math.log(this.options.max);var min=this.options.min===0?0:Math.log(this.options.min);var v=value===0?0:Math.log(value);return 100*(v-min)/(max-min)}}}};Slider=function(element,options){createNewSlider.call(this,element,options);return this};function createNewSlider(element,options){if(typeof element==="string"){this.element=document.querySelector(element)}else if(element instanceof HTMLElement){this.element=element}options=options?options:{};var optionTypes=Object.keys(this.defaultOptions);for(var i=0;i<optionTypes.length;i++){var optName=optionTypes[i];var val=options[optName];val=typeof val!=="undefined"?val:getDataAttrib(this.element,optName);val=val!==null?val:this.defaultOptions[optName];if(!this.options){this.options={}}this.options[optName]=val}function getDataAttrib(element,optName){var dataName="data-slider-"+optName.replace(/_/g,"-");var dataValString=element.getAttribute(dataName);try{return JSON.parse(dataValString)}catch(err){return dataValString}}var origWidth=this.element.style.width;var updateSlider=false;var parent=this.element.parentNode;var sliderTrackSelection;var sliderTrackLow,sliderTrackHigh;var sliderMinHandle;var sliderMaxHandle;if(this.sliderElem){updateSlider=true}else{this.sliderElem=document.createElement("div");this.sliderElem.className="slider";var sliderTrack=document.createElement("div");sliderTrack.className="slider-track";sliderTrackLow=document.createElement("div");sliderTrackLow.className="slider-track-low";sliderTrackSelection=document.createElement("div");sliderTrackSelection.className="slider-selection";sliderTrackHigh=document.createElement("div");sliderTrackHigh.className="slider-track-high";sliderMinHandle=document.createElement("div");sliderMinHandle.className="slider-handle min-slider-handle";sliderMaxHandle=document.createElement("div");sliderMaxHandle.className="slider-handle max-slider-handle";sliderTrack.appendChild(sliderTrackLow);sliderTrack.appendChild(sliderTrackSelection);sliderTrack.appendChild(sliderTrackHigh);this.ticks=[];if(Array.isArray(this.options.ticks)&&this.options.ticks.length>0){for(i=0;i<this.options.ticks.length;i++){var tick=document.createElement("div");tick.className="slider-tick";this.ticks.push(tick);sliderTrack.appendChild(tick)}sliderTrackSelection.className+=" tick-slider-selection"}sliderTrack.appendChild(sliderMinHandle);sliderTrack.appendChild(sliderMaxHandle);this.tickLabels=[];if(Array.isArray(this.options.ticks_labels)&&this.options.ticks_labels.length>0){this.tickLabelContainer=document.createElement("div");this.tickLabelContainer.className="slider-tick-label-container";for(i=0;i<this.options.ticks_labels.length;i++){var label=document.createElement("div");label.className="slider-tick-label";label.innerHTML=this.options.ticks_labels[i];this.tickLabels.push(label);this.tickLabelContainer.appendChild(label)}}var createAndAppendTooltipSubElements=function(tooltipElem){var arrow=document.createElement("div");arrow.className="tooltip-arrow";var inner=document.createElement("div");inner.className="tooltip-inner";tooltipElem.appendChild(arrow);tooltipElem.appendChild(inner)};var sliderTooltip=document.createElement("div");sliderTooltip.className="tooltip tooltip-main";createAndAppendTooltipSubElements(sliderTooltip);var sliderTooltipMin=document.createElement("div");sliderTooltipMin.className="tooltip tooltip-min";createAndAppendTooltipSubElements(sliderTooltipMin);var sliderTooltipMax=document.createElement("div");sliderTooltipMax.className="tooltip tooltip-max";createAndAppendTooltipSubElements(sliderTooltipMax);this.sliderElem.appendChild(sliderTrack);this.sliderElem.appendChild(sliderTooltip);this.sliderElem.appendChild(sliderTooltipMin);this.sliderElem.appendChild(sliderTooltipMax);if(this.tickLabelContainer){this.sliderElem.appendChild(this.tickLabelContainer)}parent.insertBefore(this.sliderElem,this.element);this.element.style.display="none"}if($){this.$element=$(this.element);this.$sliderElem=$(this.sliderElem)}this.eventToCallbackMap={};this.sliderElem.id=this.options.id;this.touchCapable="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch;this.tooltip=this.sliderElem.querySelector(".tooltip-main");this.tooltipInner=this.tooltip.querySelector(".tooltip-inner");this.tooltip_min=this.sliderElem.querySelector(".tooltip-min");this.tooltipInner_min=this.tooltip_min.querySelector(".tooltip-inner");this.tooltip_max=this.sliderElem.querySelector(".tooltip-max");this.tooltipInner_max=this.tooltip_max.querySelector(".tooltip-inner");if(SliderScale[this.options.scale]){this.options.scale=SliderScale[this.options.scale]}if(updateSlider===true){this._removeClass(this.sliderElem,"slider-horizontal");this._removeClass(this.sliderElem,"slider-vertical");this._removeClass(this.tooltip,"hide");this._removeClass(this.tooltip_min,"hide");this._removeClass(this.tooltip_max,"hide");["left","top","width","height"].forEach(function(prop){this._removeProperty(this.trackLow,prop);this._removeProperty(this.trackSelection,prop);this._removeProperty(this.trackHigh,prop)},this);[this.handle1,this.handle2].forEach(function(handle){this._removeProperty(handle,"left");this._removeProperty(handle,"top")},this);[this.tooltip,this.tooltip_min,this.tooltip_max].forEach(function(tooltip){this._removeProperty(tooltip,"left");this._removeProperty(tooltip,"top");this._removeProperty(tooltip,"margin-left");this._removeProperty(tooltip,"margin-top");this._removeClass(tooltip,"right");this._removeClass(tooltip,"top")},this)}if(this.options.orientation==="vertical"){this._addClass(this.sliderElem,"slider-vertical");this.stylePos="top";this.mousePos="pageY";this.sizePos="offsetHeight";this._addClass(this.tooltip,"right");this.tooltip.style.left="100%";this._addClass(this.tooltip_min,"right");this.tooltip_min.style.left="100%";this._addClass(this.tooltip_max,"right");this.tooltip_max.style.left="100%"}else{this._addClass(this.sliderElem,"slider-horizontal");this.sliderElem.style.width=origWidth;this.options.orientation="horizontal";this.stylePos="left";this.mousePos="pageX";this.sizePos="offsetWidth";this._addClass(this.tooltip,"top");this.tooltip.style.top=-this.tooltip.outerHeight-14+"px";this._addClass(this.tooltip_min,"top");this.tooltip_min.style.top=-this.tooltip_min.outerHeight-14+"px";this._addClass(this.tooltip_max,"top");this.tooltip_max.style.top=-this.tooltip_max.outerHeight-14+"px"}if(Array.isArray(this.options.ticks)&&this.options.ticks.length>0){this.options.max=Math.max.apply(Math,this.options.ticks);this.options.min=Math.min.apply(Math,this.options.ticks)}if(Array.isArray(this.options.value)){this.options.range=true}else if(this.options.range){this.options.value=[this.options.value,this.options.max]}this.trackLow=sliderTrackLow||this.trackLow;this.trackSelection=sliderTrackSelection||this.trackSelection;this.trackHigh=sliderTrackHigh||this.trackHigh;if(this.options.selection==="none"){this._addClass(this.trackLow,"hide");this._addClass(this.trackSelection,"hide");this._addClass(this.trackHigh,"hide")}this.handle1=sliderMinHandle||this.handle1;this.handle2=sliderMaxHandle||this.handle2;if(updateSlider===true){this._removeClass(this.handle1,"round triangle");this._removeClass(this.handle2,"round triangle hide");for(i=0;i<this.ticks.length;i++){this._removeClass(this.ticks[i],"round triangle hide")}}var availableHandleModifiers=["round","triangle","custom"];var isValidHandleType=availableHandleModifiers.indexOf(this.options.handle)!==-1;if(isValidHandleType){this._addClass(this.handle1,this.options.handle);this._addClass(this.handle2,this.options.handle);for(i=0;i<this.ticks.length;i++){this._addClass(this.ticks[i],this.options.handle)}}this.offset=this._offset(this.sliderElem);this.size=this.sliderElem[this.sizePos];this.setValue(this.options.value);this.handle1Keydown=this._keydown.bind(this,0);this.handle1.addEventListener("keydown",this.handle1Keydown,false);this.handle2Keydown=this._keydown.bind(this,1);this.handle2.addEventListener("keydown",this.handle2Keydown,false);this.mousedown=this._mousedown.bind(this);if(this.touchCapable){this.sliderElem.addEventListener("touchstart",this.mousedown,false)}this.sliderElem.addEventListener("mousedown",this.mousedown,false);if(this.options.tooltip==="hide"){this._addClass(this.tooltip,"hide");this._addClass(this.tooltip_min,"hide");this._addClass(this.tooltip_max,"hide")}else if(this.options.tooltip==="always"){this._showTooltip();this._alwaysShowTooltip=true}else{this.showTooltip=this._showTooltip.bind(this);this.hideTooltip=this._hideTooltip.bind(this);this.sliderElem.addEventListener("mouseenter",this.showTooltip,false);this.sliderElem.addEventListener("mouseleave",this.hideTooltip,false);this.handle1.addEventListener("focus",this.showTooltip,false);this.handle1.addEventListener("blur",this.hideTooltip,false);this.handle2.addEventListener("focus",this.showTooltip,false);this.handle2.addEventListener("blur",this.hideTooltip,false)}if(this.options.enabled){this.enable()}else{this.disable()}}Slider.prototype={_init:function(){},constructor:Slider,defaultOptions:{id:"",min:0,max:10,step:1,precision:0,orientation:"horizontal",value:5,range:false,selection:"before",tooltip:"show",tooltip_split:false,handle:"round",reversed:false,enabled:true,formatter:function(val){if(Array.isArray(val)){return val[0]+" : "+val[1]}else{return val}},natural_arrow_keys:false,ticks:[],ticks_positions:[],ticks_labels:[],ticks_snap_bounds:0,scale:"linear",focus:false},over:false,inDrag:false,getValue:function(){if(this.options.range){return this.options.value}return this.options.value[0]},setValue:function(val,triggerSlideEvent,triggerChangeEvent){if(!val){val=0}var oldValue=this.getValue();this.options.value=this._validateInputValue(val);var applyPrecision=this._applyPrecision.bind(this);if(this.options.range){this.options.value[0]=applyPrecision(this.options.value[0]);this.options.value[1]=applyPrecision(this.options.value[1]);this.options.value[0]=Math.max(this.options.min,Math.min(this.options.max,this.options.value[0]));this.options.value[1]=Math.max(this.options.min,Math.min(this.options.max,this.options.value[1]))}else{this.options.value=applyPrecision(this.options.value);this.options.value=[Math.max(this.options.min,Math.min(this.options.max,this.options.value))];this._addClass(this.handle2,"hide");if(this.options.selection==="after"){this.options.value[1]=this.options.max}else{this.options.value[1]=this.options.min}}if(this.options.max>this.options.min){this.percentage=[this._toPercentage(this.options.value[0]),this._toPercentage(this.options.value[1]),this.options.step*100/(this.options.max-this.options.min)]}else{this.percentage=[0,0,100]}this._layout();var newValue=this.options.range?this.options.value:this.options.value[0];if(triggerSlideEvent===true){this._trigger("slide",newValue)}if(oldValue!==newValue&&triggerChangeEvent===true){this._trigger("change",{oldValue:oldValue,newValue:newValue})}this._setDataVal(newValue);return this},destroy:function(){this._removeSliderEventHandlers();this.sliderElem.parentNode.removeChild(this.sliderElem);this.element.style.display="";this._cleanUpEventCallbacksMap();this.element.removeAttribute("data");if($){this._unbindJQueryEventHandlers();this.$element.removeData("slider")}},disable:function(){this.options.enabled=false;this.handle1.removeAttribute("tabindex");this.handle2.removeAttribute("tabindex");this._addClass(this.sliderElem,"slider-disabled");this._trigger("slideDisabled");return this},enable:function(){this.options.enabled=true;this.handle1.setAttribute("tabindex",0);this.handle2.setAttribute("tabindex",0);this._removeClass(this.sliderElem,"slider-disabled");this._trigger("slideEnabled");return this},toggle:function(){if(this.options.enabled){this.disable()}else{this.enable()}return this},isEnabled:function(){return this.options.enabled},on:function(evt,callback){this._bindNonQueryEventHandler(evt,callback);return this},getAttribute:function(attribute){if(attribute){return this.options[attribute]}else{return this.options}},setAttribute:function(attribute,value){this.options[attribute]=value;return this},refresh:function(){this._removeSliderEventHandlers();createNewSlider.call(this,this.element,this.options);if($){$.data(this.element,"slider",this)}return this},relayout:function(){this._layout();return this},_removeSliderEventHandlers:function(){this.handle1.removeEventListener("keydown",this.handle1Keydown,false);this.handle1.removeEventListener("focus",this.showTooltip,false);this.handle1.removeEventListener("blur",this.hideTooltip,false);this.handle2.removeEventListener("keydown",this.handle2Keydown,false);this.handle2.removeEventListener("focus",this.handle2Keydown,false);this.handle2.removeEventListener("blur",this.handle2Keydown,false);this.sliderElem.removeEventListener("mouseenter",this.showTooltip,false);this.sliderElem.removeEventListener("mouseleave",this.hideTooltip,false);this.sliderElem.removeEventListener("touchstart",this.mousedown,false);this.sliderElem.removeEventListener("mousedown",this.mousedown,false)},_bindNonQueryEventHandler:function(evt,callback){if(this.eventToCallbackMap[evt]===undefined){this.eventToCallbackMap[evt]=[]}this.eventToCallbackMap[evt].push(callback)},_cleanUpEventCallbacksMap:function(){var eventNames=Object.keys(this.eventToCallbackMap);for(var i=0;i<eventNames.length;i++){var eventName=eventNames[i];this.eventToCallbackMap[eventName]=null}},_showTooltip:function(){if(this.options.tooltip_split===false){this._addClass(this.tooltip,"in");this.tooltip_min.style.display="none";this.tooltip_max.style.display="none"}else{this._addClass(this.tooltip_min,"in");this._addClass(this.tooltip_max,"in");this.tooltip.style.display="none"}this.over=true},_hideTooltip:function(){if(this.inDrag===false&&this.alwaysShowTooltip!==true){this._removeClass(this.tooltip,"in");this._removeClass(this.tooltip_min,"in");this._removeClass(this.tooltip_max,"in")}this.over=false},_layout:function(){var positionPercentages;if(this.options.reversed){positionPercentages=[100-this.percentage[0],this.percentage[1]]}else{positionPercentages=[this.percentage[0],this.percentage[1]]}this.handle1.style[this.stylePos]=positionPercentages[0]+"%";this.handle2.style[this.stylePos]=positionPercentages[1]+"%";if(Array.isArray(this.options.ticks)&&this.options.ticks.length>0){var maxTickValue=Math.max.apply(Math,this.options.ticks);var minTickValue=Math.min.apply(Math,this.options.ticks);var styleSize=this.options.orientation==="vertical"?"height":"width";var styleMargin=this.options.orientation==="vertical"?"marginTop":"marginLeft";var labelSize=this.size/(this.options.ticks.length-1);if(this.tickLabelContainer){var extraMargin=0;if(this.options.ticks_positions.length===0){this.tickLabelContainer.style[styleMargin]=-labelSize/2+"px";extraMargin=this.tickLabelContainer.offsetHeight}else{for(i=0;i<this.tickLabelContainer.childNodes.length;i++){if(this.tickLabelContainer.childNodes[i].offsetHeight>extraMargin){extraMargin=this.tickLabelContainer.childNodes[i].offsetHeight}}}if(this.options.orientation==="horizontal"){this.sliderElem.style.marginBottom=extraMargin+"px"}}for(var i=0;i<this.options.ticks.length;i++){var percentage=this.options.ticks_positions[i]||100*(this.options.ticks[i]-minTickValue)/(maxTickValue-minTickValue);this.ticks[i].style[this.stylePos]=percentage+"%";this._removeClass(this.ticks[i],"in-selection");if(!this.options.range){if(this.options.selection==="after"&&percentage>=positionPercentages[0]){this._addClass(this.ticks[i],"in-selection")}else if(this.options.selection==="before"&&percentage<=positionPercentages[0]){this._addClass(this.ticks[i],"in-selection")}}else if(percentage>=positionPercentages[0]&&percentage<=positionPercentages[1]){this._addClass(this.ticks[i],"in-selection")}if(this.tickLabels[i]){this.tickLabels[i].style[styleSize]=labelSize+"px";if(this.options.ticks_positions[i]!==undefined){this.tickLabels[i].style.position="absolute";this.tickLabels[i].style[this.stylePos]=this.options.ticks_positions[i]+"%";this.tickLabels[i].style[styleMargin]=-labelSize/2+"px"}}}}if(this.options.orientation==="vertical"){this.trackLow.style.top="0";this.trackLow.style.height=Math.min(positionPercentages[0],positionPercentages[1])+"%";this.trackSelection.style.top=Math.min(positionPercentages[0],positionPercentages[1])+"%";this.trackSelection.style.height=Math.abs(positionPercentages[0]-positionPercentages[1])+"%";this.trackHigh.style.bottom="0";this.trackHigh.style.height=100-Math.min(positionPercentages[0],positionPercentages[1])-Math.abs(positionPercentages[0]-positionPercentages[1])+"%"}else{this.trackLow.style.left="0";this.trackLow.style.width=Math.min(positionPercentages[0],positionPercentages[1])+"%";this.trackSelection.style.left=Math.min(positionPercentages[0],positionPercentages[1])+"%";this.trackSelection.style.width=Math.abs(positionPercentages[0]-positionPercentages[1])+"%";this.trackHigh.style.right="0";this.trackHigh.style.width=100-Math.min(positionPercentages[0],positionPercentages[1])-Math.abs(positionPercentages[0]-positionPercentages[1])+"%";var offset_min=this.tooltip_min.getBoundingClientRect();var offset_max=this.tooltip_max.getBoundingClientRect();if(offset_min.right>offset_max.left){this._removeClass(this.tooltip_max,"top");this._addClass(this.tooltip_max,"bottom");this.tooltip_max.style.top=18+"px"}else{this._removeClass(this.tooltip_max,"bottom");this._addClass(this.tooltip_max,"top");this.tooltip_max.style.top=this.tooltip_min.style.top}}var formattedTooltipVal;if(this.options.range){formattedTooltipVal=this.options.formatter(this.options.value);this._setText(this.tooltipInner,formattedTooltipVal);this.tooltip.style[this.stylePos]=(positionPercentages[1]+positionPercentages[0])/2+"%";if(this.options.orientation==="vertical"){this._css(this.tooltip,"margin-top",-this.tooltip.offsetHeight/2+"px")}else{this._css(this.tooltip,"margin-left",-this.tooltip.offsetWidth/2+"px")}if(this.options.orientation==="vertical"){this._css(this.tooltip,"margin-top",-this.tooltip.offsetHeight/2+"px")}else{this._css(this.tooltip,"margin-left",-this.tooltip.offsetWidth/2+"px")}var innerTooltipMinText=this.options.formatter(this.options.value[0]);this._setText(this.tooltipInner_min,innerTooltipMinText);var innerTooltipMaxText=this.options.formatter(this.options.value[1]);this._setText(this.tooltipInner_max,innerTooltipMaxText);this.tooltip_min.style[this.stylePos]=positionPercentages[0]+"%";if(this.options.orientation==="vertical"){this._css(this.tooltip_min,"margin-top",-this.tooltip_min.offsetHeight/2+"px")}else{this._css(this.tooltip_min,"margin-left",-this.tooltip_min.offsetWidth/2+"px")}this.tooltip_max.style[this.stylePos]=positionPercentages[1]+"%";if(this.options.orientation==="vertical"){this._css(this.tooltip_max,"margin-top",-this.tooltip_max.offsetHeight/2+"px")}else{this._css(this.tooltip_max,"margin-left",-this.tooltip_max.offsetWidth/2+"px")}}else{formattedTooltipVal=this.options.formatter(this.options.value[0]);this._setText(this.tooltipInner,formattedTooltipVal);this.tooltip.style[this.stylePos]=positionPercentages[0]+"%";if(this.options.orientation==="vertical"){this._css(this.tooltip,"margin-top",-this.tooltip.offsetHeight/2+"px")}else{this._css(this.tooltip,"margin-left",-this.tooltip.offsetWidth/2+"px")}}},_removeProperty:function(element,prop){if(element.style.removeProperty){element.style.removeProperty(prop)}else{element.style.removeAttribute(prop)}},_mousedown:function(ev){if(!this.options.enabled){return false}this.offset=this._offset(this.sliderElem);this.size=this.sliderElem[this.sizePos];var percentage=this._getPercentage(ev);if(this.options.range){var diff1=Math.abs(this.percentage[0]-percentage);var diff2=Math.abs(this.percentage[1]-percentage);this.dragged=diff1<diff2?0:1}else{this.dragged=0}this.percentage[this.dragged]=this.options.reversed?100-percentage:percentage;this._layout();if(this.touchCapable){document.removeEventListener("touchmove",this.mousemove,false);document.removeEventListener("touchend",this.mouseup,false)}if(this.mousemove){document.removeEventListener("mousemove",this.mousemove,false)}if(this.mouseup){document.removeEventListener("mouseup",this.mouseup,false)}this.mousemove=this._mousemove.bind(this);this.mouseup=this._mouseup.bind(this);if(this.touchCapable){document.addEventListener("touchmove",this.mousemove,false);document.addEventListener("touchend",this.mouseup,false)}document.addEventListener("mousemove",this.mousemove,false);document.addEventListener("mouseup",this.mouseup,false);this.inDrag=true;var newValue=this._calculateValue();this._trigger("slideStart",newValue);this._setDataVal(newValue);this.setValue(newValue,false,true);this._pauseEvent(ev);if(this.options.focus){this._triggerFocusOnHandle(this.dragged)}return true},_triggerFocusOnHandle:function(handleIdx){if(handleIdx===0){this.handle1.focus()}if(handleIdx===1){this.handle2.focus()}},_keydown:function(handleIdx,ev){if(!this.options.enabled){return false}var dir;switch(ev.keyCode){case 37:case 40:dir=-1;break;case 39:case 38:dir=1;break}if(!dir){return}if(this.options.natural_arrow_keys){var ifVerticalAndNotReversed=this.options.orientation==="vertical"&&!this.options.reversed;var ifHorizontalAndReversed=this.options.orientation==="horizontal"&&this.options.reversed;if(ifVerticalAndNotReversed||ifHorizontalAndReversed){dir=-dir}}var val=this.options.value[handleIdx]+dir*this.options.step;if(this.options.range){val=[!handleIdx?val:this.options.value[0],handleIdx?val:this.options.value[1]]}this._trigger("slideStart",val);this._setDataVal(val);this.setValue(val,true,true);this._trigger("slideStop",val);this._setDataVal(val);this._layout();this._pauseEvent(ev);return false},_pauseEvent:function(ev){if(ev.stopPropagation){ev.stopPropagation()}if(ev.preventDefault){ev.preventDefault()}ev.cancelBubble=true;ev.returnValue=false},_mousemove:function(ev){if(!this.options.enabled){return false}var percentage=this._getPercentage(ev);this._adjustPercentageForRangeSliders(percentage);this.percentage[this.dragged]=this.options.reversed?100-percentage:percentage;this._layout();var val=this._calculateValue(true);this.setValue(val,true,true);return false},_adjustPercentageForRangeSliders:function(percentage){if(this.options.range){if(this.dragged===0&&this.percentage[1]<percentage){this.percentage[0]=this.percentage[1];this.dragged=1}else if(this.dragged===1&&this.percentage[0]>percentage){this.percentage[1]=this.percentage[0];this.dragged=0}}},_mouseup:function(){if(!this.options.enabled){return false}if(this.touchCapable){document.removeEventListener("touchmove",this.mousemove,false);document.removeEventListener("touchend",this.mouseup,false)}document.removeEventListener("mousemove",this.mousemove,false);document.removeEventListener("mouseup",this.mouseup,false);this.inDrag=false;if(this.over===false){this._hideTooltip()}var val=this._calculateValue(true);this._layout();this._trigger("slideStop",val);this._setDataVal(val);return false},_calculateValue:function(snapToClosestTick){var val;if(this.options.range){val=[this.options.min,this.options.max];if(this.percentage[0]!==0){val[0]=this._toValue(this.percentage[0]);val[0]=this._applyPrecision(val[0])}if(this.percentage[1]!==100){val[1]=this._toValue(this.percentage[1]);val[1]=this._applyPrecision(val[1])}}else{val=this._toValue(this.percentage[0]);val=parseFloat(val);val=this._applyPrecision(val)}if(snapToClosestTick){var min=[val,Infinity];for(var i=0;i<this.options.ticks.length;i++){var diff=Math.abs(this.options.ticks[i]-val);if(diff<=min[1]){min=[this.options.ticks[i],diff]}}if(min[1]<=this.options.ticks_snap_bounds){return min[0]}}return val},_applyPrecision:function(val){var precision=this.options.precision||this._getNumDigitsAfterDecimalPlace(this.options.step);return this._applyToFixedAndParseFloat(val,precision)},_getNumDigitsAfterDecimalPlace:function(num){var match=(""+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);if(!match){return 0}return Math.max(0,(match[1]?match[1].length:0)-(match[2]?+match[2]:0))},_applyToFixedAndParseFloat:function(num,toFixedInput){var truncatedNum=num.toFixed(toFixedInput);return parseFloat(truncatedNum)},_getPercentage:function(ev){if(this.touchCapable&&(ev.type==="touchstart"||ev.type==="touchmove")){ev=ev.touches[0]}var eventPosition=ev[this.mousePos];var sliderOffset=this.offset[this.stylePos];var distanceToSlide=eventPosition-sliderOffset;var percentage=distanceToSlide/this.size*100;percentage=Math.round(percentage/this.percentage[2])*this.percentage[2];return Math.max(0,Math.min(100,percentage))},_validateInputValue:function(val){if(typeof val==="number"){return val}else if(Array.isArray(val)){this._validateArray(val);return val}else{throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(val))}},_validateArray:function(val){for(var i=0;i<val.length;i++){var input=val[i];if(typeof input!=="number"){throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(input))}}},_setDataVal:function(val){var value="value: '"+val+"'";this.element.setAttribute("data",value);this.element.setAttribute("value",val);this.element.value=val},_trigger:function(evt,val){val=val||val===0?val:undefined;var callbackFnArray=this.eventToCallbackMap[evt];if(callbackFnArray&&callbackFnArray.length){for(var i=0;i<callbackFnArray.length;i++){var callbackFn=callbackFnArray[i];callbackFn(val)}}if($){this._triggerJQueryEvent(evt,val)}},_triggerJQueryEvent:function(evt,val){var eventData={type:evt,value:val};this.$element.trigger(eventData);this.$sliderElem.trigger(eventData)},_unbindJQueryEventHandlers:function(){this.$element.off();this.$sliderElem.off()},_setText:function(element,text){if(typeof element.innerText!=="undefined"){element.innerText=text}else if(typeof element.textContent!=="undefined"){element.textContent=text}},_removeClass:function(element,classString){var classes=classString.split(" ");var newClasses=element.className;for(var i=0;i<classes.length;i++){var classTag=classes[i];var regex=new RegExp("(?:\\s|^)"+classTag+"(?:\\s|$)");newClasses=newClasses.replace(regex," ")}element.className=newClasses.trim()},_addClass:function(element,classString){var classes=classString.split(" ");var newClasses=element.className;for(var i=0;i<classes.length;i++){var classTag=classes[i];var regex=new RegExp("(?:\\s|^)"+classTag+"(?:\\s|$)");var ifClassExists=regex.test(newClasses);if(!ifClassExists){newClasses+=" "+classTag}}element.className=newClasses.trim()},_offsetLeft:function(obj){var offsetLeft=obj.offsetLeft;while((obj=obj.offsetParent)&&!isNaN(obj.offsetLeft)){offsetLeft+=obj.offsetLeft}return offsetLeft},_offsetTop:function(obj){var offsetTop=obj.offsetTop;while((obj=obj.offsetParent)&&!isNaN(obj.offsetTop)){offsetTop+=obj.offsetTop}return offsetTop},_offset:function(obj){return{left:this._offsetLeft(obj),top:this._offsetTop(obj)}},_css:function(elementRef,styleName,value){if($){$.style(elementRef,styleName,value)}else{var style=styleName.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(all,letter){return letter.toUpperCase()});elementRef.style[style]=value}},_toValue:function(percentage){return this.options.scale.toValue.apply(this,[percentage])},_toPercentage:function(value){return this.options.scale.toPercentage.apply(this,[value])}};if($){var namespace=$.fn.slider?"bootstrapSlider":"slider";$.bridget(namespace,Slider)}})($);return Slider});
ntopng-3.8.1+dfsg1/httpdocs/js/jquery_bootstrap.min.js-2-//# sourceMappingURL=jquery_bootstrap.min.js.map
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-add-user.sh-119-    fi
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-add-user.sh:120:    NTOPNG_PASSWORD_MD5=`echo -n $NTOPNG_PASSWORD | md5sum | cut -c 1-32`
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-add-user.sh-121-    return 0
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-32-    echo "Usage:"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:33:    echo "`basename $0` -a restore [-d datadir] [-c archive.tar.gz]"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:34:    echo "`basename $0` -a backup  [-d datadir] [-c archive.tar.gz]"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:35:    echo "`basename $0` -a check-restore [-d datadir] [-c archive.tar.gz]"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:36:    echo "`basename $0` -a install-n2disk-conf [-d datadir] -i interface"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:37:    echo "`basename $0` -a install-n2n-conf [-d datadir]"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-38-    echo ""
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-50-    echo "-a restore"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:51:    echo "`basename $0` -a restore [-c archive.tar.gz] [-d datadir]"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-52-    echo "  Restore places the files contained in the archive into the current system."
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-56-    echo "-a backup"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:57:    echo "`basename $0` -a backup [-c archive.tar.gz] [-d datadir]"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-58-    echo " Backup creates a compressed archive using files contained into the current system."
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-60-    echo "-a check-restore"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:61:    echo "`basename $0` -a check-restore [-c archive.tar.gz] [-d datadir]"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-62-    echo " Check restore scans the data directory and looks for a valid compressed archive there."
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-65-    echo "-a install-n2disk-conf"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:66:    echo "`basename $0` -a install-n2disk-conf [-d datadir] -i interface"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-67-    echo "Installs a n2disk configuration file generated by ntopng to /etc/n2disk/ creating a symlink"
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-69-    echo "-a install-n2n-conf"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:70:    echo "`basename $0` -a install-n2n-conf [-d datadir]"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-71-    echo "Installs a n2n edge configuration file generated by ntopng to /etc/n2n/ creating a symlink"
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-147-	# make sure there's at most one among -d and --data-dir
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:148:	local DATADIR_COUNT="`cat "${DEFAULT_CONF_FILE}" | grep -v "#" | grep "\-d[= ]\|\-\-data\-dir"  | wc -l`"
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-149-
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-154-	    # use awk to split on spaces or = signs and remove " and ' s, and take the last column that should be the path to the data directory
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:155:	    local CUR_DATADIR=`cat "${DEFAULT_CONF_FILE}" | grep -v "#" | grep "\-d[= ]\|\-\-data\-dir" | awk -F"[= ]" '{print $NF}' | sed s/\"//g | sed s/\'//g`
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-156-
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-248-    # executables include binaries but also shell scripts
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:249:    if ! `find "${STAGING_DIR}" -executable -type f -exec rm -rf {} \; 2> /dev/null`; then
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-250-	# some versions of find don't support -executable and require the
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-267-    while IFS= read -r -d '' FL; do
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:268:	if ! `file "${FL}" | grep -qc "ASCII text";`; then
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-269-	    if [ "${NEDGE}" == "1" ]; then
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:270:		if `file "${FL}" | grep -qc "PNG image data";`; then
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-271-		    continue
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-298-    # make sure it's a tar archive
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:299:    if ! `file "${ARCHIVE}" | grep -qc "gzip compressed data";`; then
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-300-	[ $QUIET = false ] && echo "Unrecognized file format for ${ARCHIVE}: expecting gzip compressed data"
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-306-    # must contain a manifest file
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:307:    if ! `tar tf "${ARCHIVE}" ./MANIFEST >/dev/null 2>&1`; then
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-308-	[ $QUIET = false ] && echo "Compressed archive $1 does not contain MANIFEST"
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-332-    if [ ! -z "${SRC}" ] && [ -f "${SRC}" ] && [ ! -z "${DST_DIR}" ] && [ -d "${DST_DIR}" ]; then
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:333:	local SRC_BASENAME=`basename "${SRC}"`
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-334-	local DST="${DST_DIR}/${SRC_BASENAME}"
##############################################
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-382-    # owner and group of the data directory
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in:383:    local USER_GROUP=`ls -ld ${DATADIR} | awk '{print $3":"$4}'`
ntopng-3.8.1+dfsg1/httpdocs/misc/ntopng-utils-manage-config.in-384-    # will be something like root:root nobody:nogroup
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-926-00:03:65	KiraInfo	Kira Information & Communications, Ltd.
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:927:00:03:66	AsmPacif	ASM Pacific Technology
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-928-00:03:67	JasmineN	Jasmine Networks, Inc.
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-9462-00:24:10	NueteqTe	NUETEQ Technology,Inc.
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:9463:00:24:11	Pharmasm	PharmaSmart LLC
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-9464-00:24:12	BenignTe	Benign Technologies Co, Ltd.
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-13171-00:50:C2:88:50:00/36	OooNtkIm	Ooo Ntk Imos
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:13172:00:50:C2:88:60:00/36	TransasM	Transas Marine Limited
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-13173-00:50:C2:88:70:00/36	Inventis	Inventis Technology Pty Limited
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-14528-00:50:C2:DD:50:00/36	FriendSp	Friend Spring Industrial Co., Ltd.
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:14529:00:50:C2:DD:60:00/36	TransasM	Transas Marine Limited
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-14530-00:50:C2:DD:70:00/36	TornadoM	Tornado Modular Systems
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-24072-70:B3:D5:30:30:00/36	FuchuGik	Fuchu Giken, Inc.
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:24073:70:B3:D5:30:40:00/36	TransasM	Transas Marine Limited
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-24074-70:B3:D5:30:50:00/36	CaitronI	CAITRON Industrial Solutions GmbH
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-24353-70:B3:D5:51:70:00/36	Ispher
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:24354:70:B3:D5:51:B0:00/36	VitreaSm	Vitrea Smart Home Technologies
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-24355-70:B3:D5:51:C0:00/36	AtxNetwo	ATX Networks Corp
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-25018-70:B3:D5:9D:30:00/36	Communic	Communication Technology Ltd.
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:25019:70:B3:D5:9D:40:00/36	TransasM	Transas Marine Limited
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-25020-70:B3:D5:9D:50:00/36	Southern	Southern Tier Technologies
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-25048-70:B3:D5:A0:40:00/36	GaleaEle	Galea Electric S.L.
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:25049:70:B3:D5:A0:50:00/36	TransasM	Transas Marine Limited
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-25050-70:B3:D5:A0:60:00/36	KopisMob	Kopis Mobile LLC
##############################################
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-25179-70:B3:D5:AE:10:00/36	Dimocore	DimoCore Corporation
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt:25180:70:B3:D5:AE:20:00/36	TransasM	Transas Marine Limited
ntopng-3.8.1+dfsg1/httpdocs/other/EtherOUI.txt-25181-70:B3:D5:AE:30:00/36	Zhejiang	Zhejiang Wellsun Electric Meter Co.,Ltd
##############################################
ntopng-3.8.1+dfsg1/include/IpAddress.h-81-  char* serialize();
ntopng-3.8.1+dfsg1/include/IpAddress.h:82:  bool get_sockaddr(struct sockaddr ** const sa, ssize_t * const sa_len) const;
ntopng-3.8.1+dfsg1/include/IpAddress.h-83-  json_object* getJSONObject();
##############################################
ntopng-3.8.1+dfsg1/include/Utils.h-93-  static char* tokenizer(char *arg, int c, char **data);
ntopng-3.8.1+dfsg1/include/Utils.h:94:  static in_addr_t inet_addr(const char *cp);
ntopng-3.8.1+dfsg1/include/Utils.h-95-  static char* intoaV4(unsigned int addr, char* buf, u_short bufLen);
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-43-if test -z "$BASH_VERSION$ZSH_VERSION" \
ntopng-3.8.1+dfsg1/packages/debian/configure:44:    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/debian/configure-45-  as_echo='print -r --'
ntopng-3.8.1+dfsg1/packages/debian/configure-46-  as_echo_n='print -rn --'
ntopng-3.8.1+dfsg1/packages/debian/configure:47:elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/debian/configure-48-  as_echo='printf %s\n'
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-50-else
ntopng-3.8.1+dfsg1/packages/debian/configure:51:  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
ntopng-3.8.1+dfsg1/packages/debian/configure-52-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-60-	expr "X$arg" : "X\\(.*\\)$as_nl";
ntopng-3.8.1+dfsg1/packages/debian/configure:61:	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
ntopng-3.8.1+dfsg1/packages/debian/configure-62-      esac;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-197-  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
ntopng-3.8.1+dfsg1/packages/debian/configure:198:  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
ntopng-3.8.1+dfsg1/packages/debian/configure-199-  if (eval "$as_required") 2>/dev/null; then :
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-323-      case $as_dir in #(
ntopng-3.8.1+dfsg1/packages/debian/configure:324:      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
ntopng-3.8.1+dfsg1/packages/debian/configure-325-      *) as_qdir=$as_dir;;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-396-  {
ntopng-3.8.1+dfsg1/packages/debian/configure:397:    as_val=`expr "$@" || test $? -eq 1`
ntopng-3.8.1+dfsg1/packages/debian/configure-398-  }
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-403-# ----------------------------------------
ntopng-3.8.1+dfsg1/packages/debian/configure:404:# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
ntopng-3.8.1+dfsg1/packages/debian/configure-405-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-466-  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
ntopng-3.8.1+dfsg1/packages/debian/configure:467:  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
ntopng-3.8.1+dfsg1/packages/debian/configure-468-  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-711-  case $ac_option in
ntopng-3.8.1+dfsg1/packages/debian/configure:712:  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
ntopng-3.8.1+dfsg1/packages/debian/configure-713-  *=)   ac_optarg= ;;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-755-  -disable-* | --disable-*)
ntopng-3.8.1+dfsg1/packages/debian/configure:756:    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
ntopng-3.8.1+dfsg1/packages/debian/configure-757-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-760-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/debian/configure:761:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/debian/configure-762-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-781-  -enable-* | --enable-*)
ntopng-3.8.1+dfsg1/packages/debian/configure:782:    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
ntopng-3.8.1+dfsg1/packages/debian/configure-783-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-786-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/debian/configure:787:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/debian/configure-788-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-994-  -with-* | --with-*)
ntopng-3.8.1+dfsg1/packages/debian/configure:995:    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
ntopng-3.8.1+dfsg1/packages/debian/configure-996-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-999-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/debian/configure:1000:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1001-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1010-  -without-* | --without-*)
ntopng-3.8.1+dfsg1/packages/debian/configure:1011:    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1012-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1015-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/debian/configure:1016:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1017-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1048-  *=*)
ntopng-3.8.1+dfsg1/packages/debian/configure:1049:    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/debian/configure-1050-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1069-if test -n "$ac_prev"; then
ntopng-3.8.1+dfsg1/packages/debian/configure:1070:  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1071-  as_fn_error $? "missing argument to $ac_option"
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1091-    */ )
ntopng-3.8.1+dfsg1/packages/debian/configure:1092:      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1093-      eval $ac_var=\$ac_val;;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1126-ac_ls_di=`ls -di .` &&
ntopng-3.8.1+dfsg1/packages/debian/configure:1127:ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
ntopng-3.8.1+dfsg1/packages/debian/configure-1128-  as_fn_error $? "working directory cannot be determined"
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1182-case $srcdir in
ntopng-3.8.1+dfsg1/packages/debian/configure:1183:*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
ntopng-3.8.1+dfsg1/packages/debian/configure-1184-esac
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1225-By default, \`make install' will install all the files in
ntopng-3.8.1+dfsg1/packages/debian/configure:1226:\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
ntopng-3.8.1+dfsg1/packages/debian/configure:1227:an installation prefix other than \`$ac_default_prefix' using \`--prefix',
ntopng-3.8.1+dfsg1/packages/debian/configure-1228-for instance \`--prefix=\$HOME'.
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1285-*)
ntopng-3.8.1+dfsg1/packages/debian/configure:1286:  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1287-  # A ".." for each directory in $ac_dir_suffix.
ntopng-3.8.1+dfsg1/packages/debian/configure:1288:  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1289-  case $ac_top_builddir_sub in
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1421-    *\'*)
ntopng-3.8.1+dfsg1/packages/debian/configure:1422:      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/debian/configure-1423-    esac
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1504-      case $ac_val in
ntopng-3.8.1+dfsg1/packages/debian/configure:1505:      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
ntopng-3.8.1+dfsg1/packages/debian/configure-1506-      esac
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1519-	case $ac_val in
ntopng-3.8.1+dfsg1/packages/debian/configure:1520:	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
ntopng-3.8.1+dfsg1/packages/debian/configure-1521-	esac
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1639-    set,)
ntopng-3.8.1+dfsg1/packages/debian/configure:1640:      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
ntopng-3.8.1+dfsg1/packages/debian/configure:1641:$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ntopng-3.8.1+dfsg1/packages/debian/configure-1642-      ac_cache_corrupted=: ;;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1650-	# differences in whitespace do not lead to failure.
ntopng-3.8.1+dfsg1/packages/debian/configure:1651:	ac_old_val_w=`echo x $ac_old_val`
ntopng-3.8.1+dfsg1/packages/debian/configure:1652:	ac_new_val_w=`echo x $ac_new_val`
ntopng-3.8.1+dfsg1/packages/debian/configure-1653-	if test "$ac_old_val_w" != "$ac_new_val_w"; then
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1670-    case $ac_new_val in
ntopng-3.8.1+dfsg1/packages/debian/configure:1671:    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/debian/configure-1672-    *) ac_arg=$ac_var=$ac_new_val ;;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1739-  UBUNTU_RELEASE=`lsb_release -r|cut -f 2`
ntopng-3.8.1+dfsg1/packages/debian/configure:1740:  UBUNTU_SUB_RELEASE=`echo $UBUNTU_RELEASE|cut -f 1 -d '.'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1741-
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1753-  if  test -d $HOME/PF_RING ; then
ntopng-3.8.1+dfsg1/packages/debian/configure:1754:    PFRING_VERS=`$HOME/PF_RING/package/version.sh --release`
ntopng-3.8.1+dfsg1/packages/debian/configure:1755:    PFRING_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
ntopng-3.8.1+dfsg1/packages/debian/configure-1756-    PFRING_DEP="pfring (=$PFRING_VERS-$PFRING_RELEASE)"
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1821-
ntopng-3.8.1+dfsg1/packages/debian/configure:1822:NTOPNG_VERS=`cat ../../configure.ac | head -2|grep 'C_INIT' | cut -d " " -f 2|cut -d ')' -f 1|cut -d ',' -f 2| tail -c +2 |sed 's/.\{1\}$//'`
ntopng-3.8.1+dfsg1/packages/debian/configure-1823-GIT_RELEASE=`git rev-parse HEAD`
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1987-'
ntopng-3.8.1+dfsg1/packages/debian/configure:1988:DEFS=`sed -n "$ac_script" confdefs.h`
ntopng-3.8.1+dfsg1/packages/debian/configure-1989-
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-1996-  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ntopng-3.8.1+dfsg1/packages/debian/configure:1997:  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
ntopng-3.8.1+dfsg1/packages/debian/configure-1998-  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2063-if test -z "$BASH_VERSION$ZSH_VERSION" \
ntopng-3.8.1+dfsg1/packages/debian/configure:2064:    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/debian/configure-2065-  as_echo='print -r --'
ntopng-3.8.1+dfsg1/packages/debian/configure-2066-  as_echo_n='print -rn --'
ntopng-3.8.1+dfsg1/packages/debian/configure:2067:elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/debian/configure-2068-  as_echo='printf %s\n'
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2070-else
ntopng-3.8.1+dfsg1/packages/debian/configure:2071:  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
ntopng-3.8.1+dfsg1/packages/debian/configure-2072-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2080-	expr "X$arg" : "X\\(.*\\)$as_nl";
ntopng-3.8.1+dfsg1/packages/debian/configure:2081:	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
ntopng-3.8.1+dfsg1/packages/debian/configure-2082-      esac;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2157-# ----------------------------------------
ntopng-3.8.1+dfsg1/packages/debian/configure:2158:# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
ntopng-3.8.1+dfsg1/packages/debian/configure-2159-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2229-  {
ntopng-3.8.1+dfsg1/packages/debian/configure:2230:    as_val=`expr "$@" || test $? -eq 1`
ntopng-3.8.1+dfsg1/packages/debian/configure-2231-  }
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2333-      case $as_dir in #(
ntopng-3.8.1+dfsg1/packages/debian/configure:2334:      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
ntopng-3.8.1+dfsg1/packages/debian/configure-2335-      *) as_qdir=$as_dir;;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2455-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ntopng-3.8.1+dfsg1/packages/debian/configure:2456:ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ntopng-3.8.1+dfsg1/packages/debian/configure-2457-ac_cs_version="\\
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2477-  --*=?*)
ntopng-3.8.1+dfsg1/packages/debian/configure:2478:    ac_option=`expr "X$1" : 'X\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/debian/configure:2479:    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ntopng-3.8.1+dfsg1/packages/debian/configure-2480-    ac_shift=:
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2482-  --*=)
ntopng-3.8.1+dfsg1/packages/debian/configure:2483:    ac_option=`expr "X$1" : 'X\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/debian/configure-2484-    ac_optarg=
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2506-    case $ac_optarg in
ntopng-3.8.1+dfsg1/packages/debian/configure:2507:    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/debian/configure-2508-    '') as_fn_error $? "missing file argument" ;;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2629-fi
ntopng-3.8.1+dfsg1/packages/debian/configure:2630:ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
ntopng-3.8.1+dfsg1/packages/debian/configure-2631-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2646-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ntopng-3.8.1+dfsg1/packages/debian/configure:2647:ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ntopng-3.8.1+dfsg1/packages/debian/configure-2648-ac_delim='%!_!# '
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2652-
ntopng-3.8.1+dfsg1/packages/debian/configure:2653:  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
ntopng-3.8.1+dfsg1/packages/debian/configure-2654-  if test $ac_delim_n = $ac_delim_num; then
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2814-      esac
ntopng-3.8.1+dfsg1/packages/debian/configure:2815:      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
ntopng-3.8.1+dfsg1/packages/debian/configure-2816-      as_fn_append ac_file_inputs " '$ac_f'"
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2873-*)
ntopng-3.8.1+dfsg1/packages/debian/configure:2874:  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
ntopng-3.8.1+dfsg1/packages/debian/configure-2875-  # A ".." for each directory in $ac_dir_suffix.
ntopng-3.8.1+dfsg1/packages/debian/configure:2876:  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
ntopng-3.8.1+dfsg1/packages/debian/configure-2877-  case $ac_top_builddir_sub in
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2925-/@mandir@/p'
ntopng-3.8.1+dfsg1/packages/debian/configure:2926:case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
ntopng-3.8.1+dfsg1/packages/debian/configure-2927-*datarootdir*) ac_datarootdir_seen=yes;;
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2942-
ntopng-3.8.1+dfsg1/packages/debian/configure:2943:# Neutralize VPATH when `$srcdir' = `.'.
ntopng-3.8.1+dfsg1/packages/debian/configure-2944-# Shell code in configure.ac might set extrasub.
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure-2968-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
ntopng-3.8.1+dfsg1/packages/debian/configure:2969:  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
ntopng-3.8.1+dfsg1/packages/debian/configure-2970-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure.in-38-  UBUNTU_RELEASE=`lsb_release -r|cut -f 2`
ntopng-3.8.1+dfsg1/packages/debian/configure.in:39:  UBUNTU_SUB_RELEASE=`echo $UBUNTU_RELEASE|cut -f 1 -d '.'`
ntopng-3.8.1+dfsg1/packages/debian/configure.in-40-
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure.in-52-  if [ test -d $HOME/PF_RING ]; then
ntopng-3.8.1+dfsg1/packages/debian/configure.in:53:    PFRING_VERS=`$HOME/PF_RING/package/version.sh --release`
ntopng-3.8.1+dfsg1/packages/debian/configure.in:54:    PFRING_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
ntopng-3.8.1+dfsg1/packages/debian/configure.in-55-    PFRING_DEP="pfring (=$PFRING_VERS-$PFRING_RELEASE)"
##############################################
ntopng-3.8.1+dfsg1/packages/debian/configure.in-120-
ntopng-3.8.1+dfsg1/packages/debian/configure.in:121:NTOPNG_VERS=`cat ../../configure.ac | head -2|grep 'C_INIT' | cut -d " " -f 2|cut -d ')' -f 1|cut -d ',' -f 2| tail -c +2 |sed 's/.\{1\}$//'`
ntopng-3.8.1+dfsg1/packages/debian/configure.in-122-GIT_RELEASE=`git rev-parse HEAD`
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-43-if test -z "$BASH_VERSION$ZSH_VERSION" \
ntopng-3.8.1+dfsg1/packages/freebsd/configure:44:    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/freebsd/configure-45-  as_echo='print -r --'
ntopng-3.8.1+dfsg1/packages/freebsd/configure-46-  as_echo_n='print -rn --'
ntopng-3.8.1+dfsg1/packages/freebsd/configure:47:elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/freebsd/configure-48-  as_echo='printf %s\n'
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-50-else
ntopng-3.8.1+dfsg1/packages/freebsd/configure:51:  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
ntopng-3.8.1+dfsg1/packages/freebsd/configure-52-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-60-	expr "X$arg" : "X\\(.*\\)$as_nl";
ntopng-3.8.1+dfsg1/packages/freebsd/configure:61:	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-62-      esac;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-197-  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
ntopng-3.8.1+dfsg1/packages/freebsd/configure:198:  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
ntopng-3.8.1+dfsg1/packages/freebsd/configure-199-  if (eval "$as_required") 2>/dev/null; then :
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-323-      case $as_dir in #(
ntopng-3.8.1+dfsg1/packages/freebsd/configure:324:      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
ntopng-3.8.1+dfsg1/packages/freebsd/configure-325-      *) as_qdir=$as_dir;;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-396-  {
ntopng-3.8.1+dfsg1/packages/freebsd/configure:397:    as_val=`expr "$@" || test $? -eq 1`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-398-  }
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-403-# ----------------------------------------
ntopng-3.8.1+dfsg1/packages/freebsd/configure:404:# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
ntopng-3.8.1+dfsg1/packages/freebsd/configure-405-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-466-  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
ntopng-3.8.1+dfsg1/packages/freebsd/configure:467:  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
ntopng-3.8.1+dfsg1/packages/freebsd/configure-468-  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-698-  case $ac_option in
ntopng-3.8.1+dfsg1/packages/freebsd/configure:699:  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-700-  *=)   ac_optarg= ;;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-742-  -disable-* | --disable-*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:743:    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-744-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-747-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/freebsd/configure:748:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-749-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-768-  -enable-* | --enable-*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:769:    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-770-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-773-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/freebsd/configure:774:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-775-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-972-  -with-* | --with-*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:973:    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-974-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-977-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/freebsd/configure:978:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-979-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-988-  -without-* | --without-*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:989:    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-990-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-993-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/freebsd/configure:994:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-995-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1026-  *=*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1027:    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1028-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1047-if test -n "$ac_prev"; then
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1048:  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1049-  as_fn_error $? "missing argument to $ac_option"
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1069-    */ )
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1070:      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1071-      eval $ac_var=\$ac_val;;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1104-ac_ls_di=`ls -di .` &&
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1105:ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1106-  as_fn_error $? "working directory cannot be determined"
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1160-case $srcdir in
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1161:*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1162-esac
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1203-By default, \`make install' will install all the files in
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1204:\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1205:an installation prefix other than \`$ac_default_prefix' using \`--prefix',
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1206-for instance \`--prefix=\$HOME'.
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1257-*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1258:  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1259-  # A ".." for each directory in $ac_dir_suffix.
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1260:  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1261-  case $ac_top_builddir_sub in
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1393-    *\'*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1394:      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1395-    esac
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1476-      case $ac_val in
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1477:      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1478-      esac
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1491-	case $ac_val in
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1492:	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1493-	esac
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1611-    set,)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1612:      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1613:$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1614-      ac_cache_corrupted=: ;;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1622-	# differences in whitespace do not lead to failure.
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1623:	ac_old_val_w=`echo x $ac_old_val`
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1624:	ac_new_val_w=`echo x $ac_new_val`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1625-	if test "$ac_old_val_w" != "$ac_new_val_w"; then
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1642-    case $ac_new_val in
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1643:    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1644-    *) ac_arg=$ac_var=$ac_new_val ;;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1678-
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1679:NTOPNG_VERS=`cat ../../configure.ac | head -2|grep 'C_INIT' | cut -d " " -f 2|cut -d ')' -f 1|cut -d ',' -f 2| tail -c +2 |sed 's/.\{1\}$//'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1680-GIT_RELEASE=`git rev-parse HEAD`
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1822-'
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1823:DEFS=`sed -n "$ac_script" confdefs.h`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1824-
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1831-  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1832:  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1833-  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1898-if test -z "$BASH_VERSION$ZSH_VERSION" \
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1899:    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1900-  as_echo='print -r --'
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1901-  as_echo_n='print -rn --'
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1902:elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1903-  as_echo='printf %s\n'
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1905-else
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1906:  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1907-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1915-	expr "X$arg" : "X\\(.*\\)$as_nl";
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1916:	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1917-      esac;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1992-# ----------------------------------------
ntopng-3.8.1+dfsg1/packages/freebsd/configure:1993:# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
ntopng-3.8.1+dfsg1/packages/freebsd/configure-1994-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2064-  {
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2065:    as_val=`expr "$@" || test $? -eq 1`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2066-  }
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2168-      case $as_dir in #(
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2169:      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2170-      *) as_qdir=$as_dir;;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2290-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2291:ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2292-ac_cs_version="\\
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2312-  --*=?*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2313:    ac_option=`expr "X$1" : 'X\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2314:    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2315-    ac_shift=:
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2317-  --*=)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2318:    ac_option=`expr "X$1" : 'X\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2319-    ac_optarg=
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2341-    case $ac_optarg in
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2342:    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2343-    '') as_fn_error $? "missing file argument" ;;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2458-fi
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2459:ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2460-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2475-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2476:ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2477-ac_delim='%!_!# '
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2481-
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2482:  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2483-  if test $ac_delim_n = $ac_delim_num; then
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2643-      esac
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2644:      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2645-      as_fn_append ac_file_inputs " '$ac_f'"
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2702-*)
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2703:  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2704-  # A ".." for each directory in $ac_dir_suffix.
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2705:  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2706-  case $ac_top_builddir_sub in
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2754-/@mandir@/p'
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2755:case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2756-*datarootdir*) ac_datarootdir_seen=yes;;
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2771-
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2772:# Neutralize VPATH when `$srcdir' = `.'.
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2773-# Shell code in configure.ac might set extrasub.
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2797-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
ntopng-3.8.1+dfsg1/packages/freebsd/configure:2798:  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
ntopng-3.8.1+dfsg1/packages/freebsd/configure-2799-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
##############################################
ntopng-3.8.1+dfsg1/packages/freebsd/configure.in-10-
ntopng-3.8.1+dfsg1/packages/freebsd/configure.in:11:NTOPNG_VERS=`cat ../../configure.ac | head -2|grep 'C_INIT' | cut -d " " -f 2|cut -d ')' -f 1|cut -d ',' -f 2| tail -c +2 |sed 's/.\{1\}$//'`
ntopng-3.8.1+dfsg1/packages/freebsd/configure.in-12-GIT_RELEASE=`git rev-parse HEAD`
##############################################
ntopng-3.8.1+dfsg1/packages/ntopng.spec.in-119-
ntopng-3.8.1+dfsg1/packages/ntopng.spec.in:120:# Execution order:
ntopng-3.8.1+dfsg1/packages/ntopng.spec.in-121-# install:    pre -> (copy) -> post
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-43-if test -z "$BASH_VERSION$ZSH_VERSION" \
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:44:    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-45-  as_echo='print -r --'
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-46-  as_echo_n='print -rn --'
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:47:elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-48-  as_echo='printf %s\n'
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-50-else
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:51:  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-52-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-60-	expr "X$arg" : "X\\(.*\\)$as_nl";
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:61:	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-62-      esac;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-197-  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:198:  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-199-  if (eval "$as_required") 2>/dev/null; then :
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-323-      case $as_dir in #(
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:324:      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-325-      *) as_qdir=$as_dir;;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-396-  {
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:397:    as_val=`expr "$@" || test $? -eq 1`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-398-  }
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-403-# ----------------------------------------
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:404:# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-405-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-466-  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:467:  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-468-  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-711-  case $ac_option in
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:712:  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-713-  *=)   ac_optarg= ;;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-755-  -disable-* | --disable-*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:756:    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-757-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-760-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:761:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-762-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-781-  -enable-* | --enable-*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:782:    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-783-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-786-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:787:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-788-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-994-  -with-* | --with-*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:995:    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-996-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-999-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1000:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1001-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1010-  -without-* | --without-*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1011:    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1012-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1015-    ac_useropt_orig=$ac_useropt
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1016:    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1017-    case $ac_user_opts in
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1048-  *=*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1049:    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1050-    # Reject names that are not valid shell variable names.
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1069-if test -n "$ac_prev"; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1070:  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1071-  as_fn_error $? "missing argument to $ac_option"
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1091-    */ )
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1092:      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1093-      eval $ac_var=\$ac_val;;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1126-ac_ls_di=`ls -di .` &&
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1127:ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1128-  as_fn_error $? "working directory cannot be determined"
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1182-case $srcdir in
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1183:*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1184-esac
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1225-By default, \`make install' will install all the files in
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1226:\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1227:an installation prefix other than \`$ac_default_prefix' using \`--prefix',
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1228-for instance \`--prefix=\$HOME'.
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1285-*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1286:  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1287-  # A ".." for each directory in $ac_dir_suffix.
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1288:  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1289-  case $ac_top_builddir_sub in
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1421-    *\'*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1422:      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1423-    esac
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1504-      case $ac_val in
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1505:      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1506-      esac
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1519-	case $ac_val in
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1520:	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1521-	esac
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1639-    set,)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1640:      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1641:$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1642-      ac_cache_corrupted=: ;;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1650-	# differences in whitespace do not lead to failure.
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1651:	ac_old_val_w=`echo x $ac_old_val`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1652:	ac_new_val_w=`echo x $ac_new_val`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1653-	if test "$ac_old_val_w" != "$ac_new_val_w"; then
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1670-    case $ac_new_val in
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1671:    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1672-    *) ac_arg=$ac_var=$ac_new_val ;;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1739-  UBUNTU_RELEASE=`lsb_release -r|cut -f 2`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1740:  UBUNTU_SUB_RELEASE=`echo $UBUNTU_RELEASE|cut -f 1 -d '.'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1741-
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1753-  if  test -d $HOME/PF_RING ; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1754:    PFRING_VERS=`$HOME/PF_RING/package/version.sh --release`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1755:    PFRING_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1756-    PFRING_DEP="pfring (=$PFRING_VERS-$PFRING_RELEASE)"
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1821-
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1822:NTOPNG_VERS=`cat ../../configure.ac | head -2|grep 'C_INIT' | cut -d " " -f 2|cut -d ')' -f 1|cut -d ',' -f 2| tail -c +2 |sed 's/.\{1\}$//'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1823-GIT_RELEASE=`git rev-parse HEAD`
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1987-'
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1988:DEFS=`sed -n "$ac_script" confdefs.h`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1989-
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1996-  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:1997:  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-1998-  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2063-if test -z "$BASH_VERSION$ZSH_VERSION" \
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2064:    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2065-  as_echo='print -r --'
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2066-  as_echo_n='print -rn --'
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2067:elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2068-  as_echo='printf %s\n'
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2070-else
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2071:  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2072-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2080-	expr "X$arg" : "X\\(.*\\)$as_nl";
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2081:	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2082-      esac;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2157-# ----------------------------------------
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2158:# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2159-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2229-  {
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2230:    as_val=`expr "$@" || test $? -eq 1`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2231-  }
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2333-      case $as_dir in #(
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2334:      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2335-      *) as_qdir=$as_dir;;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2455-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2456:ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2457-ac_cs_version="\\
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2477-  --*=?*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2478:    ac_option=`expr "X$1" : 'X\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2479:    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2480-    ac_shift=:
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2482-  --*=)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2483:    ac_option=`expr "X$1" : 'X\([^=]*\)='`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2484-    ac_optarg=
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2506-    case $ac_optarg in
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2507:    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2508-    '') as_fn_error $? "missing file argument" ;;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2629-fi
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2630:ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2631-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2646-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2647:ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2648-ac_delim='%!_!# '
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2652-
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2653:  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2654-  if test $ac_delim_n = $ac_delim_num; then
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2814-      esac
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2815:      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2816-      as_fn_append ac_file_inputs " '$ac_f'"
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2873-*)
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2874:  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2875-  # A ".." for each directory in $ac_dir_suffix.
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2876:  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2877-  case $ac_top_builddir_sub in
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2925-/@mandir@/p'
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2926:case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2927-*datarootdir*) ac_datarootdir_seen=yes;;
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2942-
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2943:# Neutralize VPATH when `$srcdir' = `.'.
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2944-# Shell code in configure.ac might set extrasub.
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2968-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
ntopng-3.8.1+dfsg1/packages/ubuntu/configure:2969:  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
ntopng-3.8.1+dfsg1/packages/ubuntu/configure-2970-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in-38-  UBUNTU_RELEASE=`lsb_release -r|cut -f 2`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in:39:  UBUNTU_SUB_RELEASE=`echo $UBUNTU_RELEASE|cut -f 1 -d '.'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in-40-
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in-52-  if [ test -d $HOME/PF_RING ]; then
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in:53:    PFRING_VERS=`$HOME/PF_RING/package/version.sh --release`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in:54:    PFRING_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in-55-    PFRING_DEP="pfring (=$PFRING_VERS-$PFRING_RELEASE)"
##############################################
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in-120-
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in:121:NTOPNG_VERS=`cat ../../configure.ac | head -2|grep 'C_INIT' | cut -d " " -f 2|cut -d ')' -f 1|cut -d ',' -f 2| tail -c +2 |sed 's/.\{1\}$//'`
ntopng-3.8.1+dfsg1/packages/ubuntu/configure.in-122-GIT_RELEASE=`git rev-parse HEAD`
##############################################
ntopng-3.8.1+dfsg1/scripts/lua/inc/traffic_recording_config.lua-48-    if recording_utils.isSupportedZMQInterface(ifid) then 
ntopng-3.8.1+dfsg1/scripts/lua/inc/traffic_recording_config.lua:49:      config.zmq_endpoint = recording_utils.getZMQProbeAddr(ifid)
ntopng-3.8.1+dfsg1/scripts/lua/inc/traffic_recording_config.lua-50-      recording_utils.stop(ifstats.id) -- stop before starting as the interface can be changed
##############################################
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua-181-
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua:182:  the_td.html('<a href="]]print(ntop.getHttpPrefix())print[[/lua/pro/db_explorer.lua?' + decodeURIComponent($.param(url_params)) + '"><i>' + the_td.text() + '</i></a>');
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua-183-}
##############################################
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua-357-    $('#download_flows_v4_]] print(button_id) print[[').click(function (event){
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua:358:      window.location.assign("]] print(flows_download_url) print [[?version=4&format=txt&" + $.param(buildRequestData(']] print(pcap_request_data_container_div_id) print[[')));
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua-359-      return false;
##############################################
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua-366-    $('#download_flows_v6_]] print(button_id) print[[').click(function (event){
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua:367:      window.location.assign("]] print(flows_download_url) print [[?version=6&format=txt&" + $.param(buildRequestData(']] print(pcap_request_data_container_div_id) print[[')));
ntopng-3.8.1+dfsg1/scripts/lua/modules/historical_utils.lua-368-      return false;
##############################################
ntopng-3.8.1+dfsg1/scripts/lua/modules/recording_utils.lua-56---! @return the endpoint
ntopng-3.8.1+dfsg1/scripts/lua/modules/recording_utils.lua:57:function recording_utils.getZMQProbeAddr(ifid)
ntopng-3.8.1+dfsg1/scripts/lua/modules/recording_utils.lua-58-  local port = getZMQPort(getInterfaceName(ifid))
##############################################
ntopng-3.8.1+dfsg1/src/AddressResolution.cpp-116-      if(sscanf(numeric_ip, "%u.%u.%u.%u", &ip4_0, &ip4_1, &ip4_2, &ip4_3) == 4) {
ntopng-3.8.1+dfsg1/src/AddressResolution.cpp:117:	in4.sin_family = AF_INET, in4.sin_addr.s_addr = inet_addr(numeric_ip);
ntopng-3.8.1+dfsg1/src/AddressResolution.cpp-118-	len = sizeof(struct sockaddr_in), sa = (struct sockaddr*)&in4;
##############################################
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-55-
ntopng-3.8.1+dfsg1/src/Geolocation.cpp:56:    if(test.get_sockaddr(&sa, &sa_len)) {
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-57-      ntop->getTrace()->traceEvent(TRACE_NORMAL, "Autonomous System Information", ip);
##############################################
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-59-      /* TEST Autonomous Systems database */
ntopng-3.8.1+dfsg1/src/Geolocation.cpp:60:      result = MMDB_lookup_sockaddr(&geo_ip_asn_mmdb, sa, &mmdb_error);
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-61-
##############################################
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-99-
ntopng-3.8.1+dfsg1/src/Geolocation.cpp:100:      result = MMDB_lookup_sockaddr(&geo_ip_city_mmdb, sa, &mmdb_error);
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-101-
##############################################
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-197-
ntopng-3.8.1+dfsg1/src/Geolocation.cpp:198:  if(addr && addr->get_sockaddr(&sa, &sa_len)) {
ntopng-3.8.1+dfsg1/src/Geolocation.cpp:199:    result = MMDB_lookup_sockaddr(&geo_ip_asn_mmdb, sa, &mmdb_error);
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-200-
##############################################
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-247-
ntopng-3.8.1+dfsg1/src/Geolocation.cpp:248:  if(addr && addr->get_sockaddr(&sa, &sa_len)) {
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-249-    int mmdb_error, status;
##############################################
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-252-      
ntopng-3.8.1+dfsg1/src/Geolocation.cpp:253:    result = MMDB_lookup_sockaddr(&geo_ip_city_mmdb, sa, &mmdb_error);
ntopng-3.8.1+dfsg1/src/Geolocation.cpp-254-
##############################################
ntopng-3.8.1+dfsg1/src/IpAddress.cpp-35-  if(strchr(sym_addr, '.')) {
ntopng-3.8.1+dfsg1/src/IpAddress.cpp:36:    addr.ipVersion = 4, addr.localHost = 0, addr.ipType.ipv4 = inet_addr(sym_addr);
ntopng-3.8.1+dfsg1/src/IpAddress.cpp-37-  } else {
##############################################
ntopng-3.8.1+dfsg1/src/IpAddress.cpp-238-
ntopng-3.8.1+dfsg1/src/IpAddress.cpp:239:bool IpAddress::get_sockaddr(struct sockaddr ** const sa, ssize_t * const sa_len) const {
ntopng-3.8.1+dfsg1/src/IpAddress.cpp-240-  if(!sa || !sa_len)
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-1324-#ifdef HAVE_NEDGE
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:1325:static int ntop_set_bind_addr(lua_State* vm, bool http) {
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-1326-  char *addr, *addr2 = (char *) CONST_LOOPBACK_ADDRESS;
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-1347-
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:1348:static int ntop_set_http_bind_addr(lua_State* vm) {
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:1349:  return ntop_set_bind_addr(vm, true /* http */);
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-1350-}
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-1351-
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:1352:static int ntop_set_https_bind_addr(lua_State* vm) {
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:1353:  return ntop_set_bind_addr(vm, false /* https */);
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-1354-}
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-1923-  serv_addr.sin_port = htons(server_port);
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:1924:  serv_addr.sin_addr.s_addr = inet_addr(server_ip);
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-1925-
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2382-    server_addr.sin_family = AF_INET;
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:2383:    server_addr.sin_addr.s_addr = inet_addr(host); /* FIX: add IPv6 support */
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2384-    server_addr.sin_port = htons(port);
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2747-  else {
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:2748:    in_addr_t addr = inet_addr(device_ip);
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2749-
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2837-
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:2838:  lua_pushstring(vm, ntop_interface->mdnsResolveIPv4(inet_addr(numIP),
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2839-						     symIP, sizeof(symIP),
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2938-
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:2939:  ntop_interface->mdnsQueueResolveIPv4(inet_addr(numIP), true);
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2940-  lua_pushnil(vm);
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2990-  else {
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:2991:    in_addr_t addr = inet_addr(device_ip);
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-2992-
##############################################
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-3869-  if(ntop_interface && (ntop_interface->getIfType() == interface_type_NETFILTER))
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp:3870:    ((NetfilterInterface *)ntop_interface)->setLanIPAddress(inet_addr(ip));
ntopng-3.8.1+dfsg1/src/LuaEngine.cpp-3871-
##############################################
ntopng-3.8.1+dfsg1/src/MDNS.cpp-154-  
ntopng-3.8.1+dfsg1/src/MDNS.cpp:155:  dest.sin_family = AF_INET, dest.sin_port = htons(5353), dest.sin_addr.s_addr = inet_addr(targetIPv4);
ntopng-3.8.1+dfsg1/src/MDNS.cpp-156-  if(sendto(batch_udp_sock, mdnsbuf, len, 0, (struct sockaddr *)&dest, sizeof(struct sockaddr_in)) < 0) {
##############################################
ntopng-3.8.1+dfsg1/src/NetworkDiscovery.cpp-407-  iph->saddr = sender_ip;
ntopng-3.8.1+dfsg1/src/NetworkDiscovery.cpp:408:  iph->daddr = inet_addr("224.0.0.251");
ntopng-3.8.1+dfsg1/src/NetworkDiscovery.cpp-409-
##############################################
ntopng-3.8.1+dfsg1/src/NetworkDiscovery.cpp-539-  /* SSDP */
ntopng-3.8.1+dfsg1/src/NetworkDiscovery.cpp:540:  sin.sin_addr.s_addr = inet_addr("239.255.255.250"), sin.sin_family = AF_INET, sin.sin_port = ssdp_port;
ntopng-3.8.1+dfsg1/src/NetworkDiscovery.cpp-541-
##############################################
ntopng-3.8.1+dfsg1/src/Paginator.cpp-101-	} else if(!strcmp(key, "deviceIpFilter")) {
ntopng-3.8.1+dfsg1/src/Paginator.cpp:102:	  deviceIP = ntohl(inet_addr(lua_tostring(L, -1)));
ntopng-3.8.1+dfsg1/src/Paginator.cpp-103-	} else if(!strcmp(key, "countryFilter")) {
##############################################
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp-818-	/* Do not override EXPORTER_IPV4_ADDRESS */
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp:819:	if(flow.core.deviceIP == 0 && (flow.core.deviceIP = ntohl(inet_addr(value)))) 
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp-820-	  add_to_additional_fields = true;
##############################################
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp-824-	/* Format: a.b.c.d, possibly overrides NPROBE_IPV4_ADDRESS */
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp:825:	if((flow.core.deviceIP = ntohl(inet_addr(value))))
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp-826-	  add_to_additional_fields = true;
##############################################
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp-1088-      if((key != NULL) && (value != NULL)) {
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp:1089:	if(!strcmp(key, "deviceIP")) stats.deviceIP = ntohl(inet_addr(value));
ntopng-3.8.1+dfsg1/src/ParserInterface.cpp-1090-	else if(!strcmp(key, "ifIndex")) stats.ifIndex = atol(value);
##############################################
ntopng-3.8.1+dfsg1/src/Prefs.cpp-616-  if(aux) {
ntopng-3.8.1+dfsg1/src/Prefs.cpp:617:    safe_search_dns_ip = Utils::inet_addr(aux);
ntopng-3.8.1+dfsg1/src/Prefs.cpp-618-    free(aux);
##############################################
ntopng-3.8.1+dfsg1/src/Prefs.cpp-622-  if(aux) {
ntopng-3.8.1+dfsg1/src/Prefs.cpp:623:    global_primary_dns_ip = Utils::inet_addr(aux);
ntopng-3.8.1+dfsg1/src/Prefs.cpp-624-    free(aux);
##############################################
ntopng-3.8.1+dfsg1/src/Prefs.cpp-628-  if(aux) {
ntopng-3.8.1+dfsg1/src/Prefs.cpp:629:    global_secondary_dns_ip = Utils::inet_addr(aux);
ntopng-3.8.1+dfsg1/src/Prefs.cpp-630-    free(aux);
##############################################
ntopng-3.8.1+dfsg1/src/Utils.cpp-1909-
ntopng-3.8.1+dfsg1/src/Utils.cpp:1910:  asm volatile("rdtsc" : "=a" (a), "=d" (d));
ntopng-3.8.1+dfsg1/src/Utils.cpp-1911-  return (((ticks)a) | (((ticks)d) << 32));
##############################################
ntopng-3.8.1+dfsg1/src/Utils.cpp-1913-  /*
ntopng-3.8.1+dfsg1/src/Utils.cpp:1914:    __asm __volatile("rdtsc" : "=A" (x));
ntopng-3.8.1+dfsg1/src/Utils.cpp-1915-    return (x);
##############################################
ntopng-3.8.1+dfsg1/src/Utils.cpp-2102-
ntopng-3.8.1+dfsg1/src/Utils.cpp:2103:	ptr = (unsigned char *)LLADDR((struct sockaddr_dl *)ifaptr->ifa_addr);
ntopng-3.8.1+dfsg1/src/Utils.cpp-2104-	memcpy(mac_addr, ptr, 6);
##############################################
ntopng-3.8.1+dfsg1/src/Utils.cpp-2327-
ntopng-3.8.1+dfsg1/src/Utils.cpp:2328:in_addr_t Utils::inet_addr(const char *cp) {
ntopng-3.8.1+dfsg1/src/Utils.cpp-2329-  if((cp == NULL) || (cp[0] == '\0'))
##############################################
ntopng-3.8.1+dfsg1/src/Utils.cpp-2331-  else
ntopng-3.8.1+dfsg1/src/Utils.cpp:2332:    return(::inet_addr(cp));
ntopng-3.8.1+dfsg1/src/Utils.cpp-2333-}
##############################################
ntopng-3.8.1+dfsg1/src/Utils.cpp-2835-  serv.sin_family = AF_INET;
ntopng-3.8.1+dfsg1/src/Utils.cpp:2836:  serv.sin_addr.s_addr = inet_addr(kGoogleDnsIp);
ntopng-3.8.1+dfsg1/src/Utils.cpp-2837-  serv.sin_port = htons(kDnsPort);
##############################################
ntopng-3.8.1+dfsg1/src/Utils.cpp-2842-  } else
ntopng-3.8.1+dfsg1/src/Utils.cpp:2843:    me = inet_addr("127.0.0.1");
ntopng-3.8.1+dfsg1/src/Utils.cpp-2844-
##############################################
ntopng-3.8.1+dfsg1/src/Utils.cpp-3139-    if(fgets(line, sizeof(line), fp) != NULL)
ntopng-3.8.1+dfsg1/src/Utils.cpp:3140:      rc = inet_addr(line);
ntopng-3.8.1+dfsg1/src/Utils.cpp-3141-
##############################################
ntopng-3.8.1+dfsg1/third-party/lua-resty-template-master/README.md-266-
ntopng-3.8.1+dfsg1/third-party/lua-resty-template-master/README.md:267:* `template_root` (`set $template_root /var/www/site/templates`)
ntopng-3.8.1+dfsg1/third-party/lua-resty-template-master/README.md:268:* `template_location` (`set $template_location /templates`)
ntopng-3.8.1+dfsg1/third-party/lua-resty-template-master/README.md-269-
##############################################
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c-108-  if(af == AF_INET) {
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c:109:    result = inet_addr(src);
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c-110-    if(result == -1)
##############################################
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c-120-    struct in6_addr Address;
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c:121:    return (inet6_addr(src, &Address));
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c-122-  }
##############################################
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c-367-#if defined(NT) && !defined(HAVE_INET_NTOP)
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c:368:    inet6_addr(string, &sin6);
ntopng-3.8.1+dfsg1/third-party/patricia/patricia.c-369-    return (New_Prefix (AF_INET6, &sin6, bitlen));
##############################################
ntopng-3.8.1+dfsg1/tools/find_globals.sh-26-function check_ver {
ntopng-3.8.1+dfsg1/tools/find_globals.sh:27:  luac_cmd="`which $1`"
ntopng-3.8.1+dfsg1/tools/find_globals.sh-28-
ntopng-3.8.1+dfsg1/tools/find_globals.sh-29-  if [[ $? -eq 0 ]]; then
ntopng-3.8.1+dfsg1/tools/find_globals.sh:30:    luac_ver="`$luac_cmd -v 2>&1 | cut -f2 -d' '`"
ntopng-3.8.1+dfsg1/tools/find_globals.sh-31-
##############################################
ntopng-3.8.1+dfsg1/tools/find_globals.sh-69-    # a little formatting here
ntopng-3.8.1+dfsg1/tools/find_globals.sh:70:    lineno=`echo $line | cut -f1 -d" "`
ntopng-3.8.1+dfsg1/tools/find_globals.sh:71:    field=`echo $line | cut -f2 -d" "`
ntopng-3.8.1+dfsg1/tools/find_globals.sh-72-    sym="${line##* }"
##############################################
ntopng-3.8.1+dfsg1/tools/localization/localize.sh-3-function usage {
ntopng-3.8.1+dfsg1/tools/localization/localize.sh:4:  echo -e "Usage: `basename $0` action parameters"
ntopng-3.8.1+dfsg1/tools/localization/localize.sh-5-  echo
##############################################
ntopng-3.8.1+dfsg1/tools/localization/localize.sh-67-  lua "$base_path/sort_localization_file.lua" "$lang"
ntopng-3.8.1+dfsg1/tools/localization/localize.sh:68:  missing_lines=`"$base_path/missing_localization.py" missing "$root_path/scripts/locales/en.lua" "$lang_path"`
ntopng-3.8.1+dfsg1/tools/localization/localize.sh-69-  if [[ ! -z $missing_lines ]]; then
##############################################
ntopng-3.8.1+dfsg1/tools/netfilter_local.sh-11-if [[ $# -ne 1 ]]; then
ntopng-3.8.1+dfsg1/tools/netfilter_local.sh:12:  echo "Usage: `basename $0` local_interface" >&2
ntopng-3.8.1+dfsg1/tools/netfilter_local.sh-13-  exit 1
##############################################
ntopng-3.8.1+dfsg1/debian/patches/use-system-ndpi.patch-12--PKG_CHECK_MODULES([NDPI], [libndpi >= 2.0], [
ntopng-3.8.1+dfsg1/debian/patches/use-system-ndpi.patch:13:-   NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"`/libndpi
ntopng-3.8.1+dfsg1/debian/patches/use-system-ndpi.patch-14--   # Use static libndpi library as building against the dynamic library fails
##############################################
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-131-PKG_CHECK_MODULES([NDPI], [libndpi >= 2.0], [
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:132:   NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"`/libndpi
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-133-   # Use static libndpi library as building against the dynamic library fails
##############################################
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-306-     if test -f "${PF_RING_HOME}/userland/libpcap/libpcap.a"; then
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:307:       LDFLAGS="${LDFLAGS} ${PF_RING_HOME}/userland/lib/libpfring.a -L${PF_RING_HOME}/userland/libpcap/ `${PF_RING_HOME}/userland/lib/pfring_config --libs`"
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-308-       CPPFLAGS="${CPPFLAGS} -I${PF_RING_HOME}/kernel -I${PF_RING_HOME}/userland/lib -I${PF_RING_HOME}/userland/libpcap"
##############################################
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-356- if test -d $HOME/PF_RING; then
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:357:  PFRING_GIT_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-358- fi
##############################################
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-361- if test -f "$HOME/PF_RING/kernel/linux/pf_ring.h"; then
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:362:  PFRING_VERSION=`$HOME/PF_RING/package/version.sh --release`
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-363- fi
##############################################
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-382-then
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:383:   UGLIFYJS_VERSION=`$UGLIFYJS --version | cut -f 2 -d" "`
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-384-   UGLIFYJS_MAJOR_VERSION="${UGLIFYJS_VERSION%%.*}"
##############################################
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-482-if test -n "$MYSQLTOOL"; then
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:483:   MYSQLLIBS="`$MYSQLTOOL --libs_r`"
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-484-   if test ".$MYSQLLIBS" != "."; then
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:485:      MYSQL_LIB="`$MYSQLTOOL --libs`"
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-486-   else
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:487:      MYSQL_LIB="`$MYSQLTOOL --libs_r`"
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-488-   fi
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-489-
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed:490:   MYSQL_INC="`$MYSQLTOOL --include`"
ntopng-3.8.1+dfsg1/.pc/no-librt.patch/configure.seed-491-   AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql])
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-131-PKG_CHECK_MODULES([NDPI], [libndpi >= 2.0], [
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:132:   NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"`/libndpi
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-133-   # Use static libndpi library as building against the dynamic library fails
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-306-     if test -f "${PF_RING_HOME}/userland/libpcap/libpcap.a"; then
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:307:       LDFLAGS="${LDFLAGS} ${PF_RING_HOME}/userland/lib/libpfring.a -L${PF_RING_HOME}/userland/libpcap/ `${PF_RING_HOME}/userland/lib/pfring_config --libs`"
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-308-       CPPFLAGS="${CPPFLAGS} -I${PF_RING_HOME}/kernel -I${PF_RING_HOME}/userland/lib -I${PF_RING_HOME}/userland/libpcap"
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-356- if test -d $HOME/PF_RING; then
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:357:  PFRING_GIT_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-358- fi
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-361- if test -f "$HOME/PF_RING/kernel/linux/pf_ring.h"; then
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:362:  PFRING_VERSION=`$HOME/PF_RING/package/version.sh --release`
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-363- fi
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-382-then
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:383:   UGLIFYJS_VERSION=`$UGLIFYJS --version | cut -f 2 -d" "`
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-384-   UGLIFYJS_MAJOR_VERSION="${UGLIFYJS_VERSION%%.*}"
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-481-if test -n "$MYSQLTOOL"; then
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:482:   MYSQLLIBS="`$MYSQLTOOL --libs_r`"
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-483-   if test ".$MYSQLLIBS" != "."; then
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:484:      MYSQL_LIB="`$MYSQLTOOL --libs`"
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-485-   else
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:486:      MYSQL_LIB="`$MYSQLTOOL --libs_r`"
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-487-   fi
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-488-
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed:489:   MYSQL_INC="`$MYSQLTOOL --include`"
ntopng-3.8.1+dfsg1/.pc/use-system-ndpi.patch/configure.seed-490-   AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql])
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-259-     if test -f "${PF_RING_HOME}/userland/libpcap/libpcap.a"; then
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed:260:       LDFLAGS="${LDFLAGS} ${PF_RING_HOME}/userland/lib/libpfring.a -L${PF_RING_HOME}/userland/libpcap/ `${PF_RING_HOME}/userland/lib/pfring_config --libs`"
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-261-       CPPFLAGS="${CPPFLAGS} -I${PF_RING_HOME}/kernel -I${PF_RING_HOME}/userland/lib -I${PF_RING_HOME}/userland/libpcap"
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-309- if test -d $HOME/PF_RING; then
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed:310:  PFRING_GIT_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-311- fi
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-314- if test -f "$HOME/PF_RING/kernel/linux/pf_ring.h"; then
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed:315:  PFRING_VERSION=`$HOME/PF_RING/package/version.sh --release`
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-316- fi
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-335-then
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed:336:   UGLIFYJS_VERSION=`$UGLIFYJS --version | cut -f 2 -d" "`
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-337-   UGLIFYJS_MAJOR_VERSION="${UGLIFYJS_VERSION%%.*}"
##############################################
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-434-if test -n "$MYSQLTOOL"; then
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed:435:   MYSQLLIBS="`$MYSQLTOOL --libs_r`"
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-436-   if test ".$MYSQLLIBS" != "."; then
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed:437:      MYSQL_LIB="`$MYSQLTOOL --libs`"
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-438-   else
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed:439:      MYSQL_LIB="`$MYSQLTOOL --libs_r`"
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-440-   fi
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-441-
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed:442:   MYSQL_INC="`$MYSQLTOOL --include`"
ntopng-3.8.1+dfsg1/.pc/use-system-lua.patch/configure.seed-443-   AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql])
##############################################
ntopng-3.8.1+dfsg1/configure.seed-259-     if test -f "${PF_RING_HOME}/userland/libpcap/libpcap.a"; then
ntopng-3.8.1+dfsg1/configure.seed:260:       LDFLAGS="${LDFLAGS} ${PF_RING_HOME}/userland/lib/libpfring.a -L${PF_RING_HOME}/userland/libpcap/ `${PF_RING_HOME}/userland/lib/pfring_config --libs`"
ntopng-3.8.1+dfsg1/configure.seed-261-       CPPFLAGS="${CPPFLAGS} -I${PF_RING_HOME}/kernel -I${PF_RING_HOME}/userland/lib -I${PF_RING_HOME}/userland/libpcap"
##############################################
ntopng-3.8.1+dfsg1/configure.seed-309- if test -d $HOME/PF_RING; then
ntopng-3.8.1+dfsg1/configure.seed:310:  PFRING_GIT_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
ntopng-3.8.1+dfsg1/configure.seed-311- fi
##############################################
ntopng-3.8.1+dfsg1/configure.seed-314- if test -f "$HOME/PF_RING/kernel/linux/pf_ring.h"; then
ntopng-3.8.1+dfsg1/configure.seed:315:  PFRING_VERSION=`$HOME/PF_RING/package/version.sh --release`
ntopng-3.8.1+dfsg1/configure.seed-316- fi
##############################################
ntopng-3.8.1+dfsg1/configure.seed-335-then
ntopng-3.8.1+dfsg1/configure.seed:336:   UGLIFYJS_VERSION=`$UGLIFYJS --version | cut -f 2 -d" "`
ntopng-3.8.1+dfsg1/configure.seed-337-   UGLIFYJS_MAJOR_VERSION="${UGLIFYJS_VERSION%%.*}"
##############################################
ntopng-3.8.1+dfsg1/configure.seed-434-if test -n "$MYSQLTOOL"; then
ntopng-3.8.1+dfsg1/configure.seed:435:   MYSQLLIBS="`$MYSQLTOOL --libs_r`"
ntopng-3.8.1+dfsg1/configure.seed-436-   if test ".$MYSQLLIBS" != "."; then
ntopng-3.8.1+dfsg1/configure.seed:437:      MYSQL_LIB="`$MYSQLTOOL --libs`"
ntopng-3.8.1+dfsg1/configure.seed-438-   else
ntopng-3.8.1+dfsg1/configure.seed:439:      MYSQL_LIB="`$MYSQLTOOL --libs_r`"
ntopng-3.8.1+dfsg1/configure.seed-440-   fi
ntopng-3.8.1+dfsg1/configure.seed-441-
ntopng-3.8.1+dfsg1/configure.seed:442:   MYSQL_INC="`$MYSQLTOOL --include`"
ntopng-3.8.1+dfsg1/configure.seed-443-   AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql])