
(function(window,undefined){var
readyList,rootjQuery,core_strundefined=typeof undefined,document=window.document,location=window.location,_jQuery=window.jQuery,_$=window.$,class2type={},core_deletedIds=[],core_version="1.9.1",core_concat=core_deletedIds.concat,core_push=core_deletedIds.push,core_slice=core_deletedIds.slice,core_indexOf=core_deletedIds.indexOf,core_toString=class2type.toString,core_hasOwn=class2type.hasOwnProperty,core_trim=core_version.trim,jQuery=function(selector,context){return new jQuery.fn.init(selector,context,rootjQuery);},core_pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,core_rnotwhite=/\S+/g,rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rquickExpr=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,rvalidchars=/^[\],:{}\s]*$/,rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g,rvalidescape=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,rvalidtokens=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,fcamelCase=function(all,letter){return letter.toUpperCase();},completed=function(event){if(document.addEventListener||event.type==="load"||document.readyState==="complete"){detach();jQuery.ready();}},detach=function(){if(document.addEventListener){document.removeEventListener("DOMContentLoaded",completed,false);window.removeEventListener("load",completed,false);}else{document.detachEvent("onreadystatechange",completed);window.detachEvent("onload",completed);}};jQuery.fn=jQuery.prototype={jquery:core_version,constructor:jQuery,init:function(selector,context,rootjQuery){var match,elem;if(!selector){return this;}
if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(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&&elem.parentNode){if(elem.id!==match[2]){return rootjQuery.find(selector);}
this.length=1;this[0]=elem;}
this.context=document;this.selector=selector;return this;}}else if(!context||context.jquery){return(context||rootjQuery).find(selector);}else{return this.constructor(context).find(selector);}}else if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this;}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector);}
if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context;}
return jQuery.makeArray(selector,this);},selector:"",length:0,size:function(){return this.length;},toArray:function(){return core_slice.call(this);},get:function(num){return num==null?this.toArray():(num<0?this[this.length+num]:this[num]);},pushStack:function(elems){var ret=jQuery.merge(this.constructor(),elems);ret.prevObject=this;ret.context=this.context;return ret;},each:function(callback,args){return jQuery.each(this,callback,args);},ready:function(fn){jQuery.ready.promise().done(fn);return this;},slice:function(){return this.pushStack(core_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]]:[]);},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},end:function(){return this.prevObject||this.constructor(null);},push:core_push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var src,copyIsArray,copy,name,options,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!jQuery.isFunction(target)){target={};}
if(length===i){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=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.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({noConflict:function(deep){if(window.$===jQuery){window.$=_$;}
if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery;}
return jQuery;},isReady:false,readyWait:1,holdReady:function(hold){if(hold){jQuery.readyWait++;}else{jQuery.ready(true);}},ready:function(wait){if(wait===true?--jQuery.readyWait:jQuery.isReady){return;}
if(!document.body){return setTimeout(jQuery.ready);}
jQuery.isReady=true;if(wait!==true&&--jQuery.readyWait>0){return;}
readyList.resolveWith(document,[jQuery]);if(jQuery.fn.trigger){jQuery(document).trigger("ready").off("ready");}},isFunction:function(obj){return jQuery.type(obj)==="function";},isArray:Array.isArray||function(obj){return jQuery.type(obj)==="array";},isWindow:function(obj){return obj!=null&&obj==obj.window;},isNumeric:function(obj){return!isNaN(parseFloat(obj))&&isFinite(obj);},type:function(obj){if(obj==null){return String(obj);}
return typeof obj==="object"||typeof obj==="function"?class2type[core_toString.call(obj)]||"object":typeof obj;},isPlainObject:function(obj){if(!obj||jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false;}
try{if(obj.constructor&&!core_hasOwn.call(obj,"constructor")&&!core_hasOwn.call(obj.constructor.prototype,"isPrototypeOf")){return false;}}catch(e){return false;}
var key;for(key in obj){}
return key===undefined||core_hasOwn.call(obj,key);},isEmptyObject:function(obj){var name;for(name in obj){return false;}
return true;},error:function(msg){throw new Error(msg);},parseHTML:function(data,context,keepScripts){if(!data||typeof data!=="string"){return null;}
if(typeof context==="boolean"){keepScripts=context;context=false;}
context=context||document;var parsed=rsingleTag.exec(data),scripts=!keepScripts&&[];if(parsed){return[context.createElement(parsed[1])];}
parsed=jQuery.buildFragment([data],context,scripts);if(scripts){jQuery(scripts).remove();}
return jQuery.merge([],parsed.childNodes);},parseJSON:function(data){if(window.JSON&&window.JSON.parse){return window.JSON.parse(data);}
if(data===null){return data;}
if(typeof data==="string"){data=jQuery.trim(data);if(data){if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return(new Function("return "+data))();}}}
jQuery.error("Invalid JSON: "+data);},parseXML:function(data){var xml,tmp;if(!data||typeof data!=="string"){return null;}
try{if(window.DOMParser){tmp=new DOMParser();xml=tmp.parseFromString(data,"text/xml");}else{xml=new ActiveXObject("Microsoft.XMLDOM");xml.async="false";xml.loadXML(data);}}catch(e){xml=undefined;}
if(!xml||!xml.documentElement||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data);}
return xml;},noop:function(){},globalEval:function(data){if(data&&jQuery.trim(data)){(window.execScript||function(data){window["eval"].call(window,data);})(data);}},camelCase:function(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase);},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase();},each:function(obj,callback,args){var value,i=0,length=obj.length,isArray=isArraylike(obj);if(args){if(isArray){for(;i<length;i++){value=callback.apply(obj[i],args);if(value===false){break;}}}else{for(i in obj){value=callback.apply(obj[i],args);if(value===false){break;}}}}else{if(isArray){for(;i<length;i++){value=callback.call(obj[i],i,obj[i]);if(value===false){break;}}}else{for(i in obj){value=callback.call(obj[i],i,obj[i]);if(value===false){break;}}}}
return obj;},trim:core_trim&&!core_trim.call("\uFEFF\xA0")?function(text){return text==null?"":core_trim.call(text);}: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{core_push.call(ret,arr);}}
return ret;},inArray:function(elem,arr,i){var len;if(arr){if(core_indexOf){return core_indexOf.call(arr,elem,i);}
len=arr.length;i=i?i<0?Math.max(0,len+i):i:0;for(;i<len;i++){if(i in arr&&arr[i]===elem){return i;}}}
return-1;},merge:function(first,second){var l=second.length,i=first.length,j=0;if(typeof l==="number"){for(;j<l;j++){first[i++]=second[j];}}else{while(second[j]!==undefined){first[i++]=second[j++];}}
first.length=i;return first;},grep:function(elems,callback,inv){var retVal,ret=[],i=0,length=elems.length;inv=!!inv;for(;i<length;i++){retVal=!!callback(elems[i],i);if(inv!==retVal){ret.push(elems[i]);}}
return ret;},map:function(elems,callback,arg){var value,i=0,length=elems.length,isArray=isArraylike(elems),ret=[];if(isArray){for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value;}}}else{for(i in elems){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value;}}}
return core_concat.apply([],ret);},guid:1,proxy:function(fn,context){var args,proxy,tmp;if(typeof context==="string"){tmp=fn[context];context=fn;fn=tmp;}
if(!jQuery.isFunction(fn)){return undefined;}
args=core_slice.call(arguments,2);proxy=function(){return fn.apply(context||this,args.concat(core_slice.call(arguments)));};proxy.guid=fn.guid=fn.guid||jQuery.guid++;return proxy;},access:function(elems,fn,key,value,chainable,emptyGet,raw){var i=0,length=elems.length,bulk=key==null;if(jQuery.type(key)==="object"){chainable=true;for(i in key){jQuery.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<length;i++){fn(elems[i],key,raw?value:value.call(elems[i],i,fn(elems[i],key)));}}}
return chainable?elems:bulk?fn.call(elems):length?fn(elems[0],key):emptyGet;},now:function(){return(new Date()).getTime();}});jQuery.ready.promise=function(obj){if(!readyList){readyList=jQuery.Deferred();if(document.readyState==="complete"){setTimeout(jQuery.ready);}else if(document.addEventListener){document.addEventListener("DOMContentLoaded",completed,false);window.addEventListener("load",completed,false);}else{document.attachEvent("onreadystatechange",completed);window.attachEvent("onload",completed);var top=false;try{top=window.frameElement==null&&document.documentElement;}catch(e){}
if(top&&top.doScroll){(function doScrollCheck(){if(!jQuery.isReady){try{top.doScroll("left");}catch(e){return setTimeout(doScrollCheck,50);}
detach();jQuery.ready();}})();}}}
return readyList.promise(obj);};jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(i,name){class2type["[object "+name+"]"]=name.toLowerCase();});function isArraylike(obj){var length=obj.length,type=jQuery.type(obj);if(jQuery.isWindow(obj)){return false;}
if(obj.nodeType===1&&length){return true;}
return type==="array"||type!=="function"&&(length===0||typeof length==="number"&&length>0&&(length-1)in obj);}
rootjQuery=jQuery(document);var optionsCache={};function createOptions(options){var object=optionsCache[options]={};jQuery.each(options.match(core_rnotwhite)||[],function(_,flag){object[flag]=true;});return object;}
jQuery.Callbacks=function(options){options=typeof options==="string"?(optionsCache[options]||createOptions(options)):jQuery.extend({},options);var
firing,memory,fired,firingLength,firingIndex,firingStart,list=[],stack=!options.once&&[],fire=function(data){memory=options.memory&&data;fired=true;firingIndex=firingStart||0;firingStart=0;firingLength=list.length;firing=true;for(;list&&firingIndex<firingLength;firingIndex++){if(list[firingIndex].apply(data[0],data[1])===false&&options.stopOnFalse){memory=false;break;}}
firing=false;if(list){if(stack){if(stack.length){fire(stack.shift());}}else if(memory){list=[];}else{self.disable();}}},self={add:function(){if(list){var start=list.length;(function add(args){jQuery.each(args,function(_,arg){var type=jQuery.type(arg);if(type==="function"){if(!options.unique||!self.has(arg)){list.push(arg);}}else if(arg&&arg.length&&type!=="string"){add(arg);}});})(arguments);if(firing){firingLength=list.length;}else if(memory){firingStart=start;fire(memory);}}
return this;},remove:function(){if(list){jQuery.each(arguments,function(_,arg){var index;while((index=jQuery.inArray(arg,list,index))>-1){list.splice(index,1);if(firing){if(index<=firingLength){firingLength--;}
if(index<=firingIndex){firingIndex--;}}}});}
return this;},has:function(fn){return fn?jQuery.inArray(fn,list)>-1:!!(list&&list.length);},empty:function(){list=[];return this;},disable:function(){list=stack=memory=undefined;return this;},disabled:function(){return!list;},lock:function(){stack=undefined;if(!memory){self.disable();}
return this;},locked:function(){return!stack;},fireWith:function(context,args){args=args||[];args=[context,args.slice?args.slice():args];if(list&&(!fired||stack)){if(firing){stack.push(args);}else{fire(args);}}
return this;},fire:function(){self.fireWith(this,arguments);return this;},fired:function(){return!!fired;}};return self;};jQuery.extend({Deferred:function(func){var tuples=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],state="pending",promise={state:function(){return state;},always:function(){deferred.done(arguments).fail(arguments);return this;},then:function(){var fns=arguments;return jQuery.Deferred(function(newDefer){jQuery.each(tuples,function(i,tuple){var action=tuple[0],fn=jQuery.isFunction(fns[i])&&fns[i];deferred[tuple[1]](function(){var returned=fn&&fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().done(newDefer.resolve).fail(newDefer.reject).progress(newDefer.notify);}else{newDefer[action+"With"](this===promise?newDefer.promise():this,fn?[returned]:arguments);}});});fns=null;}).promise();},promise:function(obj){return obj!=null?jQuery.extend(obj,promise):promise;}},deferred={};promise.pipe=promise.then;jQuery.each(tuples,function(i,tuple){var list=tuple[2],stateString=tuple[3];promise[tuple[1]]=list.add;if(stateString){list.add(function(){state=stateString;},tuples[i^1][2].disable,tuples[2][2].lock);}
deferred[tuple[0]]=function(){deferred[tuple[0]+"With"](this===deferred?promise:this,arguments);return this;};deferred[tuple[0]+"With"]=list.fireWith;});promise.promise(deferred);if(func){func.call(deferred,deferred);}
return deferred;},when:function(subordinate){var i=0,resolveValues=core_slice.call(arguments),length=resolveValues.length,remaining=length!==1||(subordinate&&jQuery.isFunction(subordinate.promise))?length:0,deferred=remaining===1?subordinate:jQuery.Deferred(),updateFunc=function(i,contexts,values){return function(value){contexts[i]=this;values[i]=arguments.length>1?core_slice.call(arguments):value;if(values===progressValues){deferred.notifyWith(contexts,values);}else if(!(--remaining)){deferred.resolveWith(contexts,values);}};},progressValues,progressContexts,resolveContexts;if(length>1){progressValues=new Array(length);progressContexts=new Array(length);resolveContexts=new Array(length);for(;i<length;i++){if(resolveValues[i]&&jQuery.isFunction(resolveValues[i].promise)){resolveValues[i].promise().done(updateFunc(i,resolveContexts,resolveValues)).fail(deferred.reject).progress(updateFunc(i,progressContexts,progressValues));}else{--remaining;}}}
if(!remaining){deferred.resolveWith(resolveContexts,resolveValues);}
return deferred.promise();}});jQuery.support=(function(){var support,all,a,input,select,fragment,opt,eventName,isSupported,i,div=document.createElement("div");div.setAttribute("className","t");div.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";all=div.getElementsByTagName("*");a=div.getElementsByTagName("a")[0];if(!all||!a||!all.length){return{};}
select=document.createElement("select");opt=select.appendChild(document.createElement("option"));input=div.getElementsByTagName("input")[0];a.style.cssText="top:1px;float:left;opacity:.5";support={getSetAttribute:div.className!=="t",leadingWhitespace:div.firstChild.nodeType===3,tbody:!div.getElementsByTagName("tbody").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/top/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:/^0.5/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:!!input.value,optSelected:opt.selected,enctype:!!document.createElement("form").enctype,html5Clone:document.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>",boxModel:document.compatMode==="CSS1Compat",deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true,boxSizingReliable:true,pixelPosition:false};input.checked=true;support.noCloneChecked=input.cloneNode(true).checked;select.disabled=true;support.optDisabled=!opt.disabled;try{delete div.test;}catch(e){support.deleteExpando=false;}
input=document.createElement("input");input.setAttribute("value","");support.input=input.getAttribute("value")==="";input.value="t";input.setAttribute("type","radio");support.radioValue=input.value==="t";input.setAttribute("checked","t");input.setAttribute("name","t");fragment=document.createDocumentFragment();fragment.appendChild(input);support.appendChecked=input.checked;support.checkClone=fragment.cloneNode(true).cloneNode(true).lastChild.checked;if(div.attachEvent){div.attachEvent("onclick",function(){support.noCloneEvent=false;});div.cloneNode(true).click();}
for(i in{submit:true,change:true,focusin:true}){div.setAttribute(eventName="on"+i,"t");support[i+"Bubbles"]=eventName in window||div.attributes[eventName].expando===false;}
div.style.backgroundClip="content-box";div.cloneNode(true).style.backgroundClip="";support.clearCloneStyle=div.style.backgroundClip==="content-box";jQuery(function(){var container,marginDiv,tds,divReset="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",body=document.getElementsByTagName("body")[0];if(!body){return;}
container=document.createElement("div");container.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";body.appendChild(container).appendChild(div);div.innerHTML="<table><tr><td></td><td>t</td></tr></table>";tds=div.getElementsByTagName("td");tds[0].style.cssText="padding:0;margin:0;border:0;display:none";isSupported=(tds[0].offsetHeight===0);tds[0].style.display="";tds[1].style.display="none";support.reliableHiddenOffsets=isSupported&&(tds[0].offsetHeight===0);div.innerHTML="";div.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";support.boxSizing=(div.offsetWidth===4);support.doesNotIncludeMarginInBodyOffset=(body.offsetTop!==1);if(window.getComputedStyle){support.pixelPosition=(window.getComputedStyle(div,null)||{}).top!=="1%";support.boxSizingReliable=(window.getComputedStyle(div,null)||{width:"4px"}).width==="4px";marginDiv=div.appendChild(document.createElement("div"));marginDiv.style.cssText=div.style.cssText=divReset;marginDiv.style.marginRight=marginDiv.style.width="0";div.style.width="1px";support.reliableMarginRight=!parseFloat((window.getComputedStyle(marginDiv,null)||{}).marginRight);}
if(typeof div.style.zoom!==core_strundefined){div.innerHTML="";div.style.cssText=divReset+"width:1px;padding:1px;display:inline;zoom:1";support.inlineBlockNeedsLayout=(div.offsetWidth===3);div.style.display="block";div.innerHTML="<div></div>";div.firstChild.style.width="5px";support.shrinkWrapBlocks=(div.offsetWidth!==3);if(support.inlineBlockNeedsLayout){body.style.zoom=1;}}
body.removeChild(container);container=div=tds=marginDiv=null;});all=select=fragment=opt=a=input=null;return support;})();var rbrace=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,rmultiDash=/([A-Z])/g;function internalData(elem,name,data,pvt){if(!jQuery.acceptData(elem)){return;}
var thisCache,ret,internalKey=jQuery.expando,getByName=typeof name==="string",isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[internalKey]:elem[internalKey]&&internalKey;if((!id||!cache[id]||(!pvt&&!cache[id].data))&&getByName&&data===undefined){return;}
if(!id){if(isNode){elem[internalKey]=id=core_deletedIds.pop()||jQuery.guid++;}else{id=internalKey;}}
if(!cache[id]){cache[id]={};if(!isNode){cache[id].toJSON=jQuery.noop;}}
if(typeof name==="object"||typeof name==="function"){if(pvt){cache[id]=jQuery.extend(cache[id],name);}else{cache[id].data=jQuery.extend(cache[id].data,name);}}
thisCache=cache[id];if(!pvt){if(!thisCache.data){thisCache.data={};}
thisCache=thisCache.data;}
if(data!==undefined){thisCache[jQuery.camelCase(name)]=data;}
if(getByName){ret=thisCache[name];if(ret==null){ret=thisCache[jQuery.camelCase(name)];}}else{ret=thisCache;}
return ret;}
function internalRemoveData(elem,name,pvt){if(!jQuery.acceptData(elem)){return;}
var i,l,thisCache,isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[jQuery.expando]:jQuery.expando;if(!cache[id]){return;}
if(name){thisCache=pvt?cache[id]:cache[id].data;if(thisCache){if(!jQuery.isArray(name)){if(name in thisCache){name=[name];}else{name=jQuery.camelCase(name);if(name in thisCache){name=[name];}else{name=name.split(" ");}}}else{name=name.concat(jQuery.map(name,jQuery.camelCase));}
for(i=0,l=name.length;i<l;i++){delete thisCache[name[i]];}
if(!(pvt?isEmptyDataObject:jQuery.isEmptyObject)(thisCache)){return;}}}
if(!pvt){delete cache[id].data;if(!isEmptyDataObject(cache[id])){return;}}
if(isNode){jQuery.cleanData([elem],true);}else if(jQuery.support.deleteExpando||cache!=cache.window){delete cache[id];}else{cache[id]=null;}}
jQuery.extend({cache:{},expando:"jQuery"+(core_version+Math.random()).replace(/\D/g,""),noData:{"embed":true,"object":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000","applet":true},hasData:function(elem){elem=elem.nodeType?jQuery.cache[elem[jQuery.expando]]:elem[jQuery.expando];return!!elem&&!isEmptyDataObject(elem);},data:function(elem,name,data){return internalData(elem,name,data);},removeData:function(elem,name){return internalRemoveData(elem,name);},_data:function(elem,name,data){return internalData(elem,name,data,true);},_removeData:function(elem,name){return internalRemoveData(elem,name,true);},acceptData:function(elem){if(elem.nodeType&&elem.nodeType!==1&&elem.nodeType!==9){return false;}
var noData=elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()];return!noData||noData!==true&&elem.getAttribute("classid")===noData;}});jQuery.fn.extend({data:function(key,value){var attrs,name,elem=this[0],i=0,data=null;if(key===undefined){if(this.length){data=jQuery.data(elem);if(elem.nodeType===1&&!jQuery._data(elem,"parsedAttrs")){attrs=elem.attributes;for(;i<attrs.length;i++){name=attrs[i].name;if(!name.indexOf("data-")){name=jQuery.camelCase(name.slice(5));dataAttr(elem,name,data[name]);}}
jQuery._data(elem,"parsedAttrs",true);}}
return data;}
if(typeof key==="object"){return this.each(function(){jQuery.data(this,key);});}
return jQuery.access(this,function(value){if(value===undefined){return elem?dataAttr(elem,key,jQuery.data(elem,key)):null;}
this.each(function(){jQuery.data(this,key,value);});},null,value,arguments.length>1,null,true);},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});}});function dataAttr(elem,key,data){if(data===undefined&&elem.nodeType===1){var name="data-"+key.replace(rmultiDash,"-$1").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=data==="true"?true:data==="false"?false:data==="null"?null:+data+""===data?+data:rbrace.test(data)?jQuery.parseJSON(data):data;}catch(e){}
jQuery.data(elem,key,data);}else{data=undefined;}}
return data;}
function isEmptyDataObject(obj){var name;for(name in obj){if(name==="data"&&jQuery.isEmptyObject(obj[name])){continue;}
if(name!=="toJSON"){return false;}}
return true;}
jQuery.extend({queue:function(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=jQuery._data(elem,type);if(data){if(!queue||jQuery.isArray(data)){queue=jQuery._data(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--;}
hooks.cur=fn;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 jQuery._data(elem,key)||jQuery._data(elem,key,{empty:jQuery.Callbacks("once memory").add(function(){jQuery._removeData(elem,type+"queue");jQuery._removeData(elem,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);});},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=setTimeout(next,time);hooks.stop=function(){clearTimeout(timeout);};});},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=jQuery._data(elements[i],type+"queueHooks");if(tmp&&tmp.empty){count++;tmp.empty.add(resolve);}}
resolve();return defer.promise(obj);}});var nodeHook,boolHook,rclass=/[\t\r\n]/g,rreturn=/\r/g,rfocusable=/^(?:input|select|textarea|button|object)$/i,rclickable=/^(?:a|area)$/i,rboolean=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,ruseDefault=/^(?:checked|selected)$/i,getSetAttribute=jQuery.support.getSetAttribute,getSetInput=jQuery.support.input;jQuery.fn.extend({attr:function(name,value){return jQuery.access(this,jQuery.attr,name,value,arguments.length>1);},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name);});},prop:function(name,value){return jQuery.access(this,jQuery.prop,name,value,arguments.length>1);},removeProp:function(name){name=jQuery.propFix[name]||name;return this.each(function(){try{this[name]=undefined;delete this[name];}catch(e){}});},addClass:function(value){var classes,elem,cur,clazz,j,i=0,len=this.length,proceed=typeof value==="string"&&value;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,this.className));});}
if(proceed){classes=(value||"").match(core_rnotwhite)||[];for(;i<len;i++){elem=this[i];cur=elem.nodeType===1&&(elem.className?(" "+elem.className+" ").replace(rclass," "):" ");if(cur){j=0;while((clazz=classes[j++])){if(cur.indexOf(" "+clazz+" ")<0){cur+=clazz+" ";}}
elem.className=jQuery.trim(cur);}}}
return this;},removeClass:function(value){var classes,elem,cur,clazz,j,i=0,len=this.length,proceed=arguments.length===0||typeof value==="string"&&value;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,this.className));});}
if(proceed){classes=(value||"").match(core_rnotwhite)||[];for(;i<len;i++){elem=this[i];cur=elem.nodeType===1&&(elem.className?(" "+elem.className+" ").replace(rclass," "):"");if(cur){j=0;while((clazz=classes[j++])){while(cur.indexOf(" "+clazz+" ")>=0){cur=cur.replace(" "+clazz+" "," ");}}
elem.className=value?jQuery.trim(cur):"";}}}
return this;},toggleClass:function(value,stateVal){var type=typeof value,isBool=typeof stateVal==="boolean";if(jQuery.isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,this.className,stateVal),stateVal);});}
return this.each(function(){if(type==="string"){var className,i=0,self=jQuery(this),state=stateVal,classNames=value.match(core_rnotwhite)||[];while((className=classNames[i++])){state=isBool?state:!self.hasClass(className);self[state?"addClass":"removeClass"](className);}}else if(type===core_strundefined||type==="boolean"){if(this.className){jQuery._data(this,"__className__",this.className);}
this.className=this.className||value===false?"":jQuery._data(this,"__className__")||"";}});},hasClass:function(selector){var className=" "+selector+" ",i=0,l=this.length;for(;i<l;i++){if(this[i].nodeType===1&&(" "+this[i].className+" ").replace(rclass," ").indexOf(className)>=0){return true;}}
return false;},val:function(value){var ret,hooks,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;return typeof ret==="string"?ret.replace(rreturn,""):ret==null?"":ret;}
return;}
isFunction=jQuery.isFunction(value);return this.each(function(i){var val,self=jQuery(this);if(this.nodeType!==1){return;}
if(isFunction){val=value.call(this,i,self.val());}else{val=value;}
if(val==null){val="";}else if(typeof val==="number"){val+="";}else if(jQuery.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=elem.attributes.value;return!val||val.specified?elem.value:elem.text;}},select:{get:function(elem){var value,option,options=elem.options,index=elem.selectedIndex,one=elem.type==="select-one"||index<0,values=one?null:[],max=one?index+1:options.length,i=index<0?max:one?index:0;for(;i<max;i++){option=options[i];if((option.selected||i===index)&&(jQuery.support.optDisabled?!option.disabled:option.getAttribute("disabled")===null)&&(!option.parentNode.disabled||!jQuery.nodeName(option.parentNode,"optgroup"))){value=jQuery(option).val();if(one){return value;}
values.push(value);}}
return values;},set:function(elem,value){var values=jQuery.makeArray(value);jQuery(elem).find("option").each(function(){this.selected=jQuery.inArray(jQuery(this).val(),values)>=0;});if(!values.length){elem.selectedIndex=-1;}
return values;}}},attr:function(elem,name,value){var hooks,notxml,ret,nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return;}
if(typeof elem.getAttribute===core_strundefined){return jQuery.prop(elem,name,value);}
notxml=nType!==1||!jQuery.isXMLDoc(elem);if(notxml){name=name.toLowerCase();hooks=jQuery.attrHooks[name]||(rboolean.test(name)?boolHook:nodeHook);}
if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);}else if(hooks&&notxml&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}else{elem.setAttribute(name,value+"");return value;}}else if(hooks&&notxml&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret;}else{if(typeof elem.getAttribute!==core_strundefined){ret=elem.getAttribute(name);}
return ret==null?undefined:ret;}},removeAttr:function(elem,value){var name,propName,i=0,attrNames=value&&value.match(core_rnotwhite);if(attrNames&&elem.nodeType===1){while((name=attrNames[i++])){propName=jQuery.propFix[name]||name;if(rboolean.test(name)){if(!getSetAttribute&&ruseDefault.test(name)){elem[jQuery.camelCase("default-"+name)]=elem[propName]=false;}else{elem[propName]=false;}}else{jQuery.attr(elem,name,"");}
elem.removeAttribute(getSetAttribute?name:propName);}}},attrHooks:{type:{set:function(elem,value){if(!jQuery.support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val;}
return value;}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(elem,name,value){var ret,hooks,notxml,nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return;}
notxml=nType!==1||!jQuery.isXMLDoc(elem);if(notxml){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;}else{return(elem[name]=value);}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret;}else{return elem[name];}}},propHooks:{tabIndex:{get:function(elem){var attributeNode=elem.getAttributeNode("tabindex");return attributeNode&&attributeNode.specified?parseInt(attributeNode.value,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:undefined;}}}});boolHook={get:function(elem,name){var
prop=jQuery.prop(elem,name),attr=typeof prop==="boolean"&&elem.getAttribute(name),detail=typeof prop==="boolean"?getSetInput&&getSetAttribute?attr!=null:ruseDefault.test(name)?elem[jQuery.camelCase("default-"+name)]:!!attr:elem.getAttributeNode(name);return detail&&detail.value!==false?name.toLowerCase():undefined;},set:function(elem,value,name){if(value===false){jQuery.removeAttr(elem,name);}else if(getSetInput&&getSetAttribute||!ruseDefault.test(name)){elem.setAttribute(!getSetAttribute&&jQuery.propFix[name]||name,name);}else{elem[jQuery.camelCase("default-"+name)]=elem[name]=true;}
return name;}};if(!getSetInput||!getSetAttribute){jQuery.attrHooks.value={get:function(elem,name){var ret=elem.getAttributeNode(name);return jQuery.nodeName(elem,"input")?elem.defaultValue:ret&&ret.specified?ret.value:undefined;},set:function(elem,value,name){if(jQuery.nodeName(elem,"input")){elem.defaultValue=value;}else{return nodeHook&&nodeHook.set(elem,value,name);}}};}
if(!getSetAttribute){nodeHook=jQuery.valHooks.button={get:function(elem,name){var ret=elem.getAttributeNode(name);return ret&&(name==="id"||name==="name"||name==="coords"?ret.value!=="":ret.specified)?ret.value:undefined;},set:function(elem,value,name){var ret=elem.getAttributeNode(name);if(!ret){elem.setAttributeNode((ret=elem.ownerDocument.createAttribute(name)));}
ret.value=value+="";return name==="value"||value===elem.getAttribute(name)?value:undefined;}};jQuery.attrHooks.contenteditable={get:nodeHook.get,set:function(elem,value,name){nodeHook.set(elem,value===""?false:value,name);}};jQuery.each(["width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{set:function(elem,value){if(value===""){elem.setAttribute(name,"auto");return value;}}});});}
if(!jQuery.support.hrefNormalized){jQuery.each(["href","src","width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{get:function(elem){var ret=elem.getAttribute(name,2);return ret==null?undefined:ret;}});});jQuery.each(["href","src"],function(i,name){jQuery.propHooks[name]={get:function(elem){return elem.getAttribute(name,4);}};});}
if(!jQuery.support.style){jQuery.attrHooks.style={get:function(elem){return elem.style.cssText||undefined;},set:function(elem,value){return(elem.style.cssText=value+"");}};}
if(!jQuery.support.optSelected){jQuery.propHooks.selected=jQuery.extend(jQuery.propHooks.selected,{get:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex;}}
return null;}});}
if(!jQuery.support.enctype){jQuery.propFix.enctype="encoding";}
if(!jQuery.support.checkOn){jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={get:function(elem){return elem.getAttribute("value")===null?"on":elem.value;}};});}
jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]=jQuery.extend(jQuery.valHooks[this],{set:function(elem,value){if(jQuery.isArray(value)){return(elem.checked=jQuery.inArray(jQuery(elem).val(),value)>=0);}}});});var rformElems=/^(?:input|select|textarea)$/i,rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|contextmenu)|click/,rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,rtypenamespace=/^([^.]*)(?:\.(.+)|)$/;function returnTrue(){return true;}
function returnFalse(){return false;}
jQuery.event={global:{},add:function(elem,types,handler,data,selector){var tmp,events,t,handleObjIn,special,eventHandle,handleObj,handlers,type,namespaces,origType,elemData=jQuery._data(elem);if(!elemData){return;}
if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.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!==core_strundefined&&(!e||jQuery.event.triggered!==e.type)?jQuery.event.dispatch.apply(eventHandle.elem,arguments):undefined;};eventHandle.elem=elem;}
types=(types||"").match(core_rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();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,false);}else if(elem.attachEvent){elem.attachEvent("on"+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;}
elem=null;},remove:function(elem,types,handler,selector,mappedTypes){var j,handleObj,tmp,origCount,t,events,special,handlers,type,namespaces,origType,elemData=jQuery.hasData(elem)&&jQuery._data(elem);if(!elemData||!(events=elemData.events)){return;}
types=(types||"").match(core_rnotwhite)||[""];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)){delete elemData.handle;jQuery._removeData(elem,"events");}},trigger:function(event,data,elem,onlyHandlers){var handle,ontype,cur,bubbleType,special,tmp,i,eventPath=[elem||document],type=core_hasOwn.call(event,"type")?event.type:event,namespaces=core_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(".")>=0){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=true;event.namespace=namespaces.join(".");event.namespace_re=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=(jQuery._data(cur,"events")||{})[event.type]&&jQuery._data(cur,"handle");if(handle){handle.apply(cur,data);}
handle=ontype&&cur[ontype];if(handle&&jQuery.acceptData(cur)&&handle.apply&&handle.apply(cur,data)===false){event.preventDefault();}}
event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(elem.ownerDocument,data)===false)&&!(type==="click"&&jQuery.nodeName(elem,"a"))&&jQuery.acceptData(elem)){if(ontype&&elem[type]&&!jQuery.isWindow(elem)){tmp=elem[ontype];if(tmp){elem[ontype]=null;}
jQuery.event.triggered=type;try{elem[type]();}catch(e){}
jQuery.event.triggered=undefined;if(tmp){elem[ontype]=tmp;}}}}
return event.result;},dispatch:function(event){event=jQuery.event.fix(event);var i,ret,handleObj,matched,j,handlerQueue=[],args=core_slice.call(arguments),handlers=(jQuery._data(this,"events")||{})[event.type]||[],special=jQuery.event.special[event.type]||{};args[0]=event;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.namespace_re||event.namespace_re.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 sel,handleObj,matches,i,handlerQueue=[],delegateCount=handlers.delegateCount,cur=event.target;if(delegateCount&&cur.nodeType&&(!event.button||event.type!=="click")){for(;cur!=this;cur=cur.parentNode||this){if(cur.nodeType===1&&(cur.disabled!==true||event.type!=="click")){matches=[];for(i=0;i<delegateCount;i++){handleObj=handlers[i];sel=handleObj.selector+" ";if(matches[sel]===undefined){matches[sel]=handleObj.needsContext?jQuery(sel,this).index(cur)>=0:jQuery.find(sel,this,null,[cur]).length;}
if(matches[sel]){matches.push(handleObj);}}
if(matches.length){handlerQueue.push({elem:cur,handlers:matches});}}}}
if(delegateCount<handlers.length){handlerQueue.push({elem:this,handlers:handlers.slice(delegateCount)});}
return handlerQueue;},fix:function(event){if(event[jQuery.expando]){return event;}
var i,prop,copy,type=event.type,originalEvent=event,fixHook=this.fixHooks[type];if(!fixHook){this.fixHooks[type]=fixHook=rmouseEvent.test(type)?this.mouseHooks:rkeyEvent.test(type)?this.keyHooks:{};}
copy=fixHook.props?this.props.concat(fixHook.props):this.props;event=new jQuery.Event(originalEvent);i=copy.length;while(i--){prop=copy[i];event[prop]=originalEvent[prop];}
if(!event.target){event.target=originalEvent.srcElement||document;}
if(event.target.nodeType===3){event.target=event.target.parentNode;}
event.metaKey=!!event.metaKey;return fixHook.filter?fixHook.filter(event,originalEvent):event;},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(event,original){if(event.which==null){event.which=original.charCode!=null?original.charCode:original.keyCode;}
return event;}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(event,original){var body,eventDoc,doc,button=original.button,fromElement=original.fromElement;if(event.pageX==null&&original.clientX!=null){eventDoc=event.target.ownerDocument||document;doc=eventDoc.documentElement;body=eventDoc.body;event.pageX=original.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=original.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}
if(!event.relatedTarget&&fromElement){event.relatedTarget=fromElement===event.target?original.toElement:fromElement;}
if(!event.which&&button!==undefined){event.which=(button&1?1:(button&2?3:(button&4?2:0)));}
return event;}},special:{load:{noBubble:true},click:{trigger:function(){if(jQuery.nodeName(this,"input")&&this.type==="checkbox"&&this.click){this.click();return false;}}},focus:{trigger:function(){if(this!==document.activeElement&&this.focus){try{this.focus();return false;}catch(e){}}},delegateType:"focusin"},blur:{trigger:function(){if(this===document.activeElement&&this.blur){this.blur();return false;}},delegateType:"focusout"},beforeunload:{postDispatch:function(event){if(event.result!==undefined){event.originalEvent.returnValue=event.result;}}}},simulate:function(type,elem,event,bubble){var e=jQuery.extend(new jQuery.Event(),event,{type:type,isSimulated:true,originalEvent:{}});if(bubble){jQuery.event.trigger(e,null,elem);}else{jQuery.event.dispatch.call(elem,e);}
if(e.isDefaultPrevented()){event.preventDefault();}}};jQuery.removeEvent=document.removeEventListener?function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle,false);}}:function(elem,type,handle){var name="on"+type;if(elem.detachEvent){if(typeof elem[name]===core_strundefined){elem[name]=null;}
elem.detachEvent(name,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.returnValue===false||src.getPreventDefault&&src.getPreventDefault())?returnTrue:returnFalse;}else{this.type=src;}
if(props){jQuery.extend(this,props);}
this.timeStamp=src&&src.timeStamp||jQuery.now();this[jQuery.expando]=true;};jQuery.Event.prototype={isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue;if(!e){return;}
if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue;if(!e){return;}
if(e.stopPropagation){e.stopPropagation();}
e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();}};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},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;}};});if(!jQuery.support.submitBubbles){jQuery.event.special.submit={setup:function(){if(jQuery.nodeName(this,"form")){return false;}
jQuery.event.add(this,"click._submit keypress._submit",function(e){var elem=e.target,form=jQuery.nodeName(elem,"input")||jQuery.nodeName(elem,"button")?elem.form:undefined;if(form&&!jQuery._data(form,"submitBubbles")){jQuery.event.add(form,"submit._submit",function(event){event._submit_bubble=true;});jQuery._data(form,"submitBubbles",true);}});},postDispatch:function(event){if(event._submit_bubble){delete event._submit_bubble;if(this.parentNode&&!event.isTrigger){jQuery.event.simulate("submit",this.parentNode,event,true);}}},teardown:function(){if(jQuery.nodeName(this,"form")){return false;}
jQuery.event.remove(this,"._submit");}};}
if(!jQuery.support.changeBubbles){jQuery.event.special.change={setup:function(){if(rformElems.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){jQuery.event.add(this,"propertychange._change",function(event){if(event.originalEvent.propertyName==="checked"){this._just_changed=true;}});jQuery.event.add(this,"click._change",function(event){if(this._just_changed&&!event.isTrigger){this._just_changed=false;}
jQuery.event.simulate("change",this,event,true);});}
return false;}
jQuery.event.add(this,"beforeactivate._change",function(e){var elem=e.target;if(rformElems.test(elem.nodeName)&&!jQuery._data(elem,"changeBubbles")){jQuery.event.add(elem,"change._change",function(event){if(this.parentNode&&!event.isSimulated&&!event.isTrigger){jQuery.event.simulate("change",this.parentNode,event,true);}});jQuery._data(elem,"changeBubbles",true);}});},handle:function(event){var elem=event.target;if(this!==elem||event.isSimulated||event.isTrigger||(elem.type!=="radio"&&elem.type!=="checkbox")){return event.handleObj.handler.apply(this,arguments);}},teardown:function(){jQuery.event.remove(this,"._change");return!rformElems.test(this.nodeName);}};}
if(!jQuery.support.focusinBubbles){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var attaches=0,handler=function(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event),true);};jQuery.event.special[fix]={setup:function(){if(attaches++===0){document.addEventListener(orig,handler,true);}},teardown:function(){if(--attaches===0){document.removeEventListener(orig,handler,true);}}};});}
jQuery.fn.extend({on:function(types,selector,data,fn,one){var type,origFn;if(typeof types==="object"){if(typeof selector!=="string"){data=data||selector;selector=undefined;}
for(type in types){this.on(type,selector,data,types[type],one);}
return this;}
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 this;}
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 this.each(function(){jQuery.event.add(this,types,fn,data,selector);});},one:function(types,selector,data,fn){return this.on(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);});},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);},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);}}});(function(window,undefined){var i,cachedruns,Expr,getText,isXML,compile,hasDuplicate,outermostContext,setDocument,document,docElem,documentIsXML,rbuggyQSA,rbuggyMatches,matches,contains,sortOrder,expando="sizzle"+-(new Date()),preferredDoc=window.document,support={},dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),strundefined=typeof undefined,MAX_NEGATIVE=1<<31,arr=[],pop=arr.pop,push=arr.push,slice=arr.slice,indexOf=arr.indexOf||function(elem){var i=0,len=this.length;for(;i<len;i++){if(this[i]===elem){return i;}}
return-1;},whitespace="[\\x20\\t\\r\\n\\f]",characterEncoding="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",identifier=characterEncoding.replace("w","w#"),operators="([*^$|!~]?=)",attributes="\\["+whitespace+"*("+characterEncoding+")"+whitespace+"*(?:"+operators+whitespace+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+identifier+")|)|)"+whitespace+"*\\]",pseudos=":("+characterEncoding+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+attributes.replace(3,8)+")*)|.*)\\)|)",rtrim=new RegExp("^"+whitespace+"+|((?:^|[^\\\\])(?:\\\\.)*)"+whitespace+"+$","g"),rcomma=new RegExp("^"+whitespace+"*,"+whitespace+"*"),rcombinators=new RegExp("^"+whitespace+"*([\\x20\\t\\r\\n\\f>+~])"+whitespace+"*"),rpseudo=new RegExp(pseudos),ridentifier=new RegExp("^"+identifier+"$"),matchExpr={"ID":new RegExp("^#("+characterEncoding+")"),"CLASS":new RegExp("^\\.("+characterEncoding+")"),"NAME":new RegExp("^\\[name=['\"]?("+characterEncoding+")['\"]?\\]"),"TAG":new RegExp("^("+characterEncoding.replace("w","w*")+")"),"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"),"needsContext":new RegExp("^"+whitespace+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+
whitespace+"*((?:-\\d)?\\d*)"+whitespace+"*\\)|)(?=[^-]|$)","i")},rsibling=/[\x20\t\r\n\f]*[+~]/,rnative=/^[^{]+\{\s*\[native code/,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rescape=/'|\\/g,rattributeQuotes=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,runescape=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,funescape=function(_,escaped){var high="0x"+escaped-0x10000;return high!==high?escaped:high<0?String.fromCharCode(high+0x10000):String.fromCharCode(high>>10|0xD800,high&0x3FF|0xDC00);};try{slice.call(preferredDoc.documentElement.childNodes,0)[0].nodeType;}catch(e){slice=function(i){var elem,results=[];while((elem=this[i++])){results.push(elem);}
return results;};}
function isNative(fn){return rnative.test(fn+"");}
function createCache(){var cache,keys=[];return(cache=function(key,value){if(keys.push(key+=" ")>Expr.cacheLength){delete cache[keys.shift()];}
return(cache[key]=value);});}
function markFunction(fn){fn[expando]=true;return fn;}
function assert(fn){var div=document.createElement("div");try{return fn(div);}catch(e){return false;}finally{div=null;}}
function Sizzle(selector,context,results,seed){var match,elem,m,nodeType,i,groups,old,nid,newContext,newSelector;if((context?context.ownerDocument||context:preferredDoc)!==document){setDocument(context);}
context=context||document;results=results||[];if(!selector||typeof selector!=="string"){return results;}
if((nodeType=context.nodeType)!==1&&nodeType!==9){return[];}
if(!documentIsXML&&!seed){if((match=rquickExpr.exec(selector))){if((m=match[1])){if(nodeType===9){elem=context.getElementById(m);if(elem&&elem.parentNode){if(elem.id===m){results.push(elem);return results;}}else{return results;}}else{if(context.ownerDocument&&(elem=context.ownerDocument.getElementById(m))&&contains(context,elem)&&elem.id===m){results.push(elem);return results;}}}else if(match[2]){push.apply(results,slice.call(context.getElementsByTagName(selector),0));return results;}else if((m=match[3])&&support.getByClassName&&context.getElementsByClassName){push.apply(results,slice.call(context.getElementsByClassName(m),0));return results;}}
if(support.qsa&&!rbuggyQSA.test(selector)){old=true;nid=expando;newContext=context;newSelector=nodeType===9&&selector;if(nodeType===1&&context.nodeName.toLowerCase()!=="object"){groups=tokenize(selector);if((old=context.getAttribute("id"))){nid=old.replace(rescape,"\\$&");}else{context.setAttribute("id",nid);}
nid="[id='"+nid+"'] ";i=groups.length;while(i--){groups[i]=nid+toSelector(groups[i]);}
newContext=rsibling.test(selector)&&context.parentNode||context;newSelector=groups.join(",");}
if(newSelector){try{push.apply(results,slice.call(newContext.querySelectorAll(newSelector),0));return results;}catch(qsaError){}finally{if(!old){context.removeAttribute("id");}}}}}
return select(selector.replace(rtrim,"$1"),context,results,seed);}
isXML=Sizzle.isXML=function(elem){var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return documentElement?documentElement.nodeName!=="HTML":false;};setDocument=Sizzle.setDocument=function(node){var doc=node?node.ownerDocument||node:preferredDoc;if(doc===document||doc.nodeType!==9||!doc.documentElement){return document;}
document=doc;docElem=doc.documentElement;documentIsXML=isXML(doc);support.tagNameNoComments=assert(function(div){div.appendChild(doc.createComment(""));return!div.getElementsByTagName("*").length;});support.attributes=assert(function(div){div.innerHTML="<select></select>";var type=typeof div.lastChild.getAttribute("multiple");return type!=="boolean"&&type!=="string";});support.getByClassName=assert(function(div){div.innerHTML="<div class='hidden e'></div><div class='hidden'></div>";if(!div.getElementsByClassName||!div.getElementsByClassName("e").length){return false;}
div.lastChild.className="e";return div.getElementsByClassName("e").length===2;});support.getByName=assert(function(div){div.id=expando+0;div.innerHTML="<a name='"+expando+"'></a><div name='"+expando+"'></div>";docElem.insertBefore(div,docElem.firstChild);var pass=doc.getElementsByName&&doc.getElementsByName(expando).length===2+
doc.getElementsByName(expando+0).length;support.getIdNotName=!doc.getElementById(expando);docElem.removeChild(div);return pass;});Expr.attrHandle=assert(function(div){div.innerHTML="<a href='#'></a>";return div.firstChild&&typeof div.firstChild.getAttribute!==strundefined&&div.firstChild.getAttribute("href")==="#";})?{}:{"href":function(elem){return elem.getAttribute("href",2);},"type":function(elem){return elem.getAttribute("type");}};if(support.getIdNotName){Expr.find["ID"]=function(id,context){if(typeof context.getElementById!==strundefined&&!documentIsXML){var m=context.getElementById(id);return m&&m.parentNode?[m]:[];}};Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId;};};}else{Expr.find["ID"]=function(id,context){if(typeof context.getElementById!==strundefined&&!documentIsXML){var m=context.getElementById(id);return m?m.id===id||typeof m.getAttributeNode!==strundefined&&m.getAttributeNode("id").value===id?[m]:undefined:[];}};Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node=typeof elem.getAttributeNode!==strundefined&&elem.getAttributeNode("id");return node&&node.value===attrId;};};}
Expr.find["TAG"]=support.tagNameNoComments?function(tag,context){if(typeof context.getElementsByTagName!==strundefined){return context.getElementsByTagName(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["NAME"]=support.getByName&&function(tag,context){if(typeof context.getElementsByName!==strundefined){return context.getElementsByName(name);}};Expr.find["CLASS"]=support.getByClassName&&function(className,context){if(typeof context.getElementsByClassName!==strundefined&&!documentIsXML){return context.getElementsByClassName(className);}};rbuggyMatches=[];rbuggyQSA=[":focus"];if((support.qsa=isNative(doc.querySelectorAll))){assert(function(div){div.innerHTML="<select><option selected=''></option></select>";if(!div.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)");}
if(!div.querySelectorAll(":checked").length){rbuggyQSA.push(":checked");}});assert(function(div){div.innerHTML="<input type='hidden' i=''/>";if(div.querySelectorAll("[i^='']").length){rbuggyQSA.push("[*^$]="+whitespace+"*(?:\"\"|'')");}
if(!div.querySelectorAll(":enabled").length){rbuggyQSA.push(":enabled",":disabled");}
div.querySelectorAll("*,:x");rbuggyQSA.push(",.*:");});}
if((support.matchesSelector=isNative((matches=docElem.matchesSelector||docElem.mozMatchesSelector||docElem.webkitMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector)))){assert(function(div){support.disconnectedMatch=matches.call(div,"div");matches.call(div,"[s!='']:x");rbuggyMatches.push("!=",pseudos);});}
rbuggyQSA=new RegExp(rbuggyQSA.join("|"));rbuggyMatches=new RegExp(rbuggyMatches.join("|"));contains=isNative(docElem.contains)||docElem.compareDocumentPosition?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=docElem.compareDocumentPosition?function(a,b){var compare;if(a===b){hasDuplicate=true;return 0;}
if((compare=b.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(b))){if(compare&1||a.parentNode&&a.parentNode.nodeType===11){if(a===doc||contains(preferredDoc,a)){return-1;}
if(b===doc||contains(preferredDoc,b)){return 1;}
return 0;}
return compare&4?-1:1;}
return a.compareDocumentPosition?-1:1;}:function(a,b){var cur,i=0,aup=a.parentNode,bup=b.parentNode,ap=[a],bp=[b];if(a===b){hasDuplicate=true;return 0;}else if(!aup||!bup){return a===doc?-1:b===doc?1:aup?-1:bup?1: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;};hasDuplicate=false;[0,0].sort(sortOrder);support.detectDuplicates=hasDuplicate;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&&!documentIsXML&&(!rbuggyMatches||!rbuggyMatches.test(expr))&&!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){var val;if((elem.ownerDocument||elem)!==document){setDocument(elem);}
if(!documentIsXML){name=name.toLowerCase();}
if((val=Expr.attrHandle[name])){return val(elem);}
if(documentIsXML||support.attributes){return elem.getAttribute(name);}
return((val=elem.getAttributeNode(name))||elem.getAttribute(name))&&elem[name]===true?name:val&&val.specified?val.value:null;};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg);};Sizzle.uniqueSort=function(results){var elem,duplicates=[],i=1,j=0;hasDuplicate=!support.detectDuplicates;results.sort(sortOrder);if(hasDuplicate){for(;(elem=results[i]);i++){if(elem===results[i-1]){j=duplicates.push(i);}}
while(j--){results.splice(duplicates[j],1);}}
return results;};function siblingCheck(a,b){var cur=b&&a,diff=cur&&(~b.sourceIndex||MAX_NEGATIVE)-(~a.sourceIndex||MAX_NEGATIVE);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 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]);}}});});}
getText=Sizzle.getText=function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){for(;(node=elem[i]);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,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[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[5]&&match[2];if(matchExpr["CHILD"].test(match[0])){return null;}
if(match[4]){match[2]=match[4];}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(nodeName){if(nodeName==="*"){return function(){return true;};}
nodeName=nodeName.replace(runescape,funescape).toLowerCase();return 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(elem.className||(typeof elem.getAttribute!==strundefined&&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+" ").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,outerCache,node,diff,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType;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){outerCache=parent[expando]||(parent[expando]={});cache=outerCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=cache[0]===dirruns&&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){outerCache[type]=[dirruns,nodeIndex,diff];break;}}}else if(useCache&&(cache=(elem[expando]||(elem[expando]={}))[type])&&cache[0]===dirruns){diff=cache[1];}else{while((node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop())){if((ofType?node.nodeName.toLowerCase()===name:node.nodeType===1)&&++diff){if(useCache){(node[expando]||(node[expando]={}))[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.call(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);return!results.pop();};}),"has":markFunction(function(selector){return function(elem){return Sizzle(selector,elem).length>0;};}),"contains":markFunction(function(text){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=documentIsXML?elem.getAttribute("xml:lang")||elem.getAttribute("lang"):elem.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":function(elem){return elem.disabled===false;},"disabled":function(elem){return elem.disabled===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.nodeName>"@"||elem.nodeType===3||elem.nodeType===4){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()===elem.type);},"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;})}};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 tokenize(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,checkNonElements=base&&dir==="parentNode",doneName=done++;return combinator.first?function(elem,context,xml){while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){return matcher(elem,context,xml);}}}:function(elem,context,xml){var data,cache,outerCache,dirkey=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]={});if((cache=outerCache[dir])&&cache[0]===dirkey){if((data=cache[1])===true||data===cachedruns){return data===true;}}else{cache=outerCache[dir]=[dirkey];cache[1]=matcher(elem,context,xml)||cachedruns;if(cache[1]===true){return true;}}}}}};}
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 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.call(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.call(checkContext,elem)>-1;},implicitRelative,true),matchers=[function(elem,context,xml){return(!leadingRelative&&(xml||context!==outermostContext))||((checkContext=context).nodeType?matchContext(elem,context,xml):matchAnyContext(elem,context,xml));}];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)).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 matcherCachedRuns=0,bySet=setMatchers.length>0,byElement=elementMatchers.length>0,superMatcher=function(seed,context,xml,results,expandContext){var elem,j,matcher,setMatched=[],matchedCount=0,i="0",unmatched=seed&&[],outermost=expandContext!=null,contextBackup=outermostContext,elems=seed||byElement&&Expr.find["TAG"]("*",expandContext&&context.parentNode||context),dirrunsUnique=(dirruns+=contextBackup==null?1:Math.random()||0.1);if(outermost){outermostContext=context!==document&&context;cachedruns=matcherCachedRuns;}
for(;(elem=elems[i])!=null;i++){if(byElement&&elem){j=0;while((matcher=elementMatchers[j++])){if(matcher(elem,context,xml)){results.push(elem);break;}}
if(outermost){dirruns=dirrunsUnique;cachedruns=++matcherCachedRuns;}}
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,group){var i,setMatchers=[],elementMatchers=[],cached=compilerCache[selector+" "];if(!cached){if(!group){group=tokenize(selector);}
i=group.length;while(i--){cached=matcherFromTokens(group[i]);if(cached[expando]){setMatchers.push(cached);}else{elementMatchers.push(cached);}}
cached=compilerCache(selector,matcherFromGroupMatchers(elementMatchers,setMatchers));}
return cached;};function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i<len;i++){Sizzle(selector,contexts[i],results);}
return results;}
function select(selector,context,results,seed){var i,tokens,token,type,find,match=tokenize(selector);if(!seed){if(match.length===1){tokens=match[0]=match[0].slice(0);if(tokens.length>2&&(token=tokens[0]).type==="ID"&&context.nodeType===9&&!documentIsXML&&Expr.relative[tokens[1].type]){context=Expr.find["ID"](token.matches[0].replace(runescape,funescape),context)[0];if(!context){return results;}
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)&&context.parentNode||context))){tokens.splice(i,1);selector=seed.length&&toSelector(tokens);if(!selector){push.apply(results,slice.call(seed,0));return results;}
break;}}}}}
compile(selector,match)(seed,context,documentIsXML,results,rsibling.test(selector));return results;}
Expr.pseudos["nth"]=Expr.pseudos["eq"];function setFilters(){}
Expr.filters=setFilters.prototype=Expr.pseudos;Expr.setFilters=new setFilters();setDocument();Sizzle.attr=jQuery.attr;jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;})(window);var runtil=/Until$/,rparentsprev=/^(?:parents|prev(?:Until|All))/,isSimple=/^.[^:#\[\.,]*$/,rneedsContext=jQuery.expr.match.needsContext,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({find:function(selector){var i,ret,self,len=this.length;if(typeof selector!=="string"){self=this;return this.pushStack(jQuery(selector).filter(function(){for(i=0;i<len;i++){if(jQuery.contains(self[i],this)){return true;}}}));}
ret=[];for(i=0;i<len;i++){jQuery.find(selector,this[i],ret);}
ret=this.pushStack(len>1?jQuery.unique(ret):ret);ret.selector=(this.selector?this.selector+" ":"")+selector;return ret;},has:function(target){var i,targets=jQuery(target,this),len=targets.length;return this.filter(function(){for(i=0;i<len;i++){if(jQuery.contains(this,targets[i])){return true;}}});},not:function(selector){return this.pushStack(winnow(this,selector,false));},filter:function(selector){return this.pushStack(winnow(this,selector,true));},is:function(selector){return!!selector&&(typeof selector==="string"?rneedsContext.test(selector)?jQuery(selector,this.context).index(this[0])>=0:jQuery.filter(selector,this).length>0:this.filter(selector).length>0);},closest:function(selectors,context){var cur,i=0,l=this.length,ret=[],pos=rneedsContext.test(selectors)||typeof selectors!=="string"?jQuery(selectors,context||this.context):0;for(;i<l;i++){cur=this[i];while(cur&&cur.ownerDocument&&cur!==context&&cur.nodeType!==11){if(pos?pos.index(cur)>-1:jQuery.find.matchesSelector(cur,selectors)){ret.push(cur);break;}
cur=cur.parentNode;}}
return this.pushStack(ret.length>1?jQuery.unique(ret):ret);},index:function(elem){if(!elem){return(this[0]&&this[0].parentNode)?this.first().prevAll().length:-1;}
if(typeof elem==="string"){return jQuery.inArray(this[0],jQuery(elem));}
return jQuery.inArray(elem.jquery?elem[0]:elem,this);},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context):jQuery.makeArray(selector&&selector.nodeType?[selector]:selector),all=jQuery.merge(this.get(),set);return this.pushStack(jQuery.unique(all));},addBack:function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector));}});jQuery.fn.andSelf=jQuery.fn.addBack;function sibling(cur,dir){do{cur=cur[dir];}while(cur&&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 jQuery.dir(elem,"parentNode");},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until);},next:function(elem){return sibling(elem,"nextSibling");},prev:function(elem){return sibling(elem,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until);},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until);},siblings:function(elem){return jQuery.sibling((elem.parentNode||{}).firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.merge([],elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until);if(!runtil.test(name)){selector=until;}
if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret);}
ret=this.length>1&&!guaranteedUnique[name]?jQuery.unique(ret):ret;if(this.length>1&&rparentsprev.test(name)){ret=ret.reverse();}
return this.pushStack(ret);};});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")";}
return elems.length===1?jQuery.find.matchesSelector(elems[0],expr)?[elems[0]]:[]:jQuery.find.matches(expr,elems);},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur);}
cur=cur[dir];}
return matched;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n);}}
return r;}});function winnow(elements,qualifier,keep){qualifier=qualifier||0;if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){var retVal=!!qualifier.call(elem,i,elem);return retVal===keep;});}else if(qualifier.nodeType){return jQuery.grep(elements,function(elem){return(elem===qualifier)===keep;});}else if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1;});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep);}else{qualifier=jQuery.filter(qualifier,filtered);}}
return jQuery.grep(elements,function(elem){return(jQuery.inArray(elem,qualifier)>=0)===keep;});}
function createSafeFragment(document){var list=nodeNames.split("|"),safeFrag=document.createDocumentFragment();if(safeFrag.createElement){while(list.length){safeFrag.createElement(list.pop());}}
return safeFrag;}
var nodeNames="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|"+"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",rinlinejQuery=/ jQuery\d+="(?:null|\d+)"/g,rnoshimcache=new RegExp("<(?:"+nodeNames+")[\\s/>]","i"),rleadingWhitespace=/^\s+/,rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&#?\w+;/,rnoInnerhtml=/<(?:script|style|link)/i,manipulation_rcheckableType=/^(?:checkbox|radio)$/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/^$|\/(?:java|ecma)script/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:jQuery.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},safeFragment=createSafeFragment(document),fragmentDiv=safeFragment.appendChild(document.createElement("div"));wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;jQuery.fn.extend({text:function(value){return jQuery.access(this,function(value){return value===undefined?jQuery.text(this):this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(value));},null,value,arguments.length);},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i));});}
if(this[0]){var 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.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild;}
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(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes);}}).end();},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){this.appendChild(elem);}});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){this.insertBefore(elem,this.firstChild);}});},before:function(){return this.domManip(arguments,false,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this);}});},after:function(){return this.domManip(arguments,false,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this.nextSibling);}});},remove:function(selector,keepData){var elem,i=0;for(;(elem=this[i])!=null;i++){if(!selector||jQuery.filter(selector,[elem]).length>0){if(!keepData&&elem.nodeType===1){jQuery.cleanData(getAll(elem));}
if(elem.parentNode){if(keepData&&jQuery.contains(elem.ownerDocument,elem)){setGlobalEval(getAll(elem,"script"));}
elem.parentNode.removeChild(elem);}}}
return this;},empty:function(){var elem,i=0;for(;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));}
while(elem.firstChild){elem.removeChild(elem.firstChild);}
if(elem.options&&jQuery.nodeName(elem,"select")){elem.options.length=0;}}
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 jQuery.access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined){return elem.nodeType===1?elem.innerHTML.replace(rinlinejQuery,""):undefined;}
if(typeof value==="string"&&!rnoInnerhtml.test(value)&&(jQuery.support.htmlSerialize||!rnoshimcache.test(value))&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,"<$1></$2>");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(value){var isFunc=jQuery.isFunction(value);if(!isFunc&&typeof value!=="string"){value=jQuery(value).not(this).detach();}
return this.domManip([value],true,function(elem){var next=this.nextSibling,parent=this.parentNode;if(parent){jQuery(this).remove();parent.insertBefore(elem,next);}});},detach:function(selector){return this.remove(selector,true);},domManip:function(args,table,callback){args=core_concat.apply([],args);var first,node,hasScripts,scripts,doc,fragment,i=0,l=this.length,set=this,iNoClone=l-1,value=args[0],isFunction=jQuery.isFunction(value);if(isFunction||!(l<=1||typeof value!=="string"||jQuery.support.checkClone||!rchecked.test(value))){return this.each(function(index){var self=set.eq(index);if(isFunction){args[0]=value.call(this,index,table?self.html():undefined);}
self.domManip(args,table,callback);});}
if(l){fragment=jQuery.buildFragment(args,this[0].ownerDocument,false,this);first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first;}
if(first){table=table&&jQuery.nodeName(first,"tr");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(table&&jQuery.nodeName(this[i],"table")?findOrAppend(this[i],"tbody"):this[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||"")&&!jQuery._data(node,"globalEval")&&jQuery.contains(doc,node)){if(node.src){jQuery.ajax({url:node.src,type:"GET",dataType:"script",async:false,global:false,"throws":true});}else{jQuery.globalEval((node.text||node.textContent||node.innerHTML||"").replace(rcleanScript,""));}}}}
fragment=first=null;}}
return this;}});function findOrAppend(elem,tag){return elem.getElementsByTagName(tag)[0]||elem.appendChild(elem.ownerDocument.createElement(tag));}
function disableScript(elem){var attr=elem.getAttributeNode("type");elem.type=(attr&&attr.specified)+"/"+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 setGlobalEval(elems,refElements){var elem,i=0;for(;(elem=elems[i])!=null;i++){jQuery._data(elem,"globalEval",!refElements||jQuery._data(refElements[i],"globalEval"));}}
function cloneCopyEvent(src,dest){if(dest.nodeType!==1||!jQuery.hasData(src)){return;}
var type,i,l,oldData=jQuery._data(src),curData=jQuery._data(dest,oldData),events=oldData.events;if(events){delete curData.handle;curData.events={};for(type in events){for(i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type,events[type][i]);}}}
if(curData.data){curData.data=jQuery.extend({},curData.data);}}
function fixCloneNodeIssues(src,dest){var nodeName,e,data;if(dest.nodeType!==1){return;}
nodeName=dest.nodeName.toLowerCase();if(!jQuery.support.noCloneEvent&&dest[jQuery.expando]){data=jQuery._data(dest);for(e in data.events){jQuery.removeEvent(dest,e,data.handle);}
dest.removeAttribute(jQuery.expando);}
if(nodeName==="script"&&dest.text!==src.text){disableScript(dest).text=src.text;restoreScript(dest);}else if(nodeName==="object"){if(dest.parentNode){dest.outerHTML=src.outerHTML;}
if(jQuery.support.html5Clone&&(src.innerHTML&&!jQuery.trim(dest.innerHTML))){dest.innerHTML=src.innerHTML;}}else if(nodeName==="input"&&manipulation_rcheckableType.test(src.type)){dest.defaultChecked=dest.checked=src.checked;if(dest.value!==src.value){dest.value=src.value;}}else if(nodeName==="option"){dest.defaultSelected=dest.selected=src.defaultSelected;}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue;}}
jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var elems,i=0,ret=[],insert=jQuery(selector),last=insert.length-1;for(;i<=last;i++){elems=i===last?this:this.clone(true);jQuery(insert[i])[original](elems);core_push.apply(ret,elems.get());}
return this.pushStack(ret);};});function getAll(context,tag){var elems,elem,i=0,found=typeof context.getElementsByTagName!==core_strundefined?context.getElementsByTagName(tag||"*"):typeof context.querySelectorAll!==core_strundefined?context.querySelectorAll(tag||"*"):undefined;if(!found){for(found=[],elems=context.childNodes||context;(elem=elems[i])!=null;i++){if(!tag||jQuery.nodeName(elem,tag)){found.push(elem);}else{jQuery.merge(found,getAll(elem,tag));}}}
return tag===undefined||tag&&jQuery.nodeName(context,tag)?jQuery.merge([context],found):found;}
function fixDefaultChecked(elem){if(manipulation_rcheckableType.test(elem.type)){elem.defaultChecked=elem.checked;}}
jQuery.extend({clone:function(elem,dataAndEvents,deepDataAndEvents){var destElements,node,clone,i,srcElements,inPage=jQuery.contains(elem.ownerDocument,elem);if(jQuery.support.html5Clone||jQuery.isXMLDoc(elem)||!rnoshimcache.test("<"+elem.nodeName+">")){clone=elem.cloneNode(true);}else{fragmentDiv.innerHTML=elem.outerHTML;fragmentDiv.removeChild(clone=fragmentDiv.firstChild);}
if((!jQuery.support.noCloneEvent||!jQuery.support.noCloneChecked)&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){destElements=getAll(clone);srcElements=getAll(elem);for(i=0;(node=srcElements[i])!=null;++i){if(destElements[i]){fixCloneNodeIssues(node,destElements[i]);}}}
if(dataAndEvents){if(deepDataAndEvents){srcElements=srcElements||getAll(elem);destElements=destElements||getAll(clone);for(i=0;(node=srcElements[i])!=null;i++){cloneCopyEvent(node,destElements[i]);}}else{cloneCopyEvent(elem,clone);}}
destElements=getAll(clone,"script");if(destElements.length>0){setGlobalEval(destElements,!inPage&&getAll(elem,"script"));}
destElements=srcElements=node=null;return clone;},buildFragment:function(elems,context,scripts,selection){var j,elem,contains,tmp,tag,tbody,wrap,l=elems.length,safe=createSafeFragment(context),nodes=[],i=0;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||safe.appendChild(context.createElement("div"));tag=(rtagName.exec(elem)||["",""])[1].toLowerCase();wrap=wrapMap[tag]||wrapMap._default;tmp.innerHTML=wrap[1]+elem.replace(rxhtmlTag,"<$1></$2>")+wrap[2];j=wrap[0];while(j--){tmp=tmp.lastChild;}
if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0]));}
if(!jQuery.support.tbody){elem=tag==="table"&&!rtbody.test(elem)?tmp.firstChild:wrap[1]==="<table>"&&!rtbody.test(elem)?tmp:0;j=elem&&elem.childNodes.length;while(j--){if(jQuery.nodeName((tbody=elem.childNodes[j]),"tbody")&&!tbody.childNodes.length){elem.removeChild(tbody);}}}
jQuery.merge(nodes,tmp.childNodes);tmp.textContent="";while(tmp.firstChild){tmp.removeChild(tmp.firstChild);}
tmp=safe.lastChild;}}}
if(tmp){safe.removeChild(tmp);}
if(!jQuery.support.appendChecked){jQuery.grep(getAll(nodes,"input"),fixDefaultChecked);}
i=0;while((elem=nodes[i++])){if(selection&&jQuery.inArray(elem,selection)!==-1){continue;}
contains=jQuery.contains(elem.ownerDocument,elem);tmp=getAll(safe.appendChild(elem),"script");if(contains){setGlobalEval(tmp);}
if(scripts){j=0;while((elem=tmp[j++])){if(rscriptType.test(elem.type||"")){scripts.push(elem);}}}}
tmp=null;return safe;},cleanData:function(elems,acceptData){var elem,type,id,data,i=0,internalKey=jQuery.expando,cache=jQuery.cache,deleteExpando=jQuery.support.deleteExpando,special=jQuery.event.special;for(;(elem=elems[i])!=null;i++){if(acceptData||jQuery.acceptData(elem)){id=elem[internalKey];data=id&&cache[id];if(data){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type);}else{jQuery.removeEvent(elem,type,data.handle);}}}
if(cache[id]){delete cache[id];if(deleteExpando){delete elem[internalKey];}else if(typeof elem.removeAttribute!==core_strundefined){elem.removeAttribute(internalKey);}else{elem[internalKey]=null;}
core_deletedIds.push(id);}}}}}});var iframe,getStyles,curCSS,ralpha=/alpha\([^)]*\)/i,ropacity=/opacity\s*=\s*([^)]*)/,rposition=/^(top|right|bottom|left)$/,rdisplayswap=/^(none|table(?!-c[ea]).+)/,rmargin=/^margin/,rnumsplit=new RegExp("^("+core_pnum+")(.*)$","i"),rnumnonpx=new RegExp("^("+core_pnum+")(?!px)[a-z%]+$","i"),rrelNum=new RegExp("^([+-])=("+core_pnum+")","i"),elemdisplay={BODY:"block"},cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:0,fontWeight:400},cssExpand=["Top","Right","Bottom","Left"],cssPrefixes=["Webkit","O","Moz","ms"];function vendorPropName(style,name){if(name in style){return name;}
var capName=name.charAt(0).toUpperCase()+name.slice(1),origName=name,i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in style){return name;}}
return origName;}
function isHidden(elem,el){elem=el||elem;return jQuery.css(elem,"display")==="none"||!jQuery.contains(elem.ownerDocument,elem);}
function showHide(elements,show){var display,elem,hidden,values=[],index=0,length=elements.length;for(;index<length;index++){elem=elements[index];if(!elem.style){continue;}
values[index]=jQuery._data(elem,"olddisplay");display=elem.style.display;if(show){if(!values[index]&&display==="none"){elem.style.display="";}
if(elem.style.display===""&&isHidden(elem)){values[index]=jQuery._data(elem,"olddisplay",css_defaultDisplay(elem.nodeName));}}else{if(!values[index]){hidden=isHidden(elem);if(display&&display!=="none"||!hidden){jQuery._data(elem,"olddisplay",hidden?display:jQuery.css(elem,"display"));}}}}
for(index=0;index<length;index++){elem=elements[index];if(!elem.style){continue;}
if(!show||elem.style.display==="none"||elem.style.display===""){elem.style.display=show?values[index]||"":"none";}}
return elements;}
jQuery.fn.extend({css:function(name,value){return jQuery.access(this,function(elem,name,value){var len,styles,map={},i=0;if(jQuery.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);},show:function(){return showHide(this,true);},hide:function(){return showHide(this);},toggle:function(state){var bool=typeof state==="boolean";return this.each(function(){if(bool?state:isHidden(this)){jQuery(this).show();}else{jQuery(this).hide();}});}});jQuery.extend({cssHooks:{opacity:{get:function(elem,computed){if(computed){var ret=curCSS(elem,"opacity");return ret===""?"1":ret;}}}},cssNumber:{"columnCount":true,"fillOpacity":true,"fontWeight":true,"lineHeight":true,"opacity":true,"orphans":true,"widows":true,"zIndex":true,"zoom":true},cssProps:{"float":jQuery.support.cssFloat?"cssFloat":"styleFloat"},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),style=elem.style;name=jQuery.cssProps[origName]||(jQuery.cssProps[origName]=vendorPropName(style,origName));hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(value!==undefined){type=typeof value;if(type==="string"&&(ret=rrelNum.exec(value))){value=(ret[1]+1)*ret[2]+parseFloat(jQuery.css(elem,name));type="number";}
if(value==null||type==="number"&&isNaN(value)){return;}
if(type==="number"&&!jQuery.cssNumber[origName]){value+="px";}
if(!jQuery.support.clearCloneStyle&&value===""&&name.indexOf("background")===0){style[name]="inherit";}
if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value,extra))!==undefined){try{style[name]=value;}catch(e){}}}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 num,val,hooks,origName=jQuery.camelCase(name);name=jQuery.cssProps[origName]||(jQuery.cssProps[origName]=vendorPropName(elem.style,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||jQuery.isNumeric(num)?num||0:val;}
return val;},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;}});if(window.getComputedStyle){getStyles=function(elem){return window.getComputedStyle(elem,null);};curCSS=function(elem,name,_computed){var width,minWidth,maxWidth,computed=_computed||getStyles(elem),ret=computed?computed.getPropertyValue(name)||computed[name]:undefined,style=elem.style;if(computed){if(ret===""&&!jQuery.contains(elem.ownerDocument,elem)){ret=jQuery.style(elem,name);}
if(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;};}else if(document.documentElement.currentStyle){getStyles=function(elem){return elem.currentStyle;};curCSS=function(elem,name,_computed){var left,rs,rsLeft,computed=_computed||getStyles(elem),ret=computed?computed[name]:undefined,style=elem.style;if(ret==null&&style&&style[name]){ret=style[name];}
if(rnumnonpx.test(ret)&&!rposition.test(name)){left=style.left;rs=elem.runtimeStyle;rsLeft=rs&&rs.left;if(rsLeft){rs.left=elem.currentStyle.left;}
style.left=name==="fontSize"?"1em":ret;ret=style.pixelLeft+"px";style.left=left;if(rsLeft){rs.left=rsLeft;}}
return ret===""?"auto":ret;};}
function setPositiveNumber(elem,value,subtract){var matches=rnumsplit.exec(value);return matches?Math.max(0,matches[1]-(subtract||0))+(matches[2]||"px"):value;}
function augmentWidthOrHeight(elem,name,extra,isBorderBox,styles){var i=extra===(isBorderBox?"border":"content")?4:name==="width"?1:0,val=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=true,val=name==="width"?elem.offsetWidth:elem.offsetHeight,styles=getStyles(elem),isBorderBox=jQuery.support.boxSizing&&jQuery.css(elem,"boxSizing",false,styles)==="border-box";if(val<=0||val==null){val=curCSS(elem,name,styles);if(val<0||val==null){val=elem.style[name];}
if(rnumnonpx.test(val)){return val;}
valueIsBorderBox=isBorderBox&&(jQuery.support.boxSizingReliable||val===elem.style[name]);val=parseFloat(val)||0;}
return(val+
augmentWidthOrHeight(elem,name,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles))+"px";}
function css_defaultDisplay(nodeName){var doc=document,display=elemdisplay[nodeName];if(!display){display=actualDisplay(nodeName,doc);if(display==="none"||!display){iframe=(iframe||jQuery("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(doc.documentElement);doc=(iframe[0].contentWindow||iframe[0].contentDocument).document;doc.write("<!doctype html><html><body>");doc.close();display=actualDisplay(nodeName,doc);iframe.detach();}
elemdisplay[nodeName]=display;}
return display;}
function actualDisplay(name,doc){var elem=jQuery(doc.createElement(name)).appendTo(doc.body),display=jQuery.css(elem[0],"display");elem.remove();return display;}
jQuery.each(["height","width"],function(i,name){jQuery.cssHooks[name]={get:function(elem,computed,extra){if(computed){return elem.offsetWidth===0&&rdisplayswap.test(jQuery.css(elem,"display"))?jQuery.swap(elem,cssShow,function(){return getWidthOrHeight(elem,name,extra);}):getWidthOrHeight(elem,name,extra);}},set:function(elem,value,extra){var styles=extra&&getStyles(elem);return setPositiveNumber(elem,value,extra?augmentWidthOrHeight(elem,name,extra,jQuery.support.boxSizing&&jQuery.css(elem,"boxSizing",false,styles)==="border-box",styles):0);}};});if(!jQuery.support.opacity){jQuery.cssHooks.opacity={get:function(elem,computed){return ropacity.test((computed&&elem.currentStyle?elem.currentStyle.filter:elem.style.filter)||"")?(0.01*parseFloat(RegExp.$1))+"":computed?"1":"";},set:function(elem,value){var style=elem.style,currentStyle=elem.currentStyle,opacity=jQuery.isNumeric(value)?"alpha(opacity="+value*100+")":"",filter=currentStyle&&currentStyle.filter||style.filter||"";style.zoom=1;if((value>=1||value==="")&&jQuery.trim(filter.replace(ralpha,""))===""&&style.removeAttribute){style.removeAttribute("filter");if(value===""||currentStyle&&!currentStyle.filter){return;}}
style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):filter+" "+opacity;}};}
jQuery(function(){if(!jQuery.support.reliableMarginRight){jQuery.cssHooks.marginRight={get:function(elem,computed){if(computed){return jQuery.swap(elem,{"display":"inline-block"},curCSS,[elem,"marginRight"]);}}};}
if(!jQuery.support.pixelPosition&&jQuery.fn.position){jQuery.each(["top","left"],function(i,prop){jQuery.cssHooks[prop]={get:function(elem,computed){if(computed){computed=curCSS(elem,prop);return rnumnonpx.test(computed)?jQuery(elem).position()[prop]+"px":computed;}}};});}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(elem){return elem.offsetWidth<=0&&elem.offsetHeight<=0||(!jQuery.support.reliableHiddenOffsets&&((elem.style&&elem.style.display)||jQuery.css(elem,"display"))==="none");};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem);};}
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;}});var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;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||!manipulation_rcheckableType.test(type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val){return{name:elem.name,value:val.replace(rCRLF,"\r\n")};}):{name:elem.name,value:val.replace(rCRLF,"\r\n")};}).get();}});jQuery.param=function(a,traditional){var prefix,s=[],add=function(key,value){value=jQuery.isFunction(value)?value():(value==null?"":value);s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value);};if(traditional===undefined){traditional=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional;}
if(jQuery.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("&").replace(r20,"+");};function buildParams(prefix,obj,traditional,add){var name;if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v);}else{buildParams(prefix+"["+(typeof v==="object"?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.each(("blur focus focusin focusout load resize scroll unload click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup error contextmenu").split(" "),function(i,name){jQuery.fn[name]=function(data,fn){return arguments.length>0?this.on(name,null,data,fn):this.trigger(name);};});jQuery.fn.hover=function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver);};var
ajaxLocParts,ajaxLocation,ajax_nonce=jQuery.now(),ajax_rquery=/\?/,rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,rurl=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,_load=jQuery.fn.load,prefilters={},transports={},allTypes="*/".concat("*");try{ajaxLocation=location.href;}catch(e){ajaxLocation=document.createElement("a");ajaxLocation.href="";ajaxLocation=ajaxLocation.href;}
ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[];function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*";}
var dataType,i=0,dataTypes=dataTypeExpression.toLowerCase().match(core_rnotwhite)||[];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 deep,key,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;}
jQuery.fn.load=function(url,params,callback){if(typeof url!=="string"&&_load){return _load.apply(this,arguments);}
var selector,response,type,self=this,off=url.indexOf(" ");if(off>=0){selector=url.slice(off,url.length);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,dataType:"html",data:params}).done(function(responseText){response=arguments;self.html(selector?jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector):responseText);}).complete(callback&&function(jqXHR,status){self.each(callback,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.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({url:url,type:method,dataType:type,data:data,success:callback});};});jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ajaxLocation,type:"GET",isLocal:rlocalProtocol.test(ajaxLocParts[1]),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:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":window.String,"text html":true,"text json":jQuery.parseJSON,"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
parts,i,cacheURL,responseHeadersString,timeoutTimer,fireGlobals,transport,responseHeaders,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={},state=0,strAbort="canceled",jqXHR={readyState:0,getResponseHeader:function(key){var match;if(state===2){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 state===2?responseHeadersString:null;},setRequestHeader:function(name,value){var lname=name.toLowerCase();if(!state){name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value;}
return this;},overrideMimeType:function(type){if(!state){s.mimeType=type;}
return this;},statusCode:function(map){var code;if(map){if(state<2){for(code in map){statusCode[code]=[statusCode[code],map[code]];}}else{jqXHR.always(map[jqXHR.status]);}}
return this;},abort:function(statusText){var finalText=statusText||strAbort;if(transport){transport.abort(finalText);}
done(0,finalText);return this;}};deferred.promise(jqXHR).complete=completeDeferred.add;jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;s.url=((url||s.url||ajaxLocation)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//");s.type=options.method||options.type||s.method||s.type;s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().match(core_rnotwhite)||[""];if(s.crossDomain==null){parts=rurl.exec(s.url.toLowerCase());s.crossDomain=!!(parts&&(parts[1]!==ajaxLocParts[1]||parts[2]!==ajaxLocParts[2]||(parts[3]||(parts[1]==="http:"?80:443))!=(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?80:443))));}
if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}
inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(state===2){return jqXHR;}
fireGlobals=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;if(!s.hasContent){if(s.data){cacheURL=(s.url+=(ajax_rquery.test(cacheURL)?"&":"?")+s.data);delete s.data;}
if(s.cache===false){s.url=rts.test(cacheURL)?cacheURL.replace(rts,"$1_="+ajax_nonce++):cacheURL+(ajax_rquery.test(cacheURL)?"&":"?")+"_="+ajax_nonce++;}}
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||state===2)){return jqXHR.abort();}
strAbort="abort";for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i]);}
transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport");}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s]);}
if(s.async&&s.timeout>0){timeoutTimer=setTimeout(function(){jqXHR.abort("timeout");},s.timeout);}
try{state=1;transport.send(requestHeaders,done);}catch(e){if(state<2){done(-1,e);}else{throw e;}}}
function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;if(state===2){return;}
state=2;if(timeoutTimer){clearTimeout(timeoutTimer);}
transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;if(responses){response=ajaxHandleResponses(s,jqXHR,responses);}
if(status>=200&&status<300||status===304){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){isSuccess=true;statusText="nocontent";}else if(status===304){isSuccess=true;statusText="notmodified";}else{isSuccess=ajaxConvert(s,response);statusText=isSuccess.state;success=isSuccess.data;error=isSuccess.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;},getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");}});function ajaxHandleResponses(s,jqXHR,responses){var firstDataType,ct,finalDataType,type,contents=s.contents,dataTypes=s.dataTypes,responseFields=s.responseFields;for(type in responseFields){if(type in responses){jqXHR[responseFields[type]]=responses[type];}}
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){var conv2,current,conv,tmp,converters={},i=0,dataTypes=s.dataTypes.slice(),prev=dataTypes[0];if(s.dataFilter){response=s.dataFilter(response,s.dataType);}
if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv];}}
for(;(current=dataTypes[++i]);){if(current!=="*"){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.splice(i--,0,current);}
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};}}}}
prev=current;}}
return{state:"success",data:response};}
jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},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";s.global=false;}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,head=document.head||jQuery("head")[0]||document.documentElement;return{send:function(_,callback){script=document.createElement("script");script.async=true;if(s.scriptCharset){script.charset=s.scriptCharset;}
script.src=s.url;script.onload=script.onreadystatechange=function(_,isAbort){if(isAbort||!script.readyState||/loaded|complete/.test(script.readyState)){script.onload=script.onreadystatechange=null;if(script.parentNode){script.parentNode.removeChild(script);}
script=null;if(!isAbort){callback(200,"success");}}};head.insertBefore(script,head.firstChild);},abort:function(){if(script){script.onload(undefined,true);}}};}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var callback=oldCallbacks.pop()||(jQuery.expando+"_"+(ajax_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")&&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+=(ajax_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(){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";}});var xhrCallbacks,xhrSupported,xhrId=0,xhrOnUnloadAbort=window.ActiveXObject&&function(){var key;for(key in xhrCallbacks){xhrCallbacks[key](undefined,true);}};function createStandardXHR(){try{return new window.XMLHttpRequest();}catch(e){}}
function createActiveXHR(){try{return new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}
jQuery.ajaxSettings.xhr=window.ActiveXObject?function(){return!this.isLocal&&createStandardXHR()||createActiveXHR();}:createStandardXHR;xhrSupported=jQuery.ajaxSettings.xhr();jQuery.support.cors=!!xhrSupported&&("withCredentials"in xhrSupported);xhrSupported=jQuery.support.ajax=!!xhrSupported;if(xhrSupported){jQuery.ajaxTransport(function(s){if(!s.crossDomain||jQuery.support.cors){var callback;return{send:function(headers,complete){var handle,i,xhr=s.xhr();if(s.username){xhr.open(s.type,s.url,s.async,s.username,s.password);}else{xhr.open(s.type,s.url,s.async);}
if(s.xhrFields){for(i in s.xhrFields){xhr[i]=s.xhrFields[i];}}
if(s.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(s.mimeType);}
if(!s.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest";}
try{for(i in headers){xhr.setRequestHeader(i,headers[i]);}}catch(err){}
xhr.send((s.hasContent&&s.data)||null);callback=function(_,isAbort){var status,responseHeaders,statusText,responses;try{if(callback&&(isAbort||xhr.readyState===4)){callback=undefined;if(handle){xhr.onreadystatechange=jQuery.noop;if(xhrOnUnloadAbort){delete xhrCallbacks[handle];}}
if(isAbort){if(xhr.readyState!==4){xhr.abort();}}else{responses={};status=xhr.status;responseHeaders=xhr.getAllResponseHeaders();if(typeof xhr.responseText==="string"){responses.text=xhr.responseText;}
try{statusText=xhr.statusText;}catch(e){statusText="";}
if(!status&&s.isLocal&&!s.crossDomain){status=responses.text?200:404;}else if(status===1223){status=204;}}}}catch(firefoxAccessException){if(!isAbort){complete(-1,firefoxAccessException);}}
if(responses){complete(status,statusText,responses,responseHeaders);}};if(!s.async){callback();}else if(xhr.readyState===4){setTimeout(callback);}else{handle=++xhrId;if(xhrOnUnloadAbort){if(!xhrCallbacks){xhrCallbacks={};jQuery(window).unload(xhrOnUnloadAbort);}
xhrCallbacks[handle]=callback;}
xhr.onreadystatechange=callback;}},abort:function(){if(callback){callback(undefined,true);}}};}});}
var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rfxnum=new RegExp("^(?:([+-])=|)("+core_pnum+")([a-z%]*)$","i"),rrun=/queueHooks$/,animationPrefilters=[defaultPrefilter],tweeners={"*":[function(prop,value){var end,unit,tween=this.createTween(prop,value),parts=rfxnum.exec(value),target=tween.cur(),start=+target||0,scale=1,maxIterations=20;if(parts){end=+parts[2];unit=parts[3]||(jQuery.cssNumber[prop]?"":"px");if(unit!=="px"&&start){start=jQuery.css(tween.elem,prop,true)||end||1;do{scale=scale||".5";start=start/scale;jQuery.style(tween.elem,prop,start+unit);}while(scale!==(scale=tween.cur()/target)&&scale!==1&&--maxIterations);}
tween.unit=unit;tween.start=start;tween.end=parts[1]?start+(parts[1]+1)*end:end;}
return tween;}]};function createFxNow(){setTimeout(function(){fxNow=undefined;});return(fxNow=jQuery.now());}
function createTweens(animation,props){jQuery.each(props,function(prop,value){var collection=(tweeners[prop]||[]).concat(tweeners["*"]),index=0,length=collection.length;for(;index<length;index++){if(collection[index].call(animation,prop,value)){return;}}});}
function Animation(elem,properties,options){var result,stopped,index=0,length=animationPrefilters.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;}else{deferred.resolveWith(elem,[animation]);return false;}},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(true,{specialEasing:{}},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.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=animationPrefilters[index].call(animation,elem,props,animation.opts);if(result){return result;}}
createTweens(animation,props);if(jQuery.isFunction(animation.opts.start)){animation.opts.start.call(elem,animation);}
jQuery.fx.timer(jQuery.extend(tick,{elem:elem,anim:animation,queue:animation.opts.queue}));return animation.progress(animation.opts.progress).done(animation.opts.done,animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);}
function propFilter(props,specialEasing){var value,name,index,easing,hooks;for(index in props){name=jQuery.camelCase(index);easing=specialEasing[name];value=props[index];if(jQuery.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;}}}
jQuery.Animation=jQuery.extend(Animation,{tweener:function(props,callback){if(jQuery.isFunction(props)){callback=props;props=["*"];}else{props=props.split(" ");}
var prop,index=0,length=props.length;for(;index<length;index++){prop=props[index];tweeners[prop]=tweeners[prop]||[];tweeners[prop].unshift(callback);}},prefilter:function(callback,prepend){if(prepend){animationPrefilters.unshift(callback);}else{animationPrefilters.push(callback);}}});function defaultPrefilter(elem,props,opts){var prop,index,length,value,dataShow,toggle,tween,hooks,oldfire,anim=this,style=elem.style,orig={},handled=[],hidden=elem.nodeType&&isHidden(elem);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();}});});}
if(elem.nodeType===1&&("height"in props||"width"in props)){opts.overflow=[style.overflow,style.overflowX,style.overflowY];if(jQuery.css(elem,"display")==="inline"&&jQuery.css(elem,"float")==="none"){if(!jQuery.support.inlineBlockNeedsLayout||css_defaultDisplay(elem.nodeName)==="inline"){style.display="inline-block";}else{style.zoom=1;}}}
if(opts.overflow){style.overflow="hidden";if(!jQuery.support.shrinkWrapBlocks){anim.always(function(){style.overflow=opts.overflow[0];style.overflowX=opts.overflow[1];style.overflowY=opts.overflow[2];});}}
for(index in props){value=props[index];if(rfxtypes.exec(value)){delete props[index];toggle=toggle||value==="toggle";if(value===(hidden?"hide":"show")){continue;}
handled.push(index);}}
length=handled.length;if(length){dataShow=jQuery._data(elem,"fxshow")||jQuery._data(elem,"fxshow",{});if("hidden"in dataShow){hidden=dataShow.hidden;}
if(toggle){dataShow.hidden=!hidden;}
if(hidden){jQuery(elem).show();}else{anim.done(function(){jQuery(elem).hide();});}
anim.done(function(){var prop;jQuery._removeData(elem,"fxshow");for(prop in orig){jQuery.style(elem,prop,orig[prop]);}});for(index=0;index<length;index++){prop=handled[index];tween=anim.createTween(prop,hidden?dataShow[prop]:0);orig[prop]=dataShow[prop]||jQuery.style(elem,prop);if(!(prop in dataShow)){dataShow[prop]=tween.start;if(hidden){tween.end=tween.start;tween.start=prop==="width"||prop==="height"?1:0;}}}}}
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||"swing";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[tween.prop]!=null&&(!tween.elem.style||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.style&&(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.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.fn.extend({fadeTo:function(speed,to,easing,callback){return this.filter(isHidden).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);doAnimation.finish=function(){anim.stop(true);};if(empty||jQuery._data(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=jQuery._data(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=jQuery._data(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.cur&&hooks.cur.finish){hooks.cur.finish.call(this);}
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;});}});function genFx(type,includeWidth){var which,attrs={height:type},i=0;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;}
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.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};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:opt.duration in jQuery.fx.speeds?jQuery.fx.speeds[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.easing={linear:function(p){return p;},swing:function(p){return 0.5-Math.cos(p*Math.PI)/2;}};jQuery.timers=[];jQuery.fx=Tween.prototype.init;jQuery.fx.tick=function(){var timer,timers=jQuery.timers,i=0;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){if(timer()&&jQuery.timers.push(timer)){jQuery.fx.start();}};jQuery.fx.interval=13;jQuery.fx.start=function(){if(!timerId){timerId=setInterval(jQuery.fx.tick,jQuery.fx.interval);}};jQuery.fx.stop=function(){clearInterval(timerId);timerId=null;};jQuery.fx.speeds={slow:600,fast:200,_default:400};jQuery.fx.step={};if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};}
jQuery.fn.offset=function(options){if(arguments.length){return options===undefined?this:this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
var docElem,win,box={top:0,left:0},elem=this[0],doc=elem&&elem.ownerDocument;if(!doc){return;}
docElem=doc.documentElement;if(!jQuery.contains(docElem,elem)){return box;}
if(typeof elem.getBoundingClientRect!==core_strundefined){box=elem.getBoundingClientRect();}
win=getWindow(doc);return{top:box.top+(win.pageYOffset||docElem.scrollTop)-(docElem.clientTop||0),left:box.left+(win.pageXOffset||docElem.scrollLeft)-(docElem.clientLeft||0)};};jQuery.offset={setOffset:function(elem,options,i){var position=jQuery.css(elem,"position");if(position==="static"){elem.style.position="relative";}
var curElem=jQuery(elem),curOffset=curElem.offset(),curCSSTop=jQuery.css(elem,"top"),curCSSLeft=jQuery.css(elem,"left"),calculatePosition=(position==="absolute"||position==="fixed")&&jQuery.inArray("auto",[curCSSTop,curCSSLeft])>-1,props={},curPosition={},curTop,curLeft;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,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({position:function(){if(!this[0]){return;}
var offsetParent,offset,parentOffset={top:0,left:0},elem=this[0];if(jQuery.css(elem,"position")==="fixed"){offset=elem.getBoundingClientRect();}else{offsetParent=this.offsetParent();offset=this.offset();if(!jQuery.nodeName(offsetParent[0],"html")){parentOffset=offsetParent.offset();}
parentOffset.top+=jQuery.css(offsetParent[0],"borderTopWidth",true);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||document.documentElement;while(offsetParent&&(!jQuery.nodeName(offsetParent,"html")&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent;}
return offsetParent||document.documentElement;});}});jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(method,prop){var top=/Y/.test(prop);jQuery.fn[method]=function(val){return jQuery.access(this,function(elem,method,val){var win=getWindow(elem);if(val===undefined){return win?(prop in win)?win[prop]:win.document.documentElement[method]:elem[method];}
if(win){win.scrollTo(!top?val:jQuery(win).scrollLeft(),top?val:jQuery(win).scrollTop());}else{elem[method]=val;}},method,val,arguments.length,null);};});function getWindow(elem){return jQuery.isWindow(elem)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false;}
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 jQuery.access(this,function(elem,type,value){var doc;if(jQuery.isWindow(elem)){return 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,null);};});});window.jQuery=window.$=jQuery;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return jQuery;});}})(window);;(function(){var undefined;var arrayPool=[],objectPool=[];var idCounter=0;var keyPrefix=+new Date+'';var largeArraySize=75;var maxPoolSize=40;var whitespace=(' \t\x0B\f\xA0\ufeff'+'\n\r\u2028\u2029'+'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000');var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reFuncName=/^function[ \n\r\t]+\w/;var reInterpolate=/<%=([\s\S]+?)%>/g;var reLeadingSpacesAndZeros=RegExp('^['+whitespace+']*0+(?=.$)');var reNoMatch=/($^)/;var reThis=/\bthis\b/;var reUnescapedString=/['\n\r\t\u2028\u2029\\]/g;var contextProps=['Array','Boolean','Date','Function','Math','Number','Object','RegExp','String','_','attachEvent','clearTimeout','isFinite','isNaN','parseInt','setImmediate','setTimeout'];var templateCounter=0;var argsClass='[object Arguments]',arrayClass='[object Array]',boolClass='[object Boolean]',dateClass='[object Date]',funcClass='[object Function]',numberClass='[object Number]',objectClass='[object Object]',regexpClass='[object RegExp]',stringClass='[object String]';var cloneableClasses={};cloneableClasses[funcClass]=false;cloneableClasses[argsClass]=cloneableClasses[arrayClass]=cloneableClasses[boolClass]=cloneableClasses[dateClass]=cloneableClasses[numberClass]=cloneableClasses[objectClass]=cloneableClasses[regexpClass]=cloneableClasses[stringClass]=true;var debounceOptions={'leading':false,'maxWait':0,'trailing':false};var descriptor={'configurable':false,'enumerable':false,'value':null,'writable':false};var objectTypes={'boolean':false,'function':true,'object':true,'number':false,'string':false,'undefined':false};var stringEscapes={'\\':'\\',"'":"'",'\n':'n','\r':'r','\t':'t','\u2028':'u2028','\u2029':'u2029'};var root=(objectTypes[typeof window]&&window)||this;var freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports;var freeGlobal=objectTypes[typeof global]&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)){root=freeGlobal;}
function baseIndexOf(array,value,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0;while(++index<length){if(array[index]===value){return index;}}
return-1;}
function cacheIndexOf(cache,value){var type=typeof value;cache=cache.cache;if(type=='boolean'||value==null){return cache[value]?0:-1;}
if(type!='number'&&type!='string'){type='object';}
var key=type=='number'?value:keyPrefix+value;cache=(cache=cache[type])&&cache[key];return type=='object'?(cache&&baseIndexOf(cache,value)>-1?0:-1):(cache?0:-1);}
function cachePush(value){var cache=this.cache,type=typeof value;if(type=='boolean'||value==null){cache[value]=true;}else{if(type!='number'&&type!='string'){type='object';}
var key=type=='number'?value:keyPrefix+value,typeCache=cache[type]||(cache[type]={});if(type=='object'){(typeCache[key]||(typeCache[key]=[])).push(value);}else{typeCache[key]=true;}}}
function charAtCallback(value){return value.charCodeAt(0);}
function compareAscending(a,b){var ac=a.criteria,bc=b.criteria;if(ac!==bc){if(ac>bc||typeof ac=='undefined'){return 1;}
if(ac<bc||typeof bc=='undefined'){return-1;}}
return a.index-b.index;}
function createCache(array){var index=-1,length=array.length,first=array[0],mid=array[(length/2)|0],last=array[length-1];if(first&&typeof first=='object'&&mid&&typeof mid=='object'&&last&&typeof last=='object'){return false;}
var cache=getObject();cache['false']=cache['null']=cache['true']=cache['undefined']=false;var result=getObject();result.array=array;result.cache=cache;result.push=cachePush;while(++index<length){result.push(array[index]);}
return result;}
function escapeStringChar(match){return'\\'+stringEscapes[match];}
function getArray(){return arrayPool.pop()||[];}
function getObject(){return objectPool.pop()||{'array':null,'cache':null,'criteria':null,'false':false,'index':0,'null':false,'number':null,'object':null,'push':null,'string':null,'true':false,'undefined':false,'value':null};}
function noop(){}
function releaseArray(array){array.length=0;if(arrayPool.length<maxPoolSize){arrayPool.push(array);}}
function releaseObject(object){var cache=object.cache;if(cache){releaseObject(cache);}
object.array=object.cache=object.criteria=object.object=object.number=object.string=object.value=null;if(objectPool.length<maxPoolSize){objectPool.push(object);}}
function slice(array,start,end){start||(start=0);if(typeof end=='undefined'){end=array?array.length:0;}
var index=-1,length=end-start||0,result=Array(length<0?0:length);while(++index<length){result[index]=array[start+index];}
return result;}
function runInContext(context){context=context?_.defaults(root.Object(),context,_.pick(root,contextProps)):root;var Array=context.Array,Boolean=context.Boolean,Date=context.Date,Function=context.Function,Math=context.Math,Number=context.Number,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;var arrayRef=[];var objectProto=Object.prototype;var oldDash=context._;var reNative=RegExp('^'+
String(objectProto.valueOf).replace(/[.*+?^${}()|[\]\\]/g,'\\$&').replace(/valueOf|for [^\]]+/g,'.+?')+'$');var ceil=Math.ceil,clearTimeout=context.clearTimeout,floor=Math.floor,fnToString=Function.prototype.toString,getPrototypeOf=reNative.test(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,hasOwnProperty=objectProto.hasOwnProperty,now=reNative.test(now=Date.now)&&now||function(){return+new Date;},push=arrayRef.push,setImmediate=context.setImmediate,setTimeout=context.setTimeout,splice=arrayRef.splice,toString=objectProto.toString,unshift=arrayRef.unshift;var defineProperty=(function(){try{var o={},func=reNative.test(func=Object.defineProperty)&&func,result=func(o,o,o)&&func;}catch(e){}
return result;}());var nativeBind=reNative.test(nativeBind=toString.bind)&&nativeBind,nativeCreate=reNative.test(nativeCreate=Object.create)&&nativeCreate,nativeIsArray=reNative.test(nativeIsArray=Array.isArray)&&nativeIsArray,nativeIsFinite=context.isFinite,nativeIsNaN=context.isNaN,nativeKeys=reNative.test(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,nativeParseInt=context.parseInt,nativeRandom=Math.random,nativeSlice=arrayRef.slice;var isIeOpera=reNative.test(context.attachEvent),isV8=nativeBind&&!/\n|true/.test(nativeBind+isIeOpera);var ctorByClass={};ctorByClass[arrayClass]=Array;ctorByClass[boolClass]=Boolean;ctorByClass[dateClass]=Date;ctorByClass[funcClass]=Function;ctorByClass[objectClass]=Object;ctorByClass[numberClass]=Number;ctorByClass[regexpClass]=RegExp;ctorByClass[stringClass]=String;function lodash(value){return(value&&typeof value=='object'&&!isArray(value)&&hasOwnProperty.call(value,'__wrapped__'))?value:new lodashWrapper(value);}
function lodashWrapper(value,chainAll){this.__chain__=!!chainAll;this.__wrapped__=value;}
lodashWrapper.prototype=lodash.prototype;var support=lodash.support={};support.fastBind=nativeBind&&!isV8;support.funcDecomp=!reNative.test(context.WinRTError)&&reThis.test(runInContext);support.funcNames=typeof Function.name=='string';lodash.templateSettings={'escape':/<%-([\s\S]+?)%>/g,'evaluate':/<%([\s\S]+?)%>/g,'interpolate':reInterpolate,'variable':'','imports':{'_':lodash}};function baseClone(value,deep,callback,stackA,stackB){if(callback){var result=callback(value);if(typeof result!='undefined'){return result;}}
var isObj=isObject(value);if(isObj){var className=toString.call(value);if(!cloneableClasses[className]){return value;}
var ctor=ctorByClass[className];switch(className){case boolClass:case dateClass:return new ctor(+value);case numberClass:case stringClass:return new ctor(value);case regexpClass:result=ctor(value.source,reFlags.exec(value));result.lastIndex=value.lastIndex;return result;}}else{return value;}
var isArr=isArray(value);if(deep){var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length];}}
result=isArr?ctor(value.length):{};}
else{result=isArr?slice(value):assign({},value);}
if(isArr){if(hasOwnProperty.call(value,'index')){result.index=value.index;}
if(hasOwnProperty.call(value,'input')){result.input=value.input;}}
if(!deep){return result;}
stackA.push(value);stackB.push(result);(isArr?forEach:forOwn)(value,function(objValue,key){result[key]=baseClone(objValue,deep,callback,stackA,stackB);});if(initedStack){releaseArray(stackA);releaseArray(stackB);}
return result;}
function baseCreateCallback(func,thisArg,argCount){if(typeof func!='function'){return identity;}
if(typeof thisArg=='undefined'){return func;}
var bindData=func.__bindData__||(support.funcNames&&!func.name);if(typeof bindData=='undefined'){var source=reThis&&fnToString.call(func);if(!support.funcNames&&source&&!reFuncName.test(source)){bindData=true;}
if(support.funcNames||!bindData){bindData=!support.funcDecomp||reThis.test(source);setBindData(func,bindData);}}
if(bindData!==true&&(bindData&&bindData[1]&1)){return func;}
switch(argCount){case 1:return function(value){return func.call(thisArg,value);};case 2:return function(a,b){return func.call(thisArg,a,b);};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection);};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection);};}
return bind(func,thisArg);}
function baseFlatten(array,isShallow,isArgArrays,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value&&typeof value=='object'&&typeof value.length=='number'&&(isArray(value)||isArguments(value))){if(!isShallow){value=baseFlatten(value,isShallow,isArgArrays);}
var valIndex=-1,valLength=value.length,resIndex=result.length;result.length+=valLength;while(++valIndex<valLength){result[resIndex++]=value[valIndex];}}else if(!isArgArrays){result.push(value);}}
return result;}
function baseIsEqual(a,b,callback,isWhere,stackA,stackB){if(callback){var result=callback(a,b);if(typeof result!='undefined'){return!!result;}}
if(a===b){return a!==0||(1/a==1/b);}
var type=typeof a,otherType=typeof b;if(a===a&&!(a&&objectTypes[type])&&!(b&&objectTypes[otherType])){return false;}
if(a==null||b==null){return a===b;}
var className=toString.call(a),otherClass=toString.call(b);if(className==argsClass){className=objectClass;}
if(otherClass==argsClass){otherClass=objectClass;}
if(className!=otherClass){return false;}
switch(className){case boolClass:case dateClass:return+a==+b;case numberClass:return(a!=+a)?b!=+b:(a==0?(1/a==1/b):a==+b);case regexpClass:case stringClass:return a==String(b);}
var isArr=className==arrayClass;if(!isArr){if(hasOwnProperty.call(a,'__wrapped__ ')||hasOwnProperty.call(b,'__wrapped__')){return baseIsEqual(a.__wrapped__||a,b.__wrapped__||b,callback,isWhere,stackA,stackB);}
if(className!=objectClass){return false;}
var ctorA=a.constructor,ctorB=b.constructor;if(ctorA!=ctorB&&!(isFunction(ctorA)&&ctorA instanceof ctorA&&isFunction(ctorB)&&ctorB instanceof ctorB)){return false;}}
var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==a){return stackB[length]==b;}}
var size=0;result=true;stackA.push(a);stackB.push(b);if(isArr){length=a.length;size=b.length;result=size==a.length;if(!result&&!isWhere){return result;}
while(size--){var index=length,value=b[size];if(isWhere){while(index--){if((result=baseIsEqual(a[index],value,callback,isWhere,stackA,stackB))){break;}}}else if(!(result=baseIsEqual(a[size],value,callback,isWhere,stackA,stackB))){break;}}
return result;}
forIn(b,function(value,key,b){if(hasOwnProperty.call(b,key)){size++;return(result=hasOwnProperty.call(a,key)&&baseIsEqual(a[key],value,callback,isWhere,stackA,stackB));}});if(result&&!isWhere){forIn(a,function(value,key,a){if(hasOwnProperty.call(a,key)){return(result=--size>-1);}});}
if(initedStack){releaseArray(stackA);releaseArray(stackB);}
return result;}
function baseMerge(object,source,callback,stackA,stackB){(isArray(source)?forEach:forOwn)(source,function(source,key){var found,isArr,result=source,value=object[key];if(source&&((isArr=isArray(source))||isPlainObject(source))){var stackLength=stackA.length;while(stackLength--){if((found=stackA[stackLength]==source)){value=stackB[stackLength];break;}}
if(!found){var isShallow;if(callback){result=callback(value,source);if((isShallow=typeof result!='undefined')){value=result;}}
if(!isShallow){value=isArr?(isArray(value)?value:[]):(isPlainObject(value)?value:{});}
stackA.push(source);stackB.push(value);if(!isShallow){baseMerge(value,source,callback,stackA,stackB);}}}
else{if(callback){result=callback(value,source);if(typeof result=='undefined'){result=source;}}
if(typeof result!='undefined'){value=result;}}
object[key]=value;});}
function baseUniq(array,isSorted,callback){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,result=[];var isLarge=!isSorted&&length>=largeArraySize&&indexOf===baseIndexOf,seen=(callback||isLarge)?getArray():result;if(isLarge){var cache=createCache(seen);if(cache){indexOf=cacheIndexOf;seen=cache;}else{isLarge=false;seen=callback?seen:(releaseArray(seen),result);}}
while(++index<length){var value=array[index],computed=callback?callback(value,index,array):value;if(isSorted?!index||seen[seen.length-1]!==computed:indexOf(seen,computed)<0){if(callback||isLarge){seen.push(computed);}
result.push(value);}}
if(isLarge){releaseArray(seen.array);releaseObject(seen);}else if(callback){releaseArray(seen);}
return result;}
function createAggregator(setter){return function(collection,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=='number'){while(++index<length){var value=collection[index];setter(result,value,callback(value,index,collection),collection);}}else{forOwn(collection,function(value,key,collection){setter(result,value,callback(value,key,collection),collection);});}
return result;};}
function createBound(func,bitmask,partialArgs,partialRightArgs,thisArg,arity){var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,isPartial=bitmask&16,isPartialRight=bitmask&32,key=func;if(!isBindKey&&!isFunction(func)){throw new TypeError;}
if(isPartial&&!partialArgs.length){bitmask&=~16;isPartial=partialArgs=false;}
if(isPartialRight&&!partialRightArgs.length){bitmask&=~32;isPartialRight=partialRightArgs=false;}
var bindData=func&&func.__bindData__;if(bindData){if(isBind&&!(bindData[1]&1)){bindData[4]=thisArg;}
if(!isBind&&bindData[1]&1){bitmask|=8;}
if(isCurry&&!(bindData[1]&4)){bindData[5]=arity;}
if(isPartial){push.apply(bindData[2]||(bindData[2]=[]),partialArgs);}
if(isPartialRight){push.apply(bindData[3]||(bindData[3]=[]),partialRightArgs);}
bindData[1]|=bitmask;return createBound.apply(null,bindData);}
if(isBind&&!(isBindKey||isCurry||isPartialRight)&&(support.fastBind||(nativeBind&&isPartial))){if(isPartial){var args=[thisArg];push.apply(args,partialArgs);}
var bound=isPartial?nativeBind.apply(func,args):nativeBind.call(func,thisArg);}
else{bound=function(){var args=arguments,thisBinding=isBind?thisArg:this;if(isCurry||isPartial||isPartialRight){args=nativeSlice.call(args);if(isPartial){unshift.apply(args,partialArgs);}
if(isPartialRight){push.apply(args,partialRightArgs);}
if(isCurry&&args.length<arity){bitmask|=16&~32;return createBound(func,(isCurryBound?bitmask:bitmask&~3),args,null,thisArg,arity);}}
if(isBindKey){func=thisBinding[key];}
if(this instanceof bound){thisBinding=createObject(func.prototype);var result=func.apply(thisBinding,args);return isObject(result)?result:thisBinding;}
return func.apply(thisBinding,args);};}
setBindData(bound,nativeSlice.call(arguments));return bound;}
function createObject(prototype){return isObject(prototype)?nativeCreate(prototype):{};}
if(!nativeCreate){createObject=function(prototype){if(isObject(prototype)){noop.prototype=prototype;var result=new noop;noop.prototype=null;}
return result||{};};}
function escapeHtmlChar(match){return htmlEscapes[match];}
function getIndexOf(){var result=(result=lodash.indexOf)===indexOf?baseIndexOf:result;return result;}
var setBindData=!defineProperty?noop:function(func,value){descriptor.value=value;defineProperty(func,'__bindData__',descriptor);};function shimIsPlainObject(value){var ctor,result;if(!(value&&toString.call(value)==objectClass)||(ctor=value.constructor,isFunction(ctor)&&!(ctor instanceof ctor))){return false;}
forIn(value,function(value,key){result=key;});return typeof result=='undefined'||hasOwnProperty.call(value,result);}
function unescapeHtmlChar(match){return htmlUnescapes[match];}
function isArguments(value){return value&&typeof value=='object'&&typeof value.length=='number'&&toString.call(value)==argsClass||false;}
var isArray=nativeIsArray||function(value){return value&&typeof value=='object'&&typeof value.length=='number'&&toString.call(value)==arrayClass||false;};var shimKeys=function(object){var index,iterable=object,result=[];if(!iterable)return result;if(!(objectTypes[typeof object]))return result;for(index in iterable){if(hasOwnProperty.call(iterable,index)){result.push(index);}}
return result};var keys=!nativeKeys?shimKeys:function(object){if(!isObject(object)){return[];}
return nativeKeys(object);};var htmlEscapes={'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'};var htmlUnescapes=invert(htmlEscapes);var reEscapedHtml=RegExp('('+keys(htmlUnescapes).join('|')+')','g'),reUnescapedHtml=RegExp('['+keys(htmlEscapes).join('')+']','g');var assign=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=='number'?2:args.length;if(argsLength>3&&typeof args[argsLength-2]=='function'){var callback=baseCreateCallback(args[--argsLength-1],args[argsLength--],2);}else if(argsLength>2&&typeof args[argsLength-1]=='function'){callback=args[--argsLength];}
while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];result[index]=callback?callback(result[index],iterable[index]):iterable[index];}}}
return result};function clone(value,deep,callback,thisArg){if(typeof deep!='boolean'&&deep!=null){thisArg=callback;callback=deep;deep=false;}
return baseClone(value,deep,typeof callback=='function'&&baseCreateCallback(callback,thisArg,1));}
function cloneDeep(value,callback,thisArg){return baseClone(value,true,typeof callback=='function'&&baseCreateCallback(callback,thisArg,1));}
var defaults=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=='number'?2:args.length;while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(typeof result[index]=='undefined')result[index]=iterable[index];}}}
return result};function findKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){if(callback(value,key,object)){result=key;return false;}});return result;}
function findLastKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwnRight(object,function(value,key,object){if(callback(value,key,object)){result=key;return false;}});return result;}
var forIn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=='undefined'?callback:baseCreateCallback(callback,thisArg,3);for(index in iterable){if(callback(iterable[index],index,collection)===false)return result;}
return result};function forInRight(object,callback,thisArg){var pairs=[];forIn(object,function(value,key){pairs.push(key,value);});var length=pairs.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){if(callback(pairs[length--],pairs[length],object)===false){break;}}
return object;}
var forOwn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=='undefined'?callback:baseCreateCallback(callback,thisArg,3);var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(callback(iterable[index],index,collection)===false)return result;}
return result};function forOwnRight(object,callback,thisArg){var props=keys(object),length=props.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){var key=props[length];if(callback(object[key],key,object)===false){break;}}
return object;}
function functions(object){var result=[];forIn(object,function(value,key){if(isFunction(value)){result.push(key);}});return result.sort();}
function has(object,property){return object?hasOwnProperty.call(object,property):false;}
function invert(object){var index=-1,props=keys(object),length=props.length,result={};while(++index<length){var key=props[index];result[object[key]]=key;}
return result;}
function isBoolean(value){return value===true||value===false||toString.call(value)==boolClass;}
function isDate(value){return value?(typeof value=='object'&&toString.call(value)==dateClass):false;}
function isElement(value){return value?value.nodeType===1:false;}
function isEmpty(value){var result=true;if(!value){return result;}
var className=toString.call(value),length=value.length;if((className==arrayClass||className==stringClass||className==argsClass)||(className==objectClass&&typeof length=='number'&&isFunction(value.splice))){return!length;}
forOwn(value,function(){return(result=false);});return result;}
function isEqual(a,b,callback,thisArg){return baseIsEqual(a,b,typeof callback=='function'&&baseCreateCallback(callback,thisArg,2));}
function isFinite(value){return nativeIsFinite(value)&&!nativeIsNaN(parseFloat(value));}
function isFunction(value){return typeof value=='function';}
function isObject(value){return!!(value&&objectTypes[typeof value]);}
function isNaN(value){return isNumber(value)&&value!=+value;}
function isNull(value){return value===null;}
function isNumber(value){return typeof value=='number'||toString.call(value)==numberClass;}
var isPlainObject=function(value){if(!(value&&toString.call(value)==objectClass)){return false;}
var valueOf=value.valueOf,objProto=typeof valueOf=='function'&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?(value==objProto||getPrototypeOf(value)==objProto):shimIsPlainObject(value);};function isRegExp(value){return value?(typeof value=='object'&&toString.call(value)==regexpClass):false;}
function isString(value){return typeof value=='string'||toString.call(value)==stringClass;}
function isUndefined(value){return typeof value=='undefined';}
function merge(object){var args=arguments,length=2;if(!isObject(object)){return object;}
if(typeof args[2]!='number'){length=args.length;}
if(length>3&&typeof args[length-2]=='function'){var callback=baseCreateCallback(args[--length-1],args[length--],2);}else if(length>2&&typeof args[length-1]=='function'){callback=args[--length];}
var sources=nativeSlice.call(arguments,1,length),index=-1,stackA=getArray(),stackB=getArray();while(++index<length){baseMerge(object,sources[index],callback,stackA,stackB);}
releaseArray(stackA);releaseArray(stackB);return object;}
function omit(object,callback,thisArg){var indexOf=getIndexOf(),isFunc=typeof callback=='function',result={};if(isFunc){callback=lodash.createCallback(callback,thisArg,3);}else{var props=baseFlatten(arguments,true,false,1);}
forIn(object,function(value,key,object){if(isFunc?!callback(value,key,object):indexOf(props,key)<0){result[key]=value;}});return result;}
function pairs(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){var key=props[index];result[index]=[key,object[key]];}
return result;}
function pick(object,callback,thisArg){var result={};if(typeof callback!='function'){var index=-1,props=baseFlatten(arguments,true,false,1),length=isObject(object)?props.length:0;while(++index<length){var key=props[index];if(key in object){result[key]=object[key];}}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(callback(value,key,object)){result[key]=value;}});}
return result;}
function transform(object,callback,accumulator,thisArg){var isArr=isArray(object);callback=baseCreateCallback(callback,thisArg,4);if(accumulator==null){if(isArr){accumulator=[];}else{var ctor=object&&object.constructor,proto=ctor&&ctor.prototype;accumulator=createObject(proto);}}
(isArr?forEach:forOwn)(object,function(value,index,object){return callback(accumulator,value,index,object);});return accumulator;}
function values(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){result[index]=object[props[index]];}
return result;}
function at(collection){var args=arguments,index=-1,props=baseFlatten(args,true,false,1),length=(args[2]&&args[2][args[1]]===collection)?1:props.length,result=Array(length);while(++index<length){result[index]=collection[props[index]];}
return result;}
function contains(collection,target,fromIndex){var index=-1,indexOf=getIndexOf(),length=collection?collection.length:0,result=false;fromIndex=(fromIndex<0?nativeMax(0,length+fromIndex):fromIndex)||0;if(isArray(collection)){result=indexOf(collection,target,fromIndex)>-1;}else if(typeof length=='number'){result=(isString(collection)?collection.indexOf(target,fromIndex):indexOf(collection,target,fromIndex))>-1;}else{forOwn(collection,function(value){if(++index>=fromIndex){return!(result=value===target);}});}
return result;}
var countBy=createAggregator(function(result,value,key){(hasOwnProperty.call(result,key)?result[key]++:result[key]=1);});function every(collection,callback,thisArg){var result=true;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=='number'){while(++index<length){if(!(result=!!callback(collection[index],index,collection))){break;}}}else{forOwn(collection,function(value,index,collection){return(result=!!callback(value,index,collection));});}
return result;}
function filter(collection,callback,thisArg){var result=[];callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=='number'){while(++index<length){var value=collection[index];if(callback(value,index,collection)){result.push(value);}}}else{forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result.push(value);}});}
return result;}
function find(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=='number'){while(++index<length){var value=collection[index];if(callback(value,index,collection)){return value;}}}else{var result;forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false;}});return result;}}
function findLast(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forEachRight(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false;}});return result;}
function forEach(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=callback&&typeof thisArg=='undefined'?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=='number'){while(++index<length){if(callback(collection[index],index,collection)===false){break;}}}else{forOwn(collection,callback);}
return collection;}
function forEachRight(collection,callback,thisArg){var length=collection?collection.length:0;callback=callback&&typeof thisArg=='undefined'?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=='number'){while(length--){if(callback(collection[length],length,collection)===false){break;}}}else{var props=keys(collection);length=props.length;forOwn(collection,function(value,key,collection){key=props?props[--length]:--length;return callback(collection[key],key,collection);});}
return collection;}
var groupBy=createAggregator(function(result,value,key){(hasOwnProperty.call(result,key)?result[key]:result[key]=[]).push(value);});var indexBy=createAggregator(function(result,value,key){result[key]=value;});function invoke(collection,methodName){var args=nativeSlice.call(arguments,2),index=-1,isFunc=typeof methodName=='function',length=collection?collection.length:0,result=Array(typeof length=='number'?length:0);forEach(collection,function(value){result[++index]=(isFunc?methodName:value[methodName]).apply(value,args);});return result;}
function map(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=lodash.createCallback(callback,thisArg,3);if(typeof length=='number'){var result=Array(length);while(++index<length){result[index]=callback(collection[index],index,collection);}}else{result=[];forOwn(collection,function(value,key,collection){result[++index]=callback(value,key,collection);});}
return result;}
function max(collection,callback,thisArg){var computed=-Infinity,result=computed;if(!callback&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value>result){result=value;}}}else{callback=(!callback&&isString(collection))?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current>computed){computed=current;result=value;}});}
return result;}
function min(collection,callback,thisArg){var computed=Infinity,result=computed;if(!callback&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value<result){result=value;}}}else{callback=(!callback&&isString(collection))?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current<computed){computed=current;result=value;}});}
return result;}
function pluck(collection,property){var index=-1,length=collection?collection.length:0;if(typeof length=='number'){var result=Array(length);while(++index<length){result[index]=collection[index][property];}}
return result||map(collection,property);}
function reduce(collection,callback,accumulator,thisArg){if(!collection)return accumulator;var noaccum=arguments.length<3;callback=baseCreateCallback(callback,thisArg,4);var index=-1,length=collection.length;if(typeof length=='number'){if(noaccum){accumulator=collection[++index];}
while(++index<length){accumulator=callback(accumulator,collection[index],index,collection);}}else{forOwn(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)});}
return accumulator;}
function reduceRight(collection,callback,accumulator,thisArg){var noaccum=arguments.length<3;callback=baseCreateCallback(callback,thisArg,4);forEachRight(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection);});return accumulator;}
function reject(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);return filter(collection,function(value,index,collection){return!callback(value,index,collection);});}
function sample(collection,n,guard){var length=collection?collection.length:0;if(typeof length!='number'){collection=values(collection);}
if(n==null||guard){return collection?collection[random(length-1)]:undefined;}
var result=shuffle(collection);result.length=nativeMin(nativeMax(0,n),result.length);return result;}
function shuffle(collection){var index=-1,length=collection?collection.length:0,result=Array(typeof length=='number'?length:0);forEach(collection,function(value){var rand=random(++index);result[index]=result[rand];result[rand]=value;});return result;}
function size(collection){var length=collection?collection.length:0;return typeof length=='number'?length:keys(collection).length;}
function some(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=='number'){while(++index<length){if((result=callback(collection[index],index,collection))){break;}}}else{forOwn(collection,function(value,index,collection){return!(result=callback(value,index,collection));});}
return!!result;}
function sortBy(collection,callback,thisArg){var index=-1,length=collection?collection.length:0,result=Array(typeof length=='number'?length:0);callback=lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,key,collection){var object=result[++index]=getObject();object.criteria=callback(value,key,collection);object.index=index;object.value=value;});length=result.length;result.sort(compareAscending);while(length--){var object=result[length];result[length]=object.value;releaseObject(object);}
return result;}
function toArray(collection){if(collection&&typeof collection.length=='number'){return slice(collection);}
return values(collection);}
var where=filter;function compact(array){var index=-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value){result.push(value);}}
return result;}
function difference(array){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,seen=baseFlatten(arguments,true,true,1),result=[];var isLarge=length>=largeArraySize&&indexOf===baseIndexOf;if(isLarge){var cache=createCache(seen);if(cache){indexOf=cacheIndexOf;seen=cache;}else{isLarge=false;}}
while(++index<length){var value=array[index];if(indexOf(seen,value)<0){result.push(value);}}
if(isLarge){releaseObject(seen);}
return result;}
function findIndex(array,callback,thisArg){var index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length){if(callback(array[index],index,array)){return index;}}
return-1;}
function findLastIndex(array,callback,thisArg){var length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(length--){if(callback(array[length],length,array)){return length;}}
return-1;}
function first(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!='number'&&callback!=null){var index=-1;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++;}}else{n=callback;if(n==null||thisArg){return array?array[0]:undefined;}}
return slice(array,0,nativeMin(nativeMax(0,n),length));}
function flatten(array,isShallow,callback,thisArg){if(typeof isShallow!='boolean'&&isShallow!=null){thisArg=callback;callback=!(thisArg&&thisArg[isShallow]===array)?isShallow:null;isShallow=false;}
if(callback!=null){array=map(array,callback,thisArg);}
return baseFlatten(array,isShallow);}
function indexOf(array,value,fromIndex){if(typeof fromIndex=='number'){var length=array?array.length:0;fromIndex=(fromIndex<0?nativeMax(0,length+fromIndex):fromIndex||0);}else if(fromIndex){var index=sortedIndex(array,value);return array[index]===value?index:-1;}
return baseIndexOf(array,value,fromIndex);}
function initial(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!='number'&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++;}}else{n=(callback==null||thisArg)?1:callback||n;}
return slice(array,0,nativeMin(nativeMax(0,length-n),length));}
function intersection(array){var args=arguments,argsLength=args.length,argsIndex=-1,caches=getArray(),index=-1,indexOf=getIndexOf(),length=array?array.length:0,result=[],seen=getArray();while(++argsIndex<argsLength){var value=args[argsIndex];caches[argsIndex]=indexOf===baseIndexOf&&(value?value.length:0)>=largeArraySize&&createCache(argsIndex?args[argsIndex]:seen);}
outer:while(++index<length){var cache=caches[0];value=array[index];if((cache?cacheIndexOf(cache,value):indexOf(seen,value))<0){argsIndex=argsLength;(cache||seen).push(value);while(--argsIndex){cache=caches[argsIndex];if((cache?cacheIndexOf(cache,value):indexOf(args[argsIndex],value))<0){continue outer;}}
result.push(value);}}
while(argsLength--){cache=caches[argsLength];if(cache){releaseObject(cache);}}
releaseArray(caches);releaseArray(seen);return result;}
function last(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!='number'&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++;}}else{n=callback;if(n==null||thisArg){return array?array[length-1]:undefined;}}
return slice(array,nativeMax(0,length-n));}
function lastIndexOf(array,value,fromIndex){var index=array?array.length:0;if(typeof fromIndex=='number'){index=(fromIndex<0?nativeMax(0,index+fromIndex):nativeMin(fromIndex,index-1))+1;}
while(index--){if(array[index]===value){return index;}}
return-1;}
function pull(array){var args=arguments,argsIndex=0,argsLength=args.length,length=array?array.length:0;while(++argsIndex<argsLength){var index=-1,value=args[argsIndex];while(++index<length){if(array[index]===value){splice.call(array,index--,1);length--;}}}
return array;}
function range(start,end,step){start=+start||0;step=typeof step=='number'?step:(+step||1);if(end==null){end=start;start=0;}
var index=-1,length=nativeMax(0,ceil((end-start)/(step||1))),result=Array(length);while(++index<length){result[index]=start;start+=step;}
return result;}
function remove(array,callback,thisArg){var index=-1,length=array?array.length:0,result=[];callback=lodash.createCallback(callback,thisArg,3);while(++index<length){var value=array[index];if(callback(value,index,array)){result.push(value);splice.call(array,index--,1);length--;}}
return result;}
function rest(array,callback,thisArg){if(typeof callback!='number'&&callback!=null){var n=0,index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++;}}else{n=(callback==null||thisArg)?1:nativeMax(0,callback);}
return slice(array,n);}
function sortedIndex(array,value,callback,thisArg){var low=0,high=array?array.length:low;callback=callback?lodash.createCallback(callback,thisArg,1):identity;value=callback(value);while(low<high){var mid=(low+high)>>>1;(callback(array[mid])<value)?low=mid+1:high=mid;}
return low;}
function union(array){return baseUniq(baseFlatten(arguments,true,true));}
function uniq(array,isSorted,callback,thisArg){if(typeof isSorted!='boolean'&&isSorted!=null){thisArg=callback;callback=!(thisArg&&thisArg[isSorted]===array)?isSorted:null;isSorted=false;}
if(callback!=null){callback=lodash.createCallback(callback,thisArg,3);}
return baseUniq(array,isSorted,callback);}
function without(array){return difference(array,nativeSlice.call(arguments,1));}
function zip(){var array=arguments.length>1?arguments:arguments[0],index=-1,length=array?max(pluck(array,'length')):0,result=Array(length<0?0:length);while(++index<length){result[index]=pluck(array,index);}
return result;}
function zipObject(keys,values){var index=-1,length=keys?keys.length:0,result={};while(++index<length){var key=keys[index];if(values){result[key]=values[index];}else if(key){result[key[0]]=key[1];}}
return result;}
function after(n,func){if(!isFunction(func)){throw new TypeError;}
return function(){if(--n<1){return func.apply(this,arguments);}};}
function bind(func,thisArg){return arguments.length>2?createBound(func,17,nativeSlice.call(arguments,2),null,thisArg):createBound(func,1,null,null,thisArg);}
function bindAll(object){var funcs=arguments.length>1?baseFlatten(arguments,true,false,1):functions(object),index=-1,length=funcs.length;while(++index<length){var key=funcs[index];object[key]=createBound(object[key],1,null,null,object);}
return object;}
function bindKey(object,key){return arguments.length>2?createBound(key,19,nativeSlice.call(arguments,2),null,object):createBound(key,3,null,null,object);}
function compose(){var funcs=arguments,length=funcs.length;while(length--){if(!isFunction(funcs[length])){throw new TypeError;}}
return function(){var args=arguments,length=funcs.length;while(length--){args=[funcs[length].apply(this,args)];}
return args[0];};}
function createCallback(func,thisArg,argCount){var type=typeof func;if(func==null||type=='function'){return baseCreateCallback(func,thisArg,argCount);}
if(type!='object'){return function(object){return object[func];};}
var props=keys(func),key=props[0],a=func[key];if(props.length==1&&a===a&&!isObject(a)){return function(object){var b=object[key];return a===b&&(a!==0||(1/a==1/b));};}
return function(object){var length=props.length,result=false;while(length--){if(!(result=baseIsEqual(object[props[length]],func[props[length]],null,true))){break;}}
return result;};}
function curry(func,arity){arity=typeof arity=='number'?arity:(+arity||func.length);return createBound(func,4,null,null,null,arity);}
function debounce(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){throw new TypeError;}
wait=nativeMax(0,wait)||0;if(options===true){var leading=true;trailing=false;}else if(isObject(options)){leading=options.leading;maxWait='maxWait'in options&&(nativeMax(wait,options.maxWait)||0);trailing='trailing'in options?options.trailing:trailing;}
var delayed=function(){var remaining=wait-(now()-stamp);if(remaining<=0){if(maxTimeoutId){clearTimeout(maxTimeoutId);}
var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=now();result=func.apply(thisArg,args);}}else{timeoutId=setTimeout(delayed,remaining);}};var maxDelayed=function(){if(timeoutId){clearTimeout(timeoutId);}
maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||(maxWait!==wait)){lastCalled=now();result=func.apply(thisArg,args);}};return function(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId;}else{if(!maxTimeoutId&&!leading){lastCalled=stamp;}
var remaining=maxWait-(stamp-lastCalled);if(remaining<=0){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId);}
lastCalled=stamp;result=func.apply(thisArg,args);}
else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining);}}
if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait);}
if(leadingCall){result=func.apply(thisArg,args);}
return result;};}
function defer(func){if(!isFunction(func)){throw new TypeError;}
var args=nativeSlice.call(arguments,1);return setTimeout(function(){func.apply(undefined,args);},1);}
if(isV8&&moduleExports&&typeof setImmediate=='function'){defer=function(func){if(!isFunction(func)){throw new TypeError;}
return setImmediate.apply(context,arguments);};}
function delay(func,wait){if(!isFunction(func)){throw new TypeError;}
var args=nativeSlice.call(arguments,2);return setTimeout(function(){func.apply(undefined,args);},wait);}
function memoize(func,resolver){if(!isFunction(func)){throw new TypeError;}
var memoized=function(){var cache=memoized.cache,key=resolver?resolver.apply(this,arguments):keyPrefix+arguments[0];return hasOwnProperty.call(cache,key)?cache[key]:(cache[key]=func.apply(this,arguments));}
memoized.cache={};return memoized;}
function once(func){var ran,result;if(!isFunction(func)){throw new TypeError;}
return function(){if(ran){return result;}
ran=true;result=func.apply(this,arguments);func=null;return result;};}
function partial(func){return createBound(func,16,nativeSlice.call(arguments,1));}
function partialRight(func){return createBound(func,32,null,nativeSlice.call(arguments,1));}
function throttle(func,wait,options){var leading=true,trailing=true;if(!isFunction(func)){throw new TypeError;}
if(options===false){leading=false;}else if(isObject(options)){leading='leading'in options?options.leading:leading;trailing='trailing'in options?options.trailing:trailing;}
debounceOptions.leading=leading;debounceOptions.maxWait=wait;debounceOptions.trailing=trailing;var result=debounce(func,wait,debounceOptions);return result;}
function wrap(value,wrapper){if(!isFunction(wrapper)){throw new TypeError;}
return function(){var args=[value];push.apply(args,arguments);return wrapper.apply(this,args);};}
function escape(string){return string==null?'':String(string).replace(reUnescapedHtml,escapeHtmlChar);}
function identity(value){return value;}
function mixin(object,source){var ctor=object,isFunc=!source||isFunction(ctor);if(!source){ctor=lodashWrapper;source=object;object=lodash;}
forEach(functions(source),function(methodName){var func=object[methodName]=source[methodName];if(isFunc){ctor.prototype[methodName]=function(){var value=this.__wrapped__,args=[value];push.apply(args,arguments);var result=func.apply(object,args);if(value&&typeof value=='object'&&value===result){return this;}
result=new ctor(result);result.__chain__=this.__chain__;return result;};}});}
function noConflict(){context._=oldDash;return this;}
var parseInt=nativeParseInt(whitespace+'08')==8?nativeParseInt:function(value,radix){return nativeParseInt(isString(value)?value.replace(reLeadingSpacesAndZeros,''):value,radix||0);};function random(min,max,floating){var noMin=min==null,noMax=max==null;if(floating==null){if(typeof min=='boolean'&&noMax){floating=min;min=1;}
else if(!noMax&&typeof max=='boolean'){floating=max;noMax=true;}}
if(noMin&&noMax){max=1;}
min=+min||0;if(noMax){max=min;min=0;}else{max=+max||0;}
var rand=nativeRandom();return(floating||min%1||max%1)?nativeMin(min+(rand*(max-min+parseFloat('1e-'+((rand+'').length-1)))),max):min+floor(rand*(max-min+1));}
function result(object,property){if(object){var value=object[property];return isFunction(value)?object[property]():value;}}
function template(text,data,options){var settings=lodash.templateSettings;text||(text='');options=defaults({},options,settings);var imports=defaults({},options.imports,settings.imports),importsKeys=keys(imports),importsValues=values(imports);var isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+'|'+
interpolate.source+'|'+
(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+'|'+
(options.evaluate||reNoMatch).source+'|$','g');text.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=text.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){source+="' +\n__e("+escapeValue+") +\n'";}
if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '";}
if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'";}
index=offset+match.length;return match;});source+="';\n";var variable=options.variable,hasVariable=variable;if(!hasVariable){variable='obj';source='with ('+variable+') {\n'+source+'\n}\n';}
source=(isEvaluating?source.replace(reEmptyStringLeading,''):source).replace(reEmptyStringMiddle,'$1').replace(reEmptyStringTrailing,'$1;');source='function('+variable+') {\n'+
(hasVariable?'':variable+' || ('+variable+' = {});\n')+"var __t, __p = '', __e = _.escape"+
(isEvaluating?', __j = Array.prototype.join;\n'+"function print() { __p += __j.call(arguments, '') }\n":';\n')+
source+'return __p\n}';var sourceURL='\n/*\n//# sourceURL='+(options.sourceURL||'/lodash/template/source['+(templateCounter++)+']')+'\n*/';try{var result=Function(importsKeys,'return '+source+sourceURL).apply(undefined,importsValues);}catch(e){e.source=source;throw e;}
if(data){return result(data);}
result.source=source;return result;}
function times(n,callback,thisArg){n=(n=+n)>-1?n:0;var index=-1,result=Array(n);callback=baseCreateCallback(callback,thisArg,1);while(++index<n){result[index]=callback(index);}
return result;}
function unescape(string){return string==null?'':String(string).replace(reEscapedHtml,unescapeHtmlChar);}
function uniqueId(prefix){var id=++idCounter;return String(prefix==null?'':prefix)+id;}
function chain(value){value=new lodashWrapper(value);value.__chain__=true;return value;}
function tap(value,interceptor){interceptor(value);return value;}
function wrapperChain(){this.__chain__=true;return this;}
function wrapperToString(){return String(this.__wrapped__);}
function wrapperValueOf(){return this.__wrapped__;}
lodash.after=after;lodash.assign=assign;lodash.at=at;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.chain=chain;lodash.compact=compact;lodash.compose=compose;lodash.countBy=countBy;lodash.createCallback=createCallback;lodash.curry=curry;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.filter=filter;lodash.flatten=flatten;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.functions=functions;lodash.groupBy=groupBy;lodash.indexBy=indexBy;lodash.initial=initial;lodash.intersection=intersection;lodash.invert=invert;lodash.invoke=invoke;lodash.keys=keys;lodash.map=map;lodash.max=max;lodash.memoize=memoize;lodash.merge=merge;lodash.min=min;lodash.omit=omit;lodash.once=once;lodash.pairs=pairs;lodash.partial=partial;lodash.partialRight=partialRight;lodash.pick=pick;lodash.pluck=pluck;lodash.pull=pull;lodash.range=range;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.shuffle=shuffle;lodash.sortBy=sortBy;lodash.tap=tap;lodash.throttle=throttle;lodash.times=times;lodash.toArray=toArray;lodash.transform=transform;lodash.union=union;lodash.uniq=uniq;lodash.values=values;lodash.where=where;lodash.without=without;lodash.wrap=wrap;lodash.zip=zip;lodash.zipObject=zipObject;lodash.collect=map;lodash.drop=rest;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.extend=assign;lodash.methods=functions;lodash.object=zipObject;lodash.select=filter;lodash.tail=rest;lodash.unique=uniq;lodash.unzip=zip;mixin(lodash);lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.contains=contains;lodash.escape=escape;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.has=has;lodash.identity=identity;lodash.indexOf=indexOf;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isBoolean=isBoolean;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isNaN=isNaN;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isString=isString;lodash.isUndefined=isUndefined;lodash.lastIndexOf=lastIndexOf;lodash.mixin=mixin;lodash.noConflict=noConflict;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.result=result;lodash.runInContext=runInContext;lodash.size=size;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.template=template;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.all=every;lodash.any=some;lodash.detect=find;lodash.findWhere=find;lodash.foldl=reduce;lodash.foldr=reduceRight;lodash.include=contains;lodash.inject=reduce;forOwn(lodash,function(func,methodName){if(!lodash.prototype[methodName]){lodash.prototype[methodName]=function(){var args=[this.__wrapped__],chainAll=this.__chain__;push.apply(args,arguments);var result=func.apply(lodash,args);return chainAll?new lodashWrapper(result,chainAll):result;};}});lodash.first=first;lodash.last=last;lodash.sample=sample;lodash.take=first;lodash.head=first;forOwn(lodash,function(func,methodName){var callbackable=methodName!=='sample';if(!lodash.prototype[methodName]){lodash.prototype[methodName]=function(n,guard){var chainAll=this.__chain__,result=func(this.__wrapped__,n,guard);return!chainAll&&(n==null||(guard&&!(callbackable&&typeof n=='function')))?result:new lodashWrapper(result,chainAll);};}});lodash.VERSION='2.2.1';lodash.prototype.chain=wrapperChain;lodash.prototype.toString=wrapperToString;lodash.prototype.value=wrapperValueOf;lodash.prototype.valueOf=wrapperValueOf;forEach(['join','pop','shift'],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){var chainAll=this.__chain__,result=func.apply(this.__wrapped__,arguments);return chainAll?new lodashWrapper(result,chainAll):result;};});forEach(['push','reverse','sort','unshift'],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){func.apply(this.__wrapped__,arguments);return this;};});forEach(['concat','slice','splice'],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){return new lodashWrapper(func.apply(this.__wrapped__,arguments),this.__chain__);};});return lodash;}
var _=runInContext();if(typeof define=='function'&&typeof define.amd=='object'&&define.amd){root._=_;define(function(){return _;});}
else if(freeExports&&freeModule){if(moduleExports){(freeModule.exports=_)._=_;}
else{freeExports._=_;}}
else{root._=_;}}.call(this));(function(){var root=this;var previousBackbone=root.Backbone;var array=[];var push=array.push;var slice=array.slice;var splice=array.splice;var Backbone;if(typeof exports!=='undefined'){Backbone=exports;}else{Backbone=root.Backbone={};}
Backbone.VERSION='1.0.0';var _=root._;if(!_&&(typeof require!=='undefined'))_=require('underscore');Backbone.$=root.jQuery||root.Zepto||root.ender||root.$;Backbone.noConflict=function(){root.Backbone=previousBackbone;return this;};Backbone.emulateHTTP=false;Backbone.emulateJSON=false;var Events=Backbone.Events={on:function(name,callback,context){if(!eventsApi(this,'on',name,[callback,context])||!callback)return this;this._events||(this._events={});var events=this._events[name]||(this._events[name]=[]);events.push({callback:callback,context:context,ctx:context||this});return this;},once:function(name,callback,context){if(!eventsApi(this,'once',name,[callback,context])||!callback)return this;var self=this;var once=_.once(function(){self.off(name,once);callback.apply(this,arguments);});once._callback=callback;return this.on(name,once,context);},off:function(name,callback,context){var retain,ev,events,names,i,l,j,k;if(!this._events||!eventsApi(this,'off',name,[callback,context]))return this;if(!name&&!callback&&!context){this._events={};return this;}
names=name?[name]:_.keys(this._events);for(i=0,l=names.length;i<l;i++){name=names[i];if(events=this._events[name]){this._events[name]=retain=[];if(callback||context){for(j=0,k=events.length;j<k;j++){ev=events[j];if((callback&&callback!==ev.callback&&callback!==ev.callback._callback)||(context&&context!==ev.context)){retain.push(ev);}}}
if(!retain.length)delete this._events[name];}}
return this;},trigger:function(name){if(!this._events)return this;var args=slice.call(arguments,1);if(!eventsApi(this,'trigger',name,args))return this;var events=this._events[name];var allEvents=this._events.all;if(events)triggerEvents(events,args);if(allEvents)triggerEvents(allEvents,arguments);return this;},stopListening:function(obj,name,callback){var listeners=this._listeners;if(!listeners)return this;var deleteListener=!name&&!callback;if(typeof name==='object')callback=this;if(obj)(listeners={})[obj._listenerId]=obj;for(var id in listeners){listeners[id].off(name,callback,this);if(deleteListener)delete this._listeners[id];}
return this;}};var eventSplitter=/\s+/;var eventsApi=function(obj,action,name,rest){if(!name)return true;if(typeof name==='object'){for(var key in name){obj[action].apply(obj,[key,name[key]].concat(rest));}
return false;}
if(eventSplitter.test(name)){var names=name.split(eventSplitter);for(var i=0,l=names.length;i<l;i++){obj[action].apply(obj,[names[i]].concat(rest));}
return false;}
return true;};var triggerEvents=function(events,args){var ev,i=-1,l=events.length,a1=args[0],a2=args[1],a3=args[2];switch(args.length){case 0:while(++i<l)(ev=events[i]).callback.call(ev.ctx);return;case 1:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1);return;case 2:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1,a2);return;case 3:while(++i<l)(ev=events[i]).callback.call(ev.ctx,a1,a2,a3);return;default:while(++i<l)(ev=events[i]).callback.apply(ev.ctx,args);}};var listenMethods={listenTo:'on',listenToOnce:'once'};_.each(listenMethods,function(implementation,method){Events[method]=function(obj,name,callback){var listeners=this._listeners||(this._listeners={});var id=obj._listenerId||(obj._listenerId=_.uniqueId('l'));listeners[id]=obj;if(typeof name==='object')callback=this;obj[implementation](name,callback,this);return this;};});Events.bind=Events.on;Events.unbind=Events.off;_.extend(Backbone,Events);var Model=Backbone.Model=function(attributes,options){var defaults;var attrs=attributes||{};options||(options={});this.cid=_.uniqueId('c');this.attributes={};_.extend(this,_.pick(options,modelOptions));if(options.parse)attrs=this.parse(attrs,options)||{};if(defaults=_.result(this,'defaults')){attrs=_.defaults({},attrs,defaults);}
this.set(attrs,options);this.changed={};this.initialize.apply(this,arguments);};var modelOptions=['url','urlRoot','collection'];_.extend(Model.prototype,Events,{changed:null,validationError:null,idAttribute:'id',initialize:function(){},toJSON:function(options){return _.clone(this.attributes);},sync:function(){return Backbone.sync.apply(this,arguments);},get:function(attr){return this.attributes[attr];},escape:function(attr){return _.escape(this.get(attr));},has:function(attr){return this.get(attr)!=null;},set:function(key,val,options){var attr,attrs,unset,changes,silent,changing,prev,current;if(key==null)return this;if(typeof key==='object'){attrs=key;options=val;}else{(attrs={})[key]=val;}
options||(options={});if(!this._validate(attrs,options))return false;unset=options.unset;silent=options.silent;changes=[];changing=this._changing;this._changing=true;if(!changing){this._previousAttributes=_.clone(this.attributes);this.changed={};}
current=this.attributes,prev=this._previousAttributes;if(this.idAttribute in attrs)this.id=attrs[this.idAttribute];for(attr in attrs){val=attrs[attr];if(!_.isEqual(current[attr],val))changes.push(attr);if(!_.isEqual(prev[attr],val)){this.changed[attr]=val;}else{delete this.changed[attr];}
unset?delete current[attr]:current[attr]=val;}
if(!silent){if(changes.length)this._pending=true;for(var i=0,l=changes.length;i<l;i++){this.trigger('change:'+changes[i],this,current[changes[i]],options);}}
if(changing)return this;if(!silent){while(this._pending){this._pending=false;this.trigger('change',this,options);}}
this._pending=false;this._changing=false;return this;},unset:function(attr,options){return this.set(attr,void 0,_.extend({},options,{unset:true}));},clear:function(options){var attrs={};for(var key in this.attributes)attrs[key]=void 0;return this.set(attrs,_.extend({},options,{unset:true}));},hasChanged:function(attr){if(attr==null)return!_.isEmpty(this.changed);return _.has(this.changed,attr);},changedAttributes:function(diff){if(!diff)return this.hasChanged()?_.clone(this.changed):false;var val,changed=false;var old=this._changing?this._previousAttributes:this.attributes;for(var attr in diff){if(_.isEqual(old[attr],(val=diff[attr])))continue;(changed||(changed={}))[attr]=val;}
return changed;},previous:function(attr){if(attr==null||!this._previousAttributes)return null;return this._previousAttributes[attr];},previousAttributes:function(){return _.clone(this._previousAttributes);},fetch:function(options){options=options?_.clone(options):{};if(options.parse===void 0)options.parse=true;var model=this;var success=options.success;options.success=function(resp){if(!model.set(model.parse(resp,options),options))return false;if(success)success(model,resp,options);model.trigger('sync',model,resp,options);};wrapError(this,options);return this.sync('read',this,options);},save:function(key,val,options){var attrs,method,xhr,attributes=this.attributes;if(key==null||typeof key==='object'){attrs=key;options=val;}else{(attrs={})[key]=val;}
if(attrs&&(!options||!options.wait)&&!this.set(attrs,options))return false;options=_.extend({validate:true},options);if(!this._validate(attrs,options))return false;if(attrs&&options.wait){this.attributes=_.extend({},attributes,attrs);}
if(options.parse===void 0)options.parse=true;var model=this;var success=options.success;options.success=function(resp){model.attributes=attributes;var serverAttrs=model.parse(resp,options);if(options.wait)serverAttrs=_.extend(attrs||{},serverAttrs);if(_.isObject(serverAttrs)&&!model.set(serverAttrs,options)){return false;}
if(success)success(model,resp,options);model.trigger('sync',model,resp,options);};wrapError(this,options);method=this.isNew()?'create':(options.patch?'patch':'update');if(method==='patch')options.attrs=attrs;xhr=this.sync(method,this,options);if(attrs&&options.wait)this.attributes=attributes;return xhr;},destroy:function(options){options=options?_.clone(options):{};var model=this;var success=options.success;var destroy=function(){model.trigger('destroy',model,model.collection,options);};options.success=function(resp){if(options.wait||model.isNew())destroy();if(success)success(model,resp,options);if(!model.isNew())model.trigger('sync',model,resp,options);};if(this.isNew()){options.success();return false;}
wrapError(this,options);var xhr=this.sync('delete',this,options);if(!options.wait)destroy();return xhr;},url:function(){var base=_.result(this,'urlRoot')||_.result(this.collection,'url')||urlError();if(this.isNew())return base;return base+(base.charAt(base.length-1)==='/'?'':'/')+encodeURIComponent(this.id);},parse:function(resp,options){return resp;},clone:function(){return new this.constructor(this.attributes);},isNew:function(){return this.id==null;},isValid:function(options){return this._validate({},_.extend(options||{},{validate:true}));},_validate:function(attrs,options){if(!options.validate||!this.validate)return true;attrs=_.extend({},this.attributes,attrs);var error=this.validationError=this.validate(attrs,options)||null;if(!error)return true;this.trigger('invalid',this,error,_.extend(options||{},{validationError:error}));return false;}});var modelMethods=['keys','values','pairs','invert','pick','omit'];_.each(modelMethods,function(method){Model.prototype[method]=function(){var args=slice.call(arguments);args.unshift(this.attributes);return _[method].apply(_,args);};});var Collection=Backbone.Collection=function(models,options){options||(options={});if(options.url)this.url=options.url;if(options.model)this.model=options.model;if(options.comparator!==void 0)this.comparator=options.comparator;this._reset();this.initialize.apply(this,arguments);if(models)this.reset(models,_.extend({silent:true},options));};var setOptions={add:true,remove:true,merge:true};var addOptions={add:true,merge:false,remove:false};_.extend(Collection.prototype,Events,{model:Model,initialize:function(){},toJSON:function(options){return this.map(function(model){return model.toJSON(options);});},sync:function(){return Backbone.sync.apply(this,arguments);},add:function(models,options){return this.set(models,_.defaults(options||{},addOptions));},remove:function(models,options){models=_.isArray(models)?models.slice():[models];options||(options={});var i,l,index,model;for(i=0,l=models.length;i<l;i++){model=this.get(models[i]);if(!model)continue;delete this._byId[model.id];delete this._byId[model.cid];index=this.indexOf(model);this.models.splice(index,1);this.length--;if(!options.silent){options.index=index;model.trigger('remove',model,this,options);}
this._removeReference(model);}
return this;},set:function(models,options){options=_.defaults(options||{},setOptions);if(options.parse)models=this.parse(models,options);if(!_.isArray(models))models=models?[models]:[];var i,l,model,attrs,existing,sort;var at=options.at;var sortable=this.comparator&&(at==null)&&options.sort!==false;var sortAttr=_.isString(this.comparator)?this.comparator:null;var toAdd=[],toRemove=[],modelMap={};for(i=0,l=models.length;i<l;i++){if(!(model=this._prepareModel(models[i],options)))continue;if(existing=this.get(model)){if(options.remove)modelMap[existing.cid]=true;if(options.merge){existing.set(model.attributes,options);if(sortable&&!sort&&existing.hasChanged(sortAttr))sort=true;}}else if(options.add){toAdd.push(model);model.on('all',this._onModelEvent,this);this._byId[model.cid]=model;if(model.id!=null)this._byId[model.id]=model;}}
if(options.remove){for(i=0,l=this.length;i<l;++i){if(!modelMap[(model=this.models[i]).cid])toRemove.push(model);}
if(toRemove.length)this.remove(toRemove,options);}
if(toAdd.length){if(sortable)sort=true;this.length+=toAdd.length;if(at!=null){splice.apply(this.models,[at,0].concat(toAdd));}else{push.apply(this.models,toAdd);}}
if(sort)this.sort({silent:true});if(options.silent)return this;for(i=0,l=toAdd.length;i<l;i++){(model=toAdd[i]).trigger('add',model,this,options);}
if(sort)this.trigger('sort',this,options);return this;},reset:function(models,options){options||(options={});for(var i=0,l=this.models.length;i<l;i++){this._removeReference(this.models[i]);}
options.previousModels=this.models;this._reset();this.add(models,_.extend({silent:true},options));if(!options.silent)this.trigger('reset',this,options);return this;},push:function(model,options){model=this._prepareModel(model,options);this.add(model,_.extend({at:this.length},options));return model;},pop:function(options){var model=this.at(this.length-1);this.remove(model,options);return model;},unshift:function(model,options){model=this._prepareModel(model,options);this.add(model,_.extend({at:0},options));return model;},shift:function(options){var model=this.at(0);this.remove(model,options);return model;},slice:function(begin,end){return this.models.slice(begin,end);},get:function(obj){if(obj==null)return void 0;return this._byId[obj.id!=null?obj.id:obj.cid||obj];},at:function(index){return this.models[index];},where:function(attrs,first){if(_.isEmpty(attrs))return first?void 0:[];return this[first?'find':'filter'](function(model){for(var key in attrs){if(attrs[key]!==model.get(key))return false;}
return true;});},findWhere:function(attrs){return this.where(attrs,true);},sort:function(options){if(!this.comparator)throw new Error('Cannot sort a set without a comparator');options||(options={});if(_.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this);}else{this.models.sort(_.bind(this.comparator,this));}
if(!options.silent)this.trigger('sort',this,options);return this;},sortedIndex:function(model,value,context){value||(value=this.comparator);var iterator=_.isFunction(value)?value:function(model){return model.get(value);};return _.sortedIndex(this.models,model,iterator,context);},pluck:function(attr){return _.invoke(this.models,'get',attr);},fetch:function(options){options=options?_.clone(options):{};if(options.parse===void 0)options.parse=true;var success=options.success;var collection=this;options.success=function(resp){var method=options.reset?'reset':'set';collection[method](resp,options);if(success)success(collection,resp,options);collection.trigger('sync',collection,resp,options);};wrapError(this,options);return this.sync('read',this,options);},create:function(model,options){options=options?_.clone(options):{};if(!(model=this._prepareModel(model,options)))return false;if(!options.wait)this.add(model,options);var collection=this;var success=options.success;options.success=function(resp){if(options.wait)collection.add(model,options);if(success)success(model,resp,options);};model.save(null,options);return model;},parse:function(resp,options){return resp;},clone:function(){return new this.constructor(this.models);},_reset:function(){this.length=0;this.models=[];this._byId={};},_prepareModel:function(attrs,options){if(attrs instanceof Model){if(!attrs.collection)attrs.collection=this;return attrs;}
options||(options={});options.collection=this;var model=new this.model(attrs,options);if(!model._validate(attrs,options)){this.trigger('invalid',this,attrs,options);return false;}
return model;},_removeReference:function(model){if(this===model.collection)delete model.collection;model.off('all',this._onModelEvent,this);},_onModelEvent:function(event,model,collection,options){if((event==='add'||event==='remove')&&collection!==this)return;if(event==='destroy')this.remove(model,options);if(model&&event==='change:'+model.idAttribute){delete this._byId[model.previous(model.idAttribute)];if(model.id!=null)this._byId[model.id]=model;}
this.trigger.apply(this,arguments);}});var methods=['forEach','each','map','collect','reduce','foldl','inject','reduceRight','foldr','find','detect','filter','select','reject','every','all','some','any','include','contains','invoke','max','min','toArray','size','first','head','take','initial','rest','tail','drop','last','without','indexOf','shuffle','lastIndexOf','isEmpty','chain'];_.each(methods,function(method){Collection.prototype[method]=function(){var args=slice.call(arguments);args.unshift(this.models);return _[method].apply(_,args);};});var attributeMethods=['groupBy','countBy','sortBy'];_.each(attributeMethods,function(method){Collection.prototype[method]=function(value,context){var iterator=_.isFunction(value)?value:function(model){return model.get(value);};return _[method](this.models,iterator,context);};});var View=Backbone.View=function(options){this.cid=_.uniqueId('view');this._configure(options||{});this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents();};var delegateEventSplitter=/^(\S+)\s*(.*)$/;var viewOptions=['model','collection','el','id','attributes','className','tagName','events'];_.extend(View.prototype,Events,{tagName:'div',$:function(selector){return this.$el.find(selector);},initialize:function(){},render:function(){return this;},remove:function(){this.$el.remove();this.stopListening();return this;},setElement:function(element,delegate){if(this.$el)this.undelegateEvents();this.$el=element instanceof Backbone.$?element:Backbone.$(element);this.el=this.$el[0];if(delegate!==false)this.delegateEvents();return this;},delegateEvents:function(events){if(!(events||(events=_.result(this,'events'))))return this;this.undelegateEvents();for(var key in events){var method=events[key];if(!_.isFunction(method))method=this[events[key]];if(!method)continue;var match=key.match(delegateEventSplitter);var eventName=match[1],selector=match[2];method=_.bind(method,this);eventName+='.delegateEvents'+this.cid;if(selector===''){this.$el.on(eventName,method);}else{this.$el.on(eventName,selector,method);}}
return this;},undelegateEvents:function(){this.$el.off('.delegateEvents'+this.cid);return this;},_configure:function(options){if(this.options)options=_.extend({},_.result(this,'options'),options);_.extend(this,_.pick(options,viewOptions));this.options=options;},_ensureElement:function(){if(!this.el){var attrs=_.extend({},_.result(this,'attributes'));if(this.id)attrs.id=_.result(this,'id');if(this.className)attrs['class']=_.result(this,'className');var $el=Backbone.$('<'+_.result(this,'tagName')+'>').attr(attrs);this.setElement($el,false);}else{this.setElement(_.result(this,'el'),false);}}});Backbone.sync=function(method,model,options){var type=methodMap[method];_.defaults(options||(options={}),{emulateHTTP:Backbone.emulateHTTP,emulateJSON:Backbone.emulateJSON});var params={type:type,dataType:'json'};if(!options.url){params.url=_.result(model,'url')||urlError();}
if(options.data==null&&model&&(method==='create'||method==='update'||method==='patch')){params.contentType='application/json';params.data=JSON.stringify(options.attrs||model.toJSON(options));}
if(options.emulateJSON){params.contentType='application/x-www-form-urlencoded';params.data=params.data?{model:params.data}:{};}
if(options.emulateHTTP&&(type==='PUT'||type==='DELETE'||type==='PATCH')){params.type='POST';if(options.emulateJSON)params.data._method=type;var beforeSend=options.beforeSend;options.beforeSend=function(xhr){xhr.setRequestHeader('X-HTTP-Method-Override',type);if(beforeSend)return beforeSend.apply(this,arguments);};}
if(params.type!=='GET'&&!options.emulateJSON){params.processData=false;}
if(params.type==='PATCH'&&window.ActiveXObject&&!(window.external&&window.external.msActiveXFilteringEnabled)){params.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP");};}
var xhr=options.xhr=Backbone.ajax(_.extend(params,options));model.trigger('request',model,xhr,options);return xhr;};var methodMap={'create':'POST','update':'PUT','patch':'PATCH','delete':'DELETE','read':'GET'};Backbone.ajax=function(){return Backbone.$.ajax.apply(Backbone.$,arguments);};var Router=Backbone.Router=function(options){options||(options={});if(options.routes)this.routes=options.routes;this._bindRoutes();this.initialize.apply(this,arguments);};var optionalParam=/\((.*?)\)/g;var namedParam=/(\(\?)?:\w+/g;var splatParam=/\*\w+/g;var escapeRegExp=/[\-{}\[\]+?.,\\\^$|#\s]/g;_.extend(Router.prototype,Events,{initialize:function(){},route:function(route,name,callback){if(!_.isRegExp(route))route=this._routeToRegExp(route);if(_.isFunction(name)){callback=name;name='';}
if(!callback)callback=this[name];var router=this;Backbone.history.route(route,function(fragment){var args=router._extractParameters(route,fragment);callback&&callback.apply(router,args);router.trigger.apply(router,['route:'+name].concat(args));router.trigger('route',name,args);Backbone.history.trigger('route',router,name,args);});return this;},navigate:function(fragment,options){Backbone.history.navigate(fragment,options);return this;},_bindRoutes:function(){if(!this.routes)return;this.routes=_.result(this,'routes');var route,routes=_.keys(this.routes);while((route=routes.pop())!=null){this.route(route,this.routes[route]);}},_routeToRegExp:function(route){route=route.replace(escapeRegExp,'\\$&').replace(optionalParam,'(?:$1)?').replace(namedParam,function(match,optional){return optional?match:'([^\/]+)';}).replace(splatParam,'(.*?)');return new RegExp('^'+route+'$');},_extractParameters:function(route,fragment){var params=route.exec(fragment).slice(1);return _.map(params,function(param){return param?decodeURIComponent(param):null;});}});var History=Backbone.History=function(){this.handlers=[];_.bindAll(this,'checkUrl');if(typeof window!=='undefined'){this.location=window.location;this.history=window.history;}};var routeStripper=/^[#\/]|\s+$/g;var rootStripper=/^\/+|\/+$/g;var isExplorer=/msie [\w.]+/;var trailingSlash=/\/$/;History.started=false;_.extend(History.prototype,Events,{interval:50,getHash:function(window){var match=(window||this).location.href.match(/#(.*)$/);return match?match[1]:'';},getFragment:function(fragment,forcePushState){if(fragment==null){if(this._hasPushState||!this._wantsHashChange||forcePushState){fragment=this.location.pathname;var root=this.root.replace(trailingSlash,'');if(!fragment.indexOf(root))fragment=fragment.substr(root.length);}else{fragment=this.getHash();}}
return fragment.replace(routeStripper,'');},start:function(options){if(History.started)throw new Error("Backbone.history has already been started");History.started=true;this.options=_.extend({},{root:'/'},this.options,options);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var fragment=this.getFragment();var docMode=document.documentMode;var oldIE=(isExplorer.exec(navigator.userAgent.toLowerCase())&&(!docMode||docMode<=7));this.root=('/'+this.root+'/').replace(rootStripper,'/');if(oldIE&&this._wantsHashChange){this.iframe=Backbone.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;this.navigate(fragment);}
if(this._hasPushState){Backbone.$(window).on('popstate',this.checkUrl);}else if(this._wantsHashChange&&('onhashchange'in window)&&!oldIE){Backbone.$(window).on('hashchange',this.checkUrl);}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval);}
this.fragment=fragment;var loc=this.location;var atRoot=loc.pathname.replace(/[^\/]$/,'$&/')===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!atRoot){this.fragment=this.getFragment(null,true);this.location.replace(this.root+this.location.search+'#'+this.fragment);return true;}else if(this._wantsPushState&&this._hasPushState&&atRoot&&loc.hash){this.fragment=this.getHash().replace(routeStripper,'');this.history.replaceState({},document.title,this.root+this.fragment+loc.search);}
if(!this.options.silent)return this.loadUrl();},stop:function(){Backbone.$(window).off('popstate',this.checkUrl).off('hashchange',this.checkUrl);clearInterval(this._checkUrlInterval);History.started=false;},route:function(route,callback){this.handlers.unshift({route:route,callback:callback});},checkUrl:function(e){var current=this.getFragment();if(current===this.fragment&&this.iframe){current=this.getFragment(this.getHash(this.iframe));}
if(current===this.fragment)return false;if(this.iframe)this.navigate(current);this.loadUrl()||this.loadUrl(this.getHash());},loadUrl:function(fragmentOverride){var fragment=this.fragment=this.getFragment(fragmentOverride);var matched=_.any(this.handlers,function(handler){if(handler.route.test(fragment)){handler.callback(fragment);return true;}});return matched;},navigate:function(fragment,options){if(!History.started)return false;if(!options||options===true)options={trigger:options};fragment=this.getFragment(fragment||'');if(this.fragment===fragment)return;this.fragment=fragment;var url=this.root+fragment;if(this._hasPushState){this.history[options.replace?'replaceState':'pushState']({},document.title,url);}else if(this._wantsHashChange){this._updateHash(this.location,fragment,options.replace);if(this.iframe&&(fragment!==this.getFragment(this.getHash(this.iframe)))){if(!options.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,fragment,options.replace);}}else{return this.location.assign(url);}
if(options.trigger)this.loadUrl(fragment);},_updateHash:function(location,fragment,replace){if(replace){var href=location.href.replace(/(javascript:|#).*$/,'');location.replace(href+'#'+fragment);}else{location.hash='#'+fragment;}}});Backbone.history=new History;var extend=function(protoProps,staticProps){var parent=this;var child;if(protoProps&&_.has(protoProps,'constructor')){child=protoProps.constructor;}else{child=function(){return parent.apply(this,arguments);};}
_.extend(child,parent,staticProps);var Surrogate=function(){this.constructor=child;};Surrogate.prototype=parent.prototype;child.prototype=new Surrogate;if(protoProps)_.extend(child.prototype,protoProps);child.__super__=parent.prototype;return child;};Model.extend=Collection.extend=Router.extend=View.extend=History.extend=extend;var urlError=function(){throw new Error('A "url" property or function must be specified');};var wrapError=function(model,options){var error=options.error;options.error=function(resp){if(error)error(model,resp,options);model.trigger('error',model,resp,options);};};}).call(this);jQuery.fn.sortElements=(function(){var sort=[].sort;return function(comparator,getSortable){getSortable=getSortable||function(){return this;};var placements=this.map(function(){var sortElement=getSortable.call(this),parentNode=sortElement.parentNode,nextSibling=parentNode.insertBefore(document.createTextNode(''),sortElement.nextSibling);return function(){if(parentNode===this){throw new Error("You can't sort elements if any one is a descendant of another.");}
parentNode.insertBefore(this,nextSibling);parentNode.removeChild(nextSibling);};});return sort.call(this,comparator).each(function(i){placements[i].call(getSortable.call(this));});};})();if(typeof exports==='object'){var _=require('lodash');}
var joint={dia:{},ui:{},layout:{},shapes:{},format:{},util:{hashCode:function(str){var hash=0;if(str.length==0)return hash;for(var i=0;i<str.length;i++){var c=str.charCodeAt(i);hash=((hash<<5)-hash)+c;hash=hash&hash;}
return hash;},getByPath:function(obj,path,delim){delim=delim||'.';var keys=path.split(delim);var key;while(keys.length){key=keys.shift();if(key in obj){obj=obj[key];}else{return undefined;}}
return obj;},setByPath:function(obj,path,value,delim){delim=delim||'.';var keys=path.split(delim);var diver=obj;var i=0;if(path.indexOf(delim)>-1){for(var len=keys.length;i<len-1;i++){diver=diver[keys[i]]||(diver[keys[i]]={});}
diver[keys[len-1]]=value;}else{obj[path]=value;}
return obj;},flattenObject:function(obj,delim,stop){delim=delim||'.';var ret={};for(var key in obj){if(!obj.hasOwnProperty(key))continue;var shouldGoDeeper=typeof obj[key]==='object';if(shouldGoDeeper&&stop&&stop(obj[key])){shouldGoDeeper=false;}
if(shouldGoDeeper){var flatObject=this.flattenObject(obj[key],delim,stop);for(var flatKey in flatObject){if(!flatObject.hasOwnProperty(flatKey))continue;ret[key+delim+flatKey]=flatObject[flatKey];}}else{ret[key]=obj[key];}}
return ret;},uuid:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});},guid:function(obj){this.guid.id=this.guid.id||1;obj.id=(obj.id===undefined?'j_'+this.guid.id++:obj.id);return obj.id;},mixin:function(){var target=arguments[0];for(var i=1,l=arguments.length;i<l;i++){var extension=arguments[i];if((Object(extension)!==extension)&&!_.isFunction(extension)&&(extension===null||extension===undefined)){continue;}
_.each(extension,function(copy,key){if(this.mixin.deep&&(Object(copy)===copy)){if(!target[key]){target[key]=_.isArray(copy)?[]:{};}
this.mixin(target[key],copy);return;}
if(target[key]!==copy){if(!this.mixin.supplement||!target.hasOwnProperty(key)){target[key]=copy;}}},this);}
return target;},supplement:function(){this.mixin.supplement=true;var ret=this.mixin.apply(this,arguments);this.mixin.supplement=false;return ret;},deepMixin:function(){this.mixin.deep=true;var ret=this.mixin.apply(this,arguments);this.mixin.deep=false;return ret;},deepSupplement:function(){this.mixin.deep=this.mixin.supplement=true;var ret=this.mixin.apply(this,arguments);this.mixin.deep=this.mixin.supplement=false;return ret;},normalizeEvent:function(evt){return(evt.originalEvent&&evt.originalEvent.changedTouches&&evt.originalEvent.changedTouches.length)?evt.originalEvent.changedTouches[0]:evt;},nextFrame:(function(){var raf;var client=typeof window!='undefined';if(client){raf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;}
if(!raf){var lastTime=0;raf=function(callback){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=setTimeout(function(){callback(currTime+timeToCall);},timeToCall);lastTime=currTime+timeToCall;return id;};}
return client?_.bind(raf,window):raf;})(),cancelFrame:(function(){var caf;var client=typeof window!='undefined';if(client){caf=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.oCancelAnimationFrame||window.oCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.mozCancelRequestAnimationFrame;}
caf=caf||clearTimeout;return client?_.bind(caf,window):caf;})(),timing:{linear:function(t){return t;},quad:function(t){return t*t;},cubic:function(t){return t*t*t;},inout:function(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);},exponential:function(t){return Math.pow(2,10*(t-1));},bounce:function(t){for(var a=0,b=1;1;a+=b,b/=2){if(t>=(7-4*a)/11){var q=(11-6*a-11*t)/4;return-q*q+b*b;}}},reverse:function(f){return function(t){return 1-f(1-t)}},reflect:function(f){return function(t){return.5*(t<.5?f(2*t):(2-f(2-2*t)));};},clamp:function(f,n,x){n=n||0;x=x||1;return function(t){var r=f(t);return r<n?n:r>x?x:r;}},back:function(s){if(!s)s=1.70158;return function(t){return t*t*((s+1)*t-s);};},elastic:function(x){if(!x)x=1.5;return function(t){return Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*x/3*t);}}},interpolate:{number:function(a,b){var d=b-a;return function(t){return a+d*t;};},object:function(a,b){var s=_.keys(a);return function(t){var i,p,r={};for(i=s.length-1;i!=-1;i--){p=s[i];r[p]=a[p]+(b[p]-a[p])*t;}
return r;}},hexColor:function(a,b){var ca=parseInt(a.slice(1),16),cb=parseInt(b.slice(1),16);var ra=ca&0x0000ff,rd=(cb&0x0000ff)-ra;var ga=ca&0x00ff00,gd=(cb&0x00ff00)-ga;var ba=ca&0xff0000,bd=(cb&0xff0000)-ba;return function(t){return'#'+(1<<24|(ra+rd*t)|(ga+gd*t)|(ba+bd*t)).toString(16).slice(1);};},unit:function(a,b){var r=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/;var ma=r.exec(a),mb=r.exec(b);var p=mb[1].indexOf('.'),f=p>0?mb[1].length-p-1:0;var a=+ma[1],d=+mb[1]-a,u=ma[2];return function(t){return(a+d*t).toFixed(f)+u;}}},filter:{blur:function(args){var x=_.isFinite(args.x)?args.x:2;return _.template('<filter><feGaussianBlur stdDeviation="${stdDeviation}"/></filter>',{stdDeviation:_.isFinite(args.y)?[x,args.y]:x});},dropShadow:function(args){return _.template('<filter><feGaussianBlur in="SourceAlpha" stdDeviation="${blur}"/><feOffset dx="${dx}" dy="${dy}" result="offsetblur"/><feFlood flood-color="${color}"/><feComposite in2="offsetblur" operator="in"/><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>',{dx:args.dx||0,dy:args.dy||0,color:args.color||'black',blur:_.isFinite(args.blur)?args.blur:4});},grayscale:function(args){var amount=_.isFinite(args.amount)?args.amount:1;return _.template('<filter><feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${b} ${h} 0 0 0 0 0 1 0"/></filter>',{a:0.2126+0.7874*(1-amount),b:0.7152-0.7152*(1-amount),c:0.0722-0.0722*(1-amount),d:0.2126-0.2126*(1-amount),e:0.7152+0.2848*(1-amount),f:0.0722-0.0722*(1-amount),g:0.2126-0.2126*(1-amount),h:0.0722+0.9278*(1-amount)});},sepia:function(args){var amount=_.isFinite(args.amount)?args.amount:1;return _.template('<filter><feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${h} ${i} 0 0 0 0 0 1 0"/></filter>',{a:0.393+0.607*(1-amount),b:0.769-0.769*(1-amount),c:0.189-0.189*(1-amount),d:0.349-0.349*(1-amount),e:0.686+0.314*(1-amount),f:0.168-0.168*(1-amount),g:0.272-0.272*(1-amount),h:0.534-0.534*(1-amount),i:0.131+0.869*(1-amount)});},saturate:function(args){var amount=_.isFinite(args.amount)?args.amount:1;return _.template('<filter><feColorMatrix type="saturate" values="${amount}"/></filter>',{amount:1-amount});},hueRotate:function(args){return _.template('<filter><feColorMatrix type="hueRotate" values="${angle}"/></filter>',{angle:args.angle||0});},invert:function(args){var amount=_.isFinite(args.amount)?args.amount:1;return _.template('<filter><feComponentTransfer><feFuncR type="table" tableValues="${amount} ${amount2}"/><feFuncG type="table" tableValues="${amount} ${amount2}"/><feFuncB type="table" tableValues="${amount} ${amount2}"/></feComponentTransfer></filter>',{amount:amount,amount2:1-amount});},brightness:function(args){return _.template('<filter><feComponentTransfer><feFuncR type="linear" slope="${amount}"/><feFuncG type="linear" slope="${amount}"/><feFuncB type="linear" slope="${amount}"/></feComponentTransfer></filter>',{amount:_.isFinite(args.amount)?args.amount:1});},contrast:function(args){var amount=_.isFinite(args.amount)?args.amount:1;return _.template('<filter><feComponentTransfer><feFuncR type="linear" slope="${amount}" intercept="${amount2}"/><feFuncG type="linear" slope="${amount}" intercept="${amount2}"/><feFuncB type="linear" slope="${amount}" intercept="${amount2}"/></feComponentTransfer></filter>',{amount:amount,amount2:.5-amount/2});}}}};if(typeof exports==='object'){module.exports=joint;}
(function(root,factory){if(typeof define==='function'&&define.amd){define(['lodash'],factory);}else{root.Vectorizer=root.V=factory(root._);}}(this,function(_){var SVGsupported=!!(window.SVGAngle||document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure','1.1'));var ns={xmlns:'http://www.w3.org/2000/svg',xlink:'http://www.w3.org/1999/xlink'};var SVGversion='1.1';function createElement(el,attrs,children){if(!el)return undefined;if(typeof el==='object'){return new VElement(el);}
attrs=attrs||{};if(el.toLowerCase()==='svg'){attrs.xmlns=ns.xmlns;attrs['xmlns:xlink']=ns.xlink;attrs.version=SVGversion;}else if(el[0]==='<'){var svg='<svg xmlns="'+ns.xmlns+'" xmlns:xlink="'+ns.xlink+'" version="'+SVGversion+'">'+el+'</svg>';var parser=new DOMParser();parser.async=false;var svgDoc=parser.parseFromString(svg,'text/xml').documentElement;if(svgDoc.childNodes.length>1){return _.map(svgDoc.childNodes,function(childNode){return new VElement(document.importNode(childNode,true));});}
return new VElement(document.importNode(svgDoc.firstChild,true));}
el=document.createElementNS(ns.xmlns,el);for(var key in attrs){setAttribute(el,key,attrs[key]);}
if(Object.prototype.toString.call(children)!='[object Array]')children=[children];var i=0,len=(children[0]&&children.length)||0,child;for(;i<len;i++){child=children[i];el.appendChild(child instanceof VElement?child.node:child);}
return new VElement(el);}
function setAttribute(el,name,value){if(name.indexOf(':')>-1){var combinedKey=name.split(':');el.setAttributeNS(ns[combinedKey[0]],combinedKey[1],value);}else if(name==='id'){el.id=value;}else{el.setAttribute(name,value);}}
function parseTransformString(transform){var translate,rotate,scale;if(transform){var translateMatch=transform.match(/translate\((.*)\)/);if(translateMatch){translate=translateMatch[1].split(',');}
var rotateMatch=transform.match(/rotate\((.*)\)/);if(rotateMatch){rotate=rotateMatch[1].split(',');}
var scaleMatch=transform.match(/scale\((.*)\)/);if(scaleMatch){scale=scaleMatch[1].split(',');}}
var sx=(scale&&scale[0])?parseFloat(scale[0]):1;return{translate:{tx:(translate&&translate[0])?parseInt(translate[0],10):0,ty:(translate&&translate[1])?parseInt(translate[1],10):0},rotate:{angle:(rotate&&rotate[0])?parseInt(rotate[0],10):0,cx:(rotate&&rotate[1])?parseInt(rotate[1],10):undefined,cy:(rotate&&rotate[2])?parseInt(rotate[2],10):undefined},scale:{sx:sx,sy:(scale&&scale[1])?parseFloat(scale[1]):sx}};}
function deltaTransformPoint(matrix,point){var dx=point.x*matrix.a+point.y*matrix.c+0;var dy=point.x*matrix.b+point.y*matrix.d+0;return{x:dx,y:dy};}
function decomposeMatrix(matrix){var px=deltaTransformPoint(matrix,{x:0,y:1});var py=deltaTransformPoint(matrix,{x:1,y:0});var skewX=((180/Math.PI)*Math.atan2(px.y,px.x)-90);var skewY=((180/Math.PI)*Math.atan2(py.y,py.x));return{translateX:matrix.e,translateY:matrix.f,scaleX:Math.sqrt(matrix.a*matrix.a+matrix.b*matrix.b),scaleY:Math.sqrt(matrix.c*matrix.c+matrix.d*matrix.d),skewX:skewX,skewY:skewY,rotation:skewX};}
function VElement(el){this.node=el;if(!this.node.id){this.node.id=_.uniqueId('v_');}}
VElement.prototype={translate:function(tx,ty){ty=ty||0;var transformAttr=this.attr('transform')||'',transform=parseTransformString(transformAttr);if(typeof tx==='undefined'){return transform.translate;}
transformAttr=transformAttr.replace(/translate\([^\)]*\)/g,'').trim();var newTx=transform.translate.tx+tx,newTy=transform.translate.ty+ty;this.attr('transform','translate('+newTx+','+newTy+') '+transformAttr);return this;},rotate:function(angle,cx,cy){var transformAttr=this.attr('transform')||'',transform=parseTransformString(transformAttr);if(typeof angle==='undefined'){return transform.rotate;}
transformAttr=transformAttr.replace(/rotate\([^\)]*\)/g,'').trim();var newAngle=transform.rotate.angle+angle%360,newOrigin=(cx!==undefined&&cy!==undefined)?','+cx+','+cy:'';this.attr('transform',transformAttr+' rotate('+newAngle+newOrigin+')');return this;},scale:function(sx,sy){sy=(typeof sy==='undefined')?sx:sy;var transformAttr=this.attr('transform')||'',transform=parseTransformString(transformAttr);if(typeof sx==='undefined'){return transform.scale;}
transformAttr=transformAttr.replace(/scale\([^\)]*\)/g,'').trim();this.attr('transform',transformAttr+' scale('+sx+','+sy+')');return this;},bbox:function(withoutTransformations,target){if(!this.node.ownerSVGElement)return{x:0,y:0,width:0,height:0};var box;try{box=this.node.getBBox();box={x:box.x|0,y:box.y|0,width:box.width|0,height:box.height|0};}catch(e){box={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight};}
if(withoutTransformations){return box;}
var matrix=this.node.getTransformToElement(target||this.node.ownerSVGElement);var corners=[];var point=this.node.ownerSVGElement.createSVGPoint();point.x=box.x;point.y=box.y;corners.push(point.matrixTransform(matrix));point.x=box.x+box.width;point.y=box.y;corners.push(point.matrixTransform(matrix));point.x=box.x+box.width;point.y=box.y+box.height;corners.push(point.matrixTransform(matrix));point.x=box.x;point.y=box.y+box.height;corners.push(point.matrixTransform(matrix));var minX=corners[0].x;var maxX=minX;var minY=corners[0].y;var maxY=minY;for(var i=1,len=corners.length;i<len;i++){var x=corners[i].x;var y=corners[i].y;if(x<minX){minX=x;}else if(x>maxX){maxX=x;}
if(y<minY){minY=y;}else if(y>maxY){maxY=y;}}
return{x:minX,y:minY,width:maxX-minX,height:maxY-minY};},text:function(content){var lines=content.split('\n'),i=0,tspan;this.attr('y','0.8em');if(lines.length===1){this.node.textContent=content;return this;}
this.node.textContent='';for(;i<lines.length;i++){tspan=V('tspan',{dy:(i==0?'0em':'1em'),x:this.attr('x')||0});tspan.node.textContent=lines[i];this.append(tspan);}
return this;},attr:function(name,value){if(typeof name==='string'&&typeof value==='undefined'){return this.node.getAttribute(name);}
if(typeof name==='object'){_.each(name,function(value,name){setAttribute(this.node,name,value);},this);}else{setAttribute(this.node,name,value);}
return this;},remove:function(){if(this.node.parentNode){this.node.parentNode.removeChild(this.node);}},append:function(el){var els=el;if(!_.isArray(el)){els=[el];}
_.each(els,function(el){this.node.appendChild(el instanceof VElement?el.node:el);},this);return this;},prepend:function(el){this.node.insertBefore(el instanceof VElement?el.node:el,this.node.firstChild);},svg:function(){return this.node instanceof window.SVGSVGElement?this:V(this.node.ownerSVGElement);},defs:function(){var defs=this.svg().node.getElementsByTagName('defs');return(defs&&defs.length)?V(defs[0]):undefined;},clone:function(){var clone=V(this.node.cloneNode(true));clone.node.id=_.uniqueId('v-');return clone;},toLocalPoint:function(x,y){var svg=this.svg().node;var p=svg.createSVGPoint();p.x=x;p.y=y;try{var globalPoint=p.matrixTransform(svg.getScreenCTM().inverse());var globalToLocalMatrix=this.node.getTransformToElement(svg).inverse();}catch(e){return p;}
return globalPoint.matrixTransform(globalToLocalMatrix);},translateCenterToPoint:function(p){var bbox=this.bbox();var center=g.rect(bbox).center();this.translate(p.x-center.x,p.y-center.y);},translateAndAutoOrient:function(position,reference,target){var s=this.scale();this.attr('transform','');this.scale(s.sx,s.sy);var svg=this.svg().node;var bbox=this.bbox(false,target);var translateToOrigin=svg.createSVGTransform();translateToOrigin.setTranslate(-bbox.x-bbox.width/2,-bbox.y-bbox.height/2);var rotateAroundOrigin=svg.createSVGTransform();var angle=g.point(position).changeInAngle(position.x-reference.x,position.y-reference.y,reference);rotateAroundOrigin.setRotate(angle,0,0);var translateFinal=svg.createSVGTransform();var finalPosition=g.point(position).move(reference,bbox.width/2);translateFinal.setTranslate(position.x+(position.x-finalPosition.x),position.y+(position.y-finalPosition.y));var ctm=this.node.getTransformToElement(target);var transform=svg.createSVGTransform();transform.setMatrix(translateFinal.matrix.multiply(rotateAroundOrigin.matrix.multiply(translateToOrigin.matrix.multiply(ctm))));var decomposition=decomposeMatrix(transform.matrix);this.translate(decomposition.translateX,decomposition.translateY);this.rotate(decomposition.rotation);return this;},animateAlongPath:function(attrs,path){var animateMotion=V('animateMotion',attrs);var mpath=V('mpath',{'xlink:href':'#'+V(path).node.id});animateMotion.append(mpath);this.append(animateMotion);try{animateMotion.node.beginElement();}catch(e){if(document.documentElement.getAttribute('smiling')==='fake'){var animation=animateMotion.node;animation.animators=new Array();var animationID=animation.getAttribute('id');if(animationID)id2anim[animationID]=animation;_.each(getTargets(animation),function(target,index){var animator=new Animator(animation,target,index);animators.push(animator);animation.animators[index]=animator;});_.invoke(animation.animators,'register');}}}};var V=createElement;V.decomposeMatrix=decomposeMatrix;var svgDocument=V('svg').node;V.createSVGMatrix=function(m){return _.extend(svgDocument.createSVGMatrix(),m);};V.createSVGTransform=function(){return svgDocument.createSVGTransform();};V.createSVGPoint=function(x,y){var p=svgDocument.createSVGPoint();p.x=x;p.y=y;return p;};return V;}));(function(root,factory){if(typeof define==='function'&&define.amd){define([],factory);}else{root.g=factory();}}(this,function(){var math=Math;var abs=math.abs;var cos=math.cos;var sin=math.sin;var sqrt=math.sqrt;var mmin=math.min;var mmax=math.max;var atan=math.atan;var atan2=math.atan2;var acos=math.acos;var round=math.round;var floor=math.floor;var PI=math.PI;var random=math.random;var toDeg=function(rad){return(180*rad/PI)%360;};var toRad=function(deg){return(deg%360)*PI/180;};var snapToGrid=function(val,gridSize){return gridSize*Math.round(val/gridSize);};var normalizeAngle=function(angle){return(angle%360)+(angle<0?360:0);};function point(x,y){if(!(this instanceof point))
return new point(x,y);var xy;if(y===undefined&&Object(x)!==x){xy=x.split(_.indexOf(x,"@")===-1?" ":"@");this.x=parseInt(xy[0],10);this.y=parseInt(xy[1],10);}else if(Object(x)===x){this.x=x.x;this.y=x.y;}else{this.x=x;this.y=y;}}
point.prototype={toString:function(){return this.x+"@"+this.y;},adhereToRect:function(r){if(r.containsPoint(this)){return this;}
this.x=mmin(mmax(this.x,r.x),r.x+r.width);this.y=mmin(mmax(this.y,r.y),r.y+r.height);return this;},theta:function(p){p=point(p);var y=-(p.y-this.y);var x=p.x-this.x;var PRECISION=10;var rad=(y.toFixed(PRECISION)==0&&x.toFixed(PRECISION)==0)?0:atan2(y,x);if(rad<0){rad=2*PI+rad;}
return 180*rad/PI;},distance:function(p){return line(this,p).length();},manhattanDistance:function(p){return abs(p.x-this.x)+abs(p.y-this.y);},offset:function(dx,dy){this.x+=dx||0;this.y+=dy||0;return this;},magnitude:function(){return sqrt((this.x*this.x)+(this.y*this.y))||0.01;},update:function(x,y){this.x=x||0;this.y=y||0;return this;},round:function(decimals){this.x=decimals?this.x.toFixed(decimals):round(this.x);this.y=decimals?this.y.toFixed(decimals):round(this.y);return this;},normalize:function(len){var s=(len||1)/this.magnitude();this.x=s*this.x;this.y=s*this.y;return this;},difference:function(p){return point(this.x-p.x,this.y-p.y);},toPolar:function(o){o=(o&&point(o))||point(0,0);var x=this.x;var y=this.y;this.x=sqrt((x-o.x)*(x-o.x)+(y-o.y)*(y-o.y));this.y=toRad(o.theta(point(x,y)));return this;},rotate:function(o,angle){angle=(angle+360)%360;this.toPolar(o);this.y+=toRad(angle);var p=point.fromPolar(this.x,this.y,o);this.x=p.x;this.y=p.y;return this;},move:function(ref,distance){var theta=toRad(point(ref).theta(this));return this.offset(cos(theta)*distance,-sin(theta)*distance);},changeInAngle:function(dx,dy,ref){return point(this).offset(-dx,-dy).theta(ref)-this.theta(ref);},equals:function(p){return this.x===p.x&&this.y===p.y;}};point.fromPolar=function(r,angle,o){o=(o&&point(o))||point(0,0);var x=abs(r*cos(angle));var y=abs(r*sin(angle));var deg=normalizeAngle(toDeg(angle));if(deg<90)y=-y;else if(deg<180){x=-x;y=-y;}
else if(deg<270)x=-x;return point(o.x+x,o.y+y);};point.random=function(x1,x2,y1,y2){return point(floor(random()*(x2-x1+1)+x1),floor(random()*(y2-y1+1)+y1));};function line(p1,p2){if(!(this instanceof line))
return new line(p1,p2);this.start=point(p1);this.end=point(p2);}
line.prototype={toString:function(){return this.start.toString()+' '+this.end.toString();},length:function(){return sqrt(this.squaredLength());},squaredLength:function(){var x0=this.start.x;var y0=this.start.y;var x1=this.end.x;var y1=this.end.y;return(x0-=x1)*x0+(y0-=y1)*y0;},midpoint:function(){return point((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2);},intersection:function(l){var pt1Dir=point(this.end.x-this.start.x,this.end.y-this.start.y);var pt2Dir=point(l.end.x-l.start.x,l.end.y-l.start.y);var det=(pt1Dir.x*pt2Dir.y)-(pt1Dir.y*pt2Dir.x);var deltaPt=point(l.start.x-this.start.x,l.start.y-this.start.y);var alpha=(deltaPt.x*pt2Dir.y)-(deltaPt.y*pt2Dir.x);var beta=(deltaPt.x*pt1Dir.y)-(deltaPt.y*pt1Dir.x);if(det===0||alpha*det<0||beta*det<0){return null;}
if(det>0){if(alpha>det||beta>det){return null;}}else{if(alpha<det||beta<det){return null;}}
return point(this.start.x+(alpha*pt1Dir.x/det),this.start.y+(alpha*pt1Dir.y/det));}};function rect(x,y,w,h){if(!(this instanceof rect))
return new rect(x,y,w,h);if(y===undefined){y=x.y;w=x.width;h=x.height;x=x.x;}
this.x=x;this.y=y;this.width=w;this.height=h;}
rect.prototype={toString:function(){return this.origin().toString()+' '+this.corner().toString();},origin:function(){return point(this.x,this.y);},corner:function(){return point(this.x+this.width,this.y+this.height);},topRight:function(){return point(this.x+this.width,this.y);},bottomLeft:function(){return point(this.x,this.y+this.height);},center:function(){return point(this.x+this.width/2,this.y+this.height/2);},intersect:function(r){var myOrigin=this.origin();var myCorner=this.corner();var rOrigin=r.origin();var rCorner=r.corner();if(rCorner.x<=myOrigin.x||rCorner.y<=myOrigin.y||rOrigin.x>=myCorner.x||rOrigin.y>=myCorner.y)return false;return true;},sideNearestToPoint:function(p){p=point(p);var distToLeft=p.x-this.x;var distToRight=(this.x+this.width)-p.x;var distToTop=p.y-this.y;var distToBottom=(this.y+this.height)-p.y;var closest=distToLeft;var side='left';if(distToRight<closest){closest=distToRight;side='right';}
if(distToTop<closest){closest=distToTop;side='top';}
if(distToBottom<closest){closest=distToBottom;side='bottom';}
return side;},containsPoint:function(p){p=point(p);if(p.x>this.x&&p.x<this.x+this.width&&p.y>this.y&&p.y<this.y+this.height){return true;}
return false;},pointNearestToPoint:function(p){p=point(p);if(this.containsPoint(p)){var side=this.sideNearestToPoint(p);switch(side){case"right":return point(this.x+this.width,p.y);case"left":return point(this.x,p.y);case"bottom":return point(p.x,this.y+this.height);case"top":return point(p.x,this.y);}}
return p.adhereToRect(this);},intersectionWithLineFromCenterToPoint:function(p,angle){p=point(p);var center=point(this.x+this.width/2,this.y+this.height/2);var result;if(angle)p.rotate(center,angle);var sides=[line(this.origin(),this.topRight()),line(this.topRight(),this.corner()),line(this.corner(),this.bottomLeft()),line(this.bottomLeft(),this.origin())];var connector=line(center,p);for(var i=sides.length-1;i>=0;--i){var intersection=sides[i].intersection(connector);if(intersection!==null){result=intersection;break;}}
if(result&&angle)result.rotate(center,-angle);return result;},moveAndExpand:function(r){this.x+=r.x;this.y+=r.y;this.width+=r.width;this.height+=r.height;return this;},round:function(decimals){this.x=decimals?this.x.toFixed(decimals):round(this.x);this.y=decimals?this.y.toFixed(decimals):round(this.y);this.width=decimals?this.width.toFixed(decimals):round(this.width);this.height=decimals?this.height.toFixed(decimals):round(this.height);return this;}};function ellipse(c,a,b){if(!(this instanceof ellipse))
return new ellipse(c,a,b);c=point(c);this.x=c.x;this.y=c.y;this.a=a;this.b=b;}
ellipse.prototype={toString:function(){return point(this.x,this.y).toString()+' '+this.a+' '+this.b;},bbox:function(){return rect(this.x-this.a,this.y-this.b,2*this.a,2*this.b);},intersectionWithLineFromCenterToPoint:function(p,angle){p=point(p);if(angle)p.rotate(point(this.x,this.y),angle);var dx=p.x-this.x;var dy=p.y-this.y;var result;if(dx===0){result=this.bbox().pointNearestToPoint(p);if(angle)return result.rotate(point(this.x,this.y),-angle);return result;}
var m=dy/dx;var mSquared=m*m;var aSquared=this.a*this.a;var bSquared=this.b*this.b;var x=sqrt(1/((1/aSquared)+(mSquared/bSquared)));x=dx<0?-x:x;var y=m*x;result=point(this.x+x,this.y+y);if(angle)return result.rotate(point(this.x,this.y),-angle);return result;}};var bezier={curveThroughPoints:function(points){var controlPoints=this.getCurveControlPoints(points);var path=['M',points[0].x,points[0].y];for(var i=0;i<controlPoints[0].length;i++){path.push('C',controlPoints[0][i].x,controlPoints[0][i].y,controlPoints[1][i].x,controlPoints[1][i].y,points[i+1].x,points[i+1].y);}
return path;},getCurveControlPoints:function(knots){var firstControlPoints=[];var secondControlPoints=[];var n=knots.length-1;var i;if(n==1){firstControlPoints[0]=point((2*knots[0].x+knots[1].x)/3,(2*knots[0].y+knots[1].y)/3);secondControlPoints[0]=point(2*firstControlPoints[0].x-knots[0].x,2*firstControlPoints[0].y-knots[0].y);return[firstControlPoints,secondControlPoints];}
var rhs=[];for(i=1;i<n-1;i++){rhs[i]=4*knots[i].x+2*knots[i+1].x;}
rhs[0]=knots[0].x+2*knots[1].x;rhs[n-1]=(8*knots[n-1].x+knots[n].x)/2.0;var x=this.getFirstControlPoints(rhs);for(i=1;i<n-1;++i){rhs[i]=4*knots[i].y+2*knots[i+1].y;}
rhs[0]=knots[0].y+2*knots[1].y;rhs[n-1]=(8*knots[n-1].y+knots[n].y)/2.0;var y=this.getFirstControlPoints(rhs);for(i=0;i<n;i++){firstControlPoints.push(point(x[i],y[i]));if(i<n-1){secondControlPoints.push(point(2*knots[i+1].x-x[i+1],2*knots[i+1].y-y[i+1]));}else{secondControlPoints.push(point((knots[n].x+x[n-1])/2,(knots[n].y+y[n-1])/2));}}
return[firstControlPoints,secondControlPoints];},getFirstControlPoints:function(rhs){var n=rhs.length;var x=[];var tmp=[];var b=2.0;x[0]=rhs[0]/b;for(var i=1;i<n;i++){tmp[i]=1/b;b=(i<n-1?4.0:3.5)-tmp[i];x[i]=(rhs[i]-x[i-1])/b;}
for(i=1;i<n;i++){x[n-i-1]-=tmp[n-i]*x[n-i];}
return x;}};return{toDeg:toDeg,toRad:toRad,snapToGrid:snapToGrid,normalizeAngle:normalizeAngle,point:point,line:line,rect:rect,ellipse:ellipse,bezier:bezier}}));if(typeof exports==='object'){var joint={dia:{Link:require('./joint.dia.link').Link,Element:require('./joint.dia.element').Element},shapes:require('../plugins/shapes')};var Backbone=require('backbone');var _=require('lodash');var g=require('./geometry').g;}
joint.dia.GraphCells=Backbone.Collection.extend({initialize:function(){this.on('change:z',this.sort,this);},model:function(attrs,options){if(attrs.type==='link'){return new joint.dia.Link(attrs,options);}
var module=attrs.type.split('.')[0];var entity=attrs.type.split('.')[1];if(joint.shapes[module]&&joint.shapes[module][entity]){return new joint.shapes[module][entity](attrs,options);}
return new joint.dia.Element(attrs,options);},comparator:function(model){return model.get('z')||0;},getConnectedLinks:function(model,opt){opt=opt||{};if(_.isUndefined(opt.inbound)&&_.isUndefined(opt.outbound)){opt.inbound=opt.outbound=true;}
var links=[];this.each(function(cell){var source=cell.get('source');var target=cell.get('target');if(source&&source.id===model.id&&opt.outbound){links.push(cell);}
if(target&&target.id===model.id&&opt.inbound){links.push(cell);}});return links;}});joint.dia.Graph=Backbone.Model.extend({initialize:function(){this.set('cells',new joint.dia.GraphCells);this.get('cells').on('all',this.trigger,this);this.get('cells').on('remove',this.removeCell,this);},toJSON:function(){var json=Backbone.Model.prototype.toJSON.apply(this,arguments);json.cells=this.get('cells').toJSON();return json;},fromJSON:function(json){if(!json.cells){throw new Error('Graph JSON must contain cells array.');}
var attrs=json;var cells=json.cells;delete attrs.cells;this.set(attrs);this.resetCells(cells);},clear:function(){this.get('cells').remove(this.get('cells').models);},_prepareCell:function(cell){if(cell instanceof Backbone.Model&&_.isUndefined(cell.get('z'))){cell.set('z',this.get('cells').length,{silent:true});}else if(_.isUndefined(cell.z)){cell.z=this.get('cells').length;}
return cell;},addCell:function(cell,options){if(_.isArray(cell)){return this.addCells(cell,options);}
this.get('cells').add(this._prepareCell(cell),options||{});return this;},addCells:function(cells,options){_.each(cells,function(cell){this.addCell(cell,options);},this);return this;},resetCells:function(cells){this.get('cells').reset(_.map(cells,this._prepareCell,this));return this;},removeCell:function(cell,collection,options){if(options&&options.disconnectLinks){this.disconnectLinks(cell);}else{this.removeLinks(cell);}
this.get('cells').remove(cell,{silent:true});},getCell:function(id){return this.get('cells').get(id);},getElements:function(){return this.get('cells').filter(function(cell){return cell instanceof joint.dia.Element;});},getLinks:function(){return this.get('cells').filter(function(cell){return cell instanceof joint.dia.Link;});},getConnectedLinks:function(model,opt){return this.get('cells').getConnectedLinks(model,opt);},getNeighbors:function(el){var links=this.getConnectedLinks(el);var neighbors=[];var cells=this.get('cells');_.each(links,function(link){var source=link.get('source');var target=link.get('target');if(!source.x){var sourceElement=cells.get(source.id);if(sourceElement!==el){neighbors.push(sourceElement);}}
if(!target.x){var targetElement=cells.get(target.id);if(targetElement!==el){neighbors.push(targetElement);}}});return neighbors;},disconnectLinks:function(model){_.each(this.getConnectedLinks(model),function(link){link.set(link.get('source').id===model.id?'source':'target',g.point(0,0));});},removeLinks:function(model){_.invoke(this.getConnectedLinks(model),'remove');},findModelsFromPoint:function(p){return _.filter(this.getElements(),function(el){return el.getBBox().containsPoint(p);});},findModelsInArea:function(r){return _.filter(this.getElements(),function(el){return el.getBBox().intersect(r);});}});if(typeof exports==='object'){module.exports.Graph=joint.dia.Graph;}
if(typeof exports==='object'){var joint={util:require('./core').util,dia:{Link:require('./joint.dia.link').Link}};var Backbone=require('backbone');var _=require('lodash');}
joint.dia.Cell=Backbone.Model.extend({constructor:function(attributes,options){var defaults;var attrs=attributes||{};this.cid=_.uniqueId('c');this.attributes={};if(options&&options.collection)this.collection=options.collection;if(options&&options.parse)attrs=this.parse(attrs,options)||{};if(defaults=_.result(this,'defaults')){attrs=_.merge({},defaults,attrs);}
this.set(attrs,options);this.changed={};this.initialize.apply(this,arguments);},toJSON:function(){var defaultAttrs=this.constructor.prototype.defaults.attrs||{};var attrs=this.attributes.attrs;var finalAttrs={};_.each(attrs,function(attr,selector){var defaultAttr=defaultAttrs[selector];_.each(attr,function(value,name){if(_.isObject(value)&&!_.isArray(value)){_.each(value,function(value2,name2){if(!defaultAttr||!defaultAttr[name]||!_.isEqual(defaultAttr[name][name2],value2)){finalAttrs[selector]=finalAttrs[selector]||{};(finalAttrs[selector][name]||(finalAttrs[selector][name]={}))[name2]=value2;}});}else if(!defaultAttr||!_.isEqual(defaultAttr[name],value)){finalAttrs[selector]=finalAttrs[selector]||{};finalAttrs[selector][name]=value;}});});var attributes=_.cloneDeep(_.omit(this.attributes,'attrs'));attributes.attrs=finalAttrs;return attributes;},initialize:function(options){if(!options||!options.id){this.set('id',joint.util.uuid(),{silent:true});}
this._transitionIds={};this.processPorts();this.on('change:attrs',this.processPorts,this);},processPorts:function(){var previousPorts=this.ports;var ports={};_.each(this.get('attrs'),function(attrs,selector){if(attrs.port){if(!_.isUndefined(attrs.port.id)){ports[attrs.port.id]=attrs.port;}else{ports[attrs.port]={id:attrs.port};}}});var removedPorts={};_.each(previousPorts,function(port,id){if(!ports[id])removedPorts[id]=true;});if(this.collection&&!_.isEmpty(removedPorts)){var inboundLinks=this.collection.getConnectedLinks(this,{inbound:true});_.each(inboundLinks,function(link){if(removedPorts[link.get('target').port])link.remove();});var outboundLinks=this.collection.getConnectedLinks(this,{outbound:true});_.each(outboundLinks,function(link){if(removedPorts[link.get('source').port])link.remove();});}
this.ports=ports;},remove:function(options){var collection=this.collection;if(collection){collection.trigger('batch:start');}
var parentCellId=this.get('parent');if(parentCellId){var parentCell=this.collection&&this.collection.get(parentCellId);parentCell.unembed(this);}
_.invoke(this.getEmbeddedCells(),'remove',options);this.trigger('remove',this,this.collection,options);if(collection){collection.trigger('batch:stop');}},toFront:function(){if(this.collection){this.set('z',(this.collection.last().get('z')||0)+1);}},toBack:function(){if(this.collection){this.set('z',(this.collection.first().get('z')||0)-1);}},embed:function(cell){if(this.get('parent')==cell.id){throw new Error('Recursive embedding not allowed.');}else{this.trigger('batch:start');cell.set('parent',this.id);this.set('embeds',_.uniq((this.get('embeds')||[]).concat([cell.id])));this.trigger('batch:stop');}},unembed:function(cell){this.trigger('batch:start');var cellId=cell.id;cell.unset('parent');this.set('embeds',_.without(this.get('embeds'),cellId));this.trigger('batch:stop');},getEmbeddedCells:function(){if(this.collection){return _.map(this.get('embeds')||[],function(cellId){return this.collection.get(cellId);},this);}
return[];},clone:function(opt){opt=opt||{};var clone=Backbone.Model.prototype.clone.apply(this,arguments);clone.set('id',joint.util.uuid(),{silent:true});clone.set('embeds','');if(!opt.deep)return clone;var embeds=this.getEmbeddedCells();var clones=[clone];var linkCloneMapping={};_.each(embeds,function(embed){var embedClones=embed.clone({deep:true});clone.embed(embedClones[0]);_.each(embedClones,function(embedClone){clones.push(embedClone);if(embedClone instanceof joint.dia.Link){return;}
var inboundLinks=this.collection.getConnectedLinks(embed,{inbound:true});_.each(inboundLinks,function(link){var linkClone=linkCloneMapping[link.id]||link.clone();linkCloneMapping[link.id]=linkClone;var target=_.clone(linkClone.get('target'));target.id=embedClone.id;linkClone.set('target',target);});var outboundLinks=this.collection.getConnectedLinks(embed,{outbound:true});_.each(outboundLinks,function(link){var linkClone=linkCloneMapping[link.id]||link.clone();linkCloneMapping[link.id]=linkClone;var source=_.clone(linkClone.get('source'));source.id=embedClone.id;linkClone.set('source',source);});},this);},this);clones=clones.concat(_.values(linkCloneMapping));return clones;},attr:function(attrs,value,opt){var currentAttrs=this.get('attrs');var delim='/';if(_.isString(attrs)){if(value){var attr={};joint.util.setByPath(attr,attrs,value,delim);return this.set('attrs',_.merge({},currentAttrs,attr),opt);}else{return joint.util.getByPath(currentAttrs,attrs,delim);}}
return this.set('attrs',_.merge({},currentAttrs,attrs),value);},transition:function(path,value,opt,delim){delim=delim||'/';var defaults={duration:100,delay:10,timingFunction:joint.util.timing.linear,valueFunction:joint.util.interpolate.number};opt=_.extend(defaults,opt);var pathArray=path.split(delim);var property=pathArray[0];var isPropertyNested=pathArray.length>1;var firstFrameTime=0;var interpolatingFunction;var setter=_.bind(function(runtime){var id,progress,propertyValue,status;firstFrameTime=firstFrameTime||runtime;runtime-=firstFrameTime;progress=runtime/opt.duration;if(progress<1){this._transitionIds[path]=id=joint.util.nextFrame(setter);}else{progress=1;delete this._transitionIds[path];}
propertyValue=interpolatingFunction(opt.timingFunction(progress));if(isPropertyNested){var nestedPropertyValue=joint.util.setByPath({},path,propertyValue,delim)[property];propertyValue=_.merge({},this.get(property),nestedPropertyValue);}
opt.transitionId=id;this.set(property,propertyValue,opt);if(!id)this.trigger('transition:end',this,path);},this);var initiator=_.bind(function(callback){this.stopTransitions(path);interpolatingFunction=opt.valueFunction(joint.util.getByPath(this.attributes,path,delim),value);this._transitionIds[path]=joint.util.nextFrame(callback);this.trigger('transition:start',this,path);},this);return _.delay(initiator,opt.delay,setter);},getTransitions:function(){return _.keys(this._transitionIds);},stopTransitions:function(path,delim){delim=delim||'/';var pathArray=path&&path.split(delim);_(this._transitionIds).keys().filter(pathArray&&function(key){return _.isEqual(pathArray,key.split(delim).slice(0,pathArray.length));}).each(function(key){joint.util.cancelFrame(this._transitionIds[key]);delete this._transitionIds[key];this.trigger('transition:end',this,key);},this);}});joint.dia.CellView=Backbone.View.extend({tagName:'g',attributes:function(){return{'model-id':this.model.id}},initialize:function(){_.bindAll(this,'remove','update');this.$el.data('view',this);this.listenTo(this.model,'remove',this.remove);this.listenTo(this.model,'change:attrs',this.update);},_configure:function(options){options.id=options.id||joint.util.guid(this);Backbone.View.prototype._configure.apply(this,arguments);},_ensureElement:function(){var el;if(!this.el){var attrs=_.extend({id:this.id},_.result(this,'attributes'));if(this.className)attrs['class']=_.result(this,'className');el=V(_.result(this,'tagName'),attrs).node;}else{el=_.result(this,'el')}
this.setElement(el,false);},findBySelector:function(selector){var $selected=selector==='.'?this.$el:this.$el.find(selector);return $selected;},notify:function(evt){if(this.paper){var args=Array.prototype.slice.call(arguments,1);this.trigger.apply(this,[evt].concat(args));this.paper.trigger.apply(this.paper,[evt,this].concat(args));}},getStrokeBBox:function(el){var isMagnet=!!el;el=el||this.el;var bbox=V(el).bbox(false,this.paper.viewport);var strokeWidth;if(isMagnet){strokeWidth=V(el).attr('stroke-width');}else{strokeWidth=this.model.attr('rect/stroke-width')||this.model.attr('circle/stroke-width')||this.model.attr('ellipse/stroke-width')||this.model.attr('path/stroke-width');}
strokeWidth=parseFloat(strokeWidth)||0;return g.rect(bbox).moveAndExpand({x:-strokeWidth/2,y:-strokeWidth/2,width:strokeWidth,height:strokeWidth});},getBBox:function(){return V(this.el).bbox();},highlight:function(el){el=!el?this.el:this.$(el)[0]||this.el;var attrClass=V(el).attr('class')||'';if(!/\bhighlighted\b/.exec(attrClass))V(el).attr('class',attrClass.trim()+' highlighted');},unhighlight:function(el){el=!el?this.el:this.$(el)[0]||this.el;V(el).attr('class',(V(el).attr('class')||'').replace(/\bhighlighted\b/,'').trim());},findMagnet:function(el){var $el=this.$(el);if($el.length===0||$el[0]===this.el){var attrs=this.model.get('attrs')||{};if(attrs['.']&&attrs['.']['magnet']===false){return undefined;}
return this.el;}
if($el.attr('magnet')){return $el[0];}
return this.findMagnet($el.parent());},applyFilter:function(selector,filter){var $selected=this.findBySelector(selector);var filterId=filter.name+this.paper.svg.id+joint.util.hashCode(JSON.stringify(filter));if(!this.paper.svg.getElementById(filterId)){var filterSVGString=joint.util.filter[filter.name]&&joint.util.filter[filter.name](filter.args||{});if(!filterSVGString){throw new Error('Non-existing filter '+filter.name);}
var filterElement=V(filterSVGString);filterElement.attr('filterUnits','userSpaceOnUse');filterElement.node.id=filterId;V(this.paper.svg).defs().append(filterElement);}
$selected.each(function(){V(this).attr('filter','url(#'+filterId+')');});},applyGradient:function(selector,attr,gradient){var $selected=this.findBySelector(selector);var gradientId=gradient.type+this.paper.svg.id+joint.util.hashCode(JSON.stringify(gradient));if(!this.paper.svg.getElementById(gradientId)){var gradientSVGString=['<'+gradient.type+'>',_.map(gradient.stops,function(stop){return'<stop offset="'+stop.offset+'" stop-color="'+stop.color+'" stop-opacity="'+(_.isFinite(stop.opacity)?stop.opacity:1)+'" />'}).join(''),'</'+gradient.type+'>'].join('');var gradientElement=V(gradientSVGString);if(gradient.attrs){gradientElement.attr(gradient.attrs);}
gradientElement.node.id=gradientId;V(this.paper.svg).defs().append(gradientElement);}
$selected.each(function(){V(this).attr(attr,'url(#'+gradientId+')');});},getSelector:function(el,selector){if(el===this.el){return selector;}
var index=$(el).index();selector=el.tagName+':nth-child('+(index+1)+')'+' '+(selector||'');return this.getSelector($(el).parent()[0],selector+' ');},pointerdblclick:function(evt,x,y){this.notify('cell:pointerdblclick',evt,x,y);},pointerdown:function(evt,x,y){if(this.model.collection){this.model.trigger('batch:start');this._collection=this.model.collection;}
this.notify('cell:pointerdown',evt,x,y);},pointermove:function(evt,x,y){this.notify('cell:pointermove',evt,x,y);},pointerup:function(evt,x,y){this.notify('cell:pointerup',evt,x,y);if(this._collection){this._collection.trigger('batch:stop');delete this._collection;}}});if(typeof exports==='object'){module.exports.Cell=joint.dia.Cell;module.exports.CellView=joint.dia.CellView;}
if(typeof exports==='object'){var joint={util:require('./core').util,dia:{Cell:require('./joint.dia.cell').Cell,CellView:require('./joint.dia.cell').CellView}};var Backbone=require('backbone');var _=require('lodash');}
joint.dia.Element=joint.dia.Cell.extend({defaults:{position:{x:0,y:0},size:{width:1,height:1},angle:0},position:function(x,y){this.set('position',{x:x,y:y});},translate:function(tx,ty,opt){ty=ty||0;if(tx===0&&ty===0){return this;}
var position=this.get('position')||{x:0,y:0};var translatedPosition={x:position.x+tx||0,y:position.y+ty||0};if(opt&&opt.transition){if(!_.isObject(opt.transition))opt.transition={};this.transition('position',translatedPosition,_.extend({},opt.transition,{valueFunction:joint.util.interpolate.object}));}else{this.set('position',translatedPosition,opt);_.invoke(this.getEmbeddedCells(),'translate',tx,ty,opt);}
return this;},resize:function(width,height){this.trigger('batch:start');this.set('size',{width:width,height:height});this.trigger('batch:stop');return this;},rotate:function(angle,absolute){return this.set('angle',absolute?angle:((this.get('angle')||0)+angle)%360);},getBBox:function(){var position=this.get('position');var size=this.get('size');return g.rect(position.x,position.y,size.width,size.height);}});joint.dia.ElementView=joint.dia.CellView.extend({className:function(){return'element '+this.model.get('type').split('.').join(' ');},initialize:function(){_.bindAll(this,'translate','resize','rotate');joint.dia.CellView.prototype.initialize.apply(this,arguments);this.listenTo(this.model,'change:position',this.translate);this.listenTo(this.model,'change:size',this.resize);this.listenTo(this.model,'change:angle',this.rotate);},update:function(cell,renderingOnlyAttrs){var allAttrs=this.model.get('attrs');var rotatable=V(this.$('.rotatable')[0]);if(rotatable){var rotation=rotatable.attr('transform');rotatable.attr('transform','');}
var relativelyPositioned=[];var specialAttributes=['style','text','html','ref-x','ref-y','ref-dx','ref-dy','ref','x-alignment','y-alignment','port'];_.each(renderingOnlyAttrs||allAttrs,function(attrs,selector){var $selected=this.findBySelector(selector);if($selected.length===0)return;var specialAttributes=['style','text','html','ref-x','ref-y','ref-dx','ref-dy','ref','x-alignment','y-alignment','port'];if(_.isObject(attrs.filter)){specialAttributes.push('filter');this.applyFilter(selector,attrs.filter);}
if(_.isObject(attrs.fill)){specialAttributes.push('fill');this.applyGradient(selector,'fill',attrs.fill);}
if(_.isObject(attrs.stroke)){specialAttributes.push('stroke');this.applyGradient(selector,'stroke',attrs.stroke);}
var finalAttributes=_.omit(attrs,specialAttributes);$selected.each(function(){V(this).attr(finalAttributes);});if(attrs.port){$selected.attr('port',_.isUndefined(attrs.port.id)?attrs.port:attrs.port.id);}
if(attrs.style){$selected.css(attrs.style);}
if(!_.isUndefined(attrs.text)){$selected.each(function(){V(this).text(attrs.text+'');});}
if(!_.isUndefined(attrs.html)){$selected.each(function(){$(this).html(attrs.html+'');});}
if(!_.isUndefined(attrs['ref-x'])||!_.isUndefined(attrs['ref-y'])||!_.isUndefined(attrs['ref-dx'])||!_.isUndefined(attrs['ref-dy'])||!_.isUndefined(attrs['x-alignment'])||!_.isUndefined(attrs['y-alignment'])){relativelyPositioned.push($selected);}},this);var bbox=this.el.getBBox();renderingOnlyAttrs=renderingOnlyAttrs||{};_.each(relativelyPositioned,function($el){var renderingOnlyElAttrs=renderingOnlyAttrs[$el.selector];var elAttrs=renderingOnlyElAttrs?_.merge({},allAttrs[$el.selector],renderingOnlyElAttrs):allAttrs[$el.selector];this.positionRelative($el,bbox,elAttrs);},this);if(rotatable){rotatable.attr('transform',rotation||'');}},positionRelative:function($el,bbox,elAttrs){var ref=elAttrs['ref'];var refX=parseFloat(elAttrs['ref-x']);var refY=parseFloat(elAttrs['ref-y']);var refDx=parseFloat(elAttrs['ref-dx']);var refDy=parseFloat(elAttrs['ref-dy']);var yAlignment=elAttrs['y-alignment'];var xAlignment=elAttrs['x-alignment'];var isScalable=_.contains(_.pluck(_.pluck($el.parents('g'),'className'),'baseVal'),'scalable');if(ref){bbox=V(this.findBySelector(ref)[0]).bbox(false,this.el);}
var vel=V($el[0]);if(vel.attr('transform')){vel.attr('transform',vel.attr('transform').replace(/translate\([^)]*\)/g,'')||'');}
function isDefined(x){return _.isNumber(x)&&!_.isNaN(x);}
var tx=0;var ty=0;if(isDefined(refDx)){if(isScalable){var scale=V(this.$('.scalable')[0]).scale();tx=bbox.x+bbox.width+refDx/scale.sx;}else{tx=bbox.x+bbox.width+refDx;}}
if(isDefined(refDy)){if(isScalable){var scale=V(this.$('.scalable')[0]).scale();ty=bbox.y+bbox.height+refDy/scale.sy;}else{ty=bbox.y+bbox.height+refDy;}}
if(isDefined(refX)){if(refX>0&&refX<1){tx=bbox.x+bbox.width*refX;}else if(isScalable){var scale=V(this.$('.scalable')[0]).scale();tx=bbox.x+refX/scale.sx;}else{tx=bbox.x+refX;}}
if(isDefined(refY)){if(refY>0&&refY<1){ty=bbox.y+bbox.height*refY;}else if(isScalable){var scale=V(this.$('.scalable')[0]).scale();ty=bbox.y+refY/scale.sy;}else{ty=bbox.y+refY;}}
var velbbox=vel.bbox(false,this.paper.viewport);if(yAlignment==='middle'){ty-=velbbox.height/2;}else if(isDefined(yAlignment)){ty+=(yAlignment>0&&yAlignment<1)?velbbox.height*yAlignment:yAlignment;}
if(xAlignment==='middle'){tx-=velbbox.width/2;}else if(isDefined(xAlignment)){tx+=(xAlignment>0&&xAlignment<1)?velbbox.width*xAlignment:xAlignment;}
vel.translate(tx,ty);},render:function(){var markup=this.model.markup||this.model.get('markup');if(markup){var nodes=V(markup);V(this.el).append(nodes);}else{throw new Error('properties.markup is missing while the default render() implementation is used.');}
this.update();this.resize();this.rotate();this.translate();return this;},scale:function(sx,sy){V(this.el).scale(sx,sy);},resize:function(){var size=this.model.get('size')||{width:1,height:1};var angle=this.model.get('angle')||0;var scalable=V(this.$('.scalable')[0]);if(!scalable){return;}
var scalableBbox=scalable.bbox(true);scalable.attr('transform','scale('+(size.width/scalableBbox.width)+','+(size.height/scalableBbox.height)+')');var rotatable=V(this.$('.rotatable')[0]);var rotation=rotatable&&rotatable.attr('transform');if(rotation&&rotation!=='null'){rotatable.attr('transform',rotation+' rotate('+(-angle)+','+(size.width/2)+','+(size.height/2)+')');var rotatableBbox=scalable.bbox(false,this.paper.viewport);this.model.set('position',{x:rotatableBbox.x,y:rotatableBbox.y});this.rotate();}
this.update();},translate:function(model,changes,opt){var position=this.model.get('position')||{x:0,y:0};V(this.el).attr('transform','translate('+position.x+','+position.y+')');},rotate:function(){var rotatable=V(this.$('.rotatable')[0]);if(!rotatable){return;}
var angle=this.model.get('angle')||0;var size=this.model.get('size')||{width:1,height:1};var ox=size.width/2;var oy=size.height/2;rotatable.attr('transform','rotate('+angle+','+ox+','+oy+')');},pointerdown:function(evt,x,y){if(evt.target.getAttribute('magnet')&&this.paper.options.validateMagnet.call(this.paper,this,evt.target)){this.model.trigger('batch:start');var link=this.paper.getDefaultLink(this,evt.target);link.set({source:{id:this.model.id,selector:this.getSelector(evt.target),port:$(evt.target).attr('port')},target:{x:x,y:y}});this.paper.model.addCell(link);this._linkView=this.paper.findViewByModel(link);this._linkView.startArrowheadMove('target');}else{this._dx=x;this._dy=y;joint.dia.CellView.prototype.pointerdown.apply(this,arguments);}},pointermove:function(evt,x,y){if(this._linkView){this._linkView.pointermove(evt,x,y);}else{var grid=this.paper.options.gridSize;if(this.options.interactive!==false){var position=this.model.get('position');this.model.translate(g.snapToGrid(position.x,grid)-position.x+g.snapToGrid(x-this._dx,grid),g.snapToGrid(position.y,grid)-position.y+g.snapToGrid(y-this._dy,grid));}
this._dx=g.snapToGrid(x,grid);this._dy=g.snapToGrid(y,grid);joint.dia.CellView.prototype.pointermove.apply(this,arguments);}},pointerup:function(evt,x,y){if(this._linkView){this._linkView.pointerup(evt,x,y);delete this._linkView;this.model.trigger('batch:stop');}else{joint.dia.CellView.prototype.pointerup.apply(this,arguments);}}});if(typeof exports==='object'){module.exports.Element=joint.dia.Element;module.exports.ElementView=joint.dia.ElementView;}
if(typeof exports==='object'){var joint={dia:{Cell:require('./joint.dia.cell').Cell,CellView:require('./joint.dia.cell').CellView}};var Backbone=require('backbone');var _=require('lodash');var g=require('./geometry').g;}
joint.dia.Link=joint.dia.Cell.extend({markup:['<path class="connection" stroke="black"/>','<path class="marker-source" fill="black" stroke="black" />','<path class="marker-target" fill="black" stroke="black" />','<path class="connection-wrap"/>','<g class="labels"/>','<g class="marker-vertices"/>','<g class="marker-arrowheads"/>','<g class="link-tools"/>'].join(''),labelMarkup:['<g class="label">','<rect />','<text />','</g>'].join(''),toolMarkup:['<g class="link-tool">','<g class="tool-remove" event="remove">','<circle r="11" />','<path transform="scale(.8) translate(-16, -16)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z"/>','<title>Remove link.</title>','</g>','<g class="tool-options" event="link:options">','<circle r="11" transform="translate(25)"/>','<path fill="white" transform="scale(.55) translate(29, -16)" d="M31.229,17.736c0.064-0.571,0.104-1.148,0.104-1.736s-0.04-1.166-0.104-1.737l-4.377-1.557c-0.218-0.716-0.504-1.401-0.851-2.05l1.993-4.192c-0.725-0.91-1.549-1.734-2.458-2.459l-4.193,1.994c-0.647-0.347-1.334-0.632-2.049-0.849l-1.558-4.378C17.165,0.708,16.588,0.667,16,0.667s-1.166,0.041-1.737,0.105L12.707,5.15c-0.716,0.217-1.401,0.502-2.05,0.849L6.464,4.005C5.554,4.73,4.73,5.554,4.005,6.464l1.994,4.192c-0.347,0.648-0.632,1.334-0.849,2.05l-4.378,1.557C0.708,14.834,0.667,15.412,0.667,16s0.041,1.165,0.105,1.736l4.378,1.558c0.217,0.715,0.502,1.401,0.849,2.049l-1.994,4.193c0.725,0.909,1.549,1.733,2.459,2.458l4.192-1.993c0.648,0.347,1.334,0.633,2.05,0.851l1.557,4.377c0.571,0.064,1.148,0.104,1.737,0.104c0.588,0,1.165-0.04,1.736-0.104l1.558-4.377c0.715-0.218,1.399-0.504,2.049-0.851l4.193,1.993c0.909-0.725,1.733-1.549,2.458-2.458l-1.993-4.193c0.347-0.647,0.633-1.334,0.851-2.049L31.229,17.736zM16,20.871c-2.69,0-4.872-2.182-4.872-4.871c0-2.69,2.182-4.872,4.872-4.872c2.689,0,4.871,2.182,4.871,4.872C20.871,18.689,18.689,20.871,16,20.871z"/>','<title>Link options.</title>','</g>','</g>'].join(''),vertexMarkup:['<g class="marker-vertex-group" transform="translate(<%= x %>, <%= y %>)">','<circle class="marker-vertex" idx="<%= idx %>" r="10" />','<path class="marker-vertex-remove-area" idx="<%= idx %>" d="M16,5.333c-7.732,0-14,4.701-14,10.5c0,1.982,0.741,3.833,2.016,5.414L2,25.667l5.613-1.441c2.339,1.317,5.237,2.107,8.387,2.107c7.732,0,14-4.701,14-10.5C30,10.034,23.732,5.333,16,5.333z" transform="translate(5, -33)"/>','<path class="marker-vertex-remove" idx="<%= idx %>" transform="scale(.8) translate(9.5, -37)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z">','<title>Remove vertex.</title>','</path>','</g>'].join(''),arrowheadMarkup:['<g class="marker-arrowhead-group marker-arrowhead-group-<%= end %>">','<path class="marker-arrowhead" end="<%= end %>" d="M 26 0 L 0 13 L 26 26 z" />','</g>'].join(''),defaults:{type:'link'},disconnect:function(){return this.set({source:g.point(0,0),target:g.point(0,0)});},label:function(idx,value){idx=idx||0;var labels=this.get('labels');if(arguments.length===0||arguments.length===1){return labels&&labels[idx];}
var newValue=_.merge({},labels[idx],value);var newLabels=labels.slice();newLabels[idx]=newValue;return this.set({labels:newLabels});}});joint.dia.LinkView=joint.dia.CellView.extend({className:'link',options:{shortLinkLength:100},initialize:function(){joint.dia.CellView.prototype.initialize.apply(this,arguments);this.watchSource=this._createWatcher('source');this.watchTarget=this._createWatcher('target');this._labelCache={};this.startListening();},startListening:function(){this.listenTo(this.model,'change:markup',this.render);this.listenTo(this.model,'change:smooth change:manhattan',this.update);this.listenTo(this.model,'change:toolMarkup',function(){this.renderTools().updateToolsPosition();});this.listenTo(this.model,'change:labels change:labelMarkup',function(){this.renderLabels().updateLabelPositions();});this.listenTo(this.model,'change:vertices change:vertexMarkup',function(){this.renderVertexMarkers().update();});this.listenTo(this.model,'change:source',function(cell,source){this.watchSource(cell,source).update();});this.listenTo(this.model,'change:target',function(cell,target){this.watchTarget(cell,target).update();});},render:function(){this.$el.empty();var children=V(this.model.get('markup')||this.model.markup);if(!_.isArray(children))children=[children];this._V={}
_.each(children,function(child){var c=child.attr('class');c&&(this._V[$.camelCase(c)]=child);},this);if(!this._V.connection)throw new Error('link: no connection path in the markup');this.renderLabels();this.renderTools();this.renderVertexMarkers();this.renderArrowheadMarkers();V(this.el).append(children);this.watchSource(this.model,this.model.get('source')).watchTarget(this.model,this.model.get('target')).update();return this;},renderLabels:function(){if(!this._V.labels)return this;this._labelCache={};var $labels=$(this._V.labels.node).empty();var labels=this.model.get('labels')||[];if(!labels.length)return this;var labelTemplate=_.template(this.model.get('labelMarkup')||this.model.labelMarkup);var labelNodeInstance=V(labelTemplate());_.each(labels,function(label,idx){var labelNode=labelNodeInstance.clone().node;this._labelCache[idx]=V(labelNode);var $text=$(labelNode).find('text');var $rect=$(labelNode).find('rect');var textAttributes=_.extend({'text-anchor':'middle'},joint.util.getByPath(label,'attrs/text','/'));$text.attr(_.omit(textAttributes,'text'));if(!_.isUndefined(textAttributes.text)){V($text[0]).text(textAttributes.text+'');}
$labels.append(labelNode);var textBbox=V($text[0]).bbox(true,$labels[0]);V($text[0]).translate(0,-textBbox.height/2);var rectAttributes=_.extend({fill:'white',rx:3,ry:3},joint.util.getByPath(label,'attrs/rect','/'));$rect.attr(_.extend(rectAttributes,{x:textBbox.x,y:textBbox.y-textBbox.height/2,width:textBbox.width,height:textBbox.height}));},this);return this;},renderTools:function(){if(!this._V.linkTools)return this;var $tools=$(this._V.linkTools.node).empty();var toolTemplate=_.template(this.model.get('toolMarkup')||this.model.toolMarkup);var tool=V(toolTemplate());$tools.append(tool.node);this._toolCache=tool;return this;},renderVertexMarkers:function(){if(!this._V.markerVertices)return this;var $markerVertices=$(this._V.markerVertices.node).empty();var markupTemplate=_.template(this.model.get('vertexMarkup')||this.model.vertexMarkup);_.each(this.model.get('vertices'),function(vertex,idx){$markerVertices.append(V(markupTemplate(_.extend({idx:idx},vertex))).node);});return this;},renderArrowheadMarkers:function(){if(!this._V.markerArrowheads)return this;var $markerArrowheads=$(this._V.markerArrowheads.node);$markerArrowheads.empty();var markupTemplate=_.template(this.model.get('arrowheadMarkup')||this.model.arrowheadMarkup);this._sourceArrowhead=V(markupTemplate({end:'source'}));this._targetArrowhead=V(markupTemplate({end:'target'}));$markerArrowheads.append(this._sourceArrowhead.node,this._targetArrowhead.node);return this;},update:function(){_.each(this.model.get('attrs'),function(attrs,selector){if(_.isObject(attrs.filter)){this.findBySelector(selector).attr(_.omit(attrs,'filter'));this.applyFilter(selector,attrs.filter);}else{this.findBySelector(selector).attr(attrs);}},this);var vertices=this.model.get('vertices');if(this.model.get('manhattan')){vertices=this.findManhattanRoute(vertices);}
this._firstVertex=_.first(vertices);this._sourcePoint=this.getConnectionPoint('source',this.model.get('source'),this._firstVertex||this.model.get('target')).round();this._lastVertex=_.last(vertices);this._targetPoint=this.getConnectionPoint('target',this.model.get('target'),this._lastVertex||this._sourcePoint);if(this._V.markerSource){this._V.markerSource.translateAndAutoOrient(this._sourcePoint,this._firstVertex||this._targetPoint,this.paper.viewport);}
if(this._V.markerTarget){this._V.markerTarget.translateAndAutoOrient(this._targetPoint,this._lastVertex||this._sourcePoint,this.paper.viewport);}
var pathData=this.getPathData(vertices);this._V.connection.attr('d',pathData);this._V.connectionWrap&&this._V.connectionWrap.attr('d',pathData);this.updateLabelPositions();this.updateToolsPosition();this.updateArrowheadMarkers();return this;},updateLabelPositions:function(){if(!this._V.labels)return this;var labels=this.model.get('labels')||[];if(!labels.length)return this;var connectionElement=this._V.connection.node;var connectionLength=connectionElement.getTotalLength();_.each(labels,function(label,idx){var position=label.position;position=(position>connectionLength)?connectionLength:position;position=(position<0)?connectionLength+position:position;position=position>1?position:connectionLength*position;var labelCoordinates=connectionElement.getPointAtLength(position);this._labelCache[idx].attr('transform','translate('+labelCoordinates.x+', '+labelCoordinates.y+')');},this);return this;},updateToolsPosition:function(){if(!this._V.linkTools)return this;var scale='';var offset=40;if(this.getConnectionLength()<this.options.shortLinkLength){scale='scale(.5)';offset/=2;}
var toolPosition=this.getPointAtLength(offset);this._toolCache.attr('transform','translate('+toolPosition.x+', '+toolPosition.y+') '+scale);return this;},updateArrowheadMarkers:function(){if(!this._V.markerArrowheads)return this;if($.css(this._V.markerArrowheads.node,'display')==='none')return this;var sx=this.getConnectionLength()<this.options.shortLinkLength?.5:1
this._sourceArrowhead.scale(sx);this._targetArrowhead.scale(sx);this._sourceArrowhead.translateAndAutoOrient(this._sourcePoint,this._firstVertex||this._targetPoint,this.paper.viewport);this._targetArrowhead.translateAndAutoOrient(this._targetPoint,this._lastVertex||this._sourcePoint,this.paper.viewport);return this;},_createWatcher:function(endType){function watchEnd(link,end){end=end||{};var previousEnd=link.previous(endType)||{};if(this._isModel(previousEnd)){this.stopListening(this.paper.getModelById(previousEnd.id),'change');}
if(this._isModel(end)){this.listenTo(this.paper.getModelById(end.id),'change',function(){this._cacheEndBbox(endType,end).update();});}
return this._cacheEndBbox(endType,end);}
return watchEnd;},_cacheEndBbox:function(endType,end){var cacheBbox='_'+endType+'Bbox';if(this._isModel(end)){var selector=this._makeSelector(end);var view=this.paper.findViewByModel(end.id);var magnetElement=this.paper.viewport.querySelector(selector);this[cacheBbox]=view.getStrokeBBox(magnetElement);}else{this[cacheBbox]={width:1,height:1,x:end.x,y:end.y};}
return this;},removeVertex:function(idx){var vertices=_.clone(this.model.get('vertices'));if(vertices&&vertices.length){vertices.splice(idx,1);this.model.set('vertices',vertices);}
return this;},addVertex:function(vertex){this.model.set('attrs',this.model.get('attrs')||{});var attrs=this.model.get('attrs');var vertices=(this.model.get('vertices')||[]).slice();var originalVertices=vertices.slice();var path=this._V.connection.node.cloneNode(false);var originalPathLength=path.getTotalLength();var pathLength;var pathLengthTolerance=20;var idx=vertices.length+1;while(idx--){vertices.splice(idx,0,vertex);V(path).attr('d',this.getPathData(vertices));pathLength=path.getTotalLength();if(pathLength-originalPathLength>pathLengthTolerance){vertices=originalVertices.slice();}else{break;}}
this.model.set('vertices',vertices);return Math.max(idx,0);},getPathData:function(vertices){var sourcePoint=g.point(this._sourcePoint);var targetPoint=g.point(this._targetPoint);if(this._V.markerSource){this._markerSourceBbox=this._markerSourceBbox||this._V.markerSource.bbox(true);sourcePoint.move(this._firstVertex||targetPoint,this._markerSourceBbox.width*-this._V.markerSource.scale().sx);}
if(this._V.markerTarget){this._markerTargetBbox=this._markerTargetBbox||this._V.markerTarget.bbox(true);targetPoint.move(this._lastVertex||sourcePoint,this._markerTargetBbox.width*-this._V.markerTarget.scale().sx);}
var d;if(this.model.get('smooth')){if(vertices&&vertices.length){d=g.bezier.curveThroughPoints([sourcePoint].concat(vertices||[]).concat([targetPoint]));}else{var controlPointX=(sourcePoint.x<targetPoint.x)?targetPoint.x-((targetPoint.x-sourcePoint.x)/2):sourcePoint.x-((sourcePoint.x-targetPoint.x)/2);d=['M',sourcePoint.x,sourcePoint.y,'C',controlPointX,sourcePoint.y,controlPointX,targetPoint.y,targetPoint.x,targetPoint.y];}}else{d=['M',sourcePoint.x,sourcePoint.y];_.each(vertices,function(vertex){d.push(vertex.x,vertex.y);});d.push(targetPoint.x,targetPoint.y);}
return d.join(' ');},getConnectionPoint:function(end,selectorOrPoint,referenceSelectorOrPoint){var spot;if(this._isPoint(selectorOrPoint)){spot=g.point(selectorOrPoint);}else{var spotBbox=end==='source'?this._sourceBbox:this._targetBbox;var reference;if(this._isPoint(referenceSelectorOrPoint)){reference=g.point(referenceSelectorOrPoint);}else{var referenceBbox=end==='source'?this._targetBbox:this._sourceBbox;reference=g.rect(referenceBbox).intersectionWithLineFromCenterToPoint(g.rect(spotBbox).center());reference=reference||g.rect(referenceBbox).center();}
if(this.paper.options.perpendicularLinks){var horizontalLineRect=g.rect(0,reference.y,this.paper.options.width,1);var verticalLineRect=g.rect(reference.x,0,1,this.paper.options.height);var nearestSide;if(horizontalLineRect.intersect(g.rect(spotBbox))){nearestSide=g.rect(spotBbox).sideNearestToPoint(reference);switch(nearestSide){case'left':spot=g.point(spotBbox.x,reference.y);break;case'right':spot=g.point(spotBbox.x+spotBbox.width,reference.y);break;default:spot=g.rect(spotBbox).center();break;}}else if(verticalLineRect.intersect(g.rect(spotBbox))){nearestSide=g.rect(spotBbox).sideNearestToPoint(reference);switch(nearestSide){case'top':spot=g.point(reference.x,spotBbox.y);break;case'bottom':spot=g.point(reference.x,spotBbox.y+spotBbox.height);break;default:spot=g.rect(spotBbox).center();break;}}else{spot=g.rect(spotBbox).intersectionWithLineFromCenterToPoint(reference);spot=spot||g.rect(spotBbox).center();}}else{spot=g.rect(spotBbox).intersectionWithLineFromCenterToPoint(reference);spot=spot||g.rect(spotBbox).center();}}
return spot;},_isModel:function(end){return end&&end.id;},_isPoint:function(end){return!this._isModel(end);},_makeSelector:function(end){var selector='[model-id="'+end.id+'"]';if(end.port){selector+=' [port="'+end.port+'"]';}else if(end.selector){selector+=' '+end.selector;}
return selector;},findManhattanRoute:function(vertices){vertices=(vertices||[]).slice();var manhattanVertices=[];function direction(p1,p2){if(p1.y<p2.y&&p1.x===p2.x){return'down';}else if(p1.y>p2.y&&p1.x===p2.x){return'up';}else if(p1.x<p2.x&&p1.y===p2.y){return'right';}
return'left';}
function bestDirection(p1,p2,preferredDirection){var directions;if(p1.x<p2.x){if(p1.y>p2.y){directions=['up','right'];}
else if(p1.y<p2.y){directions=['down','right'];}
else{directions=['right'];}}else if(p1.x>p2.x){if(p1.y>p2.y){directions=['up','left'];}
else if(p1.y<p2.y){directions=['down','left'];}
else{directions=['left'];}}else{if(p1.y>p2.y){directions=['up'];}
else{directions=['down'];}}
if(_.contains(directions,preferredDirection)){return preferredDirection;}
var direction=_.first(directions);switch(preferredDirection){case'down':if(direction==='up')return _.last(directions);break;case'up':if(direction==='down')return _.last(directions);break;case'left':if(direction==='right')return _.last(directions);break;case'right':if(direction==='left')return _.last(directions);break;}
return direction;}
function findMiddleVertex(p1,p2,preferredDirection){var direction=bestDirection(p1,p2,preferredDirection);if(direction==='down'||direction==='up'){return{x:p1.x,y:p2.y,d:direction};}
return{x:p2.x,y:p1.y,d:direction};}
var sourceCenter=g.rect(this._sourceBbox).center();var targetCenter=g.rect(this._targetBbox).center();vertices.unshift(sourceCenter);vertices.push(targetCenter);var manhattanVertex;var lastManhattanVertex;var vertex;var nextVertex;for(var i=0;i<vertices.length-1;i++){vertex=vertices[i];nextVertex=vertices[i+1];lastManhattanVertex=_.last(manhattanVertices);if(i>0){manhattanVertex=vertex;manhattanVertex.d=lastManhattanVertex?direction(lastManhattanVertex,vertex):'top';manhattanVertices.push(manhattanVertex);lastManhattanVertex=manhattanVertex;}
var d=lastManhattanVertex&&lastManhattanVertex.d;manhattanVertex=findMiddleVertex(vertex,nextVertex,d);if(!g.point(manhattanVertex).equals(g.point(vertex))&&!g.point(manhattanVertex).equals(g.point(nextVertex))){manhattanVertices.push(manhattanVertex);}}
return manhattanVertices;},getConnectionLength:function(){return this._V.connection.node.getTotalLength();},getPointAtLength:function(length){return this._V.connection.node.getPointAtLength(length);},_beforeArrowheadMove:function(){this.model.trigger('batch:start');this._z=this.model.get('z');this.model.set('z',Number.MAX_VALUE);this.el.style.pointerEvents='none';},_afterArrowheadMove:function(){if(this._z){this.model.set('z',this._z);delete this._z;}
this.el.style.pointerEvents='visiblePainted';this.model.trigger('batch:stop');},_createValidateConnectionArgs:function(arrowhead){var args=[];args[4]=arrowhead;args[5]=this;var oppositeArrowhead,i=0,j=0;if(arrowhead==='source'){i=2;oppositeArrowhead='target';}else{j=2;oppositeArrowhead='source';}
var end=this.model.get(oppositeArrowhead);if(end.id){args[i]=this.paper.findViewByModel(end.id)
args[i+1]=end.selector&&args[i].el.querySelector(end.selector);}
function validateConnectionArgs(cellView,magnet){args[j]=cellView;args[j+1]=cellView.el===magnet?undefined:magnet;return args;}
return validateConnectionArgs;},startArrowheadMove:function(end){this._action='arrowhead-move';this._arrowhead=end;this._beforeArrowheadMove();this._validateConnectionArgs=this._createValidateConnectionArgs(this._arrowhead);},pointerdown:function(evt,x,y){joint.dia.CellView.prototype.pointerdown.apply(this,arguments);this._dx=x;this._dy=y;if(this.options.interactive===false)return;var className=evt.target.getAttribute('class');switch(className){case'marker-vertex':this._action='vertex-move';this._vertexIdx=evt.target.getAttribute('idx');break;case'marker-vertex-remove':case'marker-vertex-remove-area':this.removeVertex(evt.target.getAttribute('idx'));break;case'marker-arrowhead':this.startArrowheadMove(evt.target.getAttribute('end'));break;default:var targetParentEvent=evt.target.parentNode.getAttribute('event');if(targetParentEvent){if(targetParentEvent==='remove'){this.model.remove();}else{this.paper.trigger(targetParentEvent,evt,this,x,y);}}else{this._vertexIdx=this.addVertex({x:x,y:y});this._action='vertex-move';}}},pointermove:function(evt,x,y){joint.dia.CellView.prototype.pointermove.apply(this,arguments);switch(this._action){case'vertex-move':var vertices=_.clone(this.model.get('vertices'));vertices[this._vertexIdx]={x:x,y:y};this.model.set('vertices',vertices);break;case'arrowhead-move':var target=(evt.type==='mousemove')?evt.target:document.elementFromPoint(evt.clientX,evt.clientY)
if(this._targetEvent!==target){this._magnetUnderPointer&&this._viewUnderPointer.unhighlight(this._magnetUnderPointer);this._viewUnderPointer=this.paper.findView(target);if(this._viewUnderPointer){this._magnetUnderPointer=this._viewUnderPointer.findMagnet(target);if(this._magnetUnderPointer&&this.paper.options.validateConnection.apply(this.paper,this._validateConnectionArgs(this._viewUnderPointer,this._magnetUnderPointer))){this._magnetUnderPointer&&this._viewUnderPointer.highlight(this._magnetUnderPointer);}else{this._magnetUnderPointer=null;}}else{this._magnetUnderPointer=null;}}
this._targetEvent=target;this.model.set(this._arrowhead,{x:x,y:y});break;}
this._dx=x;this._dy=y;},pointerup:function(evt){joint.dia.CellView.prototype.pointerup.apply(this,arguments);if(this._action==='arrowhead-move'){if(this._magnetUnderPointer){this._viewUnderPointer.unhighlight(this._magnetUnderPointer);this.model.set(this._arrowhead,{id:this._viewUnderPointer.model.id,selector:this._viewUnderPointer.getSelector(this._magnetUnderPointer),port:$(this._magnetUnderPointer).attr('port')});}
delete this._viewUnderPointer;delete this._magnetUnderPointer;delete this._staticView;delete this._staticMagnet;this._afterArrowheadMove();}
delete this._action;}});if(typeof exports==='object'){module.exports.Link=joint.dia.Link;module.exports.LinkView=joint.dia.LinkView;}
joint.dia.Paper=Backbone.View.extend({options:{width:800,height:600,gridSize:50,perpendicularLinks:false,elementView:joint.dia.ElementView,linkView:joint.dia.LinkView,defaultLink:new joint.dia.Link,validateMagnet:function(cellView,magnet){return magnet.getAttribute('magnet')!=='passive';},validateConnection:function(cellViewS,magnetS,cellViewT,magnetT,end,linkView){return(end==='target'?cellViewT:cellViewS)instanceof joint.dia.ElementView;}},events:{'mousedown':'pointerdown','dblclick':'mousedblclick','touchstart':'pointerdown','mousemove':'pointermove','touchmove':'pointermove'},initialize:function(){_.bindAll(this,'addCell','sortCells','resetCells','pointerup');this.svg=V('svg').node;this.viewport=V('g').node;V(this.svg).append(V('defs').node);V(this.viewport).attr({'class':'viewport'});V(this.svg).append(this.viewport);this.$el.append(this.svg);this.setDimensions();this.listenTo(this.model,'add',this.addCell);this.listenTo(this.model,'reset',this.resetCells);this.listenTo(this.model,'sort',this.sortCells);$(document).on('mouseup touchend',this.pointerup);},remove:function(){$(document).off('mouseup touchend',this.pointerup);Backbone.View.prototype.remove.call(this);},setDimensions:function(width,height){if(width)this.options.width=width;if(height)this.options.height=height;V(this.svg).attr('width',this.options.width);V(this.svg).attr('height',this.options.height);this.trigger('resize');},fitToContent:function(gridWidth,gridHeight,padding){gridWidth=gridWidth||1;gridHeight=gridHeight||1;padding=padding||0;var bbox=V(this.viewport).bbox(true,this.svg);var calcWidth=Math.ceil((bbox.width+bbox.x)/gridWidth)*gridWidth;var calcHeight=Math.ceil((bbox.height+bbox.y)/gridHeight)*gridHeight;calcWidth+=padding;calcHeight+=padding;if(calcWidth!=this.options.width||calcHeight!=this.options.height){this.setDimensions(calcWidth||this.options.width,calcHeight||this.options.height);}},createViewForModel:function(cell){var view;var type=cell.get('type');var module=type.split('.')[0];var entity=type.split('.')[1];if(joint.shapes[module]&&joint.shapes[module][entity+'View']){view=new joint.shapes[module][entity+'View']({model:cell,interactive:this.options.interactive});}else if(cell instanceof joint.dia.Element){view=new this.options.elementView({model:cell,interactive:this.options.interactive});}else{view=new this.options.linkView({model:cell,interactive:this.options.interactive});}
return view;},addCell:function(cell){var view=this.createViewForModel(cell);V(this.viewport).append(view.el);view.paper=this;view.render();$(view.el).find('image').on('dragstart',function(){return false;});},resetCells:function(cellsCollection){$(this.viewport).empty();var cells=cellsCollection.models.slice();cells.sort(function(a,b){return a instanceof joint.dia.Link?1:-1;});_.each(cells,this.addCell,this);this.sortCells();},sortCells:function(){var $cells=$(this.viewport).children('[model-id]');var cells=this.model.get('cells');$cells.sortElements(function(a,b){var cellA=cells.get($(a).attr('model-id'));var cellB=cells.get($(b).attr('model-id'));return(cellA.get('z')||0)>(cellB.get('z')||0)?1:-1;});},scale:function(sx,sy,ox,oy){if(!ox){ox=0;oy=0;}
V(this.viewport).attr('transform','');if(ox||oy){V(this.viewport).translate(-ox*(sx-1),-oy*(sy-1));}
V(this.viewport).scale(sx,sy);this.trigger('scale',ox,oy);return this;},rotate:function(deg,ox,oy){if(_.isUndefined(ox)){var bbox=this.viewport.getBBox();ox=bbox.width/2;oy=bbox.height/2;}
V(this.viewport).rotate(deg,ox,oy);},zoom:function(level){level=level||1;V(this.svg).attr('width',this.options.width*level);V(this.svg).attr('height',this.options.height*level);},findView:function(el){var $el=this.$(el);if($el.length===0||$el[0]===this.el){return undefined;}
if($el.data('view')){return $el.data('view');}
return this.findView($el.parent());},findViewByModel:function(cell){var id=_.isString(cell)?cell:cell.id;var $view=this.$('[model-id="'+id+'"]');if($view.length){return $view.data('view');}
return undefined;},findViewsFromPoint:function(p){p=g.point(p);var views=_.map(this.model.getElements(),this.findViewByModel);return _.filter(views,function(view){return g.rect(view.getBBox()).containsPoint(p);});},findViewsInArea:function(r){r=g.rect(r);var views=_.map(this.model.getElements(),this.findViewByModel);return _.filter(views,function(view){return r.intersect(g.rect(view.getBBox()));});},getModelById:function(id){return this.model.getCell(id);},snapToGrid:function(p){var localPoint=V(this.viewport).toLocalPoint(p.x,p.y);return{x:g.snapToGrid(localPoint.x,this.options.gridSize),y:g.snapToGrid(localPoint.y,this.options.gridSize)};},getDefaultLink:function(cellView,magnet){return _.isFunction(this.options.defaultLink)?this.options.defultLink.call(this,cellView,magnet):this.options.defaultLink.clone();},mousedblclick:function(evt){evt.preventDefault();evt=joint.util.normalizeEvent(evt);var view=this.findView(evt.target);var localPoint=this.snapToGrid({x:evt.clientX,y:evt.clientY});if(view){view.pointerdblclick(evt,localPoint.x,localPoint.y);}else{this.trigger('blank:pointerdblclick',evt,localPoint.x,localPoint.y);}},pointerdown:function(evt){evt.preventDefault();evt=joint.util.normalizeEvent(evt);var view=this.findView(evt.target);var localPoint=this.snapToGrid({x:evt.clientX,y:evt.clientY});if(view){this.sourceView=view;view.pointerdown(evt,localPoint.x,localPoint.y);}else{this.trigger('blank:pointerdown',evt,localPoint.x,localPoint.y);}},pointermove:function(evt){evt.preventDefault();evt=joint.util.normalizeEvent(evt);if(this.sourceView){var localPoint=this.snapToGrid({x:evt.clientX,y:evt.clientY});this.sourceView.pointermove(evt,localPoint.x,localPoint.y);}},pointerup:function(evt){evt=joint.util.normalizeEvent(evt);var localPoint=this.snapToGrid({x:evt.clientX,y:evt.clientY});if(this.sourceView){this.sourceView.pointerup(evt,localPoint.x,localPoint.y);this.sourceView=null;}else{this.trigger('blank:pointerup',evt,localPoint.x,localPoint.y);}}});if(typeof exports==='object'){var joint={util:require('../src/core').util,shapes:{},dia:{Element:require('../src/joint.dia.element').Element}};var _=require('lodash');}
joint.shapes.basic={};joint.shapes.basic.Generic=joint.dia.Element.extend({defaults:joint.util.deepSupplement({type:'basic.Generic',attrs:{'.':{fill:'#FFFFFF',stroke:'none'}}},joint.dia.Element.prototype.defaults)});joint.shapes.basic.Rect=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><rect/></g><text/></g>',defaults:joint.util.deepSupplement({type:'basic.Rect',attrs:{'rect':{fill:'#FFFFFF',stroke:'black',width:100,height:60},'text':{'font-size':14,text:'','ref-x':.5,'ref-y':.5,ref:'rect','y-alignment':'middle','x-alignment':'middle',fill:'black','font-family':'Arial, helvetica, sans-serif'}}},joint.shapes.basic.Generic.prototype.defaults)});joint.shapes.basic.Text=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><text/></g></g>',defaults:joint.util.deepSupplement({type:'basic.Text',attrs:{'text':{'font-size':18,fill:'black'}}},joint.shapes.basic.Generic.prototype.defaults)});joint.shapes.basic.Circle=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><circle/></g><text/></g>',defaults:joint.util.deepSupplement({type:'basic.Circle',size:{width:60,height:60},attrs:{'circle':{fill:'#FFFFFF',stroke:'black',r:30,transform:'translate(30, 30)'},'text':{'font-size':14,text:'','text-anchor':'middle','ref-x':.5,'ref-y':.5,ref:'circle','y-alignment':'middle',fill:'black','font-family':'Arial, helvetica, sans-serif'}}},joint.shapes.basic.Generic.prototype.defaults)});joint.shapes.basic.Image=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><image/></g><text/></g>',defaults:joint.util.deepSupplement({type:'basic.Image',attrs:{'text':{'font-size':14,text:'','text-anchor':'middle','ref-x':.5,'ref-dy':20,ref:'image','y-alignment':'middle',fill:'black','font-family':'Arial, helvetica, sans-serif'}}},joint.shapes.basic.Generic.prototype.defaults)});joint.shapes.basic.Path=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><path/></g><text/></g>',defaults:joint.util.deepSupplement({type:'basic.Path',size:{width:60,height:60},attrs:{'path':{fill:'#FFFFFF',stroke:'black'},'text':{'font-size':14,text:'','text-anchor':'middle','ref-x':.5,'ref-dy':20,ref:'path','y-alignment':'middle',fill:'black','font-family':'Arial, helvetica, sans-serif'}}},joint.shapes.basic.Generic.prototype.defaults)});joint.shapes.basic.PortsModelInterface={initialize:function(){this.updatePortsAttrs();this.on('change:inPorts change:outPorts',this.updatePortsAttrs,this);this.constructor.__super__.constructor.__super__.initialize.apply(this,arguments);},updatePortsAttrs:function(eventName){var currAttrs=this.get('attrs');_.each(this._portSelectors,function(selector){if(currAttrs[selector])delete currAttrs[selector];});this._portSelectors=[];var attrs={};_.each(this.get('inPorts'),function(portName,index,ports){var portAttributes=this.getPortAttrs(portName,index,ports.length,'.inPorts','in');this._portSelectors=this._portSelectors.concat(_.keys(portAttributes));_.extend(attrs,portAttributes);},this);_.each(this.get('outPorts'),function(portName,index,ports){var portAttributes=this.getPortAttrs(portName,index,ports.length,'.outPorts','out');this._portSelectors=this._portSelectors.concat(_.keys(portAttributes));_.extend(attrs,portAttributes);},this);this.attr(attrs,{silent:true});this.processPorts();this.trigger('process:ports');},getPortSelector:function(name){var selector='.inPorts';var index=this.get('inPorts').indexOf(name);if(index<0){selector='.outPorts';index=this.get('outPorts').indexOf(name);if(index<0)throw new Error("getPortSelector(): Port doesn't exist.");}
return selector+'>g:nth-child('+(index+1)+')>circle';}};joint.shapes.basic.PortsViewInterface={initialize:function(){this.listenTo(this.model,'process:ports',this.update);joint.dia.ElementView.prototype.initialize.apply(this,arguments);},update:function(){this.renderPorts();joint.dia.ElementView.prototype.update.apply(this,arguments);},renderPorts:function(){var $inPorts=this.$('.inPorts').empty();var $outPorts=this.$('.outPorts').empty();var portTemplate=_.template(this.model.portMarkup);_.each(_.filter(this.model.ports,function(p){return p.type==='in'}),function(port,index){$inPorts.append(V(portTemplate({id:index,port:port})).node);});_.each(_.filter(this.model.ports,function(p){return p.type==='out'}),function(port,index){$outPorts.append(V(portTemplate({id:index,port:port})).node);});}};joint.shapes.basic.TextBlock=joint.shapes.basic.Rect.extend({markup:['<g class="rotatable"><g class="scalable"><rect/></g><switch>','<foreignObject requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" class="fobj">','<body xmlns="http://www.w3.org/1999/xhtml"><div/></body>','</foreignObject>','<svg overflow="hidden"><text/></svg>','</switch></g>'].join(''),defaults:joint.util.deepSupplement({type:'basic.TextBlock',content:''},joint.shapes.basic.Rect.prototype.defaults),initialize:function(){if(typeof SVGForeignObjectElement!=='undefined'){this.setForeignObjectSize(this,this.get('size'));this.setDivContent(this,this.get('content'));this.listenTo(this,'change:size',this.setForeignObjectSize);this.listenTo(this,'change:content',this.setDivContent);}else{this.setSvgSize(this,this.get('size'));this.setTextContent(this,this.get('content'));this.listenTo(this,'change:size',this.setSvgSize);this.listenTo(this,'change:content',this.setTextContent);}
joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments);},setForeignObjectSize:function(cell,size){cell.attr({'.fobj':_.clone(size),div:{style:_.clone(size)}});},setSvgSize:function(cell,size){cell.attr({svg:_.clone(size)});},setDivContent:function(cell,content){cell.attr({div:{html:content}});},setTextContent:function(cell,content){cell.attr({text:{text:content}});}});if(typeof exports==='object'){module.exports=joint.shapes.basic;}