34 lines
No EOL
651 KiB
JavaScript
34 lines
No EOL
651 KiB
JavaScript
/*!
|
||
* jQuery JavaScript Library v1.8.1
|
||
* http://jquery.com/
|
||
*
|
||
* Includes Sizzle.js
|
||
* http://sizzlejs.com/
|
||
*
|
||
* Copyright 2012 jQuery Foundation and other contributors
|
||
* Released under the MIT license
|
||
* http://jquery.org/license
|
||
*
|
||
* Date: Thu Aug 30 2012 17:17:22 GMT-0400 (Eastern Daylight Time)
|
||
*/
|
||
function BestInPlaceEditor(e){this.element=e,this.initOptions(),this.bindForm(),this.initNil(),jQuery(this.activator).bind("click",{editor:this},this.clickHandler)}function openAnalyze(){analyzeOpen=!0,findOpen&&closeFind(),organizeOpen&&closeOrganize(),$("#sideOptionFind").css("z-index","8"),$("#sideOptionAnalyze, #closeAnalyze").css("z-index","10"),$("#sideOptionOrganize").css("z-index","8"),$("#sideOptionAnalyze").animate({width:"100px",height:"76px"},100),$("#closeAnalyze").css("display","block"),$("#sideOptionAnalyze").css("cursor","default");var e=Object.keys(Mconsole.graph.nodes).length,t=0;Mconsole.graph.eachNode(function(e){e.eachAdjacency(function(){t++})}),t/=2,$(".analysis").html("<p>"+e+" topics</p><p>"+t+" synapses</p>")}function closeAnalyze(){analyzeOpen=!1,$("#closeAnalyze").css("display","none"),$("#sideOptionAnalyze").css("cursor","pointer"),$("#sideOptionAnalyze").animate({width:"64px",height:"32px"},100)}function switchVisible(e,t){categoryVisible[e]==1?hideCategory(e,t):categoryVisible[e]==0&&showCategory(e,t)}function hideCategory(e,t){t==null&&(t=500),Mconsole.graph.eachNode(function(t){t.getData("metacode")==e&&(t.setData("alpha",.4,"end"),t.eachAdjacency(function(e){e.setData("alpha",.4,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:t})}function showCategory(e,t){t==null&&(t=500),Mconsole.graph.eachNode(function(t){t.getData("metacode")==e&&(t.setData("alpha",1,"end"),t.eachAdjacency(function(e){e.setData("alpha",1,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:t})}function hideAll(e){e==null&&(e=500),Mconsole.graph.eachNode(function(e){!e.getData("inCommons")&&!e.getData("onCanvas")&&(e.setData("alpha",.4,"end"),e.eachAdjacency(function(e){e.setData("alpha",.4,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function showAll(e){e==null&&(e=500),Mconsole.graph.eachNode(function(e){e.setData("alpha",1,"end"),e.eachAdjacency(function(e){e.setData("alpha",1,"end")})}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function onCanvasSearch(e,t,n){Mconsole.graph.eachNode(function(r){e!=null?r.name.indexOf(e)!==-1&&e!=""?r.setData("onCanvas",!0):r.setData("onCanvas",!1):t!=null?r.getData("inmaps").indexOf(parseInt(t))!==-1?r.setData("onCanvas",!0):r.setData("onCanvas",!1):n!=null&&(r.getData("userid").toString()==n?r.setData("onCanvas",!0):r.setData("onCanvas",!1)),Mconsole.plot()})}function clearCanvas(){Mconsole.graph.eachNode(function(e){Mconsole.graph.removeNode(e.id),Mconsole.labels.disposeLabel(e.id)}),Mconsole.plot()}function clearFoundData(){Mconsole.graph.eachNode(function(e){e.getData("inCommons")===!0&&(Mconsole.graph.removeNode(e.id),Mconsole.labels.disposeLabel(e.id))}),Mconsole.plot()}function openFind(){findOpen=!0,analyzeOpen&&closeAnalyze(),organizeOpen&&closeOrganize(),$("#sideOptionFind, #closeFind").css("z-index","10"),$("#sideOptionAnalyze").css("z-index","9"),$("#sideOptionOrganize").css("z-index","8"),firstVal=$('#sideOptionFind option[value="name"]').attr("selected"),secondVal=$('#sideOptionFind option[value="metacode"]').attr("selected"),thirdVal=$('#sideOptionFind option[value="map (by name)"]').attr("selected"),fourthVal=$('#sideOptionFind option[value="mapper (by name)"]').attr("selected"),firstVal==="selected"||thirdVal==="selected"||fourthVal==="selected"?$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#topic_by_name_input").focus()}):secondVal==="selected"?$("#sideOptionFind").animate({width:"380px",height:"463px"},100,function(){}):thirdVal==="selected"?$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#map_by_name_input").focus()}):fourthVal==="selected"&&$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#mapper_by_name_input").focus()}),$("#closeFind, #findWhere").css("display","block"),$("#sideOptionFind").css("cursor","default")}function closeFind(){findOpen=!1,Mconsole.graph.eachNode(function(e){e.setData("inCommons",!1),e.setData("onCanvas",!1)}),Mconsole.plot(),$("#closeFind, #findWhere").css("display","none"),$("#sideOptionFind").css("cursor","pointer"),$("#sideOptionFind").animate({width:"45px",height:"32px"},100)}function selectEdgeOnClickHandler(e,t){if(Mconsole.busy)return;if(t.altKey){editEdge(e,t);return}var n=e.getData("showDesc");n&&t.shiftKey?deselectEdge(e):!n&&t.shiftKey?selectEdge(e):n&&!t.shiftKey?deselectAllEdges():!n&&!t.shiftKey&&(deselectAllEdges(),selectEdge(e)),Mconsole.plot()}function selectNodeOnClickHandler(e,t){if(Mconsole.busy)return;gType!="centered"&&(t.shiftKey||Mconsole.graph.eachNode(function(t){t.id!=e.id&&(delete t.selected,t.setData("onCanvas",!1)),t.setData("dim",25,"current"),t.eachAdjacency(function(e){deselectEdge(e)})}),e.selected?(e.setData("dim",25,"current"),delete e.selected,e.setData("onCanvas",!1)):(e.selected=!0,e.setData("dim",30,"current"),e.setData("onCanvas",!0),e.eachAdjacency(function(e){selectEdge(e)}),Mconsole.plot()),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:500}),Mconsole.plot())}function canvasDoubleClickHandler(e,t){var n=300,r=MetamapsModel.lastCanvasClick,i=Date.now();i-r<n?($("#topic_grabTopic").val("null"),$("#topic_addSynapse").val("false"),$("#new_topic").css("left",t.clientX+"px"),$("#new_topic").css("top",t.clientY+"px"),$("#topic_x").val(e.x),$("#topic_y").val(e.y),$("#new_topic").fadeIn("fast"),addMetacode(),$("#topic_name").focus()):(MetamapsModel.lastCanvasClick=i,$("#new_topic").fadeOut("fast"),$("#new_synapse").fadeOut("fast"),tempInit=!1,tempNode=null,tempNode2=null,Mconsole.plot())}function onDragMoveTopicHandler(e,t,n){if(e&&!e.nodeFrom){$("#new_synapse").fadeOut("fast"),$("#new_topic").fadeOut("fast");var r=t.getPos();if(n.button!=0||!!n.altKey||n.buttons!=0&&n.buttons!=1&&n.buttons!=undefined){if((n.button==2||n.button==0&&n.altKey||n.buttons==2)&&userid!=null){tempInit==0&&(tempNode=e,tempInit=!0),temp=t.getNode();if(temp!=0&&temp.id!=e.id)tempNode2=temp,Mconsole.plot(),renderMidArrow({x:tempNode.pos.getc().x,y:tempNode.pos.getc().y},{x:temp.pos.getc().x,y:temp.pos.getc().y},13,!1,Mconsole.canvas),Mconsole.graph.eachNode(function(e){e.setData("dim",25,"current")}),temp.setData("dim",35,"current"),Mconsole.fx.plotNode(tempNode,Mconsole.canvas),Mconsole.fx.plotNode(temp,Mconsole.canvas);else if(!temp){tempNode2=null,Mconsole.graph.eachNode(function(e){e.setData("dim",25,"current")}),$("#topic_grabTopic").val("null");var i=n.clientX-110,s=n.clientY-30;$("#new_topic").css("left",i+"px"),$("#new_topic").css("top",s+"px"),$("#new_synapse").css("left",i+"px"),$("#new_synapse").css("top",s+"px"),$("#topic_x").val(t.getPos().x),$("#topic_y").val(t.getPos().y),Mconsole.plot(),renderMidArrow({x:tempNode.pos.getc().x,y:tempNode.pos.getc().y},{x:r.x,y:r.y},13,!1,Mconsole.canvas),Mconsole.fx.plotNode(tempNode,Mconsole.canvas)}}}else dragged=e.id,e.pos.setc(r.x,r.y),e.data.$xloc=r.x,e.data.$yloc=r.y,Mconsole.plot()}}function graphSettings(e){var t={injectInto:"infovis",Navigation:{enable:!0,type:"HTML",panning:"avoid nodes",zooming:15},Node:{overridable:!0,color:"#2D6A5D",type:"customNode",dim:25},Edge:{overridable:!0,color:"#222222",type:"customEdge",lineWidth:2,alpha:.4},Label:{type:"HTML",size:20},Tips:{enable:!1,onShow:function(e,t){}},Events:{enable:!0,enableForEdges:!0,type:"HTML",onMouseMove:function(e,t,n){onMouseMoveHandler(e,t,n)},onDragMove:function(e,t,n){onDragMoveTopicHandler(e,t,n)},onDragEnd:function(e,t,n){onDragEndTopicHandler(e,t,n,!1)},onDragCancel:function(e,t,n){onDragCancelHandler(e,t,n,!1)},onTouchMove:function(e,t,n){$jit.util.event.stop(n),this.onDragMove(e,t,n)},onClick:function(e,t,n){if(n.target.id!="infovis-canvas")return!1;e.nodeFrom?selectEdgeOnClickHandler(e,n):e&&!e.nodeFrom?selectNodeOnClickHandler(e,n):canvasDoubleClickHandler(t.getPos(),n)}},iterations:200,levelDistance:200,onCreateLabel:function(e,t){onCreateLabelHandler(e,t)},onPlaceLabel:function(e,t){onPlaceLabelHandler(e,t)}};return e=="centered"&&(t.background={CanvasStyles:{strokeStyle:"#333",lineWidth:1.5}},t.Events.enableForEdges=!0,t.Events.onDragEnd=function(e,t,n){onDragEndTopicHandler(e,t,n,!1)},t.Events.onDragCancel=function(e,t,n){onDragCancelHandler(e,t,n,!0)},t.Events.onClick=function(e,t,n){if(n.target.id!="infovis-canvas")return!1;e.nodeFrom?selectEdgeOnClickHandler(e,n):e&&!e.nodeFrom?Mconsole.busy||($("h1.index").html("Viewing Topic: "+e.name),window.history.pushState(e.name,"Metamaps","/topics/"+e.id),Mconsole.onClick(e.id,{hideLabels:!1,duration:1e3,onComplete:function(){fetchRelatives(e)}})):canvasDoubleClickHandler(t.getPos(),n)}),t}function onMouseMoveHandler(e,t,n){if(Mconsole.busy)return;var e=t.getNode(),r=t.getEdge();if(e!=0){MetamapsModel.edgeHoveringOver&&onMouseLeave(MetamapsModel.edgeHoveringOver);return}r==0&&MetamapsModel.edgeHoveringOver!=0?onMouseLeave(MetamapsModel.edgeHoveringOver):r!=0&&MetamapsModel.edgeHoveringOver==0?onMouseEnter(r):r!=0&&MetamapsModel.edgeHoveringOver!=r&&(onMouseLeave(MetamapsModel.edgeHoveringOver),onMouseEnter(r)),MetamapsModel.edgeHoveringOver=r}function onMouseEnter(e){$("canvas").css("cursor","pointer");var t=e.getData("showDesc");t||(e.setDataset("end",{lineWidth:4,color:"#222222",alpha:1}),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:100}),Mconsole.plot())}function onMouseLeave(e){$("canvas").css("cursor","default");var t=e.getData("showDesc");t||(e.setDataset("end",{lineWidth:2,color:"#222222",alpha:.4}),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:100})),Mconsole.plot()}function onDragEndTopicHandler(e,t,n,r){tempInit&&tempNode2==null?($("#topic_addSynapse").val("true"),$("#new_topic").fadeIn("fast"),addMetacode(),$("#topic_name").focus()):tempInit&&tempNode2!=null?($("#topic_addSynapse").val("false"),$("#synapse_topic1id").val(tempNode.id),$("#synapse_topic2id").val(tempNode2.id),$("#new_synapse").fadeIn("fast"),$("#synapse_desc").focus(),tempNode=null,tempNode2=null,tempInit=!1):dragged!=0&&goRealtime&&saveLayout(dragged)}function onDragCancelHandler(e,t,n,r){tempNode=null,tempNode2=null,tempInit=!1,r||($("#topic_addSynapse").val("false"),$("#topic_topic1id").val(0),$("#topic_topic2id").val(0)),Mconsole.plot()}function onPlaceLabelHandler(e,t){var n=e.style,r=parseInt(n.left),i=parseInt(n.top),s=e.offsetWidth;n.left=r-s/2+107+"px",n.top=i-165+"px",n.display="";var o=document.getElementById("topic_"+t.id+"_label");s=o.offsetWidth,n=o.style,n.left=-(s/2+106)+"px"}function initialize(e,t){t==null&&(loadlater=!1),viewMode="graph",gType=e;if(e=="centered")Mconsole=new $jit.RGraph(graphSettings(e));else{if(e!="arranged"&&e!="chaotic")return alert("You didn't specify a type!"),!1;Mconsole=new $jit.ForceDirected(graphSettings(e))}if(!t){Mconsole.busy=!0,Mconsole.loadJSON(json);var n;e=="centered"?(Mconsole.graph.eachNode(function(e){var t=e.getPos();t.setc(-200,-200)}),Mconsole.compute("end"),n={modes:["polar"],duration:2e3,onComplete:function(){Mconsole.busy=!1}}):e=="arranged"?(Mconsole.graph.eachNode(function(e){var t=e.getPos();t.setc(0,0);var n=new $jit.Complex;n.x=e.data.$xloc,n.y=e.data.$yloc,e.setPos(n,"end")}),n={modes:["linear"],transition:$jit.Trans.Quad.easeInOut,duration:2500,onComplete:function(){Mconsole.busy=!1}}):e=="chaotic"&&(Mconsole.compute(),n={modes:["linear"],transition:$jit.Trans.Elastic.easeOut,duration:2500,onComplete:function(){Mconsole.busy=!1}}),$(document).ready(function(){e=="centered"?Mconsole.fx.animate(n):(e=="arranged"||e=="chaotic")&&Mconsole.animate(n)})}}function onCreateLabelHandler(e,t){var n=generateShowcardHTML();n=replaceVariables(n,t);var r=document.createElement("div");r.className="showcard topic_"+t.id;if(authorizeToEdit(t)){var i=document.createElement("div");i.className="permission canEdit",i.innerHTML=n,r.appendChild(i)}else r.innerHTML=n;r.style.display="none",e.appendChild(r);var s=document.createElement("span"),o=s.style;s.className="name topic_"+t.id,s.id="topic_"+t.id+"_label",s.innerHTML=generateLittleHTML(t),e.appendChild(s),o.fontSize="0.9em",o.color="#222222",bindCallbacks(r,s,t)}function generateShowcardHTML(){return' <div class="CardOnGraph" id="topic_$_id_$"> <p class="type best_in_place best_in_place_metacode" data-url="/topics/$_id_$" data-object="topic" data-collection=$_metacode_choices_$ data-attribute="metacode" data-type="select">$_metacode_$</p> <img alt="$_metacode_$" class="icon" title="Click to hide card" height="50" width="50" src="$_imgsrc_$" /> <div class="cardSettings"> <div class="mapPerm" title="$_permission_$"> $_mk_permission_$ </div> $_edit_permission_$ </div> <span class="title"> <span class="best_in_place best_in_place_name" data-url="/topics/$_id_$" data-object="topic" data-attribute="name" data-type="input">$_name_$</span> <a href="/topics/$_id_$" class="topic-go-arrow" target="_blank"> <img class="topic-go-arrow" title="Explore Topic" src="/assets/go-arrow.png" /> </a> <div class="clearfloat"></div> </span> <div class="contributor"> Added by: <a href="/users/$_userid_$" target="_blank">$_username_$ </a> </div> <div class="scroll"> <div class="desc"> <span class="best_in_place best_in_place_desc" data-url="/topics/$_id_$" data-object="topic" data-nil="$_desc_nil_$" data-attribute="desc" data-type="textarea">$_desc_$</span> <div class="clearfloat"></div> </div> </div> <div class="link"> $_go_link_$ $_a_tag_$<span class="best_in_place best_in_place_link" data-url="/topics/$_id_$" data-object="topic" data-attribute="link" data-type="input">$_link_$</span>$_close_a_tag_$ </div> <div class="clearfloat"></div> </div>'}function replaceVariables(e,t){var n,r,i;authorizeToEdit(t)?(n='<a href="'+t.getData("link")+'" '+' class="go-link" target="_blank">[go]</a>',r="",i=""):(n="",t.getData("link")!=""?(r='<a href="'+t.getData("link")+'">',i="</a>"):(r="",i=""));var s=new Array;for(var o in imgArray)imgArray.hasOwnProperty(o)&&o!=t.getData("metacode")&&s.push(o);s.sort(),s.unshift(t.getData("metacode"));var u="'[";for(var a in s)u+='["'+s[a]+'","'+s[a]+'"],';u=u.slice(0,-1),u+="]'";var f="<span class='gray'>Click to add description.</span>",l="<span class='gray'>Click to add link.</span>",c="";userid==t.getData("userid")&&(c=' <div class="permActivator"> <div class="editSettings"> <span>Permissions: </span> <span title="Click to Edit"> <span class="best_in_place best_in_place_permission" id="best_in_place_topic_$_id_$_permission" data-url="/topics/$_id_$" data-object="topic" data-collection=$_permission_choices_$ data-attribute="permission" data-type="select" data-value="$_permission_$"> $_permission_$ </span> </span> <div class="clearfloat"></div> </div> </div>');var h=["commons","public","private"],p="'[";for(var a in h)p+='["'+h[a]+'","'+h[a]+'"],';return p=p.slice(0,-1),p+="]'",c=c.replace(/\$_permission_choices_\$/g,p),e=e.replace(/\$_edit_permission_\$/g,c),e=e.replace(/\$_permission_\$/g,t.getData("permission")),e=e.replace(/\$_mk_permission_\$/g,mk_permission(t)),e=e.replace(/\$_id_\$/g,t.id),e=e.replace(/\$_metacode_\$/g,t.getData("metacode")),e=e.replace(/\$_imgsrc_\$/g,imgArray[t.getData("metacode")].src),e=e.replace(/\$_name_\$/g,t.name),e=e.replace(/\$_userid_\$/g,t.getData("userid")),e=e.replace(/\$_username_\$/g,t.getData("username")),e=e.replace(/\$_metacode_choices_\$/g,u),e=e.replace(/\$_go_link_\$/g,n),e=e.replace(/\$_a_tag_\$/g,r),e=e.replace(/\$_close_a_tag_\$/g,i),t.getData("link")==""&&authorizeToEdit(t)?e=e.replace(/\$_link_\$/g,l):e=e.replace(/\$_link_\$/g,t.getData("link")),e=e.replace(/\$_desc_nil_\$/g,f),t.getData("desc")==""&&authorizeToEdit(t)?e=e.replace(/\$_desc_\$/g,f):e=e.replace(/\$_desc_\$/g,t.getData("desc")),e}function generateLittleHTML(e){var t=' <div class="label">$_name_$</div> <div class="nodeOptions">';return userid==null||mapid==null||!mapperm?t+=' <span class="removeFromCanvas" onclick="hideNode($_id_$)" title="Click to remove topic from canvas"> </span>':mapperm&&(t+=' <span class="removeFromCanvas" onclick="hideNode($_id_$)" title="Click to remove topic from canvas"> </span> <span class="removeFromMap" onclick="removeNode($_id_$)" title="Click to remove topic from map"> </span>'),userid==e.getData("userid")&&(t+=' <span class="deleteTopic" onclick="var t = confirm(\'Are you sure you want to permanently delete this node and all synapses linking to it?\'); if (t) deleteNode($_id_$)" title="Click to delete this topic"> </span>'),t+="</div>",t=t.replace(/\$_id_\$/g,e.id),t=t.replace(/\$_mapid_\$/g,mapid),t=t.replace(/\$_name_\$/g,e.name),t}function hideCard(e){var t=".showcard";e!=null&&(t+=".topic_"+e.id),$(t).fadeOut("fast",function(){e.setData("dim",25,"current"),$(".name").show(),Mconsole.plot()})}function bindCallbacks(e,t,n){$(e).find("img.icon").click(function(){hideCard(n)}),$(e).find(".scroll").mCustomScrollbar(),$(t).find(".label").click(function(e){$(".showcard").css("display","none"),$(".name").css("display","block"),$(".name.topic_"+n.id).css("display","none"),$(".showcard.topic_"+n.id).fadeIn("fast"),n.setData("dim",1,"current"),Mconsole.plot()}),t.onmouseover=function(){$(".name.topic_"+n.id+" .nodeOptions").css("display","block")},t.onmouseout=function(){$(".name.topic_"+n.id+" .nodeOptions").css("display","none")},$(e).find(".best_in_place_metacode").bind("ajax:success",function(){var t=$(this).html();$(e).find("img.icon").attr("alt",t),$(e).find("img.icon").attr("src",imgArray[t].src),n.setData("metacode",t),Mconsole.plot()}),$(e).find(".best_in_place_name").bind("ajax:success",function(){var e=$(this).html();$(t).find(".label").html(e)}),$(e).find(".best_in_place_link").bind("ajax:success",function(){var t=$(this).html();$(e).find(".go-link").attr("href",t)});var r=!1,i,s;$(e).find(".permActivator").bind("mouseover",function(){clearTimeout(s),that=this,i=setTimeout(function(){r||(r=!0,$(that).animate({width:"203px",height:"37px"},300,function(){r=!1}))},300)}),$(e).find(".permActivator").bind("mouseout",function(){clearTimeout(i),that=this,s=setTimeout(function(){r||(r=!0,$(that).animate({height:"16px",width:"16px"},300,function(){r=!1}))},800)}),$(e).find(".best_in_place_permission").bind("ajax:success",function(){var e=$(this).html(),t=$(this).parents(".cardSettings").find(".mapPerm");t.attr("title",e),e=="commons"?t.html("co"):e=="public"?t.html("pu"):e=="private"&&t.html("pr")})}function organize(){Mconsole.compute(),Mconsole.fx.animate({modes:["linear"],hideLabels:!0})}function openOrganize(){organizeOpen=!0,findOpen&&closeFind(),analyzeOpen&&closeAnalyze(),$("#sideOptionFind").css("z-index","8"),$("#sideOptionAnalyze").css("z-index","9"),$("#sideOptionOrganize, #closeOrganize").css("z-index","10"),$("#sideOptionOrganize").animate({width:"100px",height:"76px"},100),$("#closeOrganize").css("display","block"),$("#sideOptionOrganize").css("cursor","default")}function closeOrganize(){organizeOpen=!1,$("#closeOrganize").css("display","none"),$("#sideOptionOrganize").css("cursor","pointer"),$("#sideOptionOrganize").animate({width:"75px",height:"32px"},100)}function authorizeToEdit(e){return!userid||e.data.$permission!="commons"&&e.data.$userid!=userid?!1:!0}function mk_permission(e){if(e.getData("permission")=="commons")return"co";if(e.getData("permission")=="public")return"pu";if(e.getData("permission")=="private")return"pr"}function editEdge(e,t){if(authorizeToEdit(e)){$("#edit_synapse").remove(),deselectEdge(e);var n=document.createElement("div");n.className="permission canEdit";var r=document.createElement("div");r.setAttribute("id","edit_synapse"),n.appendChild(r),$(".main .wrapper").append(n),$("#edit_synapse").attr("class","best_in_place best_in_place_desc"),$("#edit_synapse").attr("data-object","synapse"),$("#edit_synapse").attr("data-attribute","desc"),$("#edit_synapse").attr("data-type","input"),$("#edit_synapse").attr("data-nil"," "),$("#edit_synapse").attr("data-url","/synapses/"+e.getData("id")),$("#edit_synapse").html(e.getData("desc")),$("#edit_synapse").css("position","absolute"),$("#edit_synapse").css("left",t.clientX),$("#edit_synapse").css("top",t.clientY),$("#edit_synapse").bind("ajax:success",function(){var t=$(this).html();e.setData("desc",t),selectEdge(e),Mconsole.plot(),$("#edit_synapse").remove()}),$("#edit_synapse").focusout(function(){$("#edit_synapse").hide()}),$("#edit_synapse").click(),$("#edit_synapse form").submit(function(){$("#edit_synapse").hide()}),$("#edit_synapse input").focus(),$("#edit_synapse").show()}else!authorizeToEdit(e)&&userid&&alert("You don't have the permissions to edit this synapse.")}function deselectAllEdges(){for(var e=0;e<MetamapsModel.selectedEdges.length;e+=1){var t=MetamapsModel.selectedEdges[e];deselectEdge(t)}}function removeEdge(e){var t=e.getData("id");$.ajax({type:"DELETE",url:"/synapses/"+t,success:function(){hideEdge(e)}})}function hideEdge(e){var t=e.nodeFrom.id,n=e.nodeTo.id;e.setData("alpha",0,"end"),Mconsole.fx.animate({modes:["edge-property:alpha"],duration:1e3}),Mconsole.graph.removeAdjacence(t,n),Mconsole.plot()}function hideSelectedEdges(){for(var e=0;e<MetamapsModel.selectedEdges.length;e+=1){var t=MetamapsModel.selectedEdges[e];hideEdge(t)}MetamapsModel.selectedEdges=new Array}function removeSelectedEdges(){for(var e=0;e<MetamapsModel.selectedEdges.length;e+=1){if(mapid!=null){var t=MetamapsModel.selectedEdges[e],n=t.getData("id");$.ajax({type:"POST",url:"/synapses/"+mapid+"/"+n+"/removefrommap"})}hideEdge(t)}MetamapsModel.selectedEdges=new Array}function deleteSelectedEdges(){for(var e=0;e<MetamapsModel.selectedEdges.length;e+=1){var t=MetamapsModel.selectedEdges[e],n=t.getData("id");$.ajax({type:"DELETE",url:"/synapses/"+n}),hideEdge(t)}MetamapsModel.selectedEdges=new Array}function selectEdge(e){var t=e.getData("showDesc");t||(e.setData("showDesc",!0,"current"),e.setDataset("end",{lineWidth:4,color:"#FFFFFF",alpha:1}),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:100})),MetamapsModel.selectedEdges.push(e)}function deselectEdge(e){var t=e.getData("showDesc");t&&(e.setData("showDesc",!1,"current"),e.setDataset("end",{lineWidth:2,color:"#222222",alpha:.4}),MetamapsModel.edgeHoveringOver==e&&e.setDataset("end",{lineWidth:4,color:"#222222",alpha:1}),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:100})),MetamapsModel.selectedEdges.splice(MetamapsModel.selectedEdges.indexOf(e),1)}function hideNode(e){var t=Mconsole.graph.getNode(e);if(e==Mconsole.root&&gType=="centered"){alert("You can't hide this topic, it is the root of your graph.");return}t.setData("alpha",0,"end"),t.eachAdjacency(function(e){e.setData("alpha",0,"end")}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:1e3}),Mconsole.graph.removeNode(e),Mconsole.labels.disposeLabel(e)}function hideSelectedNodes(){Mconsole.graph.eachNode(function(e){e.data.$onCanvas==1&&hideNode(e.id)})}function removeNode(e){mapperm&&$.ajax({type:"POST",url:"/topics/"+mapid+"/"+e+"/removefrommap"})}function removeSelectedNodes(){mapperm&&Mconsole.graph.eachNode(function(e){e.data.$onCanvas==1&&removeNode(e.id)})}function deleteNode(e){if(e==Mconsole.root&&gType=="centered"){alert("You can't delete this topic, it is the root of your graph.");return}$.ajax({type:"DELETE",url:"/topics/"+e})}function deleteSelectedNodes(){Mconsole.graph.eachNode(function(e){e.data.$onCanvas==1&&deleteNode(e.id)})}function addHoverForSettings(){$(".permActivator").unbind("mouseover"),$(".permActivator").unbind("mouseout");var e=!1,t,n;$(".permActivator").bind("mouseover",function(){clearTimeout(n),that=this,t=setTimeout(function(){e||(e=!0,$(that).animate({width:"203px",height:"37px"},300,function(){e=!1}))},300)}),$(".permActivator").bind("mouseout",function(){clearTimeout(t),that=this,n=setTimeout(function(){e||(e=!0,$(that).animate({height:"16px",width:"16px"},300,function(){e=!1}))},800)}),$(".best_in_place_permission").unbind("ajax:success"),$(".best_in_place_permission").bind("ajax:success",function(){var e=$(this).html(),t=$(this).parents(".cardSettings").find(".mapPerm");t.attr("title",e),e=="commons"?t.html("co"):e=="public"?t.html("pu"):e=="private"&&t.html("pr")})}function saveLayoutAll(){var e="";if(gType=="arranged"||gType=="chaotic")Mconsole.graph.eachNode(function(t){e=e+t.data.$mappingid+"/"+t.pos.x+"/"+t.pos.y+","}),e=e.slice(0,-1),$("#map_coordinates").val(e),$("#saveMapLayout").submit()}function saveLayout(e){var t=Mconsole.graph.getNode(e);$("#map_coordinates").val(t.data.$mappingid+"/"+t.pos.x+"/"+t.pos.y),$("#saveMapLayout").submit(),dragged=0,$("#saveLayout").attr("value","Saved!"),setTimeout(function(){$("#saveLayout").attr("value","Save Layout")},1500)}function saveToMap(){var e="",t="",n=new Array;Mconsole.graph.eachNode(function(t){e+=t.id+"/"+t.pos.x+"/"+t.pos.y+",",t.eachAdjacency(function(e){n.push(e.getData("id"))})}),n=$.grep(n,function(e,t){return $.inArray(e,n)===t}),t=n.join(),e=e.slice(0,-1),$("#map_topicsToMap").val(e),$("#map_synapsesToMap").val(t),$("#new_map").fadeIn("fast")}function addMetacode(){metacodeIMGinit||($("#metacodeImg").CloudCarousel({titleBox:$("#metacodeImgTitle"),yRadius:40,xPos:150,yPos:40,speed:.15,mouseWheel:!0,bringToFront:!0}),metacodeIMGinit=!0)}function fetchRelatives(e){var t=$.ajax({type:"Get",url:"/topics/"+e.id+"?format=json",success:function(e){gType=="centered"?(Mconsole.busy=!0,Mconsole.op.sum(e,{type:"fade",duration:500,hideLabels:!1}),Mconsole.graph.eachNode(function(e){e.eachAdjacency(function(e){e.getData("showDesc")||(e.setData("alpha",.4,"start"),e.setData("alpha",.4,"current"),e.setData("alpha",.4,"end"))})}),Mconsole.busy=!1):(Mconsole.op.sum(e,{type:"nothing"}),Mconsole.plot())},error:function(){alert("failure")}})}function MconsoleReset(){var e=Mconsole.canvas.translateOffsetX,t=Mconsole.canvas.translateOffsetY;Mconsole.canvas.translate(-e,-t);var n=Mconsole.canvas.scaleOffsetX,r=Mconsole.canvas.scaleOffsetY;Mconsole.canvas.scale(1/n,1/r)}(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase()
|
||
,n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=1-(n/f.duration||0),i=0,s=f.tweens.length;for(;i<s;i++)f.tweens[i].run(r);return u.notifyWith(e,[f,r,n]),r<1&&s?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c=this,h=e.style,p={},d=[],m=e.nodeType&&Gt(e);n.queue||(f=v._queueHooks(e,"fx"),f.unqueued==null&&(f.unqueued=0,l=f.empty.fire,f.empty.fire=function(){f.unqueued||l()}),f.unqueued++,c.always(function(){c.always(function(){f.unqueued--,v.queue(e,"fx").length||f.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?h.display="inline-block":h.zoom=1)),n.overflow&&(h.overflow="hidden",v.support.shrinkWrapBlocks||c.done(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r];if(s===(m?"hide":"show"))continue;d.push(r)}}o=d.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),m?v(e).show():c.done(function(){v(e).hide()}),c.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in p)v.style(e,t,p[t])});for(r=0;r<o;r++)i=d[r],a=c.createTween(i,m?u[i]:0),p[i]=u[i]||v.style(e,i),i in u||(u[i]=a.start,m&&(a.end=a.start,a.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.1",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call(" ")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":e.toString().replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||s.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"&&(!e.unique||!c.has(n))?a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return typeof e=="object"?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0],r.style.cssText="top:1px;float:left;opacity:.5";if(!n||!n.length||!r)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.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%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||++v.uuid:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")===0&&(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)~s.indexOf(" "+t[o]+" ")||(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>-1)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>-1)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r,i,s=e.selectedIndex,o=[],u=e.options,a=e.type==="select-one";if(s<0)return null;n=a?s:0,r=a?s+1:u.length;for(;n<r;n++){i=u[n];if(i.selected&&(v.support.optDisabled?!i.disabled:i.getAttribute("disabled")===null)&&(!i.parentNode.disabled||!v.nodeName(i.parentNode,"optgroup"))){t=v(i).val();if(a)return t;o.push(t)}}return a&&!o.length&&u.length?v(u[s]).val():o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,""+r),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},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(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=""+t}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call
|
||
(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,l,c,h,p=(v._data(this,"events")||{})[n.type]||[],d=p.delegateCount,m=[].slice.call(arguments),g=!n.exclusive&&!n.namespace,y=v.event.special[n.type]||{},b=[];m[0]=n,n.delegateTarget=this;if(y.preDispatch&&y.preDispatch.call(this,n)===!1)return;if(d&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<d;r++)l=p[r],c=l.selector,u[c]===t&&(u[c]=v(c,this).index(s)>=0),u[c]&&f.push(l);f.length&&b.push({elem:s,matches:f})}p.length>d&&b.push({elem:this,matches:p.slice(d)});for(r=0;r<b.length&&!n.isPropagationStopped();r++){a=b[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){l=a.matches[i];if(g||!n.namespace&&!l.namespace||n.namespace_re&&n.namespace_re.test(l.namespace))n.data=l.data,n.handleObj=l,o=((v.event.special[l.origType]||{}).handle||l.handler).apply(a.elem,m),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return y.postDispatch&&y.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length==1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function Y(e,t,n,r){n=n||[],t=t||m;var i,s,o,f,l=t.nodeType;if(l!==1&&l!==9)return[];if(!e||typeof e!="string")return n;o=u(t);if(!o&&!r)if(i=j.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&a(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return w.apply(n,b.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&K&&t.getElementsByClassName)return w.apply(n,b.call(t.getElementsByClassName(f),0)),n}return lt(e,t,n,r,o)}function Z(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function et(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function tt(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function nt(e,t,n,r){var i,o,u,a,f,l,c,h,p,v,g=!n&&t!==m,y=(g?"<s>":"")+e.replace(D,"$1<s>"),w=T[d][y];if(w)return r?0:b.call(w,0);f=e,l=[],h=0,p=s.preFilter,v=s.filter;while(f){if(!i||(o=P.exec(f)))o&&(f=f.slice(o[0].length),u.selector=c),l.push(u=[]),c="",g&&(f=" "+f);i=!1;if(o=H.exec(f))c+=o[0],f=f.slice(o[0].length),i=u.push({part:o.pop().replace(D," "),string:o[0],captures:o});for(a in v)(o=W[a].exec(f))&&(!p[a]||(o=p[a](o,t,n)))&&(c+=o[0],f=f.slice(o[0].length),i=u.push({part:a,string:o.shift(),captures:o}));if(!i)break}return c&&(u.selector=c),r?f.length:f?Y.error(e):b.call(T(y,l),0)}function rt(e,t,i,s){var o=t.dir,u=y++;return e||(e=function(e){return e===i}),t.first?function(t){while(t=t[o])if(t.nodeType===1)return e(t)&&t}:s?function(t){while(t=t[o])if(t.nodeType===1&&e(t))return t}:function(t){var i,s=u+"."+n,a=s+"."+r;while(t=t[o])if(t.nodeType===1){if((i=t[d])===a)return t.sizset;if(typeof i=="string"&&i.indexOf(s)===0){if(t.sizset)return t}else{t[d]=a;if(e(t))return t.sizset=!0,t;t.sizset=!1}}}}function it(e,t){return e?function(n){var r=t(n);return r&&e(r===!0?n:r)}:t}function st(e,t,n){var r,i,o=0;for(;r=e[o];o++)s.relative[r.part]?i=rt(i,s.relative[r.part],t,n):i=it(i,s.filter[r.part].apply(null,r.captures.concat(t,n)));return i}function ot(e){return function(t){var n,r=0;for(;n=e[r];r++)if(n(t))return!0;return!1}}function ut(e,t,n,r){var i=0,s=t.length;for(;i<s;i++)Y(e,t[i],n,r)}function at(e,t,n,r,i,o){var u,a=s.setFilters[t.toLowerCase()];return a||Y.error(t),(e||!(u=i))&&ut(e||"*",r,u=[],i),u.length>0?a(u,n,o):[]}function ft(e,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m,g,y=0,b=e.length,E=W.POS,S=new RegExp("^"+E.source+"(?!"+C+")","i"),x=function(){var e=1,n=arguments.length-2;for(;e<n;e++)arguments[e]===t&&(p[e]=t)};for(;y<b;y++){s=e[y],o="",h=i;for(u=0,a=s.length;u<a;u++){f=s[u],l=f.string;if(f.part==="PSEUDO"){E.exec(""),c=0;while(p=E.exec(l)){d=!0,v=E.lastIndex=p.index+p[0].length;if(v>c){o+=l.slice(c,p.index),c=v,m=[n],H.test(o)&&(h&&(m=h),h=i);if(g=q.test(o))o=o.slice(0,-5).replace(H,"$&*"),c++;p.length>1&&p[0].replace(S,x),h=at(o,p[1],p[2],m,h,g)}o=""}}d||(o+=l),d=!1}o?H.test(o)?ut(o,h||[n],r,i):Y(o,n,r,i?i.concat(h):h):w.apply(r,h)}return b===1?r:Y.uniqueSort(r)}function lt(e,t,i,o,u){e=e.replace(D,"$1");var a,l,c,h,p,d,v,m,g,y,E=nt(e,t,u),S=t.nodeType;if(W.POS.test(e))return ft(E,t,i,o);if(o)a=b.call(o,0);else if(E.length===1){if((d=b.call(E[0],0)).length>2&&(v=d[0]).part==="ID"&&S===9&&!u&&s.relative[d[1].part]){t=s.find.ID(v.captures[0].replace(z,""),t,u)[0];if(!t)return i;e=e.slice(d.shift().string.length)}g=(E=I.exec(d[0].string))&&!E.index&&t.parentNode||t,m="";for(p=d.length-1;p>=0;p--){v=d[p],y=v.part,m=v.string+m;if(s.relative[y])break;if(s.order.test(y)){a=s.find[y](v.captures[0].replace(z,""),g,u);if(a==null)continue;e=e.slice(0,e.length-m.length)+m.replace(W[y],""),e||w.apply(i,b.call(a,0));break}}}if(e){l=f(e,t,u),n=l.dirruns++,a==null&&(a=s.find.TAG("*",I.test(e)&&t.parentNode||t));for(p=0;h=a[p];p++)r=l.runs++,l(h)&&i.push(h)}return i}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=e.document,g=m.documentElement,y=0,b=[].slice,w=[].push,E=function(e,t){return e[d]=t||!0,e},S=function(){var e={},t=[];return E(function(n,r){return t.push(n)>s.cacheLength&&delete e[t.shift()],e[n]=r},e)},x=S(),T=S(),N=S(),C="[\\x20\\t\\r\\n\\f]",k="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",L=k.replace("w","w#"),A="([*^$|!~]?=)",O="\\["+C+"*("+k+")"+C+"*(?:"+A+C+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+L+")|)|)"+C+"*\\]",M=":("+k+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+O+")|[^:]|\\\\.)*|.*))\\)|)",_=":(nth|eq|gt|lt|first|last|even|odd)(?:\\(((?:-\\d)?\\d*)\\)|)(?=[^-]|$)",D=new RegExp("^"+C+"+|((?:^|[^\\\\])(?:\\\\.)*)"+C+"+$","g"),P=new RegExp("^"+C+"*,"+C+"*"),H=new RegExp("^"+C+"*([\\x20\\t\\r\\n\\f>+~])"+C+"*"),B=new RegExp(M),j=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,F=/^:not/,I=/[\x20\t\r\n\f]*[+~]/,q=/:not\($/,R=/h\d/i,U=/input|select|textarea|button/i,z=/\\(?!\\)/g,W={ID:new RegExp("^#("+k+")"),CLASS:new RegExp("^\\.("+k+")"),NAME:new RegExp("^\\[name=['\"]?("+k+")['\"]?\\]"),TAG:new RegExp("^("+k.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+M),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+C+"*(even|odd|(([+-]|)(\\d*)n|)"+C+"*(?:([+-]|)"+C+"*(\\d+)|))"+C+"*\\)|)","i"),POS:new RegExp(_,"ig"),needsContext:new RegExp("^"+C+"*[>+~]|"+_,"i")},X=function(e){var t=m.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},V=X(function(e){return e.appendChild(m.createComment("")),!e.getElementsByTagName("*").length}),$=X(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),J=X(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),K=X(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),Q=X(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",g.insertBefore(e,g.firstChild);var t=m.getElementsByName&&m.getElementsByName(d).length===2+m.getElementsByName(d+0).length;return i=!m.getElementById(d),g.removeChild(e),t});try{b.call(g.childNodes,0)[0].nodeType}catch(G){b=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}Y.matches=function(e,t){return Y(e,null,null,t)},Y.matchesSelector=function(e,t){return Y(t,null,null,[e]).length>0},o=Y.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},u=Y.isXML=function(t){var n=t&&(t.ownerDocument||t).documentElement;return n?n.nodeName!=="HTML":!1},a=Y.contains=g.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:g.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},Y.attr=function(e,t){var n,r=u(e);return r||(t=t.toLowerCase()),s.attrHandle[t]?s.attrHandle[t](e):J||r?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},s=Y.selectors={cacheLength:50,createPseudo:E,match:W,order:new RegExp("ID|TAG"+(Q?"|NAME":"")+(K?"|CLASS":"")),attrHandle:$?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:i?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:V?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(z,""),e[3]=(e[4]||e[5]||"").replace(z,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||Y.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&Y.error(e[0]),e},PSEUDO:function(e,t,n){var r,i;if(W.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(r=e[4])B.test(r)&&(i=nt(r,t,n,!0))&&(i=r.indexOf(")",r.length-i)-r.length)&&(r=r.slice(0,i),e[0]=e[0].slice(0,i)),e[2]=r;return e.slice(0,3)}},filter:{ID:i?function(e){return e=e.replace(z,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(z,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace(z,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=x[d][e];return t||(t=x(e,new RegExp("(^|"+C+")"+e+"("+C+"|$)"))),function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")}},ATTR:function(e,t,n){return t?function(r){var i=Y.attr(r,e),s=i+"";if(i==null)return t==="!=";switch(t){case"=":return s===n;case"!=":return s!==n;case"^=":return n&&s.indexOf(n)===0;case"*=":return n&&s.indexOf(n)>-1;case"$=":return n&&s.substr(s.length-n.length)===n;case"~=":return(" "+s+" ").indexOf(n)>-1;case"|=":return s===n||s.substr(0,n.length+1)===n+"-"}}:function(t){return Y.attr(t,e)!=null}},CHILD:function(e,t,n,r){if(e==="nth"){var i=y++;return function(e){var t,s,o=0,u=e;if(n===1&&r===0)return!0;t=e.parentNode;if(t&&(t[d]!==i||!e.sizset)){for(u=t.firstChild;u;u=u.nextSibling)if(u.nodeType===1){u.sizset=++o;if(u===e)break}t[d]=i}return s=e.sizset-r,n===0?s===0:s%n===0&&s/n>=0}}return function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t,n,r){var i,o=s.pseudos[e]||s.pseudos[e.toLowerCase()];return o||Y.error("unsupported pseudo: "+e),o[d]?o(t,n,r):o.length>1?(i=[e,e,"",t],function(e){return o(e,0,i)}):o}},pseudos:{not:E(function(e,t,n){var r=f(e.replace(D,"$1"),t,n);return function(e){return!r(e)}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!s.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},contains:E(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),has:E(function(e){return function(t){return Y(e,t).length>0}}),header:function(e){return R.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:Z("radio"),checkbox:Z("checkbox"),file:Z("file"),password:Z("password"),image:Z("image"),submit:et("submit"),reset:et("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return U.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&(!!e.type||!!e.href)},active:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t,n){return n?e.slice(1):[e[0]]},last:function(e,t,n){var r=e.pop();return n?e:[r]},even:function(e,t,n){var r=[],i=n?1:0,s=e.length;for(;i<s;i+=2)r.push(e[i]);return r},odd:function(e,t,n){var r=[],i=n?0:1,s=e.length;for(;i<s;i+=2)r.push(e[i]);return r},lt:function(e,t,n){return n?e.slice(+t):e.slice(0,+t)},gt:function(e,t,n){return n?e.slice(0,+t+1):e.slice(+t+1)},eq:function(e,t,n){var r=e.splice(+t,1);return n?e:r}}},l=g.compareDocumentPosition?function(e,t){return e===t?(c=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return c=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return tt(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return tt(i[f],s[f]);return f===n?tt(e,s[f],-1):tt(i[f],t,1)},[0,0].sort(l),h=!c,Y.uniqueSort=function(e){var t,n=1;c=h,e.sort(l);if(c)for(;t=e[n];n++)t===e[n-1]&&e.splice(n--,1);return e},Y.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},f=Y.compile=function(e,t,n){var r,i,s,o=N[d][e];if(o&&o.context===t)return o;r=nt(e,t,n);for(i=0,s=r.length;i<s;i++)r[i]=st(r[i],t,n);return o=N(e,ot(r)),o.context=t,o.runs=o.dirruns=0,o},m.querySelectorAll&&function(){var e,t=lt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[],s=[":active"],o=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.oMatchesSelector||g.msMatchesSelector;X(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+C+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),X(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+C+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=i.length&&new RegExp(i.join("|")),lt=function(e,r,s,o,u){if(!o&&!u&&(!i||!i.test(e)))if(r.nodeType===9)try{return w.apply(s,b.call(r.querySelectorAll(e),0)),s}catch(a){}else if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){var f,l,c,h=r.getAttribute("id"),p=h||d,v=I.test(e)&&r.parentNode||r;h?p=p.replace(n,"\\$&"):r.setAttribute("id",p),f=nt(e,r,u),p="[id='"+p+"']";for(l=0,c=f.length;l<c;l++)f[l]=p+f[l].selector;try{return w.apply(s,b.call(v.querySelectorAll(f.join(",")),0)),s}catch(a){}finally{h||r.removeAttribute("id")}}return t(e,r,s,o,u)},o&&(X(function(t){e=o.call(t,"div");try{o.call(t,"[test!='']:sizzle"),s.push(W.PSEUDO.source,W.POS.source,"!=")}catch(n){}}),s=new RegExp(s.join("|")),Y.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!u(t)&&!s.test(n)&&(!i||!i.test(n)))try{var a=o.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return Y(n,null,null,[t]).length>0})}(),s.setFilters.nth=s.setFilters.eq,s.filters=s.pseudos,Y.attr=v.attr,v.find=Y,v.expr=Y.selectors,v.expr[":"]=v.expr.pseudos,v.unique=Y.uniqueSort,v.text=Y.getText,v.isXMLDoc=Y.isXML,v.contains=Y.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec
|
||
(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{ln=s.href}catch(Nn){ln=i.createElement("a"),ln.href="",ln=ln.href}cn=wn.exec(ln.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:ln,isLocal:dn.test(cn[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=""+(n||T),l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,cn[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]==cn[1]&&a[2]==cn[2]&&(a[3]||(a[1]==="http:"?80:443))==(cn[3]||(cn[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(e){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i,s=this.createTween(e,t),o=zn.exec(t),u=s.cur(),a=+u||0,f=1;if(o){n=+o[2],r=o[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&a){a=v.css(s.elem,e,!0)||n||1;do i=f=f||".5",a/=f,v.style(s.elem,e,a+r),f=s.cur()/u;while(f!==1&&f!==i)}s.unit=r,s.start=a,s.end=o[1]?a+(o[1]+1)*n:n}return s}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,t=v.timers,n=0;for(;n<t.length;n++)e=t[n],!e()&&t[n]===e&&t.splice(n--,1);t.length||v.fx.stop()},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f,l,c,h=this[0],p=h&&h.ownerDocument;if(!p)return;return(i=p.body)===h?v.offset.bodyOffset(h):(r=p.documentElement,v.contains(r,h)?(n=h.getBoundingClientRect(),s=tr(p),o=r.clientTop||i.clientTop||0,u=r.clientLeft||i.clientLeft||0,a=s.pageYOffset||r.scrollTop,f=s.pageXOffset||r.scrollLeft,l=n.top+a-o,c=n.left+f-u,{top:l,left:c}):{top:0,left:0})},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window),function(e,t){function n(t,n){var i=t.nodeName.toLowerCase();if("area"===i){var s=t.parentNode,o=s.name,u;return!t.href||!o||s.nodeName.toLowerCase()!=="map"?!1:(u=e("img[usemap=#"+o+"]")[0],!!u&&r(u))}return(/input|select|textarea|button|object/.test(i)?!t.disabled:"a"==i?t.href||n:n)&&r(t)}function r(t){return!e(t).parents().andSelf().filter(function(){return e.curCSS(this,"visibility")==="hidden"||e.expr.filters.hidden(this)}).length}e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.8.23",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),e.fn.extend({propAttr:e.fn.prop||e.fn.attr,_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.curCSS(this,"position",1))&&/(auto|scroll)/.test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.curCSS(t,"padding"+this,!0))||0,r&&(n-=parseFloat(e.curCSS(t,"border"+this+"Width",!0))||0),s&&(n-=parseFloat(e.curCSS(t,"margin"+this,!0))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return n(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var r=e.attr(t,"tabindex"),i=isNaN(r);return(i||r>=0)&&n(t,!i)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),e.curCSS||(e.curCSS=e.css),e.extend(e.ui,{plugin:{add:function(t,n,r){var i=e.ui[t].prototype;for(var s in r)i.plugins[s]=i.plugins[s]||[],i.plugins[s].push([n,r[s]])},call:function(e,t,n){var r=e.plugins[t];if(!r||!e.element[0].parentNode)return;for(var i=0;i<r.length;i++)e.options[r[i][0]]&&r[i][1].apply(e.element,n)}},contains:function(e,t){return document.compareDocumentPosition?e.compareDocumentPosition(t)&16:e!==t&&e.contains(t)},hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e<t+n},isOver:function(t,n,r,i,s,o){return e.ui.isOverAxis(t,r,s)&&e.ui.isOverAxis(n,i,o)}})}(jQuery),function(e,t){if(e.cleanData){var n=e.cleanData;e.cleanData=function(t){for(var r=0,i;(i=t[r])!=null;r++)try{e(i).triggerHandler("remove")}catch(s){}n(t)}}else{var r=e.fn.remove;e.fn.remove=function(t,n){return this.each(function(){return n||(!t||e.filter(t,[this]).length)&&e("*",this).add([this]).each(function(){try{e(this).triggerHandler("remove")}catch(t){}}),r.call(e(this),t,n)})}}e.widget=function(t,n,r){var i=t.split(".")[0],s;t=t.split(".")[1],s=i+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][s]=function(n){return!!e.data(n,t)},e[i]=e[i]||{},e[i][t]=function(e,t){arguments.length&&this._createWidget(e,t)};var o=new n;o.options=e.extend(!0,{},o.options),e[i][t].prototype=e.extend(!0,o,{namespace:i,widgetName:t,widgetEventPrefix:e[i][t].prototype.widgetEventPrefix||t,widgetBaseClass:s},r),e.widget.bridge(t,e[i][t])},e.widget.bridge=function(n,r){e.fn[n]=function(i){var s=typeof i=="string",o=Array.prototype.slice.call(arguments,1),u=this;return i=!s&&o.length?e.extend.apply(null,[!0,i].concat(o)):i,s&&i.charAt(0)==="_"?u:(s?this.each(function(){var r=e.data(this,n),s=r&&e.isFunction(r[i])?r[i].apply(r,o):r;if(s!==r&&s!==t)return u=s,!1}):this.each(function(){var t=e.data(this,n);t?t.option(i||{})._init():e.data(this,n,new r(i,this))}),u)}},e.Widget=function(e,t){arguments.length&&this._createWidget(e,t)},e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(t,n){e.data(n,this.widgetName,this),this.element=e(n),this.options=e.extend(!0,{},this.options,this._getCreateOptions(),t);var r=this;this.element.bind("remove."+this.widgetName,function(){r.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(n,r){var i=n;if(arguments.length===0)return e.extend({},this.options);if(typeof n=="string"){if(r===t)return this.options[n];i={},i[n]=r}return this._setOptions(i),this},_setOptions:function(t){var n=this;return e.each(t,function(e,t){n._setOption(e,t)}),this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&this.widget()[t?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",t),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(
|
||
e.isFunction(o)&&o.call(this.element[0],n,r)===!1||n.isDefaultPrevented())}}}(jQuery),function(e,t){var n=!1;e(document).mouseup(function(e){n=!1}),e.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which==1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return!e.browser.msie||document.documentMode>=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target==this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})}(jQuery),function(e,t){e.widget("ui.draggable",e.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(t),this.handle?(n.iframeFix&&e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1);var r=this.element[0],i=!1;while(r&&(r=r.parentNode))r==document&&(i=!0);if(!i&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!n||this.options.revert=="valid"&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)){var s=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){s._trigger("stop",t)!==!1&&s._clear()})}else this._trigger("stop",t)!==!1&&this._clear();return!1},_mouseUp:function(t){return this.options.iframeFix===!0&&e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){var n=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;return e(this.options.handle,this.element).find("*").andSelf().each(function(){this==t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):n.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo(n.appendTo=="parent"?this.element[0].parentNode:n.appendTo),r[0]!=this.element[0]&&!/(fixed|absolute)/.test(r.css("position"))&&r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.browser.msie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[t.containment=="document"?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t.containment=="document"?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(t.containment=="document"?0:e(window).scrollLeft())+e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(t.containment=="document"?0:e(window).scrollTop())+(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)&&t.containment.constructor!=Array){var n=e(t.containment),r=n[0];if(!r)return;var i=n.offset(),s=e(r).css("overflow")!="hidden";this.containment=[(parseInt(e(r).css("borderLeftWidth"),10)||0)+(parseInt(e(r).css("paddingLeft"),10)||0),(parseInt(e(r).css("borderTopWidth"),10)||0)+(parseInt(e(r).css("paddingTop"),10)||0),(s?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(e(r).css("borderLeftWidth"),10)||0)-(parseInt(e(r).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(s?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(e(r).css("borderTopWidth"),10)||0)-(parseInt(e(r).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}else t.containment.constructor==Array&&(this.containment=t.containment)},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r),left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r)}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName),s=t.pageX,o=t.pageY;if(this.originalPosition){var u;if(this.containment){if(this.relative_container){var a=this.relative_container.offset();u=[this.containment[0]+a.left,this.containment[1]+a.top,this.containment[2]+a.left,this.containment[3]+a.top]}else u=this.containment;t.pageX-this.offset.click.left<u[0]&&(s=u[0]+this.offset.click.left),t.pageY-this.offset.click.top<u[1]&&(o=u[1]+this.offset.click.top),t.pageX-this.offset.click.left>u[2]&&(s=u[2]+this.offset.click.left),t.pageY-this.offset.click.top>u[3]&&(o=u[3]+this.offset.click.top)}if(n.grid){var f=n.grid[1]?this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY;o=u?f-this.offset.click.top<u[1]||f-this.offset.click.top>u[3]?f-this.offset.click.top<u[1]?f+n.grid[1]:f-n.grid[1]:f:f;var l=n.grid[0]?this.originalPageX+Math.round((s-this.originalPageX)/n.grid[0])*n.grid[0]:this.originalPageX;s=u?l-this.offset.click.left<u[0]||l-this.offset.click.left>u[2]?l-this.offset.click.left<u[0]?l+n.grid[0]:l-n.grid[0]:l:l}}return{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():i?0:r.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:r.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r]),t=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(e){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.extend(e.ui.draggable,{version:"1.8.23"}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n){var r=e(this).data("draggable"),i=r.options,s=e.extend({},n,{item:r.element});r.sortables=[],e(i.connectToSortable).each(function(){var n=e.data(this,"sortable");n&&!n.options.disabled&&(r.sortables.push({instance:n,shouldRevert:n.options.revert}),n.refreshPositions(),n._trigger("activate",t,s))})},stop:function(t,n){var r=e(this).data("draggable"),i=e.extend({},n,{item:r.element});e.each(r.sortables,function(){this.instance.isOver?(this.instance.isOver=0,r.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,r.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,n){var r=e(this).data("draggable"),i=this,s=function(t){var n=this.offset.click.top,r=this.offset.click.left,i=this.positionAbs.top,s=this.positionAbs.left,o=t.height,u=t.width,a=t.top,f=t.left;return e.ui.isOver(i+n,s+r,a,f,o,u)};e.each(r.sortables,function(s){this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return n.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=r.offset.click.top,this.instance.offset.click.left=r.offset.click.left,this.instance.offset.parent.left-=r.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=r.offset.parent.top-this.instance.offset.parent.top,r._trigger("toSortable",t),r.dropped=this.instance.element,r.currentItem=r.element,this.instance.fromOutside=r),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n){var r=e("body"),i=e(this).data("draggable").options;r.css("cursor")&&(i._cursor=r.css("cursor")),r.css("cursor",i.cursor)},stop:function(t,n){var r=e(this).data("draggable").options;r._cursor&&e("body").css("cursor",r._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,n){var r=e(this).data("draggable").options;r._opacity&&e(n.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(t,n){var r=e(this).data("draggable");r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"&&(r.overflowOffset=r.scrollParent.offset())},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=!1;if(r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"){if(!i.axis||i.axis!="x")r.overflowOffset.top+r.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop-i.scrollSpeed);if(!i.axis||i.axis!="y")r.overflowOffset.left+r.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft-i.scrollSpeed)}else{if(!i.axis||i.axis!="x")t.pageY-e(document).scrollTop()<i.scrollSensitivity?s=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(s=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed));if(!i.axis||i.axis!="y")t.pageX-e(document).scrollLeft()<i.scrollSensitivity?s=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(s=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed))}s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n){var r=e(this).data("draggable"),i=r.options;r.snapElements=[],e(i.snap.constructor!=String?i.snap.items||":data(draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!=r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=i.snapTolerance,o=n.offset.left,u=o+r.helperProportions.width,a=n.offset.top,f=a+r.helperProportions.height;for(var l=r.snapElements.length-1;l>=0;l--){var c=r.snapElements[l].left,h=c+r.snapElements[l].width,p=r.snapElements[l].top,d=p+r.snapElements[l].height;if(!(c-s<o&&o<h+s&&p-s<a&&a<d+s||c-s<o&&o<h+s&&p-s<f&&f<d+s||c-s<u&&u<h+s&&p-s<a&&a<d+s||c-s<u&&u<h+s&&p-s<f&&f<d+s)){r.snapElements[l].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[l].item})),r.snapElements[l].snapping=!1;continue}if(i.snapMode!="inner"){var v=Math.abs(p-f)<=s,m=Math.abs(d-a)<=s,g=Math.abs(c-u)<=s,y=Math.abs(h-o)<=s;v&&(n.position.top=r._convertPositionTo("relative",{top:p-r.helperProportions.height,left:0}).top-r.margins.top),m&&(n.position.top=r._convertPositionTo("relative",{top:d,left:0}).top-r.margins.top),g&&(n.position.left=r._convertPositionTo("relative",{top:0,left:c-r.helperProportions.width}).left-r.margins.left),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h}).left-r.margins.left)}var b=v||m||g||y;if(i.snapMode!="outer"){var v=Math.abs(p-a)<=s,m=Math.abs(d-f)<=s,g=Math.abs(c-o)<=s,y=Math.abs(h-u)<=s;v&&(n.position.top=r._convertPositionTo("relative",{top:p,left:0}).top-r.margins.top),m&&(n.position.top=r._convertPositionTo("relative",{top:d-r.helperProportions.height,left:0}).top-r.margins.top),g&&(n.position.left=r._convertPositionTo("relative",{top:0,left:c}).left-r.margins.left),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h-r.helperProportions.width}).left-r.margins.left)}!r.snapElements[l].snapping&&(v||m||g||y||b)&&r.options.snap.snap&&r.options.snap.snap.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[l].item})),r.snapElements[l].snapping=v||m||g||y||b}}}),e.ui.plugin.add("draggable","stack",{start:function(t,n){var r=e(this).data("draggable").options,i=e.makeArray(e(r.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});if(!i.length)return;var s=parseInt(i[0].style.zIndex)||0;e(i).each(function(e){this.style.zIndex=s+e}),this[0].style.zIndex=s+i.length}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("zIndex")&&(i._zIndex=r.css("zIndex")),r.css("zIndex",i.zIndex)},stop:function(t,n){var r=e(this).data("draggable").options;r._zIndex&&e(n.helper).css("zIndex",r._zIndex)}})}(jQuery),function(e,t){e.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var t=this.options,n=t.accept;this.isover=0,this.isout=1,this.accept=e.isFunction(n)?n:function(e){return e.is(n)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];for(var n=0;n<t.length;n++)t[n]==this&&t.splice(n,1);return this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable"),this},_setOption:function(t,n){t=="accept"&&(this.accept=e.isFunction(n)?n:function(e){return e.is(n)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),n&&this._trigger("activate",t,this.ui(n))},_deactivate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),n&&this._trigger("deactivate",t,this.ui(n))},_over:function(t){var n=e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]==this.element[0])return;this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(n)))},_out:function(t){var n=e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]==this.element[0])return;this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(n)))},_drop:function(t,n){var r=n||e.ui.ddmanager.current;if(!r||(r.currentItem||r.element)[0]==this.element[0])return!1;var i=!1;return this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"droppable");if(t.options.greedy&&!t.options.disabled&&t.options.scope==r.options.scope&&t.accept.call(t.element[0],r.currentItem||r.element)&&e.ui.intersect(r,e.extend(t,{offset:t.element.offset()}),t.options.tolerance))return i=!0,!1}),i?!1:this.accept.call(this.element[0],r.currentItem||r.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(r)),this.element):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.extend(e.ui.droppable,{version:"1.8.23"}),e.ui.intersect=function(t,n,r){if(!n.offset)return!1;var i=(t.positionAbs||t.position.absolute).left,s=i+t.helperProportions.width,o=(t.positionAbs||t.position.absolute).top,u=o+t.helperProportions.height,a=n.offset.left,f=a+n.proportions.width,l=n.offset.top,c=l+n.proportions.height;switch(r){case"fit":return a<=i&&s<=f&&l<=o&&u<=c;case"intersect":return a<i+t.helperProportions.width/2&&s-t.helperProportions.width/2<f&&l<o+t.helperProportions.height/2&&u-t.helperProportions.height/2<c;case"pointer":var h=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,p=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,d=e.ui.isOver(p,h,l,a,n.proportions.height,n.proportions.width);return d;case"touch":return(o>=l&&o<=c||u>=l&&u<=c||o<l&&u>c)&&(i>=a&&i<=f||s>=a&&s<=f||i<a&&s>f);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,n){var r=e.ui.ddmanager.droppables[t.options.scope]||[],i=n?n.type:null,s=(t.currentItem||t.element).find(":data(droppable)").andSelf();e:for(var o=0;o<r.length;o++){if(r[o].options.disabled||t&&!r[o].accept.call(r[o].element[0],t.currentItem||t.element))continue;for(var u=0;u<s.length;u++)if(s[u]==r[o].element[0]){r[o].proportions.height=0;continue e}r[o].visible=r[o].element.css("display")!="none";if(!r[o].visible)continue;i=="mousedown"&&r[o]._activate.call(r[o],n),r[o].offset=r[o].element.offset(),r[o].proportions={width:r[o].element[0].offsetWidth,height:r[o].element[0].offsetHeight}}},drop:function(t,n){var r=!1;return e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options)return;!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(r=this._drop.call(this,n)||r),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=1,this.isover=0,this._deactivate.call(this,n))}),r},dragStart:function(t,n){t.element.parents(":not(body,html)").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)})},drag:function(t,n){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,n),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var r=e.ui.intersect(t,this,this.options.tolerance),i=!r&&this.isover==1?"isout":r&&this.isover==0?"isover":null;if(!i)return;var s;if(this.options.greedy){var o=this.element.parents(":data(droppable):eq(0)");o.length&&(s=e.data(o[0],"droppable"),s.greedyChild=i=="isover"?1:0)}s&&i=="isover"&&(s.isover=0,s.isout=1,s._out.call(s,n)),this[i]=1,this[i=="isout"?"isover":"isout"]=0,this[i=="isover"?"_over":"_out"].call(this,n),s&&i=="isout"&&(s.isout=0,s.isover=1,s._over.call(s,n))})},dragStop:function(t,n){t.element.parents(":not(body,html)").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)}}}(jQuery),function(e,t){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var t=this,n=this.options;this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!n.aspectRatio,aspectRatio:n.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:n.helper||n.ghost||n.animate?n.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=n.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var r=this.handles.split(",");this.handles={};for(var i=0;i<r.length;i++){var s=e.trim(r[i]),o="ui-resizable-"+s,u=e('<div class="ui-resizable-handle '+o+'"></div>');u.css({zIndex:n.zIndex}),"se"==s&&u.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(u)}}this._renderAxis=function(t){t=t||this.element;for(var n in this.handles){this.handles[n].constructor==String&&(this.handles[n]=e(this.handles[n],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var r=e(this.handles[n],this.element),i=0;i=/sw|ne|nw|se|n|s/.test(n)?r.outerHeight():r.outerWidth();var s=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");t.css(s,i),this._proportionallyResize()}if(!e(this.handles[n]).length)continue}},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!t.resizing){if(this.className)var e=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);t.axis=e&&e[1]?e[1]:"se"}}),n.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").hover(function(){if(n.disabled)return;e(this).removeClass("ui-resizable-autohide"),t._handles.show()},function(){if(n.disabled)return;t.resizing||(e(this).addClass("ui-resizable-autohide"),t._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var t=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){t(this.element);var n=this.element;n.after(this.originalElement.css({position:n.css("position"),width:n.outerWidth(),height:n.outerHeight(),top:n.css("top"),left:n.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_mouseCapture:function(t){var n=!1;for(var r in this.handles)e(this.handles[r])[0]==t.target&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var r=this.options,i=this.element.position(),s=this.element;this.resizing=!0,this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()},(s.is(".ui-draggable")||/absolute/.test(s.css("position")))&&s.css({position:"absolute",top:i.top,left:i.left}),this._renderProxy();var o=n(this.helper.css("left")),u=n(this.helper.css("top"));r.containment&&(o+=e(r.containment).scrollLeft()||0,u+=e(r.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:o,top:u},this.size=this._helper?{width:s.outerWidth(),height:s.outerHeight()}:{width:s.width(),height:s.height()},this.originalSize=this._helper?{width:s.outerWidth(),height:s.outerHeight()}:{width:s.width(),height:s.height()},this.originalPosition={left:o,top:u},this.sizeDiff={width:s.outerWidth()-s.width(),height:s.outerHeight()-s.height()},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio=typeof r.aspectRatio=="number"?r.aspectRatio:this.originalSize.width/this.originalSize.height||1;var a=e(".ui-resizable-"+this.axis).css("cursor");return e("body").css("cursor",a=="auto"?this.axis+"-resize":a),s.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var n=this.helper,r=this.options,i={},s=this,o=this.originalMousePosition,u=this.axis,a=t.pageX-o.left||0,f=t.pageY-o.top||0,l=this._change[u];if(!l)return!1;var c=l.apply(this,[t,a,f]),h=e.browser.msie&&e.browser.version<7,p=this.sizeDiff;this._updateVirtualBoundaries(t.shiftKey);if(this._aspectRatio||t.shiftKey)c=this._updateRatio(c,t);return c=this._respectSize(c,t),this._propagate("resize"
|
||
,t),n.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(c),this._trigger("resize",t,this.ui()),!1},_mouseStop:function(t){this.resizing=!1;var n=this.options,r=this;if(this._helper){var i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),o=s&&e.ui.hasScroll(i[0],"left")?0:r.sizeDiff.height,u=s?0:r.sizeDiff.width,a={width:r.helper.width()-u,height:r.helper.height()-o},f=parseInt(r.element.css("left"),10)+(r.position.left-r.originalPosition.left)||null,l=parseInt(r.element.css("top"),10)+(r.position.top-r.originalPosition.top)||null;n.animate||this.element.css(e.extend(a,{top:l,left:f})),r.helper.height(r.size.height),r.helper.width(r.size.width),this._helper&&!n.animate&&this._proportionallyResize()}return e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t=this.options,n,i,s,o,u;u={minWidth:r(t.minWidth)?t.minWidth:0,maxWidth:r(t.maxWidth)?t.maxWidth:Infinity,minHeight:r(t.minHeight)?t.minHeight:0,maxHeight:r(t.maxHeight)?t.maxHeight:Infinity};if(this._aspectRatio||e)n=u.minHeight*this.aspectRatio,s=u.minWidth/this.aspectRatio,i=u.maxHeight*this.aspectRatio,o=u.maxWidth/this.aspectRatio,n>u.minWidth&&(u.minWidth=n),s>u.minHeight&&(u.minHeight=s),i<u.maxWidth&&(u.maxWidth=i),o<u.maxHeight&&(u.maxHeight=o);this._vBoundaries=u},_updateCache:function(e){var t=this.options;this.offset=this.helper.offset(),r(e.left)&&(this.position.left=e.left),r(e.top)&&(this.position.top=e.top),r(e.height)&&(this.size.height=e.height),r(e.width)&&(this.size.width=e.width)},_updateRatio:function(e,t){var n=this.options,i=this.position,s=this.size,o=this.axis;return r(e.height)?e.width=e.height*this.aspectRatio:r(e.width)&&(e.height=e.width/this.aspectRatio),o=="sw"&&(e.left=i.left+(s.width-e.width),e.top=null),o=="nw"&&(e.top=i.top+(s.height-e.height),e.left=i.left+(s.width-e.width)),e},_respectSize:function(e,t){var n=this.helper,i=this._vBoundaries,s=this._aspectRatio||t.shiftKey,o=this.axis,u=r(e.width)&&i.maxWidth&&i.maxWidth<e.width,a=r(e.height)&&i.maxHeight&&i.maxHeight<e.height,f=r(e.width)&&i.minWidth&&i.minWidth>e.width,l=r(e.height)&&i.minHeight&&i.minHeight>e.height;f&&(e.width=i.minWidth),l&&(e.height=i.minHeight),u&&(e.width=i.maxWidth),a&&(e.height=i.maxHeight);var c=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,p=/sw|nw|w/.test(o),d=/nw|ne|n/.test(o);f&&p&&(e.left=c-i.minWidth),u&&p&&(e.left=c-i.maxWidth),l&&d&&(e.top=h-i.minHeight),a&&d&&(e.top=h-i.maxHeight);var v=!e.width&&!e.height;return v&&!e.left&&e.top?e.top=null:v&&!e.top&&e.left&&(e.left=null),e},_proportionallyResize:function(){var t=this.options;if(!this._proportionallyResizeElements.length)return;var n=this.helper||this.element;for(var r=0;r<this._proportionallyResizeElements.length;r++){var i=this._proportionallyResizeElements[r];if(!this.borderDif){var s=[i.css("borderTopWidth"),i.css("borderRightWidth"),i.css("borderBottomWidth"),i.css("borderLeftWidth")],o=[i.css("paddingTop"),i.css("paddingRight"),i.css("paddingBottom"),i.css("paddingLeft")];this.borderDif=e.map(s,function(e,t){var n=parseInt(e,10)||0,r=parseInt(o[t],10)||0;return n+r})}if(!(!e.browser.msie||!e(n).is(":hidden")&&!e(n).parents(":hidden").length))continue;i.css({height:n.height()-this.borderDif[0]-this.borderDif[2]||0,width:n.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var t=this.element,n=this.options;this.elementOffset=t.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var r=e.browser.msie&&e.browser.version<7,i=r?1:0,s=r?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+s,height:this.element.outerHeight()+s,position:"absolute",left:this.elementOffset.left-i+"px",top:this.elementOffset.top-i+"px",zIndex:++n.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(e,t,n){return{width:this.originalSize.width+t}},w:function(e,t,n){var r=this.options,i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,n){var r=this.options,i=this.originalSize,s=this.originalPosition;return{top:s.top+n,height:i.height-n}},s:function(e,t,n){return{height:this.originalSize.height+n}},se:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},sw:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,n,r]))},ne:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},nw:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,n,r]))}},_propagate:function(t,n){e.ui.plugin.call(this,t,[n,this.ui()]),t!="resize"&&this._trigger(t,n,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.extend(e.ui.resizable,{version:"1.8.23"}),e.ui.plugin.add("resizable","alsoResize",{start:function(t,n){var r=e(this).data("resizable"),i=r.options,s=function(t){e(t).each(function(){var t=e(this);t.data("resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};typeof i.alsoResize=="object"&&!i.alsoResize.parentNode?i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)}):s(i.alsoResize)},resize:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.originalSize,o=r.originalPosition,u={height:r.size.height-s.height||0,width:r.size.width-s.width||0,top:r.position.top-o.top||0,left:r.position.left-o.left||0},a=function(t,r){e(t).each(function(){var t=e(this),i=e(this).data("resizable-alsoresize"),s={},o=r&&r.length?r:t.parents(n.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var n=(i[t]||0)+(u[t]||0);n&&n>=0&&(s[t]=n||null)}),t.css(s)})};typeof i.alsoResize=="object"&&!i.alsoResize.nodeType?e.each(i.alsoResize,function(e,t){a(e,t)}):a(i.alsoResize)},stop:function(t,n){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","animate",{stop:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r._proportionallyResizeElements,o=s.length&&/textarea/i.test(s[0].nodeName),u=o&&e.ui.hasScroll(s[0],"left")?0:r.sizeDiff.height,a=o?0:r.sizeDiff.width,f={width:r.size.width-a,height:r.size.height-u},l=parseInt(r.element.css("left"),10)+(r.position.left-r.originalPosition.left)||null,c=parseInt(r.element.css("top"),10)+(r.position.top-r.originalPosition.top)||null;r.element.animate(e.extend(f,c&&l?{top:c,left:l}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var n={width:parseInt(r.element.css("width"),10),height:parseInt(r.element.css("height"),10),top:parseInt(r.element.css("top"),10),left:parseInt(r.element.css("left"),10)};s&&s.length&&e(s[0]).css({width:n.width,height:n.height}),r._updateCache(n),r._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(t,r){var i=e(this).data("resizable"),s=i.options,o=i.element,u=s.containment,a=u instanceof e?u.get(0):/parent/.test(u)?o.parent().get(0):u;if(!a)return;i.containerElement=e(a);if(/document/.test(u)||u==document)i.containerOffset={left:0,top:0},i.containerPosition={left:0,top:0},i.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight};else{var f=e(a),l=[];e(["Top","Right","Left","Bottom"]).each(function(e,t){l[e]=n(f.css("padding"+t))}),i.containerOffset=f.offset(),i.containerPosition=f.position(),i.containerSize={height:f.innerHeight()-l[3],width:f.innerWidth()-l[1]};var c=i.containerOffset,h=i.containerSize.height,p=i.containerSize.width,d=e.ui.hasScroll(a,"left")?a.scrollWidth:p,v=e.ui.hasScroll(a)?a.scrollHeight:h;i.parentData={element:a,left:c.left,top:c.top,width:d,height:v}}},resize:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.containerSize,o=r.containerOffset,u=r.size,a=r.position,f=r._aspectRatio||t.shiftKey,l={top:0,left:0},c=r.containerElement;c[0]!=document&&/static/.test(c.css("position"))&&(l=o),a.left<(r._helper?o.left:0)&&(r.size.width=r.size.width+(r._helper?r.position.left-o.left:r.position.left-l.left),f&&(r.size.height=r.size.width/r.aspectRatio),r.position.left=i.helper?o.left:0),a.top<(r._helper?o.top:0)&&(r.size.height=r.size.height+(r._helper?r.position.top-o.top:r.position.top),f&&(r.size.width=r.size.height*r.aspectRatio),r.position.top=r._helper?o.top:0),r.offset.left=r.parentData.left+r.position.left,r.offset.top=r.parentData.top+r.position.top;var h=Math.abs((r._helper?r.offset.left-l.left:r.offset.left-l.left)+r.sizeDiff.width),p=Math.abs((r._helper?r.offset.top-l.top:r.offset.top-o.top)+r.sizeDiff.height),d=r.containerElement.get(0)==r.element.parent().get(0),v=/relative|absolute/.test(r.containerElement.css("position"));d&&v&&(h-=r.parentData.left),h+r.size.width>=r.parentData.width&&(r.size.width=r.parentData.width-h,f&&(r.size.height=r.size.width/r.aspectRatio)),p+r.size.height>=r.parentData.height&&(r.size.height=r.parentData.height-p,f&&(r.size.width=r.size.height*r.aspectRatio))},stop:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.position,o=r.containerOffset,u=r.containerPosition,a=r.containerElement,f=e(r.helper),l=f.offset(),c=f.outerWidth()-r.sizeDiff.width,h=f.outerHeight()-r.sizeDiff.height;r._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:l.left-u.left-o.left,width:c,height:h}),r._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:l.left-u.left-o.left,width:c,height:h})}}),e.ui.plugin.add("resizable","ghost",{start:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.size;r.ghost=r.originalElement.clone(),r.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:""),r.ghost.appendTo(r.helper)},resize:function(t,n){var r=e(this).data("resizable"),i=r.options;r.ghost&&r.ghost.css({position:"relative",height:r.size.height,width:r.size.width})},stop:function(t,n){var r=e(this).data("resizable"),i=r.options;r.ghost&&r.helper&&r.helper.get(0).removeChild(r.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.size,o=r.originalSize,u=r.originalPosition,a=r.axis,f=i._aspectRatio||t.shiftKey;i.grid=typeof i.grid=="number"?[i.grid,i.grid]:i.grid;var l=Math.round((s.width-o.width)/(i.grid[0]||1))*(i.grid[0]||1),c=Math.round((s.height-o.height)/(i.grid[1]||1))*(i.grid[1]||1);/^(se|s|e)$/.test(a)?(r.size.width=o.width+l,r.size.height=o.height+c):/^(ne)$/.test(a)?(r.size.width=o.width+l,r.size.height=o.height+c,r.position.top=u.top-c):/^(sw)$/.test(a)?(r.size.width=o.width+l,r.size.height=o.height+c,r.position.left=u.left-l):(r.size.width=o.width+l,r.size.height=o.height+c,r.position.top=u.top-c,r.position.left=u.left-l)}});var n=function(e){return parseInt(e,10)||0},r=function(e){return!isNaN(parseInt(e,10))}}(jQuery),function(e,t){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var t=this;this.element.addClass("ui-selectable"),this.dragged=!1;var n;this.refresh=function(){n=e(t.options.filter,t.element[0]),n.addClass("ui-selectee"),n.each(function(){var t=e(this),n=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:n.left,top:n.top,right:n.left+t.outerWidth(),bottom:n.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=n.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){return this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy(),this},_mouseStart:function(t){var n=this;this.opos=[t.pageX,t.pageY];if(this.options.disabled)return;var r=this.options;this.selectees=e(r.filter,this.element[0]),this._trigger("start",t),e(r.appendTo).append(this.helper),this.helper.css({left:t.clientX,top:t.clientY,width:0,height:0}),r.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var r=e.data(this,"selectable-item");r.startselected=!0,!t.metaKey&&!t.ctrlKey&&(r.$element.removeClass("ui-selected"),r.selected=!1,r.$element.addClass("ui-unselecting"),r.unselecting=!0,n._trigger("unselecting",t,{unselecting:r.element}))}),e(t.target).parents().andSelf().each(function(){var r=e.data(this,"selectable-item");if(r){var i=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected");return r.$element.removeClass(i?"ui-unselecting":"ui-selected").addClass(i?"ui-selecting":"ui-unselecting"),r.unselecting=!i,r.selecting=i,r.selected=i,i?n._trigger("selecting",t,{selecting:r.element}):n._trigger("unselecting",t,{unselecting:r.element}),!1}})},_mouseDrag:function(t){var n=this;this.dragged=!0;if(this.options.disabled)return;var r=this.options,i=this.opos[0],s=this.opos[1],o=t.pageX,u=t.pageY;if(i>o){var a=o;o=i,i=a}if(s>u){var a=u;u=s,s=a}return this.helper.css({left:i,top:s,width:o-i,height:u-s}),this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!a||a.element==n.element[0])return;var f=!1;r.tolerance=="touch"?f=!(a.left>o||a.right<i||a.top>u||a.bottom<s):r.tolerance=="fit"&&(f=a.left>i&&a.right<o&&a.top>s&&a.bottom<u),f?(a.selected&&(a.$element.removeClass("ui-selected"),a.selected=!1),a.unselecting&&(a.$element.removeClass("ui-unselecting"),a.unselecting=!1),a.selecting||(a.$element.addClass("ui-selecting"),a.selecting=!0,n._trigger("selecting",t,{selecting:a.element}))):(a.selecting&&((t.metaKey||t.ctrlKey)&&a.startselected?(a.$element.removeClass("ui-selecting"),a.selecting=!1,a.$element.addClass("ui-selected"),a.selected=!0):(a.$element.removeClass("ui-selecting"),a.selecting=!1,a.startselected&&(a.$element.addClass("ui-unselecting"),a.unselecting=!0),n._trigger("unselecting",t,{unselecting:a.element}))),a.selected&&!t.metaKey&&!t.ctrlKey&&!a.startselected&&(a.$element.removeClass("ui-selected"),a.selected=!1,a.$element.addClass("ui-unselecting"),a.unselecting=!0,n._trigger("unselecting",t,{unselecting:a.element})))}),!1},_mouseStop:function(t){var n=this;this.dragged=!1;var r=this.options;return e(".ui-unselecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-unselecting"),r.unselecting=!1,r.startselected=!1,n._trigger("unselected",t,{unselected:r.element})}),e(".ui-selecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-selecting").addClass("ui-selected"),r.selecting=!1,r.selected=!0,r.startselected=!0,n._trigger("selected",t,{selected:r.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.extend(e.ui.selectable,{version:"1.8.23"})}(jQuery),function(e,t){e.widget("ui.sortable",e.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?e.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){e.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,n){t==="disabled"?(this.options[t]=n,this.widget()[n?"addClass":"removeClass"]("ui-sortable-disabled")):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,n){var r=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(t);var i=null,s=this,o=e(t.target).parents().each(function(){if(e.data(this,r.widgetName+"-item")==s)return i=e(this),!1});e.data(t.target,r.widgetName+"-item")==s&&(i=e(t.target));if(!i)return!1;if(this.options.handle&&!n){var u=!1;e(this.options.handle,i).find("*").andSelf().each(function(){this==t.target&&(u=!0)});if(!u)return!1}return this.currentItem=i,this._removeCurrentsFromItems(),!0},_mouseStart:function(t,n,r){var i=this.options,s=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),i.containment&&this._setContainment(),i.cursor&&(e("body").css("cursor")&&(this._storedCursor=e("body").css("cursor")),e("body").css("cursor",i.cursor)),i.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",i.opacity)),i.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",i.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!r)for(var o=this.containers.length-1;o>=0;o--)this.containers[o]._trigger("activate",t,s._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var n=this.options,r=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<n.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+n.scrollSpeed:t.pageY-this.overflowOffset.top<n.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-n.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<n.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+n.scrollSpeed:t.pageX-this.overflowOffset.left<n.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-n.scrollSpeed)):(t.pageY-e(document).scrollTop()<n.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<n.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+n.scrollSpeed)),t.pageX-e(document).scrollLeft()<n.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<n.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+n.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(var i=this.items.length-1;i>=0;i--){var s=this.items[i],o=s.item[0],u=this._intersectsWithPointer(s);if(!u)continue;if(o!=this.currentItem[0]&&this.placeholder[u==1?"next":"prev"]()[0]!=o&&!e.ui.contains(this.placeholder[0],o)&&(this.options.type=="semi-dynamic"?!e.ui.contains(this.element[0],o):!0)){this.direction=u==1?"down":"up";if(this.options.tolerance!="pointer"&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,n){if(!t)return;e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t);if(this.options.revert){var r=this,i=r.placeholder.offset();r.reverting=!0,e(this.helper).animate({left:i.left-this.offset.parent.left-r.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:i.top-this.offset.parent.top-r.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){r._clear(t)})}else this._clear(t,n);return!1},cancel:function(){var t=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("deactivate",null,t._uiHash(this)),this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",null,t._uiHash(this)),this.containers[n].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},e(n).each(function(){var n=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[-=_](.+)/);n&&r.push((t.key||n[1]+"[]")+"="+(t.key&&t.expression?n[1]:n[2]))}),!r.length&&t.key&&r.push(t.key+"="),r.join("&")},toArray:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},n.each(function(){r.push(e(t.item||this).attr(t.attribute||"id")||"")}),r},_intersectsWith:function(e){var t=this.positionAbs.left,n=t+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,s=e.left,o=s+e.width,u=e.top,a=u+e.height,f=this.offset.click.top,l=this.offset.click.left,c=r+f>u&&r+f<a&&t+l>s&&t+l<o;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?c:s<t+this.helperProportions.width/2&&n-this.helperProportions.width/2<o&&u<r+this.helperProportions.height/2&&i-this.helperProportions.height/2<a},_intersectsWithPointer:function(t){var n=this.options.axis==="x"||e.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),r=this.options.axis==="y"||e.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),i=n&&r,s=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return i?this.floating?o&&o=="right"||s=="down"?2:1:s&&(s=="down"?2:1):!1},_intersectsWithSides:function(t){var n=e.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),r=e.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),i=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return this.floating&&s?s=="right"&&r||s=="left"&&!r:i&&(i=="down"&&n||i=="up"&&!n)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return e!=0&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return e!=0&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor==String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var n=this,r=[],i=[],s=this._connectWith();if(s&&t)for(var o=s.length-1;o>=0;o--){var u=e(s[o]);for(var a=u.length-1;a>=0;a--){var f=e.data(u[a],this.widgetName);f&&f!=this&&!f.options.disabled&&i.push([e.isFunction(f.options.items)?f.options.items.call(f.element):e(f.options.items,f.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),f])}}i.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var o=i.length-1;o>=0;o--)i[o][0].each(function(){r.push(this)});return e(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");for(var t=0;t<this.items.length;t++)for(var n=0;n<e.length;n++)e[n]==this.items[t].item[0]&&this.items.splice(t,1)},_refreshItems:function(t){this.items=[],this.containers=[this];var n=this.items,r=this,i=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],s=this._connectWith();if(s&&this.ready)for(var o=s.length-1;o>=0;o--){var u=e(s[o]);for(var a=u.length-1;a>=0;a--){var f=e.data(u[a],this.widgetName);f&&f!=this&&!f.options.disabled&&(i.push([e.isFunction(f.options.items)?f.options.items.call(f.element[0],t,{item:this.currentItem}):e(f.options.items,f.element),f]),this.containers.push(f))}}for(var o=i.length-1;o>=0;o--){var l=i[o][1],c=i[o][0];for(var a=0,h=c.length;a<h;a++){var p=e(c[a]);p.data(this.widgetName+"-item",l),n.push({item:p,instance:l,width:0,height:0,left:0,top:0})}}},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var n=this.items.length-1;n>=0;n--){var r=this.items[n];if(r.instance!=this.currentContainer&&this.currentContainer&&r.item[0]!=this.currentItem[0])continue;var i=this.options.toleranceElement?e(this.options.toleranceElement,r.item):r.item;t||(r.width=i.outerWidth(),r.height=i.outerHeight());var s=i.offset();r.left=s.left,r.top=s.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var n=this.containers.length-1;n>=0;n--){var s=this.containers[n].element.offset();this.containers[n].containerCache.left=s.left,this.containers[n].containerCache.top=s.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight()}return this},_createPlaceholder:function(t){var n=t||this,r=n.options;if(!r.placeholder||r.placeholder.constructor==String){var i=r.placeholder;r.placeholder={element:function(){var t=e(document.createElement(n.currentItem[0].nodeName)).addClass(i||n.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return i||(t.style.visibility="hidden"),t},update:function(e,t){if(i&&!r.forcePlaceholderSize)return;t.height()||t.height(n.currentItem.innerHeight()-parseInt(n.currentItem.css("paddingTop")||0,10)-parseInt(n.currentItem.css("paddingBottom")||0,10)),t.width()||t.width(n.currentItem.innerWidth()-parseInt(n.currentItem.css("paddingLeft")||0,10)-parseInt(n.currentItem.css("paddingRight")||0,10))}}}n.placeholder=e(r.placeholder.element.call(n.element,n.currentItem)),n.currentItem.after(n.placeholder),r.placeholder.update(n,n.placeholder)},_contactContainers:function(t){var n=null,r=null;for(var i=this.containers.length-1;i>=0;i--){if(e.ui.contains(this.currentItem[0],this.containers[i].element[0]))continue;if(this._intersectsWith(this.containers[i].containerCache)){if(n&&e.ui.contains(this.containers[i].element[0],n.element[0]))continue;n=this.containers[i],r=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0)}if(!n)return;if(this.containers.length===1)this.containers[r]._trigger("over",t,this._uiHash(this)),this.containers[r].containerCache.over=1;else if(this.currentContainer!=this.containers[r]){var s=1e4,o=null,u=this.positionAbs[this.containers[r].floating?"left":"top"];for(var a=this.items.length-1;a>=0;a--){if(!e.ui.contains(this.containers[r].element[0],this.items[a].item[0]))continue;var f=this.containers[r].floating?this.items[a].item.offset().left:this.items[a].item.offset().top;Math.abs(f-u)<s&&(s=Math.abs(f-u),o=this.items[a],this.direction=f-u>0?"down":"up")}if(!o&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[r],o?this._rearrange(t,o,null,!0):this._rearrange(t,null,this.containers[r].element,!0),this._trigger("change",t,this._uiHash()),this.containers[r]._trigger("change",t,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[r]._trigger("over",t,this._uiHash(this)),this.containers[r].containerCache.over=1}},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t,this.currentItem])):n.helper=="clone"?this.currentItem.clone():this.currentItem;return r.parents("body").length||e(n.appendTo!="parent"?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(r[0]),r[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(r[0].style.width==""||n.forceHelperSize)&&r.width(this.currentItem.width()),(r[0].style.height==""||n.forceHelperSize)&&r.height(this.currentItem.height()),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.browser.msie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset
|
||
.parent.top,e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)){var n=e(t.containment)[0],r=e(t.containment).offset(),i=e(n).css("overflow")!="hidden";this.containment=[r.left+(parseInt(e(n).css("borderLeftWidth"),10)||0)+(parseInt(e(n).css("paddingLeft"),10)||0)-this.margins.left,r.top+(parseInt(e(n).css("borderTopWidth"),10)||0)+(parseInt(e(n).css("paddingTop"),10)||0)-this.margins.top,r.left+(i?Math.max(n.scrollWidth,n.offsetWidth):n.offsetWidth)-(parseInt(e(n).css("borderLeftWidth"),10)||0)-(parseInt(e(n).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,r.top+(i?Math.max(n.scrollHeight,n.offsetHeight):n.offsetHeight)-(parseInt(e(n).css("borderTopWidth"),10)||0)-(parseInt(e(n).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(e.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r),left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(e.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r)}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var s=t.pageX,o=t.pageY;if(this.originalPosition){this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(s=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top));if(n.grid){var u=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1];o=this.containment?u-this.offset.click.top<this.containment[1]||u-this.offset.click.top>this.containment[3]?u-this.offset.click.top<this.containment[1]?u+n.grid[1]:u-n.grid[1]:u:u;var a=this.originalPageX+Math.round((s-this.originalPageX)/n.grid[0])*n.grid[0];s=this.containment?a-this.offset.click.left<this.containment[0]||a-this.offset.click.left>this.containment[2]?a-this.offset.click.left<this.containment[0]?a+n.grid[0]:a-n.grid[0]:a:a}}return{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(e.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():i?0:r.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(e.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:r.scrollLeft())}},_rearrange:function(e,t,n,r){n?n[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var i=this,s=this.counter;window.setTimeout(function(){s==i.counter&&i.refreshPositions(!r)},0)},_clear:function(t,n){this.reverting=!1;var r=[],i=this;!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var s in this._storedCSS)if(this._storedCSS[s]=="auto"||this._storedCSS[s]=="static")this._storedCSS[s]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!n&&r.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!n&&r.push(function(e){this._trigger("update",e,this._uiHash())});if(!e.ui.contains(this.element[0],this.currentItem[0])){n||r.push(function(e){this._trigger("remove",e,this._uiHash())});for(var s=this.containers.length-1;s>=0;s--)e.ui.contains(this.containers[s].element[0],this.currentItem[0])&&!n&&(r.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.containers[s])),r.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.containers[s])))}for(var s=this.containers.length-1;s>=0;s--)n||r.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[s])),this.containers[s].containerCache.over&&(r.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[s])),this.containers[s].containerCache.over=0);this._storedCursor&&e("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!n){this._trigger("beforeStop",t,this._uiHash());for(var s=0;s<r.length;s++)r[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}n||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!=this.currentItem[0]&&this.helper.remove(),this.helper=null;if(!n){for(var s=0;s<r.length;s++)r[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var n=t||this;return{helper:n.helper,placeholder:n.placeholder||e([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:t?t.element:null}}}),e.extend(e.ui.sortable,{version:"1.8.23"})}(jQuery),jQuery.effects||function(e,t){function n(t){var n;return t&&t.constructor==Array&&t.length==3?t:(n=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(t))?[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10)]:(n=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(t))?[parseFloat(n[1])*2.55,parseFloat(n[2])*2.55,parseFloat(n[3])*2.55]:(n=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(t))?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:(n=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(t))?[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)]:(n=/rgba\(0, 0, 0, 0\)/.exec(t))?i.transparent:i[e.trim(t).toLowerCase()]}function r(t,r){var i;do{i=(e.curCSS||e.css)(t,r);if(i!=""&&i!="transparent"||e.nodeName(t,"body"))break;r="backgroundColor"}while(t=t.parentNode);return n(i)}function u(){var e=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,t={},n,r;if(e&&e.length&&e[0]&&e[e[0]]){var i=e.length;while(i--)n=e[i],typeof e[n]=="string"&&(r=n.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()}),t[r]=e[n])}else for(n in e)typeof e[n]=="string"&&(t[n]=e[n]);return t}function a(t){var n,r;for(n in t)r=t[n],(r==null||e.isFunction(r)||n in o||/scrollbar/.test(n)||!/color/i.test(n)&&isNaN(parseFloat(r)))&&delete t[n];return t}function f(e,t){var n={_:0},r;for(r in t)e[r]!=t[r]&&(n[r]=t[r]);return n}function l(t,n,r,i){typeof t=="object"&&(i=n,r=null,n=t,t=n.effect),e.isFunction(n)&&(i=n,r=null,n={});if(typeof n=="number"||e.fx.speeds[n])i=r,r=n,n={};return e.isFunction(r)&&(i=r,r=null),n=n||{},r=r||n.duration,r=e.fx.off?0:typeof r=="number"?r:r in e.fx.speeds?e.fx.speeds[r]:e.fx.speeds._default,i=i||n.complete,[t,n,r,i]}function c(t){return!t||typeof t=="number"||e.fx.speeds[t]?!0:typeof t=="string"&&!e.effects[t]?!0:!1}e.effects={},e.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(t,i){e.fx.step[i]=function(e){e.colorInit||(e.start=r(e.elem,i),e.end=n(e.end),e.colorInit=!0),e.elem.style[i]="rgb("+Math.max(Math.min(parseInt(e.pos*(e.end[0]-e.start[0])+e.start[0],10),255),0)+","+Math.max(Math.min(parseInt(e.pos*(e.end[1]-e.start[1])+e.start[1],10),255),0)+","+Math.max(Math.min(parseInt(e.pos*(e.end[2]-e.start[2])+e.start[2],10),255),0)+")"}});var i={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},s=["add","remove","toggle"],o={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.effects.animateClass=function(t,n,r,i){return e.isFunction(r)&&(i=r,r=null),this.queue(function(){var o=e(this),l=o.attr("style")||" ",c=a(u.call(this)),h,p=o.attr("class")||"";e.each(s,function(e,n){t[n]&&o[n+"Class"](t[n])}),h=a(u.call(this)),o.attr("class",p),o.animate(f(c,h),{queue:!1,duration:n,easing:r,complete:function(){e.each(s,function(e,n){t[n]&&o[n+"Class"](t[n])}),typeof o.attr("style")=="object"?(o.attr("style").cssText="",o.attr("style").cssText=l):o.attr("style",l),i&&i.apply(this,arguments),e.dequeue(this)}})})},e.fn.extend({_addClass:e.fn.addClass,addClass:function(t,n,r,i){return n?e.effects.animateClass.apply(this,[{add:t},n,r,i]):this._addClass(t)},_removeClass:e.fn.removeClass,removeClass:function(t,n,r,i){return n?e.effects.animateClass.apply(this,[{remove:t},n,r,i]):this._removeClass(t)},_toggleClass:e.fn.toggleClass,toggleClass:function(n,r,i,s,o){return typeof r=="boolean"||r===t?i?e.effects.animateClass.apply(this,[r?{add:n}:{remove:n},i,s,o]):this._toggleClass(n,r):e.effects.animateClass.apply(this,[{toggle:n},r,i,s])},switchClass:function(t,n,r,i,s){return e.effects.animateClass.apply(this,[{add:n,remove:t},r,i,s])}}),e.extend(e.effects,{version:"1.8.23",save:function(e,t){for(var n=0;n<t.length;n++)t[n]!==null&&e.data("ec.storage."+t[n],e[0].style[t[n]])},restore:function(e,t){for(var n=0;n<t.length;n++)t[n]!==null&&e.css(t[n],e.data("ec.storage."+t[n]))},setMode:function(e,t){return t=="toggle"&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var n,r;switch(e[0]){case"top":n=0;break;case"middle":n=.5;break;case"bottom":n=1;break;default:n=e[0]/t.height}switch(e[1]){case"left":r=0;break;case"center":r=.5;break;case"right":r=1;break;default:r=e[1]/t.width}return{x:r,y:n}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var n={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},r=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),i=document.activeElement;try{i.id}catch(s){i=document.body}return t.wrap(r),(t[0]===i||e.contains(t[0],i))&&e(i).focus(),r=t.parent(),t.css("position")=="static"?(r.css({position:"relative"}),t.css({position:"relative"})):(e.extend(n,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,r){n[r]=t.css(r),isNaN(parseInt(n[r],10))&&(n[r]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),r.css(n).show()},removeWrapper:function(t){var n,r=document.activeElement;return t.parent().is(".ui-effects-wrapper")?(n=t.parent().replaceWith(t),(t[0]===r||e.contains(t[0],r))&&e(r).focus(),n):t},setTransition:function(t,n,r,i){return i=i||{},e.each(n,function(e,n){var s=t.cssUnit(n);s[0]>0&&(i[n]=s[0]*r+s[1])}),i}}),e.fn.extend({effect:function(t,n,r,i){var s=l.apply(this,arguments),o={options:s[1],duration:s[2],callback:s[3]},u=o.options.mode,a=e.effects[t];return e.fx.off||!a?u?this[u](o.duration,o.callback):this.each(function(){o.callback&&o.callback.call(this)}):a.call(this,o)},_show:e.fn.show,show:function(e){if(c(e))return this._show.apply(this,arguments);var t=l.apply(this,arguments);return t[1].mode="show",this.effect.apply(this,t)},_hide:e.fn.hide,hide:function(e){if(c(e))return this._hide.apply(this,arguments);var t=l.apply(this,arguments);return t[1].mode="hide",this.effect.apply(this,t)},__toggle:e.fn.toggle,toggle:function(t){if(c(t)||typeof t=="boolean"||e.isFunction(t))return this.__toggle.apply(this,arguments);var n=l.apply(this,arguments);return n[1].mode="toggle",this.effect.apply(this,n)},cssUnit:function(t){var n=this.css(t),r=[];return e.each(["em","px","%","pt"],function(e,t){n.indexOf(t)>0&&(r=[parseFloat(n),t])}),r}});var h={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){h[t]=function(t){return Math.pow(t,e+2)}}),e.extend(h,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return e===0||e===1?e:-Math.pow(2,8*(e-1))*Math.sin(((e-1)*80-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){var t,n=4;while(e<((t=Math.pow(2,--n))-1)/11);return 1/Math.pow(4,3-n)-7.5625*Math.pow((t*3-2)/22-e,2)}}),e.each(h,function(t,n){e.easing["easeIn"+t]=n,e.easing["easeOut"+t]=function(e){return 1-n(1-e)},e.easing["easeInOut"+t]=function(e){return e<.5?n(e*2)/2:n(e*-2+2)/-2+1}})}(jQuery),function(e,t){e.effects.blind=function(t){return this.queue(function(){var n=e(this),r=["position","top","bottom","left","right"],i=e.effects.setMode(n,t.options.mode||"hide"),s=t.options.direction||"vertical";e.effects.save(n,r),n.show();var u=e.effects.createWrapper(n).css({overflow:"hidden"}),a=s=="vertical"?"height":"width",f=s=="vertical"?u.height():u.width();i=="show"&&u.css(a,0);var l={};l[a]=i=="show"?f:0,u.animate(l,t.duration,t.options.easing,function(){i=="hide"&&n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),t.callback&&t.callback.apply(n[0],arguments),n.dequeue()})})}}(jQuery),function(e,t){e.effects.bounce=function(t){return this.queue(function(){var n=e(this),r=["position","top","bottom","left","right"],i=e.effects.setMode(n,t.options.mode||"effect"),s=t.options.direction||"up",u=t.options.distance||20,a=t.options.times||5,f=t.duration||250;/show|hide/.test(i)&&r.push("opacity"),e.effects.save(n,r),n.show(),e.effects.createWrapper(n);var l=s=="up"||s=="down"?"top":"left",c=s=="up"||s=="left"?"pos":"neg",u=t.options.distance||(l=="top"?n.outerHeight(!0)/3:n.outerWidth(!0)/3);i=="show"&&n.css("opacity",0).css(l,c=="pos"?-u:u),i=="hide"&&(u/=a*2),i!="hide"&&a--;if(i=="show"){var h={opacity:1};h[l]=(c=="pos"?"+=":"-=")+u,n.animate(h,f/2,t.options.easing),u/=2,a--}for(var p=0;p<a;p++){var d={},v={};d[l]=(c=="pos"?"-=":"+=")+u,v[l]=(c=="pos"?"+=":"-=")+u,n.animate(d,f/2,t.options.easing).animate(v,f/2,t.options.easing),u=i=="hide"?u*2:u/2}if(i=="hide"){var h={opacity:0};h[l]=(c=="pos"?"-=":"+=")+u,n.animate(h,f/2,t.options.easing,function(){n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),t.callback&&t.callback.apply(this,arguments)})}else{var d={},v={};d[l]=(c=="pos"?"-=":"+=")+u,v[l]=(c=="pos"?"+=":"-=")+u,n.animate(d,f/2,t.options.easing).animate(v,f/2,t.options.easing,function(){e.effects.restore(n,r),e.effects.removeWrapper(n),t.callback&&t.callback.apply(this,arguments)})}n.queue("fx",function(){n.dequeue()}),n.dequeue()})}}(jQuery),function(e,t){e.effects.clip=function(t){return this.queue(function(){var n=e(this),r=["position","top","bottom","left","right","height","width"],i=e.effects.setMode(n,t.options.mode||"hide"),s=t.options.direction||"vertical";e.effects.save(n,r),n.show();var u=e.effects.createWrapper(n).css({overflow:"hidden"}),a=n[0].tagName=="IMG"?u:n,f={size:s=="vertical"?"height":"width",position:s=="vertical"?"top":"left"},l=s=="vertical"?a.height():a.width();i=="show"&&(a.css(f.size,0),a.css(f.position,l/2));var c={};c[f.size]=i=="show"?l:0,c[f.position]=i=="show"?0:l/2,a.animate(c,{queue:!1,duration:t.duration,easing:t.options.easing,complete:function(){i=="hide"&&n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),t.callback&&t.callback.apply(n[0],arguments),n.dequeue()}})})}}(jQuery),function(e,t){e.effects.drop=function(t){return this.queue(function(){var n=e(this),r=["position","top","bottom","left","right","opacity"],i=e.effects.setMode(n,t.options.mode||"hide"),s=t.options.direction||"left";e.effects.save(n,r),n.show(),e.effects.createWrapper(n);var u=s=="up"||s=="down"?"top":"left",a=s=="up"||s=="left"?"pos":"neg",f=t.options.distance||(u=="top"?n.outerHeight(!0)/2:n.outerWidth(!0)/2);i=="show"&&n.css("opacity",0).css(u,a=="pos"?-f:f);var l={opacity:i=="show"?1:0};l[u]=(i=="show"?a=="pos"?"+=":"-=":a=="pos"?"-=":"+=")+f,n.animate(l,{queue:!1,duration:t.duration,easing:t.options.easing,complete:function(){i=="hide"&&n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),t.callback&&t.callback.apply(this,arguments),n.dequeue()}})})}}(jQuery),function(e,t){e.effects.explode=function(t){return this.queue(function(){var n=t.options.pieces?Math.round(Math.sqrt(t.options.pieces)):3,r=t.options.pieces?Math.round(Math.sqrt(t.options.pieces)):3;t.options.mode=t.options.mode=="toggle"?e(this).is(":visible")?"hide":"show":t.options.mode;var i=e(this).show().css("visibility","hidden"),s=i.offset();s.top-=parseInt(i.css("marginTop"),10)||0,s.left-=parseInt(i.css("marginLeft"),10)||0;var u=i.outerWidth(!0),a=i.outerHeight(!0);for(var f=0;f<n;f++)for(var l=0;l<r;l++)i.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-l*(u/r),top:-f*(a/n)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:u/r,height:a/n,left:s.left+l*(u/r)+(t.options.mode=="show"?(l-Math.floor(r/2))*(u/r):0),top:s.top+f*(a/n)+(t.options.mode=="show"?(f-Math.floor(n/2))*(a/n):0),opacity:t.options.mode=="show"?0:1}).animate({left:s.left+l*(u/r)+(t.options.mode=="show"?0:(l-Math.floor(r/2))*(u/r)),top:s.top+f*(a/n)+(t.options.mode=="show"?0:(f-Math.floor(n/2))*(a/n)),opacity:t.options.mode=="show"?1:0},t.duration||500);setTimeout(function(){t.options.mode=="show"?i.css({visibility:"visible"}):i.css({visibility:"visible"}).hide(),t.callback&&t.callback.apply(i[0]),i.dequeue(),e("div.ui-effects-explode").remove()},t.duration||500)})}}(jQuery),function(e,t){e.effects.fade=function(t){return this.queue(function(){var n=e(this),r=e.effects.setMode(n,t.options.mode||"hide");n.animate({opacity:r},{queue:!1,duration:t.duration,easing:t.options.easing,complete:function(){t.callback&&t.callback.apply(this,arguments),n.dequeue()}})})}}(jQuery),function(e,t){e.effects.fold=function(t){return this.queue(function(){var n=e(this),r=["position","top","bottom","left","right"],i=e.effects.setMode(n,t.options.mode||"hide"),s=t.options.size||15,u=!!t.options.horizFirst,a=t.duration?t.duration/2:e.fx.speeds._default/2;e.effects.save(n,r),n.show();var f=e.effects.createWrapper(n).css({overflow:"hidden"}),l=i=="show"!=u,c=l?["width","height"]:["height","width"],h=l?[f.width(),f.height()]:[f.height(),f.width()],p=/([0-9]+)%/.exec(s);p&&(s=parseInt(p[1],10)/100*h[i=="hide"?0:1]),i=="show"&&f.css(u?{height:0,width:s}:{height:s,width:0});var d={},v={};d[c[0]]=i=="show"?h[0]:s,v[c[1]]=i=="show"?h[1]:0,f.animate(d,a,t.options.easing).animate(v,a,t.options.easing,function(){i=="hide"&&n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),t.callback&&t.callback.apply(n[0],arguments),n.dequeue()})})}}(jQuery),function(e,t){e.effects.highlight=function(t){return this.queue(function(){var n=e(this),r=["backgroundImage","backgroundColor","opacity"],i=e.effects.setMode(n,t.options.mode||"show"),s={backgroundColor:n.css("backgroundColor")};i=="hide"&&(s.opacity=0),e.effects.save(n,r),n.show().css({backgroundImage:"none",backgroundColor:t.options.color||"#ffff99"}).animate(s,{queue:!1,duration:t.duration,easing:t.options.easing,complete:function(){i=="hide"&&n.hide(),e.effects.restore(n,r),i=="show"&&!e.support.opacity&&this.style.removeAttribute("filter"),t.callback&&t.callback.apply(this,arguments),n.dequeue()}})})}}(jQuery),function(e,t){e.effects.pulsate=function(t){return this.queue(function(){var n=e(this),r=e.effects.setMode(n,t.options.mode||"show"),i=(t.options.times||5)*2-1,s=t.duration?t.duration/2:e.fx.speeds._default/2,u=n.is(":visible"),a=0;u||(n.css("opacity",0).show(),a=1),(r=="hide"&&u||r=="show"&&!u)&&i--;for(var f=0;f<i;f++)n.animate({opacity:a},s,t.options.easing),a=(a+1)%2;n.animate({opacity:a},s,t.options.easing,function(){a==0&&n.hide(),t.callback&&t.callback.apply(this,arguments)}),n.queue("fx",function(){n.dequeue()}).dequeue()})}}(jQuery),function(e,t){e.effects.puff=function(t){return this.queue(function(){var n=e(this),r=e.effects.setMode(n,t.options.mode||"hide"),i=parseInt(t.options.percent,10)||150,s=i/100,u={height:n.height(),width:n.width()};e.extend(t.options,{fade:!0,mode:r,percent:r=="hide"?i:100,from:r=="hide"?u:{height:u.height*s,width:u.width*s}}),n.effect("scale",t.options,t.duration,t.callback),n.dequeue()})},e.effects.scale=function(t){return this.queue(function(){var n=e(this),r=e.extend(!0,{},t.options),i=e.effects.setMode(n,t.options.mode||"effect"),s=parseInt(t.options.percent,10)||(parseInt(t.options.percent,10)==0?0:i=="hide"?0:100),u=t.options.direction||"both",a=t.options.origin;i!="effect"&&(r.origin=a||["middle","center"],r.restore=!0);var f={height:n.height(),width:n.width()};n.from=t.options.from||(i=="show"?{height:0,width:0}:f);var l={y:u!="horizontal"?s/100:1,x:u!="vertical"?s/100:1};n.to={height:f.height*l.y,width:f.width*l.x},t.options.fade&&(i=="show"&&(n.from.opacity=0,n.to.opacity=1),i=="hide"&&(n.from.opacity=1,n.to.opacity=0)),r.from=n.from,r.to=n.to,r.mode=i,n.effect("size",r,t.duration,t.callback),n.dequeue()})},e.effects.size=function(t){return this.queue(function(){var n=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],i=["position","top","bottom","left","right","overflow","opacity"],s=["width","height","overflow"],u=["fontSize"],a=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],f=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],l=e.effects.setMode(n,t.options.mode||"effect"),c=t.options.restore||!1,h=t.options.scale||"both",p=t.options.origin,d={height:n.height(),width:n.width()};n.from=t.options.from||d,n.to=t.options.to||d;if(p){var v=e.effects.getBaseline(p,d);n.from.top=(d.height-n.from.height)*v.y,n.from.left=(d.width-n.from.width)*v.x,n.to.top=(d.height-n.to.height)*v.y,n.to.left=(d.width-n.to.width)*v.x}var m={from:{y:n.from.height/d.height,x:n.from.width/d.width},to:{y:n.to.height/d.height,x:n.to.width/d.width}};if(h=="box"||h=="both")m.from.y!=m.to.y&&(r=r.concat(a),n.from=e.effects.setTransition(n,a,m.from.y,n.from),n.to=e.effects.setTransition(n,a,m.to.y,n.to)),m.from.x!=m.to.x&&(r=r.concat(f),n.from=e.effects.setTransition(n,f,m.from.x,n.from),n.to=e.effects.setTransition(n,f,m.to.x,n.to));(h=="content"||h=="both")&&m.from.y!=m.to.y&&(r=r.concat(u),n.from=e.effects.setTransition(n,u,m.from.y,n.from),n.to=e.effects.setTransition(n,u,m.to.y,n.to)),e.effects.save(n,c?r:i),n.show(),e.effects.createWrapper(n),n.css("overflow","hidden").css(n.from);if(h=="content"||h=="both")a=a.concat(["marginTop","marginBottom"]).concat(u),f=f.concat(["marginLeft","marginRight"]),s=r.concat(a).concat(f),n.find("*[width]").each(function(){var n=e(this);c&&e.effects.save(n,s);var r={height:n.height(),width:n.width()};n.from={height:r.height*m.from.y,width:r.width*m.from.x},n.to={height:r.height*m.to.y,width:r.width*m.to.x},m.from.y!=m.to.y&&(n.from=e.effects.setTransition(n,a,m.from.y,n.from),n.to=e.effects.setTransition(n,a,m.to.y,n.to)),m.from.x!=m.to.x&&(n.from=e.effects.setTransition(n,f,m.from.x,n.from),n.to=e.effects.setTransition(n,f,m.to.x,n.to)),n.css(n.from),n.animate(n.to,t.duration,t.options.easing,function(){c&&e.effects.restore(n,s)})});n.animate(n.to,{queue:!1,duration:t.duration,easing:t.options.easing,complete:function(){n.to.opacity===0&&n.css("opacity",n.from.opacity),l=="hide"&&n.hide(),e.effects.restore(n,c?r:i),e.effects.removeWrapper(n),t.callback&&t.callback.apply(this,arguments),n.dequeue()}})})}}(jQuery),function(e,t){e.effects.shake=function(t){return this.queue(function(){var n=e(this),r=["position","top","bottom","left","right"],i=e.effects.setMode(n,t.options.mode||"effect"),s=t.options.direction||"left",u=t.options.distance||20,a=t.options.times||3,f=t.duration||t.options.duration||140;e.effects.save(n,r),n.show(),e.effects.createWrapper(n);var l=s=="up"||s=="down"?"top":"left",c=s=="up"||s=="left"?"pos":"neg",h={},p={},d={};h[l]=(c=="pos"?"-=":"+=")+u,p[l]=(c=="pos"?"+=":"-=")+u*2,d[l]=(c=="pos"?"-=":"+=")+u*2,n.animate(h,f,t.options.easing);for(var v=1;v<a;v++)n.animate(p,f,t.options.easing).animate(d,f,t.options.easing);n.animate(p,f,t.options.easing).animate(h,f/2,t.options.easing,function(){e.effects.restore(n,r),e.effects.removeWrapper(n),t.callback&&t.callback.apply(this,arguments)}),n.queue("fx",function(){n.dequeue()}),n.dequeue()})}}(jQuery),function(e,t){e.effects.slide=function(t){return this.queue(function(){var n=e(this),r=["position","top","bottom","left","right"],i=e.effects.setMode(n,t.options.mode||"show"),s=t.options.direction||"left";e.effects.save(n,r),n.show(),e.effects.createWrapper(n).css({overflow:"hidden"});var u=s=="up"||s=="down"?"top":"left",a=s=="up"||s=="left"?"pos":"neg",f=t.options.distance||(u=="top"?n.outerHeight(!0):n.outerWidth(!0));i=="show"&&n.css(u,a=="pos"?isNaN(f)?"-"+f:-f:f);var l={};l[u]=(i=="show"?a=="pos"?"+=":"-=":a=="pos"?"-=":"+=")+f,n.animate(l,{queue:!1,duration:t.duration,easing:t.options.easing,complete:function(){i=="hide"&&n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),t.callback&&t.callback.apply(this,arguments),n.dequeue()}})})}}(jQuery),function(e,t){e.effects.transfer=function(t){return this.queue(function(){var n=e(this),r=e(t.options.to),i=r.offset(),s={top:i.top,left:i.left,height:r.innerHeight(),width:r.innerWidth()},u=n.offset(),a=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(t.options.className).css({top:u.top,left:u.left,height:n.innerHeight(),width:n.innerWidth(),position:"absolute"}).animate(s,t.duration,t.options.easing,function(){a.remove(),t.callback&&t.callback.apply(n[0],arguments),n.dequeue()})})}}(jQuery),function(e,t){e.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var t=this,n=t.options;t.running=0,t.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),t.headers=t.element.find(n.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(n.disabled)return;e(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(n.disabled)return;e(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(n.disabled)return;e(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(n.disabled)return;e(this).removeClass("ui-state-focus")}),t.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(n.navigation){var r=t.element.find("a").filter(n.navigationFilter).eq(0);if(r.length){var i=r.closest(".ui-accordion-header");i.length?t.active=i:t.active=r.closest(".ui-accordion-content").prev()}}t.active=t._findActive(t.active||n.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),t.active.next().addClass("ui-accordion-content-active"),t._createIcons(),t.resize(),t.element.attr("role","tablist"),t.headers.attr("role","tab").bind("keydown.accordion",function(e){return t._keydown(e)}).next().attr("role","tabpanel"),t.headers.not(t.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),t.active.length?t.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):t.headers.eq(0).attr("tabIndex",0),e.browser.safari||t.headers.find("a").attr("tabIndex",-1),n.event&&t.headers.bind(n.event.split(" ").join(".accordion ")+".accordion",function(e){t._clickHandler.call(t,e,this),e.preventDefault()})},_createIcons:function(){var t=this.options;t.icons&&(e("<span></span>").addClass("ui-icon "+t.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(t.icons.header).toggleClass(t.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var t=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var n=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(t.autoHeight||t.fillHeight)&&n.css("height",""),e.Widget.prototype.destroy.call(this)},_setOption:function(t,n){e.Widget.prototype._setOption.apply(this,arguments),t=="active"&&this.activate(n),t=="icons"&&(this._destroyIcons(),n&&this._createIcons()),t=="disabled"&&this.headers.add(this.headers.next())[n?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(t){if(this.options.disabled||t.altKey||t.ctrlKey)return;var n=e.ui.keyCode,r=this.headers.length,i=this.headers.index(t.target),s=!1;switch(t.keyCode){case n.RIGHT:case n.DOWN:s=this.headers[(i+1)%r];break;case n.LEFT:case n.UP:s=this.headers[(i-1+r)%r];break;case n.SPACE:case n.ENTER:this._clickHandler({target:t.target},t.target),t.preventDefault()}return s?(e(t.target).attr("tabIndex",-1),e(s).attr("tabIndex",0),s.focus(),!1):!0},resize:function(){var t=this.options,n;if(t.fillSpace){if(e.browser.msie){var r=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}n=this.element.parent().height(),e.browser.msie&&this.element.parent().css("overflow",r),this.headers.each(function(){n-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,n-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")}else t.autoHeight&&(n=0,this.headers.next().each(function(){n=Math.max(n,e(this).height("").height())}).height(n));return this},activate:function(e){this.options.active=e;var t=this._findActive(e)[0];return this._clickHandler({target:t},t),this},_findActive:function(t){return t?typeof t=="number"?this.headers.filter(":eq("+t+")"):this.headers.not(this.headers.not(t)):t===!1?e([]):this.headers.filter(":eq(0)")},_clickHandler:function(t,n){var r=this.options;if(r.disabled)return;if(!t.target){if(!r.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(r.icons.headerSelected).addClass(r.icons.header),this.active.next().addClass("ui-accordion-content-active");var i=this.active.next(),s={options:r,newHeader:e([]),oldHeader:r.active,
|
||
newContent:e([]),oldContent:i},o=this.active=e([]);this._toggle(o,i,s);return}var u=e(t.currentTarget||n),a=u[0]===this.active[0];r.active=r.collapsible&&a?!1:this.headers.index(u);if(this.running||!r.collapsible&&a)return;var f=this.active,o=u.next(),i=this.active.next(),s={options:r,newHeader:a&&r.collapsible?e([]):u,oldHeader:this.active,newContent:a&&r.collapsible?e([]):o,oldContent:i},l=this.headers.index(this.active[0])>this.headers.index(u[0]);this.active=a?e([]):u,this._toggle(o,i,s,a,l),f.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(r.icons.headerSelected).addClass(r.icons.header),a||(u.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(r.icons.header).addClass(r.icons.headerSelected),u.next().addClass("ui-accordion-content-active"));return},_toggle:function(t,n,r,i,s){var o=this,u=o.options;o.toShow=t,o.toHide=n,o.data=r;var a=function(){if(!o)return;return o._completed.apply(o,arguments)};o._trigger("changestart",null,o.data),o.running=n.size()===0?t.size():n.size();if(u.animated){var f={};u.collapsible&&i?f={toShow:e([]),toHide:n,complete:a,down:s,autoHeight:u.autoHeight||u.fillSpace}:f={toShow:t,toHide:n,complete:a,down:s,autoHeight:u.autoHeight||u.fillSpace},u.proxied||(u.proxied=u.animated),u.proxiedDuration||(u.proxiedDuration=u.duration),u.animated=e.isFunction(u.proxied)?u.proxied(f):u.proxied,u.duration=e.isFunction(u.proxiedDuration)?u.proxiedDuration(f):u.proxiedDuration;var l=e.ui.accordion.animations,c=u.duration,h=u.animated;h&&!l[h]&&!e.easing[h]&&(h="slide"),l[h]||(l[h]=function(e){this.slide(e,{easing:h,duration:c||700})}),l[h](f)}else u.collapsible&&i?t.toggle():(n.hide(),t.show()),a(!0);n.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),t.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(e){this.running=e?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),e.extend(e.ui.accordion,{version:"1.8.23",animations:{slide:function(t,n){t=e.extend({easing:"swing",duration:300},t,n);if(!t.toHide.size()){t.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},t);return}if(!t.toShow.size()){t.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},t);return}var r=t.toShow.css("overflow"),i=0,s={},o={},u=["height","paddingTop","paddingBottom"],a,f=t.toShow;a=f[0].style.width,f.width(f.parent().width()-parseFloat(f.css("paddingLeft"))-parseFloat(f.css("paddingRight"))-(parseFloat(f.css("borderLeftWidth"))||0)-(parseFloat(f.css("borderRightWidth"))||0)),e.each(u,function(n,r){o[r]="hide";var i=(""+e.css(t.toShow[0],r)).match(/^([\d+-.]+)(.*)$/);s[r]={value:i[1],unit:i[2]||"px"}}),t.toShow.css({height:0,overflow:"hidden"}).show(),t.toHide.filter(":hidden").each(t.complete).end().filter(":visible").animate(o,{step:function(e,n){n.prop=="height"&&(i=n.end-n.start===0?0:(n.now-n.start)/(n.end-n.start)),t.toShow[0].style[n.prop]=i*s[n.prop].value+s[n.prop].unit},duration:t.duration,easing:t.easing,complete:function(){t.autoHeight||t.toShow.css("height",""),t.toShow.css({width:a,overflow:r}),t.complete()}})},bounceslide:function(e){this.slide(e,{easing:e.down?"easeOutBounce":"swing",duration:e.down?1e3:200})}}})}(jQuery),function(e,t){var n=0;e.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var t=this,n=this.element[0].ownerDocument,r;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(n){if(t.options.disabled||t.element.propAttr("readOnly"))return;r=!1;var i=e.ui.keyCode;switch(n.keyCode){case i.PAGE_UP:t._move("previousPage",n);break;case i.PAGE_DOWN:t._move("nextPage",n);break;case i.UP:t._keyEvent("previous",n);break;case i.DOWN:t._keyEvent("next",n);break;case i.ENTER:case i.NUMPAD_ENTER:t.menu.active&&(r=!0,n.preventDefault());case i.TAB:if(!t.menu.active)return;t.menu.select(n);break;case i.ESCAPE:t.element.val(t.term),t.close(n);break;default:clearTimeout(t.searching),t.searching=setTimeout(function(){t.term!=t.element.val()&&(t.selectedItem=null,t.search(null,n))},t.options.delay)}}).bind("keypress.autocomplete",function(e){r&&(r=!1,e.preventDefault())}).bind("focus.autocomplete",function(){if(t.options.disabled)return;t.selectedItem=null,t.previous=t.element.val()}).bind("blur.autocomplete",function(e){if(t.options.disabled)return;clearTimeout(t.searching),t.closing=setTimeout(function(){t.close(e),t._change(e)},150)}),this._initSource(),this.menu=e("<ul></ul>").addClass("ui-autocomplete").appendTo(e(this.options.appendTo||"body",n)[0]).mousedown(function(n){var r=t.menu.element[0];e(n.target).closest(".ui-menu-item").length||setTimeout(function(){e(document).one("mousedown",function(n){n.target!==t.element[0]&&n.target!==r&&!e.ui.contains(r,n.target)&&t.close()})},1),setTimeout(function(){clearTimeout(t.closing)},13)}).menu({focus:function(e,n){var r=n.item.data("item.autocomplete");!1!==t._trigger("focus",e,{item:r})&&/^key/.test(e.originalEvent.type)&&t.element.val(r.value)},selected:function(e,r){var i=r.item.data("item.autocomplete"),s=t.previous;t.element[0]!==n.activeElement&&(t.element.focus(),t.previous=s,setTimeout(function(){t.previous=s,t.selectedItem=i},1)),!1!==t._trigger("select",e,{item:i})&&t.element.val(i.value),t.term=t.element.val(),t.close(e),t.selectedItem=i},blur:function(e,n){t.menu.element.is(":visible")&&t.element.val()!==t.term&&t.element.val(t.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),e.fn.bgiframe&&this.menu.element.bgiframe(),t.beforeunloadHandler=function(){t.element.removeAttr("autocomplete")},e(window).bind("beforeunload",t.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),e(window).unbind("beforeunload",this.beforeunloadHandler),e.Widget.prototype.destroy.call(this)},_setOption:function(t,n){e.Widget.prototype._setOption.apply(this,arguments),t==="source"&&this._initSource(),t==="appendTo"&&this.menu.element.appendTo(e(n||"body",this.element[0].ownerDocument)[0]),t==="disabled"&&n&&this.xhr&&this.xhr.abort()},_initSource:function(){var t=this,n,r;e.isArray(this.options.source)?(n=this.options.source,this.source=function(t,r){r(e.ui.autocomplete.filter(n,t.term))}):typeof this.options.source=="string"?(r=this.options.source,this.source=function(n,i){t.xhr&&t.xhr.abort(),t.xhr=e.ajax({url:r,data:n,dataType:"json",success:function(e,t){i(e)},error:function(){i([])}})}):this.source=this.options.source},search:function(e,t){e=e!=null?e:this.element.val(),this.term=this.element.val();if(e.length<this.options.minLength)return this.close(t);clearTimeout(this.closing);if(this._trigger("search",t)===!1)return;return this._search(e)},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.source({term:e},this._response())},_response:function(){var e=this,t=++n;return function(r){t===n&&e.__response(r),e.pending--,e.pending||e.element.removeClass("ui-autocomplete-loading")}},__response:function(e){!this.options.disabled&&e&&e.length?(e=this._normalize(e),this._suggest(e),this._trigger("open")):this.close()},close:function(e){clearTimeout(this.closing),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",e))},_change:function(e){this.previous!==this.element.val()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return typeof t=="string"?{label:t,value:t}:e.extend({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var n=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(n,t),this.menu.deactivate(),this.menu.refresh(),n.show(),this._resizeMenu(),n.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(new e.Event("mouseover"))},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,n){var r=this;e.each(n,function(e,n){r._renderItem(t,n)})},_renderItem:function(t,n){return e("<li></li>").data("item.autocomplete",n).append(e("<a></a>").text(n.label)).appendTo(t)},_move:function(e,t){if(!this.menu.element.is(":visible")){this.search(null,t);return}if(this.menu.first()&&/^previous/.test(e)||this.menu.last()&&/^next/.test(e)){this.element.val(this.term),this.menu.deactivate();return}this.menu[e](t)},widget:function(){return this.menu.element},_keyEvent:function(e,t){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(e,t),t.preventDefault()}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(t,n){var r=new RegExp(e.ui.autocomplete.escapeRegex(n),"i");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}})}(jQuery),function(e){e.widget("ui.menu",{_create:function(){var t=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(n){if(!e(n.target).closest(".ui-menu-item a").length)return;n.preventDefault(),t.select(n)}),this.refresh()},refresh:function(){var t=this,n=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");n.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(n){t.activate(n,e(this).parent())}).mouseleave(function(){t.deactivate()})},activate:function(e,t){this.deactivate();if(this.hasScroll()){var n=t.offset().top-this.element.offset().top,r=this.element.scrollTop(),i=this.element.height();n<0?this.element.scrollTop(r+n):n>=i&&this.element.scrollTop(r+n-i+t.height())}this.active=t.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",e,{item:t})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,t,n){if(!this.active){this.activate(n,this.element.children(t));return}var r=this.active[e+"All"](".ui-menu-item").eq(0);r.length?this.activate(n,r):this.activate(n,this.element.children(t))},nextPage:function(t){if(this.hasScroll()){if(!this.active||this.last()){this.activate(t,this.element.children(".ui-menu-item:first"));return}var n=this.active.offset().top,r=this.element.height(),i=this.element.children(".ui-menu-item").filter(function(){var t=e(this).offset().top-n-r+e(this).height();return t<10&&t>-10});i.length||(i=this.element.children(".ui-menu-item:last")),this.activate(t,i)}else this.activate(t,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(t){if(this.hasScroll()){if(!this.active||this.first()){this.activate(t,this.element.children(".ui-menu-item:last"));return}var n=this.active.offset().top,r=this.element.height(),i=this.element.children(".ui-menu-item").filter(function(){var t=e(this).offset().top-n+r-e(this).height();return t<10&&t>-10});i.length||(i=this.element.children(".ui-menu-item:first")),this.activate(t,i)}else this.activate(t,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[e.fn.prop?"prop":"attr"]("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})}(jQuery),function(e,t){var n,r,i,s,o="ui-button ui-widget ui-state-default ui-corner-all",u="ui-state-hover ui-state-active ",a="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",f=function(){var t=e(this).find(":ui-button");setTimeout(function(){t.button("refresh")},1)},l=function(t){var n=t.name,r=t.form,i=e([]);return n&&(r?i=e(r).find("[name='"+n+"']"):i=e("[name='"+n+"']",t.ownerDocument).filter(function(){return!this.form})),i};e.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",f),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.propAttr("disabled"):this.element.propAttr("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,u=this.options,a=this.type==="checkbox"||this.type==="radio",c="ui-state-hover"+(a?"":" ui-state-active"),h="ui-state-focus";u.label===null&&(u.label=this.buttonElement.html()),this.buttonElement.addClass(o).attr("role","button").bind("mouseenter.button",function(){if(u.disabled)return;e(this).addClass("ui-state-hover"),this===n&&e(this).addClass("ui-state-active")}).bind("mouseleave.button",function(){if(u.disabled)return;e(this).removeClass(c)}).bind("click.button",function(e){u.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this.element.bind("focus.button",function(){t.buttonElement.addClass(h)}).bind("blur.button",function(){t.buttonElement.removeClass(h)}),a&&(this.element.bind("change.button",function(){if(s)return;t.refresh()}),this.buttonElement.bind("mousedown.button",function(e){if(u.disabled)return;s=!1,r=e.pageX,i=e.pageY}).bind("mouseup.button",function(e){if(u.disabled)return;if(r!==e.pageX||i!==e.pageY)s=!0})),this.type==="checkbox"?this.buttonElement.bind("click.button",function(){if(u.disabled||s)return!1;e(this).toggleClass("ui-state-active"),t.buttonElement.attr("aria-pressed",t.element[0].checked)}):this.type==="radio"?this.buttonElement.bind("click.button",function(){if(u.disabled||s)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var n=t.element[0];l(n).not(n).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){if(u.disabled)return!1;e(this).addClass("ui-state-active"),n=this,e(document).one("mouseup",function(){n=null})}).bind("mouseup.button",function(){if(u.disabled)return!1;e(this).removeClass("ui-state-active")}).bind("keydown.button",function(t){if(u.disabled)return!1;(t.keyCode==e.ui.keyCode.SPACE||t.keyCode==e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active")}).bind("keyup.button",function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",u.disabled),this._resetButton()},_determineButtonType:function(){this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";if(this.type==="checkbox"||this.type==="radio"){var e=this.element.parents().filter(":last"),t="label[for='"+this.element.attr("id")+"']";this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible");var n=this.element.is(":checked");n&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.attr("aria-pressed",n)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(o+" "+u+" "+a).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title"),e.Widget.prototype.destroy.call(this)},_setOption:function(t,n){e.Widget.prototype._setOption.apply(this,arguments);if(t==="disabled"){n?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1);return}this._resetButton()},refresh:function(){var t=this.element.is(":disabled");t!==this.options.disabled&&this._setOption("disabled",t),this.type==="radio"?l(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input"){this.options.label&&this.element.val(this.options.label);return}var t=this.buttonElement.removeClass(a),n=e("<span></span>",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,s=[];r.primary||r.secondary?(this.options.text&&s.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+r.primary+"'></span>"),r.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+r.secondary+"'></span>"),this.options.text||(s.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",n))):s.push("ui-button-text-only"),t.addClass(s.join(" "))}}),e.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(t,n){t==="disabled"&&this.buttons.button("option",t,n),e.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var t=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),e.Widget.prototype.destroy.call(this)}})}(jQuery),function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function bindHover(e){var t="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.bind("mouseout",function(e){var n=$(e.target).closest(t);if(!n.length)return;n.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(n){var r=$(n.target).closest(t);if($.datepicker._isDisabledDatepicker(instActive.inline?e.parent()[0]:instActive.input[0])||!r.length)return;r.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),r.addClass("ui-state-hover"),r.hasClass("ui-datepicker-prev")&&r.addClass("ui-datepicker-prev-hover"),r.hasClass("ui-datepicker-next")&&r.addClass("ui-datepicker-next-hover")})}function extendRemove(e,t){$.extend(e,t);for(var n in t)if(t[n]==null||t[n]==undefined)e[n]=t[n];return e}function isArray(e){return e&&($.browser.safari&&typeof e=="object"&&e.length||e.constructor&&e.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker:{version:"1.8.23"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return extendRemove(this._defaults,e||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(e,t){var n=e[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:t,dpDiv:t?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(e,t){var n=$(e);t.append=$([]),t.trigger=$([]);if(n.hasClass(this.markerClassName))return;this._attachments(n,t),n.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,n,r){t.settings[n]=r}).bind("getData.datepicker",function(e,n){return this._get(t,n)}),this._autoSize(t),$.data(e,PROP_NAME,t),t.settings.disabled&&this._disableDatepicker(e)},_attachments:function(e,t){var n=this._get(t,"appendText"),r=this._get(t,"isRTL");t.append&&t.append.remove(),n&&(t.append=$('<span class="'+this._appendClass+'">'+n+"</span>"),e[r?"before":"after"](t.append)),e.unbind("focus",this._showDatepicker),t.trigger&&t.trigger.remove();var i=this._get(t,"showOn");(i=="focus"||i=="both")&&e.focus(this._showDatepicker);if(i=="button"||i=="both"){var s=this._get(t,"buttonText"),o=this._get(t,"buttonImage");t.trigger=$(this._get(t,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:o,alt:s,title:s}):$('<button type="button"></button>').addClass(this._triggerClass).html(o==""?s:$("<img/>").attr({src:o,alt:s,title:s}))),e[r?"before":"after"](t.trigger),t.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==e[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=e[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(e[0])):$.datepicker._showDatepicker(e[0]),!1})}},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t=new Date(2009,11,20),n=this._get(e,"dateFormat");if(n.match(/[DM]/)){var r=function(e){var t=0,n=0;for(var r=0;r<e.length;r++)e[r].length>t&&(t=e[r].length,n=r);return n};t.setMonth(r(this._get(e,n.match(/MM/)?"monthNames":"monthNamesShort"))),t.setDate(r(this._get(e,n.match(/DD/)?"dayNames":"dayNamesShort"))+20-t.getDay())}e.input.attr("size",this._formatDate(e,t).length)}},_inlineDatepicker:function(e,t){var n=$(e);if(n.hasClass(this.markerClassName))return;n.addClass(this.markerClassName).append(t.dpDiv).bind("setData.datepicker",function(e,n,r){t.settings[n]=r}).bind("getData.datepicker",function(e,n){return this._get(t,n)}),$.data(e,PROP_NAME,t),this._setDate(t,this._getDefaultDate(t),!0),this._updateDatepicker(t),this._updateAlternate(t),t.settings.disabled&&this._disableDatepicker(e),t.dpDiv.css("display","block")},_dialogDatepicker:function(e,t,n,r,i){var s=this._dialogInst;if(!s){this.uuid+=1;var o="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+o+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),s=this._dialogInst=this._newInst(this._dialogInput,!1),s.settings={},$.data(this._dialogInput[0],PROP_NAME,s)}extendRemove(s.settings,r||{}),t=t&&t.constructor==Date?this._formatDate(s,t):t,this._dialogInput.val(t),this._pos=i?i.length?i:[i.pageX,i.pageY]:null;if(!this._pos){var u=document.documentElement.clientWidth,a=document.documentElement.clientHeight,f=document.documentElement.scrollLeft||document.body.scrollLeft,l=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[u/2-100+f,a/2-150+l]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),s.settings.onSelect=n,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,s),this},_destroyDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();$.removeData(e,PROP_NAME),r=="input"?(n.append.remove(),n.trigger.remove(),t.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(r=="div"||r=="span")&&t.removeClass(this.markerClassName).empty()},_enableDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();if(r=="input")e.disabled=!1,n.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(r=="div"||r=="span"){var i=t.children("."+this._inlineClass);i.children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(t){return t==e?null:t})},_disableDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();if(r=="input")e.disabled=!0,n.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(r=="div"||r=="span"){var i=t.children("."+this._inlineClass);i.children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(t){return t==e?null:t}),this._disabledInputs[this._disabledInputs.length]=e},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;t<this._disabledInputs.length;t++)if(this._disabledInputs[t]==e)return!0;return!1},_getInst:function(e){try{return $.data(e,PROP_NAME)}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,t,n){var r=this._getInst(e);if(arguments.length==2&&typeof t=="string")return t=="defaults"?$.extend({},$.datepicker._defaults):r?t=="all"?$.extend({},r.settings):this._get(r,t):null;var i=t||{};typeof t=="string"&&(i={},i[t]=n);if(r){this._curInst==r&&this._hideDatepicker();var s=this._getDateDatepicker(e,!0),o=this._getMinMaxDate(r,"min"),u=this._getMinMaxDate(r,"max");extendRemove(r.settings,i),o!==null&&i.dateFormat!==undefined&&i.minDate===undefined&&(r.settings.minDate=this._formatDate(r,o)),u!==null&&i.dateFormat!==undefined&&i.maxDate===undefined&&(r.settings.maxDate=this._formatDate(r,u)),this._attachments($(e),r),this._autoSize(r),this._setDate(r,s),this._updateAlternate(r),this._updateDatepicker(r)}},_changeDatepicker:function(e,t,n){this._optionDatepicker(e,t,n)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var n=this._getInst(e);n&&(this._setDate(n,t),this._updateDatepicker(n),this._updateAlternate(n))},_getDateDatepicker:function(e,t){var n=this._getInst(e);return n&&!n.inline&&this._setDateFromField(n,t),n?this._getDate(n):null},_doKeyDown:function(e){var t=$.datepicker._getInst(e.target),n=!0,r=t.dpDiv.is(".ui-datepicker-rtl");t._keyEvent=!0;if($.datepicker._datepickerShowing)switch(e.keyCode){case 9:$.datepicker._hideDatepicker(),n=!1;break;case 13:var i=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",t.dpDiv);i[0]&&$.datepicker._selectDay(e.target,t.selectedMonth,t.selectedYear,i[0]);var s=$.datepicker._get(t,"onSelect");if(s){var o=$.datepicker._formatDate(t);s.apply(t.input?t.input[0]:null,[o,t])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(e.target,e.ctrlKey?-$.datepicker._get(t,"stepBigMonths"):-$.datepicker._get(t,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(e.target,e.ctrlKey?+$.datepicker._get(t,"stepBigMonths"):+$.datepicker._get(t,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&$.datepicker._clearDate(e.target),n=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&$.datepicker._gotoToday(e.target),n=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,r?1:-1,"D"),n=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&$.datepicker._adjustDate(e.target,e.ctrlKey?-$.datepicker._get(t,"stepBigMonths"):-$.datepicker._get(t,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,-7,"D"),n=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,r?-1:1,"D"),n=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&$.datepicker._adjustDate(e.target,e.ctrlKey?+$.datepicker._get(t,"stepBigMonths"):+$.datepicker._get(t,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,7,"D"),n=e.ctrlKey||e.metaKey;break;default:n=!1}else e.keyCode==36&&e.ctrlKey?$.datepicker._showDatepicker(this):n=!1;n&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var t=$.datepicker._getInst(e.target);if($.datepicker._get(t,"constrainInput")){var n=$.datepicker._possibleChars($.datepicker._get(t,"dateFormat")),r=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return e.ctrlKey||e.metaKey||r<" "||!n||n.indexOf(r)>-1}},_doKeyUp:function(e){var t=$.datepicker._getInst(e.target);if(t.input.val()!=t.lastVal)try{var n=$.datepicker.parseDate($.datepicker._get(t,"dateFormat"),t.input?t.input.val():null,$.datepicker._getFormatConfig(t));n&&($.datepicker._setDateFromField(t),$.datepicker._updateAlternate(t),$.datepicker._updateDatepicker(t))}catch(r){$.datepicker.log(r)}return!0},_showDatepicker:function(e){e=e.target||e,e.nodeName.toLowerCase()!="input"&&(e=$("input",e.parentNode)[0]);if($.datepicker._isDisabledDatepicker(e)||$.
|
||
datepicker._lastInput==e)return;var t=$.datepicker._getInst(e);$.datepicker._curInst&&$.datepicker._curInst!=t&&($.datepicker._curInst.dpDiv.stop(!0,!0),t&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var n=$.datepicker._get(t,"beforeShow"),r=n?n.apply(e,[e,t]):{};if(r===!1)return;extendRemove(t.settings,r),t.lastVal=null,$.datepicker._lastInput=e,$.datepicker._setDateFromField(t),$.datepicker._inDialog&&(e.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(e),$.datepicker._pos[1]+=e.offsetHeight);var i=!1;$(e).parents().each(function(){return i|=$(this).css("position")=="fixed",!i}),i&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var s={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,t.dpDiv.empty(),t.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(t),s=$.datepicker._checkOffset(t,s,i),t.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":i?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"});if(!t.inline){var o=$.datepicker._get(t,"showAnim"),u=$.datepicker._get(t,"duration"),a=function(){var e=t.dpDiv.find("iframe.ui-datepicker-cover");if(!!e.length){var n=$.datepicker._getBorders(t.dpDiv);e.css({left:-n[0],top:-n[1],width:t.dpDiv.outerWidth(),height:t.dpDiv.outerHeight()})}};t.dpDiv.zIndex($(e).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[o]?t.dpDiv.show(o,$.datepicker._get(t,"showOptions"),u,a):t.dpDiv[o||"show"](o?u:null,a),(!o||!u)&&a(),t.input.is(":visible")&&!t.input.is(":disabled")&&t.input.focus(),$.datepicker._curInst=t}},_updateDatepicker:function(e){var t=this;t.maxRows=4;var n=$.datepicker._getBorders(e.dpDiv);instActive=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var r=e.dpDiv.find("iframe.ui-datepicker-cover");!r.length||r.css({left:-n[0],top:-n[1],width:e.dpDiv.outerWidth(),height:e.dpDiv.outerHeight()}),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i=this._getNumberOfMonths(e),s=i[1],o=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),s>1&&e.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",o*s+"em"),e.dpDiv[(i[0]!=1||i[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e==$.datepicker._curInst&&$.datepicker._datepickerShowing&&e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&e.input[0]!=document.activeElement&&e.input.focus();if(e.yearshtml){var u=e.yearshtml;setTimeout(function(){u===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),u=e.yearshtml=null},0)}},_getBorders:function(e){var t=function(e){return{thin:1,medium:2,thick:3}[e]||e};return[parseFloat(t(e.css("border-left-width"))),parseFloat(t(e.css("border-top-width")))]},_checkOffset:function(e,t,n){var r=e.dpDiv.outerWidth(),i=e.dpDiv.outerHeight(),s=e.input?e.input.outerWidth():0,o=e.input?e.input.outerHeight():0,u=document.documentElement.clientWidth+(n?0:$(document).scrollLeft()),a=document.documentElement.clientHeight+(n?0:$(document).scrollTop());return t.left-=this._get(e,"isRTL")?r-s:0,t.left-=n&&t.left==e.input.offset().left?$(document).scrollLeft():0,t.top-=n&&t.top==e.input.offset().top+o?$(document).scrollTop():0,t.left-=Math.min(t.left,t.left+r>u&&u>r?Math.abs(t.left+r-u):0),t.top-=Math.min(t.top,t.top+i>a&&a>i?Math.abs(i+o):0),t},_findPos:function(e){var t=this._getInst(e),n=this._get(t,"isRTL");while(e&&(e.type=="hidden"||e.nodeType!=1||$.expr.filters.hidden(e)))e=e[n?"previousSibling":"nextSibling"];var r=$(e).offset();return[r.left,r.top]},_hideDatepicker:function(e){var t=this._curInst;if(!t||e&&t!=$.data(e,PROP_NAME))return;if(this._datepickerShowing){var n=this._get(t,"showAnim"),r=this._get(t,"duration"),i=function(){$.datepicker._tidyDialog(t)};$.effects&&$.effects[n]?t.dpDiv.hide(n,$.datepicker._get(t,"showOptions"),r,i):t.dpDiv[n=="slideDown"?"slideUp":n=="fadeIn"?"fadeOut":"hide"](n?r:null,i),n||i(),this._datepickerShowing=!1;var s=this._get(t,"onClose");s&&s.apply(t.input?t.input[0]:null,[t.input?t.input.val():"",t]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(!$.datepicker._curInst)return;var t=$(e.target),n=$.datepicker._getInst(t[0]);(t[0].id!=$.datepicker._mainDivId&&t.parents("#"+$.datepicker._mainDivId).length==0&&!t.hasClass($.datepicker.markerClassName)&&!t.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||t.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=n)&&$.datepicker._hideDatepicker()},_adjustDate:function(e,t,n){var r=$(e),i=this._getInst(r[0]);if(this._isDisabledDatepicker(r[0]))return;this._adjustInstDate(i,t+(n=="M"?this._get(i,"showCurrentAtPos"):0),n),this._updateDatepicker(i)},_gotoToday:function(e){var t=$(e),n=this._getInst(t[0]);if(this._get(n,"gotoCurrent")&&n.currentDay)n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear;else{var r=new Date;n.selectedDay=r.getDate(),n.drawMonth=n.selectedMonth=r.getMonth(),n.drawYear=n.selectedYear=r.getFullYear()}this._notifyChange(n),this._adjustDate(t)},_selectMonthYear:function(e,t,n){var r=$(e),i=this._getInst(r[0]);i["selected"+(n=="M"?"Month":"Year")]=i["draw"+(n=="M"?"Month":"Year")]=parseInt(t.options[t.selectedIndex].value,10),this._notifyChange(i),this._adjustDate(r)},_selectDay:function(e,t,n,r){var i=$(e);if($(r).hasClass(this._unselectableClass)||this._isDisabledDatepicker(i[0]))return;var s=this._getInst(i[0]);s.selectedDay=s.currentDay=$("a",r).html(),s.selectedMonth=s.currentMonth=t,s.selectedYear=s.currentYear=n,this._selectDate(e,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear))},_clearDate:function(e){var t=$(e),n=this._getInst(t[0]);this._selectDate(t,"")},_selectDate:function(e,t){var n=$(e),r=this._getInst(n[0]);t=t!=null?t:this._formatDate(r),r.input&&r.input.val(t),this._updateAlternate(r);var i=this._get(r,"onSelect");i?i.apply(r.input?r.input[0]:null,[t,r]):r.input&&r.input.trigger("change"),r.inline?this._updateDatepicker(r):(this._hideDatepicker(),this._lastInput=r.input[0],typeof r.input[0]!="object"&&r.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var t=this._get(e,"altField");if(t){var n=this._get(e,"altFormat")||this._get(e,"dateFormat"),r=this._getDate(e),i=this.formatDate(n,r,this._getFormatConfig(e));$(t).each(function(){$(this).val(i)})}},noWeekends:function(e){var t=e.getDay();return[t>0&&t<6,""]},iso8601Week:function(e){var t=new Date(e.getTime());t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t)/864e5)/7)+1},parseDate:function(e,t,n){if(e==null||t==null)throw"Invalid arguments";t=typeof t=="object"?t.toString():t+"";if(t=="")return null;var r=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff;r=typeof r!="string"?r:(new Date).getFullYear()%100+parseInt(r,10);var i=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,s=(n?n.dayNames:null)||this._defaults.dayNames,o=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,u=(n?n.monthNames:null)||this._defaults.monthNames,a=-1,f=-1,l=-1,c=-1,h=!1,p=function(t){var n=y+1<e.length&&e.charAt(y+1)==t;return n&&y++,n},d=function(e){var n=p(e),r=e=="@"?14:e=="!"?20:e=="y"&&n?4:e=="o"?3:2,i=new RegExp("^\\d{1,"+r+"}"),s=t.substring(g).match(i);if(!s)throw"Missing number at position "+g;return g+=s[0].length,parseInt(s[0],10)},v=function(e,n,r){var i=$.map(p(e)?r:n,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)}),s=-1;$.each(i,function(e,n){var r=n[1];if(t.substr(g,r.length).toLowerCase()==r.toLowerCase())return s=n[0],g+=r.length,!1});if(s!=-1)return s+1;throw"Unknown name at position "+g},m=function(){if(t.charAt(g)!=e.charAt(y))throw"Unexpected literal at position "+g;g++},g=0;for(var y=0;y<e.length;y++)if(h)e.charAt(y)=="'"&&!p("'")?h=!1:m();else switch(e.charAt(y)){case"d":l=d("d");break;case"D":v("D",i,s);break;case"o":c=d("o");break;case"m":f=d("m");break;case"M":f=v("M",o,u);break;case"y":a=d("y");break;case"@":var b=new Date(d("@"));a=b.getFullYear(),f=b.getMonth()+1,l=b.getDate();break;case"!":var b=new Date((d("!")-this._ticksTo1970)/1e4);a=b.getFullYear(),f=b.getMonth()+1,l=b.getDate();break;case"'":p("'")?m():h=!0;break;default:m()}if(g<t.length)throw"Extra/unparsed characters found in date: "+t.substring(g);a==-1?a=(new Date).getFullYear():a<100&&(a+=(new Date).getFullYear()-(new Date).getFullYear()%100+(a<=r?0:-100));if(c>-1){f=1,l=c;do{var w=this._getDaysInMonth(a,f-1);if(l<=w)break;f++,l-=w}while(!0)}var b=this._daylightSavingAdjust(new Date(a,f-1,l));if(b.getFullYear()!=a||b.getMonth()+1!=f||b.getDate()!=l)throw"Invalid date";return b},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(e,t,n){if(!t)return"";var r=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,i=(n?n.dayNames:null)||this._defaults.dayNames,s=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,o=(n?n.monthNames:null)||this._defaults.monthNames,u=function(t){var n=h+1<e.length&&e.charAt(h+1)==t;return n&&h++,n},a=function(e,t,n){var r=""+t;if(u(e))while(r.length<n)r="0"+r;return r},f=function(e,t,n,r){return u(e)?r[t]:n[t]},l="",c=!1;if(t)for(var h=0;h<e.length;h++)if(c)e.charAt(h)=="'"&&!u("'")?c=!1:l+=e.charAt(h);else switch(e.charAt(h)){case"d":l+=a("d",t.getDate(),2);break;case"D":l+=f("D",t.getDay(),r,i);break;case"o":l+=a("o",Math.round(((new Date(t.getFullYear(),t.getMonth(),t.getDate())).getTime()-(new Date(t.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":l+=a("m",t.getMonth()+1,2);break;case"M":l+=f("M",t.getMonth(),s,o);break;case"y":l+=u("y")?t.getFullYear():(t.getYear()%100<10?"0":"")+t.getYear()%100;break;case"@":l+=t.getTime();break;case"!":l+=t.getTime()*1e4+this._ticksTo1970;break;case"'":u("'")?l+="'":c=!0;break;default:l+=e.charAt(h)}return l},_possibleChars:function(e){var t="",n=!1,r=function(t){var n=i+1<e.length&&e.charAt(i+1)==t;return n&&i++,n};for(var i=0;i<e.length;i++)if(n)e.charAt(i)=="'"&&!r("'")?n=!1:t+=e.charAt(i);else switch(e.charAt(i)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":r("'")?t+="'":n=!0;break;default:t+=e.charAt(i)}return t},_get:function(e,t){return e.settings[t]!==undefined?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()==e.lastVal)return;var n=this._get(e,"dateFormat"),r=e.lastVal=e.input?e.input.val():null,i,s;i=s=this._getDefaultDate(e);var o=this._getFormatConfig(e);try{i=this.parseDate(n,r,o)||s}catch(u){this.log(u),r=t?"":r}e.selectedDay=i.getDate(),e.drawMonth=e.selectedMonth=i.getMonth(),e.drawYear=e.selectedYear=i.getFullYear(),e.currentDay=r?i.getDate():0,e.currentMonth=r?i.getMonth():0,e.currentYear=r?i.getFullYear():0,this._adjustInstDate(e)},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(e,t,n){var r=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},i=function(t){try{return $.datepicker.parseDate($.datepicker._get(e,"dateFormat"),t,$.datepicker._getFormatConfig(e))}catch(n){}var r=(t.toLowerCase().match(/^c/)?$.datepicker._getDate(e):null)||new Date,i=r.getFullYear(),s=r.getMonth(),o=r.getDate(),u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=u.exec(t);while(a){switch(a[2]||"d"){case"d":case"D":o+=parseInt(a[1],10);break;case"w":case"W":o+=parseInt(a[1],10)*7;break;case"m":case"M":s+=parseInt(a[1],10),o=Math.min(o,$.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),o=Math.min(o,$.datepicker._getDaysInMonth(i,s))}a=u.exec(t)}return new Date(i,s,o)},s=t==null||t===""?n:typeof t=="string"?i(t):typeof t=="number"?isNaN(t)?n:r(t):new Date(t.getTime());return s=s&&s.toString()=="Invalid Date"?n:s,s&&(s.setHours(0),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0)),this._daylightSavingAdjust(s)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,n){var r=!t,i=e.selectedMonth,s=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),(i!=e.selectedMonth||s!=e.selectedYear)&&!n&&this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(r?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&e.input.val()==""?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(e){var t=this._get(e,"stepMonths"),n="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(n,-t,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(n,+t,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(n)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(n,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(n,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(n,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t=new Date;t=this._daylightSavingAdjust(new Date(t.getFullYear(),t.getMonth(),t.getDate()));var n=this._get(e,"isRTL"),r=this._get(e,"showButtonPanel"),i=this._get(e,"hideIfNoPrevNext"),s=this._get(e,"navigationAsDateFormat"),o=this._getNumberOfMonths(e),u=this._get(e,"showCurrentAtPos"),a=this._get(e,"stepMonths"),f=o[0]!=1||o[1]!=1,l=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),c=this._getMinMaxDate(e,"min"),h=this._getMinMaxDate(e,"max"),p=e.drawMonth-u,d=e.drawYear;p<0&&(p+=12,d--);if(h){var v=this._daylightSavingAdjust(new Date(h.getFullYear(),h.getMonth()-o[0]*o[1]+1,h.getDate()));v=c&&v<c?c:v;while(this._daylightSavingAdjust(new Date(d,p,1))>v)p--,p<0&&(p=11,d--)}e.drawMonth=p,e.drawYear=d;var m=this._get(e,"prevText");m=s?this.formatDate(m,this._daylightSavingAdjust(new Date(d,p-a,1)),this._getFormatConfig(e)):m;var g=this._canAdjustMonth(e,-1,d,p)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+m+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"e":"w")+'">'+m+"</span></a>":i?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+m+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"e":"w")+'">'+m+"</span></a>",y=this._get(e,"nextText");y=s?this.formatDate(y,this._daylightSavingAdjust(new Date(d,p+a,1)),this._getFormatConfig(e)):y;var b=this._canAdjustMonth(e,1,d,p)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"w":"e")+'">'+y+"</span></a>":i?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"w":"e")+'">'+y+"</span></a>",w=this._get(e,"currentText"),E=this._get(e,"gotoCurrent")&&e.currentDay?l:t;w=s?this.formatDate(w,E,this._getFormatConfig(e)):w;var S=e.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">'+this._get(e,"closeText")+"</button>",x=r?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(n?S:"")+(this._isInRange(e,E)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+w+"</button>":"")+(n?"":S)+"</div>":"",T=parseInt(this._get(e,"firstDay"),10);T=isNaN(T)?0:T;var N=this._get(e,"showWeek"),C=this._get(e,"dayNames"),k=this._get(e,"dayNamesShort"),L=this._get(e,"dayNamesMin"),A=this._get(e,"monthNames"),O=this._get(e,"monthNamesShort"),M=this._get(e,"beforeShowDay"),_=this._get(e,"showOtherMonths"),D=this._get(e,"selectOtherMonths"),P=this._get(e,"calculateWeek")||this.iso8601Week,H=this._getDefaultDate(e),B="";for(var j=0;j<o[0];j++){var F="";this.maxRows=4;for(var I=0;I<o[1];I++){var q=this._daylightSavingAdjust(new Date(d,p,e.selectedDay)),R=" ui-corner-all",U="";if(f){U+='<div class="ui-datepicker-group';if(o[1]>1)switch(I){case 0:U+=" ui-datepicker-group-first",R=" ui-corner-"+(n?"right":"left");break;case o[1]-1:U+=" ui-datepicker-group-last",R=" ui-corner-"+(n?"left":"right");break;default:U+=" ui-datepicker-group-middle",R=""}U+='">'}U+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+R+'">'+(/all|left/.test(R)&&j==0?n?b:g:"")+(/all|right/.test(R)&&j==0?n?g:b:"")+this._generateMonthYearHeader(e,p,d,c,h,j>0||I>0,A,O)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var z=N?'<th class="ui-datepicker-week-col">'+this._get(e,"weekHeader")+"</th>":"";for(var W=0;W<7;W++){var X=(W+T)%7;z+="<th"+((W+T+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+C[X]+'">'+L[X]+"</span></th>"}U+=z+"</tr></thead><tbody>";var V=this._getDaysInMonth(d,p);d==e.selectedYear&&p==e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,V));var J=(this._getFirstDayOfMonth(d,p)-T+7)%7,K=Math.ceil((J+V)/7),Q=f?this.maxRows>K?this.maxRows:K:K;this.maxRows=Q;var G=this._daylightSavingAdjust(new Date(d,p,1-J));for(var Y=0;Y<Q;Y++){U+="<tr>";var Z=N?'<td class="ui-datepicker-week-col">'+this._get(e,"calculateWeek")(G)+"</td>":"";for(var W=0;W<7;W++){var et=M?M.apply(e.input?e.input[0]:null,[G]):[!0,""],tt=G.getMonth()!=p,nt=tt&&!D||!et[0]||c&&G<c||h&&G>h;Z+='<td class="'+((W+T+6)%7>=5?" ui-datepicker-week-end":"")+(tt?" ui-datepicker-other-month":"")+(G.getTime()==q.getTime()&&p==e.selectedMonth&&e._keyEvent||H.getTime()==G.getTime()&&H.getTime()==q.getTime()?" "+this._dayOverClass:"")+(nt?" "+this._unselectableClass+" ui-state-disabled":"")+(tt&&!_?"":" "+et[1]+(G.getTime()==l.getTime()?" "+this._currentClass:"")+(G.getTime()==t.getTime()?" ui-datepicker-today":""))+'"'+((!tt||_)&&et[2]?' title="'+et[2]+'"':"")+(nt?"":' data-handler="selectDay" data-event="click" data-month="'+G.getMonth()+'" data-year="'+G.getFullYear()+'"')+">"+(tt&&!_?" ":nt?'<span class="ui-state-default">'+G.getDate()+"</span>":'<a class="ui-state-default'+(G.getTime()==t.getTime()?" ui-state-highlight":"")+(G.getTime()==l.getTime()?" ui-state-active":"")+(tt?" ui-priority-secondary":"")+'" href="#">'+G.getDate()+"</a>")+"</td>",G.setDate(G.getDate()+1),G=this._daylightSavingAdjust(G)}U+=Z+"</tr>"}p++,p>11&&(p=0,d++),U+="</tbody></table>"+(f?"</div>"+(o[0]>0&&I==o[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),F+=U}B+=F}return B+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!e.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),e._keyEvent=!1,B},_generateMonthYearHeader:function(e,t,n,r,i,s,o,u){var a=this._get(e,"changeMonth"),f=this._get(e,"changeYear"),l=this._get(e,"showMonthAfterYear"),c='<div class="ui-datepicker-title">',h="";if(s||!a)h+='<span class="ui-datepicker-month">'+o[t]+"</span>";else{var p=r&&r.getFullYear()==n,d=i&&i.getFullYear()==n;h+='<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';for(var v=0;v<12;v++)(!p||v>=r.getMonth())&&(!d||v<=i.getMonth())&&(h+='<option value="'+v+'"'+(v==t?' selected="selected"':"")+">"+u[v]+"</option>");h+="</select>"}l||(c+=h+(s||!a||!f?" ":""));if(!e.yearshtml){e.yearshtml="";if(s||!f)c+='<span class="ui-datepicker-year">'+n+"</span>";else{var m=this._get(e,"yearRange").split(":"),g=(new Date).getFullYear(),y=function(e){var t=e.match(/c[+-].*/)?n+parseInt(e.substring(1),10):e.match(/[+-].*/)?g+parseInt(e,10):parseInt(e,10);return isNaN(t)?g:t},b=y(m[0]),w=Math.max(b,y(m[1]||""));b=r?Math.max(b,r.getFullYear()):b,w=i?Math.min(w,i.getFullYear()):w,e.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';for(;b<=w;b++)e.yearshtml+='<option value="'+b+'"'+(b==n?' selected="selected"':"")+">"+b+"</option>";e.yearshtml+="</select>",c+=e.yearshtml,e.yearshtml=null}}return c+=this._get(e,"yearSuffix"),l&&(c+=(s||!a||!f?" ":"")+h),c+="</div>",c},_adjustInstDate:function(e,t,n){var r=e.drawYear+(n=="Y"?t:0),i=e.drawMonth+(n=="M"?t:0),s=Math.min(e.selectedDay,this._getDaysInMonth(r,i))+(n=="D"?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(r,i,s)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),(n=="M"||n=="Y")&&this._notifyChange(e)},_restrictMinMax:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._getMinMaxDate(e,"max"),i=n&&t<n?n:t;return i=r&&i>r?r:i,i},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return t==null?[1,1]:typeof t=="number"?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return(new Date(e,t,1)).getDay()},_canAdjustMonth:function(e,t,n,r){var i=this._getNumberOfMonths(e),s=this._daylightSavingAdjust(new Date(n,r+(t<0?t:i[0]*i[1]),1));return t<0&&s.setDate(this._getDaysInMonth(s.getFullYear(),s.getMonth())),this._isInRange(e,s)},_isInRange:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._getMinMaxDate(e,"max");return(!n||t.getTime()>=n.getTime())&&(!r||t.getTime()<=r.getTime())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t=typeof t!="string"?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,n,r){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var i=t?typeof t=="object"?t:this._daylightSavingAdjust(new Date(r,n,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),i,this._getFormatConfig(e))}}),$.fn.datepicker=function(e){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var t=Array.prototype.slice.call(arguments,1);return typeof e!="string"||e!="isDisabled"&&e!="getDate"&&e!="widget"?e=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this[0]].concat(t)):this.each(function(){typeof e=="string"?$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this].concat(t)):$.datepicker._attachDatepicker(this,e)}):$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this[0]].concat(t))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.23",window["DP_jQuery_"+dpuuid]=$}(jQuery),function(e,t){var n="ui-dialog ui-widget ui-widget-content ui-corner-all ",r={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(t){var n=e(this).css(t).offset().top;n<0&&e(this).css("top",t.top-n)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var t=this,r=t.options,i=r.title||" ",s=e.ui.dialog.getTitleId(t.element),o=(t.uiDialog=e("<div></div>")).appendTo(document.body).hide().addClass(n+r.dialogClass).css({zIndex:r.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){r.closeOnEscape&&!n.isDefaultPrevented()&&n.keyCode&&n.keyCode===e.ui.keyCode.ESCAPE&&(t.close(n),n.preventDefault())}).attr({role:"dialog","aria-labelledby":s}).mousedown(function(e){t.moveToTop(!1,e)}),u=t.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(o),a=(t.uiDialogTitlebar=e("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(o),f=e('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){f.addClass("ui-state-hover")},function(){f.removeClass("ui-state-hover")}).focus(function(){f.addClass("ui-state-focus")}).blur(function(){f.removeClass("ui-state-focus")}).click(function(e){return t.close(e),!1}).appendTo(a),l=(t.uiDialogTitlebarCloseText=e("<span></span>")).addClass("ui-icon ui-icon-closethick").text(r.closeText).appendTo(f),c=e("<span></span>").addClass("ui-dialog-title").attr("id",s).html(i).prependTo(a);e.isFunction(r.beforeclose)&&!e.isFunction(r.beforeClose)&&(r.beforeClose=r.beforeclose),a.find("*").add(a).disableSelection(),r.draggable&&e.fn.draggable&&t._makeDraggable(),r.resizable&&e.fn.resizable&&t._makeResizable(),t._createButtons(r.buttons),t._isOpen=!1,e.fn.bgiframe&&o.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var e=this;return e.overlay&&e.overlay.destroy(),e.uiDialog.hide(),e.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),e.uiDialog.remove(),e.originalTitle&&e.element.attr("title",e.originalTitle),e},widget:function(){return this.uiDialog},close:function(t){var n=this,r,i;if(!1===n._trigger("beforeClose",t))return;return n.overlay&&n.overlay.destroy(),n.uiDialog.unbind("keypress.ui-dialog"),n._isOpen=!1,n.options.hide?n.uiDialog.hide(n.options.hide,function(){n._trigger("close",t)}):(n.uiDialog.hide(),n._trigger("close",t)),e.ui.dialog.overlay.resize(),n.options.modal&&(r=0,e(".ui-dialog").each(function(){this!==n.uiDialog[0]&&(i=e(this).css("z-index"),isNaN(i)||(r=Math.max(r,i)))}),e.ui.dialog.maxZ=r),n},isOpen:function(){return this._isOpen},moveToTop:function(t,n){var r=this,i=r.options,s;return i.modal&&!t||!i.stack&&!i.modal?r._trigger("focus",n):(i.zIndex>e.ui.dialog.maxZ&&(e.ui.dialog.maxZ=i.zIndex),r.overlay&&(e.ui.dialog.maxZ+=1,r.overlay.$el.css("z-index",e.ui.dialog.overlay.maxZ=e.ui.dialog.maxZ)),s={scrollTop:r.element.scrollTop(),scrollLeft:r.element.scrollLeft()},e.ui.dialog.maxZ+=1,r.uiDialog.css("z-index",e.ui.dialog.maxZ),r.element.attr(s),r._trigger("focus",n),r)},open:function(){if(this._isOpen)return;var t=this,n=t.options,r=t.uiDialog;return t.overlay=n.modal?new e.ui.dialog.overlay(t):null,t._size(),t._position(n.position),r.show(n.show),t.moveToTop(!0),n.modal&&r.bind("keydown.ui-dialog",function(t){if(t.keyCode!==e.ui.keyCode.TAB)return;var n=e(":tabbable",this),r=n.filter(":first"),i=n.filter(":last");if(t.target===i[0]&&!t.shiftKey)return r.focus(1),!1;if(t.target===r[0]&&t.shiftKey)return i.focus(1),!1}),e(t.element.find(":tabbable").get().concat(r.find(".ui-dialog-buttonpane :tabbable").get().concat(r.get()))).eq(0).focus(),t._isOpen=!0,t._trigger("open"),t},_createButtons:function(t){var n=this,r=!1,i=e("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),s=e("<div></div>").addClass("ui-dialog-buttonset").appendTo(i);n.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof t=="object"&&t!==null&&e.each(t,function(){return!(r=!0)}),r&&(e.each(t,function(t,r){r=e.isFunction(r)?{click:r,text:t}:r;var i=e('<button type="button"></button>').click(function(){r.click.apply(n.element[0],arguments)}).appendTo(s);e.each(r,function(e,t){if(e==="click")return;e in i?i[e](t):i.attr(e,t)}),e.fn.button&&i.button()}),i.appendTo(n.uiDialog))},_makeDraggable:function(){function s(e){return{position:e.position,offset:e.offset}}var t=this,n=t.options,r=e(document),i;t.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(r,o){i=n.height==="auto"?"auto":e(this).height(),e(this).height(e(this).height()).addClass("ui-dialog-dragging"),t._trigger("dragStart",r,s(o))},drag:function(e,n){t._trigger("drag",e,s(n))},stop:function(o,u){n.position=[u.position.left-r.scrollLeft(),u.position.top-r.scrollTop()],e(this).removeClass("ui-dialog-dragging").height(i),t._trigger("dragStop",o,s(u)),e.ui.dialog.overlay.resize()}})},_makeResizable:function(n){function u(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}n=n===t?this.options.resizable:n;var r=this,i=r.options,s=r.uiDialog.css("position"),o=typeof n=="string"?n:"n,e,s,w,se,sw,ne,nw";r.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:r.element,maxWidth:i.maxWidth,maxHeight:i.maxHeight,minWidth:i.minWidth,minHeight:r._minHeight(),handles:o,start:function(t,n){e(this).addClass("ui-dialog-resizing"),r._trigger("resizeStart",t,u(n))},resize:function(e,t){r._trigger("resize",e,u(t))},stop:function(t,n){e(this).removeClass("ui-dialog-resizing"),i.height=e(this).height(),i.width=e(this).width(),r._trigger("resizeStop",t,u(n)),e.ui.dialog.overlay.resize()}}).css("position",s).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var e=this.options;return e.height==="auto"?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(t){var n=[],r=[0,0],i;if(t){if(typeof t=="string"||typeof t=="object"&&"0"in t)n=t.split?t.split(" "):[t[0],t[1]],n.length===1&&(n[1]=n[0]),e.each(["left","top"],function(e,t){+n[e]===n[e]&&(r[e]=n[e],n[e]=t)}),t={my:n.join(" "),at:n.join(" "),offset:r.join(" ")};t=e.extend({},e.ui.dialog.prototype.options.position,t)}else t=e.ui.dialog.prototype.options.position;i=this.uiDialog.is(":visible"),i||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(e.extend({of:window},t)),i||this.uiDialog.hide()},_setOptions:function(t){var n=this,s={},o=!1;e.each(t,function(e,t){n._setOption(e,t),e in r&&(o=!0),e in i&&(s[e]=t)}),o&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",s)},_setOption:function(t,r){var i=this,s=i.uiDialog;switch(t){case"beforeclose":t="beforeClose";break;case"buttons":i._createButtons(r);break;case"closeText":i.uiDialogTitlebarCloseText.text(""+r);break;case"dialogClass":s.removeClass(i.options.dialogClass).addClass(n+r);break;case"disabled":r?s.addClass("ui-dialog-disabled"):s.removeClass("ui-dialog-disabled");break;case"draggable":var o=s.is(":data(draggable)");o&&!r&&s.draggable("destroy"),!o&&r&&i._makeDraggable();break;case"position":i._position(r);break;case"resizable":var u=s.is(":data(resizable)");u&&!r&&s.resizable("destroy"),u&&typeof r=="string"&&s.resizable("option","handles",r),!u&&r!==!1&&i._makeResizable(r);break;case"title":e(".ui-dialog-title",i.uiDialogTitlebar).html(""+(r||" "))}e.Widget.prototype._setOption.apply(i,arguments)},_size:function(){var t=this.options,n,r,i=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),t.minWidth>t.width&&(t.width=t.minWidth),n=this.uiDialog.css({height:"auto",width:t.width}).height(),r=Math.max(0,t.minHeight-n);if(t.height==="auto")if(e.support.minHeight)this.element.css({minHeight:r,height:"auto"});else{this.uiDialog.show();var s=this.element.css("height","auto").height();i||this.uiDialog.hide(),this.element.height(Math.max(s,r))}else this.element.height(Math.max(t.height-n,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable
|
||
("option","minHeight",this._minHeight())}}),e.extend(e.ui.dialog,{version:"1.8.23",uuid:0,maxZ:0,getTitleId:function(e){var t=e.attr("id");return t||(this.uuid+=1,t=this.uuid),"ui-dialog-title-"+t},overlay:function(t){this.$el=e.ui.dialog.overlay.create(t)}}),e.extend(e.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:e.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(e){return e+".dialog-overlay"}).join(" "),create:function(t){this.instances.length===0&&(setTimeout(function(){e.ui.dialog.overlay.instances.length&&e(document).bind(e.ui.dialog.overlay.events,function(t){if(e(t.target).zIndex()<e.ui.dialog.overlay.maxZ)return!1})},1),e(document).bind("keydown.dialog-overlay",function(n){t.options.closeOnEscape&&!n.isDefaultPrevented()&&n.keyCode&&n.keyCode===e.ui.keyCode.ESCAPE&&(t.close(n),n.preventDefault())}),e(window).bind("resize.dialog-overlay",e.ui.dialog.overlay.resize));var n=(this.oldInstances.pop()||e("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return e.fn.bgiframe&&n.bgiframe(),this.instances.push(n),n},destroy:function(t){var n=e.inArray(t,this.instances);n!=-1&&this.oldInstances.push(this.instances.splice(n,1)[0]),this.instances.length===0&&e([document,window]).unbind(".dialog-overlay"),t.remove();var r=0;e.each(this.instances,function(){r=Math.max(r,this.css("z-index"))}),this.maxZ=r},height:function(){var t,n;return e.browser.msie&&e.browser.version<7?(t=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),n=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),t<n?e(window).height()+"px":t+"px"):e(document).height()+"px"},width:function(){var t,n;return e.browser.msie?(t=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),n=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),t<n?e(window).width()+"px":t+"px"):e(document).width()+"px"},resize:function(){var t=e([]);e.each(e.ui.dialog.overlay.instances,function(){t=t.add(this)}),t.css({width:0,height:0}).css({width:e.ui.dialog.overlay.width(),height:e.ui.dialog.overlay.height()})}}),e.extend(e.ui.dialog.overlay.prototype,{destroy:function(){e.ui.dialog.overlay.destroy(this.$el)}})}(jQuery),function(e,t){e.ui=e.ui||{};var n=/left|center|right/,r=/top|center|bottom/,i="center",s={},o=e.fn.position,u=e.fn.offset;e.fn.position=function(t){if(!t||!t.of)return o.apply(this,arguments);t=e.extend({},t);var u=e(t.of),a=u[0],f=(t.collision||"flip").split(" "),l=t.offset?t.offset.split(" "):[0,0],c,h,p;return a.nodeType===9?(c=u.width(),h=u.height(),p={top:0,left:0}):a.setTimeout?(c=u.width(),h=u.height(),p={top:u.scrollTop(),left:u.scrollLeft()}):a.preventDefault?(t.at="left top",c=h=0,p={top:t.of.pageY,left:t.of.pageX}):(c=u.outerWidth(),h=u.outerHeight(),p=u.offset()),e.each(["my","at"],function(){var e=(t[this]||"").split(" ");e.length===1&&(e=n.test(e[0])?e.concat([i]):r.test(e[0])?[i].concat(e):[i,i]),e[0]=n.test(e[0])?e[0]:i,e[1]=r.test(e[1])?e[1]:i,t[this]=e}),f.length===1&&(f[1]=f[0]),l[0]=parseInt(l[0],10)||0,l.length===1&&(l[1]=l[0]),l[1]=parseInt(l[1],10)||0,t.at[0]==="right"?p.left+=c:t.at[0]===i&&(p.left+=c/2),t.at[1]==="bottom"?p.top+=h:t.at[1]===i&&(p.top+=h/2),p.left+=l[0],p.top+=l[1],this.each(function(){var n=e(this),r=n.outerWidth(),o=n.outerHeight(),u=parseInt(e.curCSS(this,"marginLeft",!0))||0,a=parseInt(e.curCSS(this,"marginTop",!0))||0,d=r+u+(parseInt(e.curCSS(this,"marginRight",!0))||0),v=o+a+(parseInt(e.curCSS(this,"marginBottom",!0))||0),m=e.extend({},p),g;t.my[0]==="right"?m.left-=r:t.my[0]===i&&(m.left-=r/2),t.my[1]==="bottom"?m.top-=o:t.my[1]===i&&(m.top-=o/2),s.fractions||(m.left=Math.round(m.left),m.top=Math.round(m.top)),g={left:m.left-u,top:m.top-a},e.each(["left","top"],function(n,i){e.ui.position[f[n]]&&e.ui.position[f[n]][i](m,{targetWidth:c,targetHeight:h,elemWidth:r,elemHeight:o,collisionPosition:g,collisionWidth:d,collisionHeight:v,offset:l,my:t.my,at:t.at})}),e.fn.bgiframe&&n.bgiframe(),n.offset(e.extend(m,{using:t.using}))})},e.ui.position={fit:{left:function(t,n){var r=e(window),i=n.collisionPosition.left+n.collisionWidth-r.width()-r.scrollLeft();t.left=i>0?t.left-i:Math.max(t.left-n.collisionPosition.left,t.left)},top:function(t,n){var r=e(window),i=n.collisionPosition.top+n.collisionHeight-r.height()-r.scrollTop();t.top=i>0?t.top-i:Math.max(t.top-n.collisionPosition.top,t.top)}},flip:{left:function(t,n){if(n.at[0]===i)return;var r=e(window),s=n.collisionPosition.left+n.collisionWidth-r.width()-r.scrollLeft(),o=n.my[0]==="left"?-n.elemWidth:n.my[0]==="right"?n.elemWidth:0,u=n.at[0]==="left"?n.targetWidth:-n.targetWidth,a=-2*n.offset[0];t.left+=n.collisionPosition.left<0?o+u+a:s>0?o+u+a:0},top:function(t,n){if(n.at[1]===i)return;var r=e(window),s=n.collisionPosition.top+n.collisionHeight-r.height()-r.scrollTop(),o=n.my[1]==="top"?-n.elemHeight:n.my[1]==="bottom"?n.elemHeight:0,u=n.at[1]==="top"?n.targetHeight:-n.targetHeight,a=-2*n.offset[1];t.top+=n.collisionPosition.top<0?o+u+a:s>0?o+u+a:0}}},e.offset.setOffset||(e.offset.setOffset=function(t,n){/static/.test(e.curCSS(t,"position"))&&(t.style.position="relative");var r=e(t),i=r.offset(),s=parseInt(e.curCSS(t,"top",!0),10)||0,o=parseInt(e.curCSS(t,"left",!0),10)||0,u={top:n.top-i.top+s,left:n.left-i.left+o};"using"in n?n.using.call(t,u):r.css(u)},e.fn.offset=function(t){var n=this[0];return!n||!n.ownerDocument?null:t?e.isFunction(t)?this.each(function(n){e(this).offset(t.call(this,n,e(this).offset()))}):this.each(function(){e.offset.setOffset(this,t)}):u.call(this)}),e.curCSS||(e.curCSS=e.css),function(){var t=document.getElementsByTagName("body")[0],n=document.createElement("div"),r,i,o,u,a;r=document.createElement(t?"div":"body"),o={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},t&&e.extend(o,{position:"absolute",left:"-1000px",top:"-1000px"});for(var f in o)r.style[f]=o[f];r.appendChild(n),i=t||document.documentElement,i.insertBefore(r,i.firstChild),n.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",u=e(n).offset(function(e,t){return t}).offset(),r.innerHTML="",i.removeChild(r),a=u.top+u.left+(t?2e3:0),s.fractions=a>21&&a<22}()}(jQuery),function(e,t){e.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),e.Widget.prototype.destroy.apply(this,arguments)},value:function(e){return e===t?this._value():(this._setOption("value",e),this)},_setOption:function(t,n){t==="value"&&(this.options.value=n,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),e.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var e=this.options.value;return typeof e!="number"&&(e=0),Math.min(this.options.max,Math.max(this.min,e))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var e=this.value(),t=this._percentage();this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),this.valueDiv.toggle(e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(t.toFixed(0)+"%"),this.element.attr("aria-valuenow",e)}}),e.extend(e.ui.progressbar,{version:"1.8.23"})}(jQuery),function(e,t){var n=5;e.widget("ui.slider",e.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var t=this,r=this.options,i=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),s="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",o=r.values&&r.values.length||1,u=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(r.disabled?" ui-slider-disabled ui-disabled":"")),this.range=e([]),r.range&&(r.range===!0&&(r.values||(r.values=[this._valueMin(),this._valueMin()]),r.values.length&&r.values.length!==2&&(r.values=[r.values[0],r.values[0]])),this.range=e("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(r.range==="min"||r.range==="max"?" ui-slider-range-"+r.range:"")));for(var a=i.length;a<o;a+=1)u.push(s);this.handles=i.add(e(u.join("")).appendTo(t.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(e){e.preventDefault()}).hover(function(){r.disabled||e(this).addClass("ui-state-hover")},function(){e(this).removeClass("ui-state-hover")}).focus(function(){r.disabled?e(this).blur():(e(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),e(this).addClass("ui-state-focus"))}).blur(function(){e(this).removeClass("ui-state-focus")}),this.handles.each(function(t){e(this).data("index.ui-slider-handle",t)}),this.handles.keydown(function(r){var i=e(this).data("index.ui-slider-handle"),s,o,u,a;if(t.options.disabled)return;switch(r.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:r.preventDefault();if(!t._keySliding){t._keySliding=!0,e(this).addClass("ui-state-active"),s=t._start(r,i);if(s===!1)return}}a=t.options.step,t.options.values&&t.options.values.length?o=u=t.values(i):o=u=t.value();switch(r.keyCode){case e.ui.keyCode.HOME:u=t._valueMin();break;case e.ui.keyCode.END:u=t._valueMax();break;case e.ui.keyCode.PAGE_UP:u=t._trimAlignValue(o+(t._valueMax()-t._valueMin())/n);break;case e.ui.keyCode.PAGE_DOWN:u=t._trimAlignValue(o-(t._valueMax()-t._valueMin())/n);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(o===t._valueMax())return;u=t._trimAlignValue(o+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(o===t._valueMin())return;u=t._trimAlignValue(o-a)}t._slide(r,i,u)}).keyup(function(n){var r=e(this).data("index.ui-slider-handle");t._keySliding&&(t._keySliding=!1,t._stop(n,r),t._change(n,r),e(this).removeClass("ui-state-active"))}),this._refreshValue(),this._animateOff=!1},destroy:function(){return this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),this._mouseDestroy(),this},_mouseCapture:function(t){var n=this.options,r,i,s,o,u,a,f,l,c;return n.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),r={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(r),s=this._valueMax()-this._valueMin()+1,u=this,this.handles.each(function(t){var n=Math.abs(i-u.values(t));s>n&&(s=n,o=e(this),a=t)}),n.range===!0&&this.values(1)===n.min&&(a+=1,o=e(this.handles[a])),f=this._start(t,a),f===!1?!1:(this._mouseSliding=!0,u._handleIndex=a,o.addClass("ui-state-active").focus(),l=o.offset(),c=!e(t.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=c?{left:0,top:0}:{left:t.pageX-l.left-o.width()/2,top:t.pageY-l.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,a,i),this._animateOff=!0,!0))},_mouseStart:function(e){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},n=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,n),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,n,r,i,s;return this.orientation==="horizontal"?(t=this.elementSize.width,n=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,n=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),r=n/t,r>1&&(r=1),r<0&&(r=0),this.orientation==="vertical"&&(r=1-r),i=this._valueMax()-this._valueMin(),s=this._valueMin()+r*i,this._trimAlignValue(s)},_start:function(e,t){var n={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("start",e,n)},_slide:function(e,t,n){var r,i,s;this.options.values&&this.options.values.length?(r=this.values(t?0:1),this.options.values.length===2&&this.options.range===!0&&(t===0&&n>r||t===1&&n<r)&&(n=r),n!==this.values(t)&&(i=this.values(),i[t]=n,s=this._trigger("slide",e,{handle:this.handles[t],value:n,values:i}),r=this.values(t?0:1),s!==!1&&this.values(t,n,!0))):n!==this.value()&&(s=this._trigger("slide",e,{handle:this.handles[t],value:n}),s!==!1&&this.value(n))},_stop:function(e,t){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("stop",e,n)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("change",e,n)}},value:function(e){if(arguments.length){this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0);return}return this._value()},values:function(t,n){var r,i,s;if(arguments.length>1){this.options.values[t]=this._trimAlignValue(n),this._refreshValue(),this._change(null,t);return}if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();r=this.options.values,i=arguments[0];for(s=0;s<r.length;s+=1)r[s]=this._trimAlignValue(i[s]),this._change(null,s);this._refreshValue()},_setOption:function(t,n){var r,i=0;e.isArray(this.options.values)&&(i=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments);switch(t){case"disabled":n?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(r=0;r<i;r+=1)this._change(null,r);this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e),e},_values:function(e){var t,n,r;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t),t;n=this.options.values.slice();for(r=0;r<n.length;r+=1)n[r]=this._trimAlignValue(n[r]);return n},_trimAlignValue:function(e){if(e<=this._valueMin())return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,n=(e-this._valueMin())%t,r=e-n;return Math.abs(n)*2>=t&&(r+=n>0?t:-t),parseFloat(r.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t=this.options.range,n=this.options,r=this,i=this._animateOff?!1:n.animate,s,o={},u,a,f,l;this.options.values&&this.options.values.length?this.handles.each(function(t,a){s=(r.values(t)-r._valueMin())/(r._valueMax()-r._valueMin())*100,o[r.orientation==="horizontal"?"left":"bottom"]=s+"%",e(this).stop(1,1)[i?"animate":"css"](o,n.animate),r.options.range===!0&&(r.orientation==="horizontal"?(t===0&&r.range.stop(1,1)[i?"animate":"css"]({left:s+"%"},n.animate),t===1&&r.range[i?"animate":"css"]({width:s-u+"%"},{queue:!1,duration:n.animate})):(t===0&&r.range.stop(1,1)[i?"animate":"css"]({bottom:s+"%"},n.animate),t===1&&r.range[i?"animate":"css"]({height:s-u+"%"},{queue:!1,duration:n.animate}))),u=s}):(a=this.value(),f=this._valueMin(),l=this._valueMax(),s=l!==f?(a-f)/(l-f)*100:0,o[r.orientation==="horizontal"?"left":"bottom"]=s+"%",this.handle.stop(1,1)[i?"animate":"css"](o,n.animate),t==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[i?"animate":"css"]({width:s+"%"},n.animate),t==="max"&&this.orientation==="horizontal"&&this.range[i?"animate":"css"]({width:100-s+"%"},{queue:!1,duration:n.animate}),t==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[i?"animate":"css"]({height:s+"%"},n.animate),t==="max"&&this.orientation==="vertical"&&this.range[i?"animate":"css"]({height:100-s+"%"},{queue:!1,duration:n.animate}))}}),e.extend(e.ui.slider,{version:"1.8.23"})}(jQuery),function(e,t){function i(){return++n}function s(){return++r}var n=0,r=0;e.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading…</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(!0)},_setOption:function(e,t){if(e=="selected"){if(this.options.collapsible&&t==this.options.selected)return;this.select(t)}else this.options[e]=t,this._tabify()},_tabId:function(e){return e.title&&e.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+i()},_sanitizeSelector:function(e){return e.replace(/:/g,"\\:")},_cookie:function(){var t=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+s());return e.cookie.apply(null,[t].concat(e.makeArray(arguments)))},_ui:function(e,t){return{tab:e,panel:t,index:this.anchors.index(e)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var t=e(this);t.html(t.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){function h(t,n){t.css("display",""),!e.support.opacity&&n.opacity&&t[0].style.removeAttribute("filter")}var r=this,i=this.options,s=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=e(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return e("a",this)[0]}),this.panels=e([]),this.anchors.each(function(t,n){var o=e(n).attr("href"),u=o.split("#")[0],a;u&&(u===location.toString().split("#")[0]||(a=e("base")[0])&&u===a.href)&&(o=n.hash,n.href=o);if(s.test(o))r.panels=r.panels.add(r.element.find(r._sanitizeSelector(o)));else if(o&&o!=="#"){e.data(n,"href.tabs",o),e.data(n,"load.tabs",o.replace(/#.*$/,""));var f=r._tabId(n);n.href="#"+f;var l=r.element.find("#"+f);l.length||(l=e(i.panelTemplate).attr("id",f).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(r.panels[t-1]||r.list),l.data("destroy.tabs",!0)),r.panels=r.panels.add(l)}else i.disabled.push(t)}),n?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),i.selected===t?(location.hash&&this.anchors.each(function(e,t){if(t.hash==location.hash)return i.selected=e,!1}),typeof i.selected!="number"&&i.cookie&&(i.selected=parseInt(r._cookie(),10)),typeof i.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(i.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),i.selected=i.selected||(this.lis.length?0:-1)):i.selected===null&&(i.selected=-1),i.selected=i.selected>=0&&this.anchors[i.selected]||i.selected<0?i.selected:0,i.disabled=e.unique(i.disabled.concat(e.map(this.lis.filter(".ui-state-disabled"),function(e,t){return r.lis.index(e)}))).sort(),e.inArray(i.selected,i.disabled)!=-1&&i.disabled.splice(e.inArray(i.selected,i.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),i.selected>=0&&this.anchors.length&&(r.element.find(r._sanitizeSelector(r.anchors[i.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(i.selected).addClass("ui-tabs-selected ui-state-active"),r.element.queue("tabs",function(){r._trigger("show",null,r._ui(r.anchors[i.selected],r.element.find(r._sanitizeSelector(r.anchors[i.selected].hash))[0]))}),this.load(i.selected)),e(window).bind("unload",function(){r.lis.add(r.anchors).unbind(".tabs"),r.lis=r.anchors=r.panels=null})):i.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[i.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),i.cookie&&this._cookie(i.selected,i.cookie);for(var o=0,u;u=this.lis[o];o++)e(u)[e.inArray(o,i.disabled)!=-1&&!e(u).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");i.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(i.event!=="mouseover"){var a=function(e,t){t.is(":not(.ui-state-disabled)")&&t.addClass("ui-state-"+e)},f=function(e,t){t.removeClass("ui-state-"+e)};this.lis.bind("mouseover.tabs",function(){a("hover",e(this))}),this.lis.bind("mouseout.tabs",function(){f("hover",e(this))}),this.anchors.bind("focus.tabs",function(){a("focus",e(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){f("focus",e(this).closest("li"))})}var l,c;i.fx&&(e.isArray(i.fx)?(l=i.fx[0],c=i.fx[1]):l=c=i.fx);var p=c?function(t,n){e(t).closest("li").addClass("ui-tabs-selected ui-state-active"),n.hide().removeClass("ui-tabs-hide").animate(c,c.duration||"normal",function(){h(n,c),r._trigger("show",null,r._ui(t,n[0]))})}:function(t,n){e(t).closest("li").addClass("ui-tabs-selected ui-state-active"),n.removeClass("ui-tabs-hide"),r._trigger("show",null,r._ui(t,n[0]))},d=l?function(e,t){t.animate(l,l.duration||"normal",function(){r.lis.removeClass("ui-tabs-selected ui-state-active"),t.addClass("ui-tabs-hide"),h(t,l),r.element.dequeue("tabs")})}:function(e,t,n){r.lis.removeClass("ui-tabs-selected ui-state-active"),t.addClass("ui-tabs-hide"),r.element.dequeue("tabs")};this.anchors.bind(i.event+".tabs",function(){var t=this,n=e(t).closest("li"),s=r.panels.filter(":not(.ui-tabs-hide)"),o=r.element.find(r._sanitizeSelector(t.hash));if(n.hasClass("ui-tabs-selected")&&!i.collapsible||n.hasClass("ui-state-disabled")||n.hasClass("ui-state-processing")||r.panels.filter(":animated").length||r._trigger("select",null,r._ui(this,o[0]))===!1)return this.blur(),!1;i.selected=r.anchors.index(this),r.abort();if(i.collapsible){if(n.hasClass("ui-tabs-selected"))return i.selected=-1,i.cookie&&r._cookie(i.selected,i.cookie),r.element.queue("tabs",function(){d(t,s)}).dequeue("tabs"),this.blur(),!1;if(!s.length)return i.cookie&&r._cookie(i.selected,i.cookie),r.element.queue("tabs",function(){p(t,o)}),r.load(r.anchors.index(this)),this.blur(),!1}i.cookie&&r._cookie(i.selected,i.cookie);if(!o.length)throw"jQuery UI Tabs: Mismatching fragment identifier.";s.length&&r.element.queue("tabs",function(){d(t,s)}),r.element.queue("tabs",function(){p(t,o)}),r.load(r.anchors.index(this)),e.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(e){return typeof e=="string"&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},destroy:function(){var t=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var t=e.data(this,"href.tabs");t&&(this.href=t);var n=e(this).unbind(".tabs");e.each(["href","load","cache"],function(e,t){n.removeData(t+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){e.data(this,"destroy.tabs")?e(this).remove():e(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),t.cookie&&this._cookie(null,t.cookie),this},add:function(n,r,i){i===t&&(i=this.anchors.length);var s=this,o=this.options,u=e(o.tabTemplate.replace(/#\{href\}/g,n).replace(/#\{label\}/g,r)),a=n.indexOf("#")?this._tabId(e("a",u)[0]):n.replace("#","");u.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var f=s.element.find("#"+a);return f.length||(f=e(o.panelTemplate).attr("id",a).data("destroy.tabs",!0)),f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),i>=this.lis.length?(u.appendTo(this.list),f.appendTo(this.list[0].parentNode)):(u.insertBefore(this.lis[i]),f.insertBefore(this.panels[i])),o.disabled=e.map(o.disabled,function(e,t){return e>=i?++e:e}),this._tabify(),this.anchors.length==1&&(o.selected=0,u.addClass("ui-tabs-selected ui-state-active"),f.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){s._trigger("show",null,s._ui(s.anchors[0],s.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[i],this.panels[i])),this},remove:function(t){t=this._getIndex(t);var n=this.options,r=this.lis.eq(t).remove(),i=this.panels.eq(t).remove();return r.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(t+(t+1<this.anchors.length?1:-1)),n.disabled=e.map(e.grep(n.disabled,function(e,n){return e!=t}),function(e,n){return e>=t?--e:e}),this._tabify(),this._trigger("remove",null,this._ui(r.find("a")[0],i[0])),this},enable:function(t){t=this._getIndex(t);var n=this.options;if(e.inArray(t,n.disabled)==-1)return;return this.lis.eq(t).removeClass("ui-state-disabled"),n.disabled=e.grep(n.disabled,function(e,n){return e!=t}),this._trigger("enable",null,this._ui(this.anchors[t],this.panels[t])),this},disable:function(e){e=this._getIndex(e);var t=this,n=this.options;return e!=n.selected&&(this.lis.eq(e).addClass("ui-state-disabled"),n.disabled.push(e),n.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[e],this.panels[e]))),this},select:function(e){e=this._getIndex(e);if(e==-1){if(!this.options.collapsible||this.options.selected==-1)return this;e=this.options.selected}return this.anchors.eq(e).trigger(this.options.event+".tabs"),this},load:function(t){t=this._getIndex(t);var n=this,r=this.options,i=this.anchors.eq(t)[0],s=e.data(i,"load.tabs");this.abort();if(!s||this.element.queue("tabs").length!==0&&e.data(i,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(t).addClass("ui-state-processing");if(r.spinner){var o=e("span",i);o.data("label.tabs",o.html()).html(r.spinner)}return this.xhr=e.ajax(e.extend({},r.ajaxOptions,{url:s,success:function(s,o){n.element.find(n._sanitizeSelector(i.hash)).html(s),n._cleanup(),r.cache&&e.data(i,"cache.tabs",!0),n._trigger("load",null,n._ui(n.anchors[t],n.panels[t]));try{r.ajaxOptions.success(s,o)}catch(u){}},error:function(e,s,o){n._cleanup(),n._trigger("load",null,n._ui(n.anchors[t],n.panels[t]));try{r.ajaxOptions.error(e,s,t,i)}catch(o){}}})),n.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(e,t){return this.anchors.eq(e).removeData("cache.tabs").data("load.tabs",t),this},length:function(){return this.anchors.length}}),e.extend(e.ui.tabs,{version:"1.8.23"}),e.extend(e.ui.tabs.prototype,{rotation:null,rotate:function(e,t){var n=this,r=this.options,i=n._rotate||(n._rotate=function(t){clearTimeout(n.rotation),n.rotation=setTimeout(function(){var e=r.selected;n.select(++e<n.anchors.length?e:0)},e),t&&t.stopPropagation()}),s=n._unrotate||(n._unrotate=t?function(e){i()}:function(e){e.clientX&&n.rotate(null)});return e?(this.element.bind("tabsshow",i),this.anchors.bind(r.event+".tabs",s),i()):(clearTimeout(n.rotation),this.element.unbind("tabsshow",i),this.anchors.unbind(r.event+".tabs",s),delete this._rotate,delete this._unrotate),this}})}(jQuery),function(e){e.purr=function(t,n){function i(){var i=document.createElement("a");e(i).attr({className:"close",href:"#close",innerHTML:"Close"}).appendTo(t).click(function(){return s(),!1}),t.appendTo(r).hide(),jQuery.browser.msie&&n.usingTransparentPNG?t.show():t.fadeIn(n.fadeInSpeed);if(!n.isSticky)var o=setInterval(function(){t.prevAll(".not-sticky").length==0&&(clearInterval(o),setTimeout(function(){s()},n.removeTimer))},200)}function s(){jQuery.browser.msie&&n.usingTransparentPNG?t.css({opacity:0}).animate({height:"0px"},{duration:n.fadeOutSpeed,complete:function(){t.remove()}}):t.animate({opacity:"0"},{duration:n.fadeOutSpeed,complete:function(){t.animate({height:"0px"},{duration:n.fadeOutSpeed,complete:function(){t.remove()}})}})}t=e(t),n.isSticky||t.addClass("not-sticky");var r=document.getElementById("purr-container");r||(r='<div id="purr-container"></div>'),r=e(r),e("body").append(r),i()},e.fn.purr=function(t){return t=t||{},t.fadeInSpeed=t.fadeInSpeed||500,t.fadeOutSpeed=t.fadeOutSpeed||500,t.removeTimer=t.removeTimer||4e3,t.isSticky=t.isSticky||!1,t.usingTransparentPNG=t.usingTransparentPNG||!1,this.each(function(){new e.purr(this,t)}),this}}(jQuery),BestInPlaceEditor.prototype={activate:function(){var e="";this.isNil?e="":this.original_content?e=this.original_content:this.sanitize?e=this.element.text():e=this.element.html();var t=this.isNil?"-":this.element.html();this.oldValue=t,this.display_value=e,jQuery(this.activator).unbind("click",this.clickHandler),this.activateForm(),this.element.trigger(jQuery.Event("best_in_place:activate"))},abort:function(){this.isNil?this.element.html(this.nil):this.element.html(this.oldValue),jQuery(this.activator).bind("click",{editor:this},this.clickHandler),this.element.trigger(jQuery.Event("best_in_place:abort")),this.element.trigger(jQuery.Event("best_in_place:deactivate"))},abortIfConfirm:function(){if(!this.useConfirm){this.abort();return}confirm("Are you sure you want to discard your changes?")&&this.abort()},update:function(){var e=this;if(this.formType in{input:1,textarea:1}&&this.getValue()==this.oldValue)return this.abort(),!0;this.isNil=!1,e.ajax({type:"post",dataType:"text",data:e.requestData(),success:function(t){e.loadSuccessCallback(t)},error:function(t,n){e.loadErrorCallback(t,n)}});if(this.formType=="select"){var t=this.getValue();this.previousCollectionValue=t,jQuery.each(this.values,function(n,r){t==r[0]&&e.element.html(r[1])})}else this.formType=="checkbox"?e.element.html(this.getValue()?this.values[1]:this.values[0]):this.getValue()!==""?e.element.text(this.getValue()):e.element.html(this.nil);e.element.trigger(jQuery.Event("best_in_place:update"))},activateForm:function(){alert("The form was not properly initialized. activateForm is unbound")},initOptions:function(){var e=this;e.element.parents().each(function(){$parent=jQuery(this),e.url=e.url||$parent.attr("data-url"),e.collection=e.collection||$parent.attr("data-collection"),e.formType=e.formType||$parent.attr("data-type"),e.objectName=e.objectName||$parent.attr("data-object"),e.attributeName=e.attributeName||$parent.attr("data-attribute"),e.activator=e.activator||$parent.attr("data-activator"),e.okButton=e.okButton||$parent.attr("data-ok-button"),e.cancelButton=e.cancelButton||$parent.attr("data-cancel-button"),e.nil=e.nil||$parent.attr("data-nil"),e.inner_class=e.inner_class||$parent.attr("data-inner-class"),e.html_attrs=e.html_attrs||$parent.attr("data-html-attrs"),e.original_content=e.original_content||$parent.attr("data-original-content"),e.collectionValue=e.collectionValue||$parent.attr("data-value")}),e.element.parents().each(function(){var t=this.id.match(/^(\w+)_(\d+)$/i);t&&(e.objectName=e.objectName||t[1])}),e.url=e.element.attr("data-url")||e.url||document.location.pathname,e.collection=e.element.attr("data-collection")||e.collection,e.formType=e.element.attr("data-type")||e.formtype||"input",e.objectName=e.element.attr("data-object")||e.objectName,e.attributeName=e.element.attr("data-attribute")||e.attributeName
|
||
,e.activator=e.element.attr("data-activator")||e.element,e.okButton=e.element.attr("data-ok-button")||e.okButton,e.cancelButton=e.element.attr("data-cancel-button")||e.cancelButton,e.nil=e.element.attr("data-nil")||e.nil||"-",e.inner_class=e.element.attr("data-inner-class")||e.inner_class||null,e.html_attrs=e.element.attr("data-html-attrs")||e.html_attrs,e.original_content=e.element.attr("data-original-content")||e.original_content,e.collectionValue=e.element.attr("data-value")||e.collectionValue,e.element.attr("data-sanitize")?e.sanitize=e.element.attr("data-sanitize")=="true":e.sanitize=!0,e.element.attr("data-use-confirm")?e.useConfirm=e.element.attr("data-use-confirm")!="false":e.useConfirm=!0,(e.formType=="select"||e.formType=="checkbox")&&e.collection!==null&&(e.values=jQuery.parseJSON(e.collection))},bindForm:function(){this.activateForm=BestInPlaceEditor.forms[this.formType].activateForm,this.getValue=BestInPlaceEditor.forms[this.formType].getValue},initNil:function(){this.element.text()===""&&(this.isNil=!0,this.element.html(this.nil))},getValue:function(){alert("The form was not properly initialized. getValue is unbound")},sanitizeValue:function(e){return jQuery.trim(e)},requestData:function(){csrf_token=jQuery("meta[name=csrf-token]").attr("content"),csrf_param=jQuery("meta[name=csrf-param]").attr("content");var e="_method=put";return e+="&"+this.objectName+"["+this.attributeName+"]="+encodeURIComponent(this.getValue()),csrf_param!==undefined&&csrf_token!==undefined&&(e+="&"+csrf_param+"="+encodeURIComponent(csrf_token)),e},ajax:function(e){return e.url=this.url,e.beforeSend=function(e){e.setRequestHeader("Accept","application/json")},jQuery.ajax(e)},loadSuccessCallback:function(e){var t=jQuery.parseJSON(jQuery.trim(e));t!==null&&t.hasOwnProperty("display_as")&&(this.element.attr("data-original-content",this.element.text()),this.original_content=this.element.text(),this.element.html(t.display_as)),this.element.trigger(jQuery.Event("ajax:success"),e),jQuery(this.activator).bind("click",{editor:this},this.clickHandler),this.element.trigger(jQuery.Event("best_in_place:deactivate")),this.collectionValue!==null&&(this.collectionValue=this.previousCollectionValue,this.previousCollectionValue=null)},loadErrorCallback:function(e,t){this.element.html(this.oldValue),this.element.trigger(jQuery.Event("best_in_place:error"),[e,t]),this.element.trigger(jQuery.Event("ajax:error")),jQuery(this.activator).bind("click",{editor:this},this.clickHandler),this.element.trigger(jQuery.Event("best_in_place:deactivate"))},clickHandler:function(e){e.preventDefault(),e.data.editor.activate()},setHtmlAttributes:function(){var e=this.element.find(this.formType),t=jQuery.parseJSON(this.html_attrs);for(var n in t)e.attr(n,t[n])}},BestInPlaceEditor.forms={input:{activateForm:function(){var e=jQuery(document.createElement("form")).addClass("form_in_place").attr("action","javascript:void(0);").attr("style","display:inline"),t=jQuery(document.createElement("input")).attr("type","text").attr("name",this.attributeName).val(this.display_value);this.inner_class!==null&&t.addClass(this.inner_class),e.append(t),this.okButton&&e.append(jQuery(document.createElement("input")).attr("type","submit").attr("value",this.okButton)),this.cancelButton&&e.append(jQuery(document.createElement("input")).attr("type","button").attr("value",this.cancelButton)),this.element.html(e),this.setHtmlAttributes(),this.element.find("input[type='text']")[0].select(),this.element.find("form").bind("submit",{editor:this},BestInPlaceEditor.forms.input.submitHandler),this.cancelButton&&this.element.find("input[type='button']").bind("click",{editor:this},BestInPlaceEditor.forms.input.cancelButtonHandler),this.element.find("input[type='text']").bind("blur",{editor:this},BestInPlaceEditor.forms.input.inputBlurHandler),this.element.find("input[type='text']").bind("keyup",{editor:this},BestInPlaceEditor.forms.input.keyupHandler),this.blurTimer=null,this.userClicked=!1},getValue:function(){return this.sanitizeValue(this.element.find("input").val())},inputBlurHandler:function(e){e.data.editor.okButton?e.data.editor.blurTimer=setTimeout(function(){e.data.editor.userClicked||e.data.editor.abort()},500):e.data.editor.cancelButton?e.data.editor.blurTimer=setTimeout(function(){e.data.editor.userClicked||e.data.editor.update()},500):e.data.editor.update()},submitHandler:function(e){e.data.editor.userClicked=!0,clearTimeout(e.data.editor.blurTimer),e.data.editor.update()},cancelButtonHandler:function(e){e.data.editor.userClicked=!0,clearTimeout(e.data.editor.blurTimer),e.data.editor.abort(),e.stopPropagation()},keyupHandler:function(e){e.keyCode==27&&e.data.editor.abort()}},date:{activateForm:function(){var e=this,t=jQuery(document.createElement("form")).addClass("form_in_place").attr("action","javascript:void(0);").attr("style","display:inline"),n=jQuery(document.createElement("input")).attr("type","text").attr("name",this.attributeName).attr("value",this.sanitizeValue(this.display_value));this.inner_class!==null&&n.addClass(this.inner_class),t.append(n),this.element.html(t),this.setHtmlAttributes(),this.element.find("input")[0].select(),this.element.find("form").bind("submit",{editor:this},BestInPlaceEditor.forms.input.submitHandler),this.element.find("input").bind("keyup",{editor:this},BestInPlaceEditor.forms.input.keyupHandler),this.element.find("input").datepicker({onClose:function(){e.update()}}).datepicker("show")},getValue:function(){return this.sanitizeValue(this.element.find("input").val())},submitHandler:function(e){e.data.editor.update()},keyupHandler:function(e){e.keyCode==27&&e.data.editor.abort()}},select:{activateForm:function(){var e=jQuery(document.createElement("form")).attr("action","javascript:void(0)").attr("style","display:inline");selected="",oldValue=this.oldValue,select_elt=jQuery(document.createElement("select")),currentCollectionValue=this.collectionValue,jQuery.each(this.values,function(e,t){var n=jQuery(document.createElement("option")).val(t[0]).html(t[1]);t[0]==currentCollectionValue&&n.attr("selected","selected"),select_elt.append(n)}),e.append(select_elt),this.element.html(e),this.setHtmlAttributes(),this.element.find("select").bind("change",{editor:this},BestInPlaceEditor.forms.select.blurHandler),this.element.find("select").bind("blur",{editor:this},BestInPlaceEditor.forms.select.blurHandler),this.element.find("select").bind("keyup",{editor:this},BestInPlaceEditor.forms.select.keyupHandler),this.element.find("select")[0].focus()},getValue:function(){return this.sanitizeValue(this.element.find("select").val())},blurHandler:function(e){e.data.editor.update()},keyupHandler:function(e){e.keyCode==27&&e.data.editor.abort()}},checkbox:{activateForm:function(){var e=Boolean(this.oldValue.toLowerCase()!=this.values[1].toLowerCase()),t=e?this.values[1]:this.values[0];this.element.html(t),this.setHtmlAttributes(),this.update()},getValue:function(){return Boolean(this.element.html().toLowerCase()==this.values[1].toLowerCase())}},textarea:{activateForm:function(){width=this.element.css("width"),height=this.element.css("height");var e=jQuery(document.createElement("form")).attr("action","javascript:void(0)").attr("style","display:inline").append(jQuery(document.createElement("textarea")).val(this.sanitizeValue(this.display_value)));this.okButton&&e.append(jQuery(document.createElement("input")).attr("type","submit").attr("value",this.okButton)),this.cancelButton&&e.append(jQuery(document.createElement("input")).attr("type","button").attr("value",this.cancelButton)),this.element.html(e),this.setHtmlAttributes(),jQuery(this.element.find("textarea")[0]).css({"min-width":width,"min-height":height}),jQuery(this.element.find("textarea")[0]).elastic(),this.element.find("textarea")[0].focus(),this.element.find("form").bind("submit",{editor:this},BestInPlaceEditor.forms.textarea.submitHandler),this.cancelButton&&this.element.find("input[type='button']").bind("click",{editor:this},BestInPlaceEditor.forms.textarea.cancelButtonHandler),this.element.find("textarea").bind("blur",{editor:this},BestInPlaceEditor.forms.textarea.blurHandler),this.element.find("textarea").bind("keyup",{editor:this},BestInPlaceEditor.forms.textarea.keyupHandler),this.blurTimer=null,this.userClicked=!1},getValue:function(){return this.sanitizeValue(this.element.find("textarea").val())},blurHandler:function(e){e.data.editor.okButton?e.data.editor.blurTimer=setTimeout(function(){e.data.editor.userClicked||e.data.editor.abortIfConfirm()},500):e.data.editor.cancelButton?e.data.editor.blurTimer=setTimeout(function(){e.data.editor.userClicked||e.data.editor.update()},500):e.data.editor.update()},submitHandler:function(e){e.data.editor.userClicked=!0,clearTimeout(e.data.editor.blurTimer),e.data.editor.update()},cancelButtonHandler:function(e){e.data.editor.userClicked=!0,clearTimeout(e.data.editor.blurTimer),e.data.editor.abortIfConfirm(),e.stopPropagation()},keyupHandler:function(e){e.keyCode==27&&e.data.editor.abortIfConfirm()}}},jQuery.fn.best_in_place=function(){function e(e){if(!e.data("bestInPlaceEditor"))return e.data("bestInPlaceEditor",new BestInPlaceEditor(e)),!0}return jQuery(this.context).delegate(this.selector,"click",function(){var t=jQuery(this);e(t)&&t.click()}),this.each(function(){e(jQuery(this))}),this},function(e){e.fn.extend({elastic:function(){var t=["paddingTop","paddingRight","paddingBottom","paddingLeft","fontSize","lineHeight","fontFamily","width","fontWeight"];return this.each(function(){function f(e,t){curratedHeight=Math.floor(parseInt(e,10)),n.height()!=curratedHeight&&n.css({height:curratedHeight+"px",overflow:t})}function l(){var e=n.val().replace(/&/g,"&").replace(/ /g," ").replace(/<|>/g,">").replace(/\n/g,"<br />"),t=r.html().replace(/<br>/ig,"<br />");if(e+" "!=t){r.html(e+" ");if(Math.abs(r.height()+i-n.height())>3){var u=r.height()+i;u>=o?f(o,"auto"):u<=s?f(s,"hidden"):f(u,"hidden")}}}if(this.type!="textarea")return!1;var n=e(this),r=e("<div />").css({position:"absolute",display:"none","word-wrap":"break-word"}),i=parseInt(n.css("line-height"),10)||parseInt(n.css("font-size"),"10"),s=parseInt(n.css("height"),10)||i*3,o=parseInt(n.css("max-height"),10)||Number.MAX_VALUE,u=0,a=0;o<0&&(o=Number.MAX_VALUE),r.appendTo(n.parent()),a=t.length;while(a--)r.css(t[a].toString(),n.css(t[a].toString()));n.css({overflow:"hidden"}),n.bind("keyup change cut paste",function(){l()}),n.bind("blur",function(){r.height()<o&&(r.height()>s?n.height(r.height()):n.height(s))}),n.live("input paste",function(e){setTimeout(l,250)}),l()})}})}(jQuery),function(e){var t=null;e.fn.railsAutocomplete=function(){return this.live("focus",function(){this.railsAutoCompleter||(this.railsAutoCompleter=new e.railsAutocomplete(this))})},e.railsAutocomplete=function(e){_e=e,this.init(_e)},e.railsAutocomplete.fn=e.railsAutocomplete.prototype={railsAutocomplete:"0.0.1"},e.railsAutocomplete.fn.extend=e.railsAutocomplete.extend=e.extend,e.railsAutocomplete.fn.extend({init:function(t){function n(e){return e.split(t.delimiter)}function r(e){return n(e).pop().replace(/^\s+/,"")}t.delimiter=e(t).attr("data-delimiter")||null,e(t).autocomplete({source:function(n,i){e.getJSON(e(t).attr("data-autocomplete"),{term:r(n.term)},function(){arguments[0].length==0&&(arguments[0]=[]),e(arguments[0]).each(function(n,r){var i={};i[r.id]=r,e(t).data(i)}),i.apply(null,arguments)})},change:function(t,n){if(e(e(this).attr("data-id-element")).val()=="")return;e(e(this).attr("data-id-element")).val(n.item?n.item.id:"");var r=e.parseJSON(e(this).attr("data-update-elements")),i=n.item?e(this).data(n.item.id.toString()):{};if(r&&e(r["id"]).val()=="")return;for(var s in r)e(r[s]).val(n.item?i[s]:"")},search:function(){var e=r(this.value);if(e.length<2)return!1},focus:function(){return!1},select:function(r,i){var s=n(this.value);s.pop(),s.push(i.item.value);if(t.delimiter!=null)s.push(""),this.value=s.join(t.delimiter);else{this.value=s.join(""),e(this).attr("data-id-element")&&e(e(this).attr("data-id-element")).val(i.item.id);if(e(this).attr("data-update-elements")){var o=e(this).data(i.item.id.toString()),u=e.parseJSON(e(this).attr("data-update-elements"));for(var a in u)e(u[a]).val(o[a])}}var f=this.value;return e(this).bind("keyup.clearId",function(){e(this).val().trim()!=f.trim()&&(e(e(this).attr("data-id-element")).val(""),e(this).unbind("keyup.clearId"))}),e(t).trigger("railsAutocomplete.select",i),!1}})}}),e(document).ready(function(){e("input[data-autocomplete]").railsAutocomplete()})}(jQuery),function(e,t){var n=function(){var t=e._data(document,"events");return t&&t.click&&e.grep(t.click,function(e){return e.namespace==="rails"}).length};n()&&e.error("jquery-ujs has already been loaded!");var r;e.rails=r={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled",requiredInputSelector:"input[name][required]:not([disabled]),textarea[name][required]:not([disabled])",fileInputSelector:"input:file",linkDisableSelector:"a[data-disable-with]",CSRFProtection:function(t){var n=e('meta[name="csrf-token"]').attr("content");n&&t.setRequestHeader("X-CSRF-Token",n)},fire:function(t,n,r){var i=e.Event(n);return t.trigger(i,r),i.result!==!1},confirm:function(e){return confirm(e)},ajax:function(t){return e.ajax(t)},href:function(e){return e.attr("href")},handleRemote:function(n){var i,s,o,u,a,f,l,c;if(r.fire(n,"ajax:before")){u=n.data("cross-domain"),a=u===t?null:u,f=n.data("with-credentials")||null,l=n.data("type")||e.ajaxSettings&&e.ajaxSettings.dataType;if(n.is("form")){i=n.attr("method"),s=n.attr("action"),o=n.serializeArray();var h=n.data("ujs:submit-button");h&&(o.push(h),n.data("ujs:submit-button",null))}else n.is(r.inputChangeSelector)?(i=n.data("method"),s=n.data("url"),o=n.serialize(),n.data("params")&&(o=o+"&"+n.data("params"))):(i=n.data("method"),s=r.href(n),o=n.data("params")||null);c={type:i||"GET",data:o,dataType:l,beforeSend:function(e,i){return i.dataType===t&&e.setRequestHeader("accept","*/*;q=0.5, "+i.accepts.script),r.fire(n,"ajax:beforeSend",[e,i])},success:function(e,t,r){n.trigger("ajax:success",[e,t,r])},complete:function(e,t){n.trigger("ajax:complete",[e,t])},error:function(e,t,r){n.trigger("ajax:error",[e,t,r])},xhrFields:{withCredentials:f},crossDomain:a},s&&(c.url=s);var p=r.ajax(c);return n.trigger("ajax:send",p),p}return!1},handleMethod:function(n){var i=r.href(n),s=n.data("method"),o=n.attr("target"),u=e("meta[name=csrf-token]").attr("content"),a=e("meta[name=csrf-param]").attr("content"),f=e('<form method="post" action="'+i+'"></form>'),l='<input name="_method" value="'+s+'" type="hidden" />';a!==t&&u!==t&&(l+='<input name="'+a+'" value="'+u+'" type="hidden" />'),o&&f.attr("target",o),f.hide().append(l).appendTo("body"),f.submit()},disableFormElements:function(t){t.find(r.disableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with",t[n]()),t[n](t.data("disable-with")),t.prop("disabled",!0)})},enableFormElements:function(t){t.find(r.enableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with")&&t[n](t.data("ujs:enable-with")),t.prop("disabled",!1)})},allowAction:function(e){var t=e.data("confirm"),n=!1,i;return t?(r.fire(e,"confirm")&&(n=r.confirm(t),i=r.fire(e,"confirm:complete",[n])),n&&i):!0},blankInputs:function(t,n,r){var i=e(),s,o,u=n||"input,textarea",a=t.find(u);return a.each(function(){s=e(this),o=s.is(":checkbox,:radio")?s.is(":checked"):s.val();if(!o==!r){if(s.is(":radio")&&a.filter('input:radio:checked[name="'+s.attr("name")+'"]').length)return!0;i=i.add(s)}}),i.length?i:!1},nonBlankInputs:function(e,t){return r.blankInputs(e,t,!0)},stopEverything:function(t){return e(t.target).trigger("ujs:everythingStopped"),t.stopImmediatePropagation(),!1},callFormSubmitBindings:function(n,r){var i=n.data("events"),s=!0;return i!==t&&i.submit!==t&&e.each(i.submit,function(e,t){if(typeof t.handler=="function")return s=t.handler(r)}),s},disableElement:function(e){e.data("ujs:enable-with",e.html()),e.html(e.data("disable-with")),e.bind("click.railsDisable",function(e){return r.stopEverything(e)})},enableElement:function(e){e.data("ujs:enable-with")!==t&&(e.html(e.data("ujs:enable-with")),e.data("ujs:enable-with",!1)),e.unbind("click.railsDisable")}},r.fire(e(document),"rails:attachBindings")&&(e.ajaxPrefilter(function(e,t,n){e.crossDomain||r.CSRFProtection(n)}),e(document).delegate(r.linkDisableSelector,"ajax:complete",function(){r.enableElement(e(this))}),e(document).delegate(r.linkClickSelector,"click.rails",function(n){var i=e(this),s=i.data("method"),o=i.data("params");if(!r.allowAction(i))return r.stopEverything(n);i.is(r.linkDisableSelector)&&r.disableElement(i);if(i.data("remote")!==t){if((n.metaKey||n.ctrlKey)&&(!s||s==="GET")&&!o)return!0;var u=r.handleRemote(i);return u===!1?r.enableElement(i):u.error(function(){r.enableElement(i)}),!1}if(i.data("method"))return r.handleMethod(i),!1}),e(document).delegate(r.inputChangeSelector,"change.rails",function(t){var n=e(this);return r.allowAction(n)?(r.handleRemote(n),!1):r.stopEverything(t)}),e(document).delegate(r.formSubmitSelector,"submit.rails",function(n){var i=e(this),s=i.data("remote")!==t,o=r.blankInputs(i,r.requiredInputSelector),u=r.nonBlankInputs(i,r.fileInputSelector);if(!r.allowAction(i))return r.stopEverything(n);if(o&&i.attr("novalidate")==t&&r.fire(i,"ajax:aborted:required",[o]))return r.stopEverything(n);if(s){if(u){setTimeout(function(){r.disableFormElements(i)},13);var a=r.fire(i,"ajax:aborted:file",[u]);return a||setTimeout(function(){r.enableFormElements(i)},13),a}return!e.support.submitBubbles&&e().jquery<"1.7"&&r.callFormSubmitBindings(i,n)===!1?r.stopEverything(n):(r.handleRemote(i),!1)}setTimeout(function(){r.disableFormElements(i)},13)}),e(document).delegate(r.formInputClickSelector,"click.rails",function(t){var n=e(this);if(!r.allowAction(n))return r.stopEverything(t);var i=n.attr("name"),s=i?{name:i,value:n.val()}:null;n.closest("form").data("ujs:submit-button",s)}),e(document).delegate(r.formSubmitSelector,"ajax:beforeSend.rails",function(t){this==t.target&&r.disableFormElements(e(this))}),e(document).delegate(r.formSubmitSelector,"ajax:complete.rails",function(t){this==t.target&&r.enableFormElements(e(this))}),e(function(){csrf_token=e("meta[name=csrf-token]").attr("content"),csrf_param=e("meta[name=csrf-param]").attr("content"),e('form input[name="'+csrf_param+'"]').val(csrf_token)}))}(jQuery),$(document).ready(function(){$("#sideOptionAnalyze").bind("click",function(){analyzeOpen||openAnalyze()}),$("#closeAnalyze").bind("click",function(){analyzeOpen&&closeAnalyze()})}),document.createElement("canvas").getContext||function(){function f(){return this.context_||(this.context_=new I(this))}function c(e,t,n){var r=l.call(arguments,2);return function(){return e.apply(t,r.concat(l.call(arguments)))}}function h(e){return String(e).replace(/&/g,"&").replace(/"/g,""")}function p(e,t,n){e.namespaces[t]||e.namespaces.add(t,n,"#default#VML")}function d(e){p(e,"g_vml_","urn:schemas-microsoft-com:vml"),p(e,"g_o_","urn:schemas-microsoft-com:office:office");if(!e.styleSheets.ex_canvas_){var t=e.createStyleSheet();t.owningElement.id="ex_canvas_",t.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function m(e){var t=e.srcElement;switch(e.propertyName){case"width":t.getContext().clearRect(),t.style.width=t.attributes.width.nodeValue+"px",t.firstChild.style.width=t.clientWidth+"px";break;case"height":t.getContext().clearRect(),t.style.height=t.attributes.height.nodeValue+"px",t.firstChild.style.height=t.clientHeight+"px"}}function g(e){var t=e.srcElement;t.firstChild&&(t.firstChild.style.width=t.clientWidth+"px",t.firstChild.style.height=t.clientHeight+"px")}function E(){return[[1,0,0],[0,1,0],[0,0,1]]}function S(e,t){var n=E();for(var r=0;r<3;r++)for(var i=0;i<3;i++){var s=0;for(var o=0;o<3;o++)s+=e[r][o]*t[o][i];n[r][i]=s}return n}function x(e,t){t.fillStyle=e.fillStyle,t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY,t.strokeStyle=e.strokeStyle,t.globalAlpha=e.globalAlpha,t.font=e.font,t.textAlign=e.textAlign,t.textBaseline=e.textBaseline,t.arcScaleX_=e.arcScaleX_,t.arcScaleY_=e.arcScaleY_,t.lineScale_=e.lineScale_}function N(e){var t=e.indexOf("(",3),n=e.indexOf(")",t+1),r=e.substring(t+1,n).split(",");if(r.length!=4||e.charAt(3)!="a")r[3]=1;return r}function C(e){return parseFloat(e)/100}function k(e,t,n){return Math.min(n,Math.max(t,e))}function L(e){var t,n,r,i,s,o;i=parseFloat(e[0])/360%360,i<0&&i++,s=k(C(e[1]),0,1),o=k(C(e[2]),0,1);if(s==0)t=n=r=o;else{var u=o<.5?o*(1+s):o+s-o*s,a=2*o-u;t=A(a,u,i+1/3),n=A(a,u,i),r=A(a,u,i-1/3)}return"#"+y[Math.floor(t*255)]+y[Math.floor(n*255)]+y[Math.floor(r*255)]}function A(e,t,n){return n<0&&n++,n>1&&n--,6*n<1?e+(t-e)*6*n:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}function M(e){if(e in O)return O[e];var t,n=1;e=String(e);if(e.charAt(0)=="#")t=e;else if(/^rgb/.test(e)){var r=N(e),t="#",i;for(var s=0;s<3;s++)r[s].indexOf("%")!=-1?i=Math.floor(C(r[s])*255):i=+r[s],t+=y[k(i,0,255)];n=+r[3]}else if(/^hsl/.test(e)){var r=N(e);t=L(r),n=r[3]}else t=T[e]||e;return O[e]={color:t,alpha:n}}function P(e){if(D[e])return D[e];var t=document.createElement("div"),n=t.style;try{n.font=e}catch(r){}return D[e]={style:n.fontStyle||_.style,variant:n.fontVariant||_.variant,weight:n.fontWeight||_.weight,size:n.fontSize||_.size,family:n.fontFamily||_.family}}function H(e,t){var n={};for(var r in e)n[r]=e[r];var i=parseFloat(t.currentStyle.fontSize),s=parseFloat(e.size);return typeof e.size=="number"?n.size=e.size:e.size.indexOf("px")!=-1?n.size=s:e.size.indexOf("em")!=-1?n.size=i*s:e.size.indexOf("%")!=-1?n.size=i/100*s:e.size.indexOf("pt")!=-1?n.size=s/.75:n.size=i,n.size*=.981,n}function B(e){return e.style+" "+e.variant+" "+e.weight+" "+e.size+"px "+e.family}function F(e){return j[e]||"square"}function I(e){this.m_=E(),this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.strokeStyle="#000",this.fillStyle="#000",this.lineWidth=1,this.lineJoin="miter",this.lineCap="butt",this.miterLimit=o*1,this.globalAlpha=1,this.font="10px sans-serif",this.textAlign="left",this.textBaseline="alphabetic",this.canvas=e;var t="width:"+e.clientWidth+"px;height:"+e.clientHeight+"px;overflow:hidden;position:absolute",n=e.ownerDocument.createElement("div");n.style.cssText=t,e.appendChild(n);var r=n.cloneNode(!1);r.style.backgroundColor="red",r.style.filter="alpha(opacity=0)",e.appendChild(r),this.element_=n,this.arcScaleX_=1,this.arcScaleY_=1,this.lineScale_=1}function R(e,t,n,r){e.currentPath_.push({type:"bezierCurveTo",cp1x:t.x,cp1y:t.y,cp2x:n.x,cp2y:n.y,x:r.x,y:r.y}),e.currentX_=r.x,e.currentY_=r.y}function U(e,t){var n=M(e.strokeStyle),r=n.color,i=n.alpha*e.globalAlpha,s=e.lineScale_*e.lineWidth;s<1&&(i*=s),t.push("<g_vml_:stroke",' opacity="',i,'"',' joinstyle="',e.lineJoin,'"',' miterlimit="',e.miterLimit,'"',' endcap="',F(e.lineCap),'"',' weight="',s,'px"',' color="',r,'" />')}function z(t,n,r,i){var s=t.fillStyle,u=t.arcScaleX_,a=t.arcScaleY_,f=i.x-r.x,l=i.y-r.y;if(s instanceof $){var c=0,h={x:0,y:0},p=0,d=1;if(s.type_=="gradient"){var v=s.x0_/u,m=s.y0_/a,g=s.x1_/u,y=s.y1_/a,b=W(t,v,m),w=W(t,g,y),E=w.x-b.x,S=w.y-b.y;c=Math.atan2(E,S)*180/Math.PI,c<0&&(c+=360),c<1e-6&&(c=0)}else{var b=W(t,s.x0_,s.y0_);h={x:(b.x-r.x)/f,y:(b.y-r.y)/l},f/=u*o,l/=a*o;var x=e.max(f,l);p=2*s.r0_/x,d=2*s.r1_/x-p}var T=s.colors_;T.sort(function(e,t){return e.offset-t.offset});var N=T.length,C=T[0].color,k=T[N-1].color,L=T[0].alpha*t.globalAlpha,A=T[N-1].alpha*t.globalAlpha,O=[];for(var _=0;_<N;_++){var D=T[_];O.push(D.offset*d+p+" "+D.color)}n.push('<g_vml_:fill type="',s.type_,'"',' method="none" focus="100%"',' color="',C,'"',' color2="',k,'"',' colors="',O.join(","),'"',' opacity="',A,'"',' g_o_:opacity2="',L,'"',' angle="',c,'"',' focusposition="',h.x,",",h.y,'" />')}else if(s instanceof J){if(f&&l){var P=-r.x,H=-r.y;n.push("<g_vml_:fill",' position="',P/f*u*u,",",H/l*a*a,'"',' type="tile"',' src="',s.src_,'" />')}}else{var B=M(t.fillStyle),j=B.color,F=B.alpha*t.globalAlpha;n.push('<g_vml_:fill color="',j,'" opacity="',F,'" />')}}function W(e,t,n){var r=e.m_;return{x:o*(t*r[0][0]+n*r[1][0]+r[2][0])-u,y:o*(t*r[0][1]+n*r[1][1]+r[2][1])-u}}function X(e){return isFinite(e[0][0])&&isFinite(e[0][1])&&isFinite(e[1][0])&&isFinite(e[1][1])&&isFinite(e[2][0])&&isFinite(e[2][1])}function V(e,t,n){if(!X(t))return;e.m_=t;if(n){var r=t[0][0]*t[1][1]-t[0][1]*t[1][0];e.lineScale_=s(i(r))}}function $(e){this.type_=e,this.x0_=0,this.y0_=0,this.r0_=0,this.x1_=0,this.y1_=0,this.r1_=0,this.colors_=[]}function J(e,t){Q(e);switch(t){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=t;break;default:K("SYNTAX_ERR")}this.src_=e.src,this.width_=e.width,this.height_=e.height}function K(e){throw new G(e)}function Q(e){(!e||e.nodeType!=1||e.tagName!="IMG")&&K("TYPE_MISMATCH_ERR"),e.readyState!="complete"&&K("INVALID_STATE_ERR")}function G(e){this.code=this[e],this.message=e+": DOM Exception "+this.code}var e=Math,t=e.round,n=e.sin,r=e.cos,i=e.abs,s=e.sqrt,o=10,u=o/2,a=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1],l=Array.prototype.slice;d(document);var v={init:function(e){var t=e||document;t.createElement("canvas"),t.attachEvent("onreadystatechange",c(this.init_,this,t))},init_:function(e){var t=e.getElementsByTagName("canvas");for(var n=0;n<t.length;n++)this.initElement(t[n])},initElement:function(e){if(!e.getContext){e.getContext=f,d(e.ownerDocument),e.innerHTML="",e.attachEvent("onpropertychange",m),e.attachEvent("onresize",g);var t=e.attributes;t.width&&t.width.specified?e.style.width=t.width.nodeValue+"px":e.width=e.clientWidth,t.height&&t.height.specified?e.style.height=t.height.nodeValue+"px":e.height=e.clientHeight}return e}};v.init();var y=[];for(var b=0;b<16;b++)for(var w=0;w<16;w++)y[b*16+w]=b.toString(16)+w.toString(16);var T={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"},O={},_={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"},D={},j={butt:"flat",round:"round"},q=I.prototype;q.clearRect=function(){this.textMeasureEl_&&(this.textMeasureEl_.removeNode(!0),this.textMeasureEl_=null),this.element_.innerHTML=""},q.beginPath=function(){this.currentPath_=[]},q.moveTo=function(e,t){var n=W(this,e,t);this.currentPath_.push({type:"moveTo",x:n.x,y:n.y}),this.currentX_=n.x,this.currentY_=n.y},q.lineTo=function(e,t){var n=W(this,e,t);this.currentPath_.push({type:"lineTo",x:n.x,y:n.y}),this.currentX_=n.x,this.currentY_=n.y},q.bezierCurveTo=function(e,t,n,r,i,s){var o=W(this,i,s),u=W(this,e,t),a=W(this,n,r);R(this,u,a,o)},q.quadraticCurveTo=function(e,t,n,r){var i=W(this,e,t),s=W(this,n,r),o={x:this.currentX_+2/3*(i.x-this.currentX_),y:this.currentY_+2/3*(i.y-this.currentY_)},u={x:o.x+(s.x-this.currentX_)/3,y:o.y+(s.y-this.currentY_)/3};R(this,o,u,s)},q.arc=function(e,t,i,s,a,f){i*=o;var l=f?"at":"wa",c=e+r(s)*i-u,h=t+n(s)*i-u,p=e+r(a)*i-u,d=t+n(a)*i-u;c==p&&!f&&(c+=.125);var v=W(this,e,t),m=W(this,c,h),g=W(this,p,d);this.currentPath_.push({type:l,x:v.x,y:v.y,radius:i,xStart:m.x,yStart:m.y,xEnd:g.x,yEnd:g.y})},q.rect=function(e,t,n,r){this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath()},q.strokeRect=function(e,t,n,r){var i=this.currentPath_;this.beginPath(),this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath(),this.stroke(),this.currentPath_=i},q.fillRect=function(e,t,n,r){var i=this.currentPath_;this.beginPath(),this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+r),this.lineTo(e,t+r),this.closePath(),this.fill(),this.currentPath_=i},q.createLinearGradient=function(e,t,n,r){var i=new $("gradient");return i.x0_=e,i.y0_=t,i.x1_=n,i.y1_=r,i},q.createRadialGradient=function(e,t,n,r,i,s){var o=new $("gradientradial");return o.x0_=e,o.y0_=t,o.r0_=n,o.x1_=r,o.y1_=i,o.r1_=s,o},q.drawImage=function(n,r){var i,s,u,a,f,l,c,h,p=n.runtimeStyle.width,d=n.runtimeStyle.height;n.runtimeStyle.width="auto",n.runtimeStyle.height="auto";var v=n.width,m=n.height;n.runtimeStyle.width=p,n.runtimeStyle.height=d;if(arguments.length==3)i=arguments[1],s=arguments[2],f=l=0,c=u=v,h=a=m;else if(arguments.length==5)i=arguments[1],s=arguments[2],u=arguments[3],a=arguments[4],f=l=0,c=v,h=m;else{if(arguments.length!=9)throw Error("Invalid number of arguments");f=arguments[1],l=arguments[2],c=arguments[3],h=arguments[4],i=arguments[5],s=arguments[6],u=arguments[7],a=arguments[8]}var g=W(this,i,s),y=c/2,b=h/2,w=[],E=10,S=10;w.push(" <g_vml_:group",' coordsize="',o*E,",",o*S,'"',' coordorigin="0,0"',' style="width:',E,"px;height:",S,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var x=[];x.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",t(g.x/o),",","Dy=",t(g.y/o),"");var T=g,N=W(this,i+u,s),C=W(this,i,s+a),k=W(this,i+u,s+a);T.x=e.max(T.x,N.x,C.x,k.x),T.y=e.max(T.y,N.y,C.y,k.y),w.push("padding:0 ",t(T.x/o),"px ",t(T.y/o),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",x.join(""),", sizingmethod='clip');")}else w.push("top:",t(g.y/o),"px;left:",t(g.x/o),"px;");w.push(' ">','<g_vml_:image src="',n.src,'"',' style="width:',o*u,"px;"," height:",o*a,'px"',' cropleft="',f/v,'"',' croptop="',l/m,'"',' cropright="',(v-f-c)/v,'"',' cropbottom="',(m-l-h)/m,'"'," />","</g_vml_:group>"),this.element_.insertAdjacentHTML("BeforeEnd",w.join(""))},q.stroke=function(e){var n=[],r=!1,i=10,s=10;n.push("<g_vml_:shape"
|
||
,' filled="',!!e,'"',' style="position:absolute;width:',i,"px;height:",s,'px;"',' coordorigin="0,0"',' coordsize="',o*i,",",o*s,'"',' stroked="',!e,'"',' path="');var u=!1,a={x:null,y:null},f={x:null,y:null};for(var l=0;l<this.currentPath_.length;l++){var c=this.currentPath_[l],h;switch(c.type){case"moveTo":h=c,n.push(" m ",t(c.x),",",t(c.y));break;case"lineTo":n.push(" l ",t(c.x),",",t(c.y));break;case"close":n.push(" x "),c=null;break;case"bezierCurveTo":n.push(" c ",t(c.cp1x),",",t(c.cp1y),",",t(c.cp2x),",",t(c.cp2y),",",t(c.x),",",t(c.y));break;case"at":case"wa":n.push(" ",c.type," ",t(c.x-this.arcScaleX_*c.radius),",",t(c.y-this.arcScaleY_*c.radius)," ",t(c.x+this.arcScaleX_*c.radius),",",t(c.y+this.arcScaleY_*c.radius)," ",t(c.xStart),",",t(c.yStart)," ",t(c.xEnd),",",t(c.yEnd))}if(c){if(a.x==null||c.x<a.x)a.x=c.x;if(f.x==null||c.x>f.x)f.x=c.x;if(a.y==null||c.y<a.y)a.y=c.y;if(f.y==null||c.y>f.y)f.y=c.y}}n.push(' ">'),e?z(this,n,a,f):U(this,n),n.push("</g_vml_:shape>"),this.element_.insertAdjacentHTML("beforeEnd",n.join(""))},q.fill=function(){this.stroke(!0)},q.closePath=function(){this.currentPath_.push({type:"close"})},q.save=function(){var e={};x(this,e),this.aStack_.push(e),this.mStack_.push(this.m_),this.m_=S(E(),this.m_)},q.restore=function(){this.aStack_.length&&(x(this.aStack_.pop(),this),this.m_=this.mStack_.pop())},q.translate=function(e,t){var n=[[1,0,0],[0,1,0],[e,t,1]];V(this,S(n,this.m_),!1)},q.rotate=function(e){var t=r(e),i=n(e),s=[[t,i,0],[-i,t,0],[0,0,1]];V(this,S(s,this.m_),!1)},q.scale=function(e,t){this.arcScaleX_*=e,this.arcScaleY_*=t;var n=[[e,0,0],[0,t,0],[0,0,1]];V(this,S(n,this.m_),!0)},q.transform=function(e,t,n,r,i,s){var o=[[e,t,0],[n,r,0],[i,s,1]];V(this,S(o,this.m_),!0)},q.setTransform=function(e,t,n,r,i,s){var o=[[e,t,0],[n,r,0],[i,s,1]];V(this,o,!0)},q.drawText_=function(e,n,r,i,s){var u=this.m_,a=1e3,f=0,l=a,c={x:0,y:0},p=[],d=H(P(this.font),this.element_),v=B(d),m=this.element_.currentStyle,g=this.textAlign.toLowerCase();switch(g){case"left":case"center":case"right":break;case"end":g=m.direction=="ltr"?"right":"left";break;case"start":g=m.direction=="rtl"?"right":"left";break;default:g="left"}switch(this.textBaseline){case"hanging":case"top":c.y=d.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":c.y=-d.size/2.25}switch(g){case"right":f=a,l=.05;break;case"center":f=l=a/2}var y=W(this,n+c.x,r+c.y);p.push('<g_vml_:line from="',-f,' 0" to="',l,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!s,'" stroked="',!!s,'" style="position:absolute;width:1px;height:1px;">'),s?U(this,p):z(this,p,{x:-f,y:0},{x:l,y:d.size});var b=u[0][0].toFixed(3)+","+u[1][0].toFixed(3)+","+u[0][1].toFixed(3)+","+u[1][1].toFixed(3)+",0,0",w=t(y.x/o)+","+t(y.y/o);p.push('<g_vml_:skew on="t" matrix="',b,'" ',' offset="',w,'" origin="',f,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',h(e),'" style="v-text-align:',g,";font:",h(v),'" /></g_vml_:line>'),this.element_.insertAdjacentHTML("beforeEnd",p.join(""))},q.fillText=function(e,t,n,r){this.drawText_(e,t,n,r,!1)},q.strokeText=function(e,t,n,r){this.drawText_(e,t,n,r,!0)},q.measureText=function(e){if(!this.textMeasureEl_){var t='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",t),this.textMeasureEl_=this.element_.lastChild}var n=this.element_.ownerDocument;return this.textMeasureEl_.innerHTML="",this.textMeasureEl_.style.font=this.font,this.textMeasureEl_.appendChild(n.createTextNode(e)),{width:this.textMeasureEl_.offsetWidth}},q.clip=function(){},q.arcTo=function(){},q.createPattern=function(e,t){return new J(e,t)},$.prototype.addColorStop=function(e,t){t=M(t),this.colors_.push({offset:e,color:t.color,alpha:t.alpha})};var Y=G.prototype=new Error;Y.INDEX_SIZE_ERR=1,Y.DOMSTRING_SIZE_ERR=2,Y.HIERARCHY_REQUEST_ERR=3,Y.WRONG_DOCUMENT_ERR=4,Y.INVALID_CHARACTER_ERR=5,Y.NO_DATA_ALLOWED_ERR=6,Y.NO_MODIFICATION_ALLOWED_ERR=7,Y.NOT_FOUND_ERR=8,Y.NOT_SUPPORTED_ERR=9,Y.INUSE_ATTRIBUTE_ERR=10,Y.INVALID_STATE_ERR=11,Y.SYNTAX_ERR=12,Y.INVALID_MODIFICATION_ERR=13,Y.NAMESPACE_ERR=14,Y.INVALID_ACCESS_ERR=15,Y.VALIDATION_ERR=16,Y.TYPE_MISMATCH_ERR=17,G_vmlCanvasManager=v,CanvasRenderingContext2D=I,CanvasGradient=$,CanvasPattern=J,DOMException=G}();var categoryVisible=new Object;categoryVisible.Group=!0,categoryVisible.Person=!0,categoryVisible.Bizarre=!0,categoryVisible.Catalyst=!0,categoryVisible.Closed=!0,categoryVisible.Experience=!0,categoryVisible["Future Dev"]=!0,categoryVisible.Idea=!0,categoryVisible.Implication=!0,categoryVisible.Insight=!0,categoryVisible.Intention=!0,categoryVisible.Knowledge=!0,categoryVisible.Location=!0,categoryVisible["Open Issue"]=!0,categoryVisible.Opinion=!0,categoryVisible.Opportunity=!0,categoryVisible.Platform=!0,categoryVisible.Problem=!0,categoryVisible.Question=!0,categoryVisible.Reference=!0,categoryVisible.Requirement=!0,categoryVisible.Resource=!0,categoryVisible.Role=!0,categoryVisible.Task=!0,categoryVisible.Tool=!0,categoryVisible.Trajectory=!0,categoryVisible.Action=!0,categoryVisible.Activity=!0;var findTopics=["name","metacode","mapper (by name)","map (by name)"],findSynapses=["topics (by name)","directionality","mapper (by name)","map (by name)"],findMaps=["name","topic (by name)","mapper (by name)","synapse (by topics)"],findMappers=["name","topic (by name)","map (by name)","synapse (by topics)"];$(document).ready(function(){$("#sideOptionFind").bind("click",function(){findOpen||openFind()}),$("#closeFind").bind("click",function(){findOpen&&closeFind()}),$("#topic_by_name_input").typing({start:function(e,t){firstVal=$("#onCanvas").attr("checked"),secondVal=$("#inCommons").attr("checked"),clearFoundData(),firstVal=="checked"&&secondVal=="checked"?$("#topic_by_name_input").autocomplete("option","disabled",!0):firstVal=="checked"?(setTimeout(function(){showAll()},0),$("#topic_by_name_input").autocomplete("option","disabled",!0)):secondVal=="checked"?$("#topic_by_name_input").autocomplete("option","disabled",!0):alert("You either need to have searching On Your Canvas or In the Commons enabled")},stop:function(e,t){firstVal=$("#onCanvas").attr("checked"),secondVal=$("#inCommons").attr("checked");var n=$("#topic_by_name_input").val();firstVal=="checked"&&secondVal=="checked"?(setTimeout(function(){onCanvasSearch(n,null,null)},0),$("#topicsByName").val(n),$("#topicsByUser").val(""),$("#topicsByMap").val(""),$("#get_topics_form").submit()):firstVal=="checked"?setTimeout(function(){onCanvasSearch(n,null,null)},0):secondVal=="checked"&&($("#topicsByName").val(n),$("#topicsByUser").val(""),$("#topicsByMap").val(""),$("#get_topics_form").submit()),n==""&&clearFoundData()},delay:2e3}),$("#sideOptionFind .select_content").change(function(){firstVal=$(this).children("option[value='topics']").attr("selected"),secondVal=$(this).children("option[value='maps']").attr("selected"),thirdVal=$(this).children("option[value='mappers']").attr("selected"),firstVal=="selected"?($("#sideOptionFind .select_type").children("option[value='metacode']").removeAttr("disabled"),$("#sideOptionFind .select_type").children("option[value='map (by name)']").removeAttr("disabled"),$("#sideOptionFind .select_type").children("option[value='mapper (by name)']").removeAttr("disabled"),$(".find").css("display","none"),$(".find_topic_by_name").css("display","block"),$("#topic_by_name_input").focus()):secondVal=="selected"?($("#sideOptionFind .select_type").val()!="name"&&($("#sideOptionFind .select_type").val("name"),$("#sideOptionFind").animate({width:"305px",height:"76px"},300,function(){})),$("#sideOptionFind .select_type").children("option[value='metacode']").attr("disabled","disabled"),$("#sideOptionFind .select_type").children("option[value='map (by name)']").attr("disabled","disabled"),$("#sideOptionFind .select_type").children("option[value='mapper (by name)']").attr("disabled","disabled"),$(".find").css("display","none"),$(".find_map_by_name").css("display","block"),$("#map_by_name_input").focus()):thirdVal=="selected"&&($("#sideOptionFind .select_type").val("name"),$("#sideOptionFind .select_type").children("option[value='metacode']").attr("disabled","disabled"),$("#sideOptionFind .select_type").children("option[value='map (by name)']").attr("disabled","disabled"),$("#sideOptionFind .select_type").children("option[value='mapper (by name)']").attr("disabled","disabled"),$(".find").css("display","none"),$(".find_mapper_by_name").css("display","block"),$("#mapper_by_name_input").focus())}),$("#sideOptionFind .select_type").change(function(){firstVal=$(this).children("option[value='name']").attr("selected"),secondVal=$(this).children("option[value='metacode']").attr("selected"),thirdVal=$(this).children("option[value='map (by name)']").attr("selected"),fourthVal=$(this).children("option[value='mapper (by name)']").attr("selected"),firstVal==="selected"?$(".find").fadeOut("fast",function(){showAll(),$(".find_topic_by_metacode ul li").not("#hideAll, #showAll").removeClass("toggledOff");for(var e in categoryVisible)categoryVisible[e]=!0;$("#sideOptionFind").animate({width:"305px",height:"76px"},300,function(){$(".find_topic_by_name").css("display","block"),$("#topic_by_name_input").focus()})}):secondVal==="selected"?$(".find").fadeOut("fast",function(){$("#sideOptionFind").animate({width:"380px",height:"463px"},300,function(){$(".find_topic_by_metacode").fadeIn("fast")})}):thirdVal==="selected"?$(".find").fadeOut("fast",function(){$("#sideOptionFind").animate({width:"305px",height:"76px"},300,function(){$(".find_map_by_name").css("display","block"),$("#map_by_name_input").focus()})}):fourthVal==="selected"&&$(".find").fadeOut("fast",function(){$("#sideOptionFind").animate({width:"305px",height:"76px"},300,function(){$(".find_mapper_by_name").css("display","block"),$("#mapper_by_name_input").focus()})})}),$(".find_topic_by_name #topic_by_name_input").bind("railsAutocomplete.select",function(e,t){t.item.id!=undefined&&window.open("/topics/"+t.item.id),$(".find_topic_by_name #topic_by_name_input").val("")}),$(".find_topic_by_name").bind("submit",function(e,t){e.preventDefault()}),$(".find_map_by_name #map_by_name_input").bind("railsAutocomplete.select",function(e,t){firstVal=$("#sideOptionFind .select_content").children("option[value='topics']").attr("selected"),secondVal=$("#sideOptionFind .select_content").children("option[value='maps']").attr("selected"),thirdVal=$("#sideOptionFind .select_content").children("option[value='mappers']").attr("selected"),firstVal=="selected"?(firstNewVal=$("#onCanvas").attr("checked"),secondNewVal=$("#inCommons").attr("checked"),firstNewVal=="checked"&&secondNewVal=="checked"?(setTimeout(function(){onCanvasSearch(null,t.item.id,null)},0),$("#topicsByMap").val(t.item.id),$("#topicsByUser").val(""),$("#topicsByName").val(""),$("#get_topics_form").submit()):firstNewVal=="checked"?setTimeout(function(){onCanvasSearch(null,t.item.id,null)},0):secondNewVal=="checked"?($("#topicsByMap").val(t.item.id),$("#topicsByUser").val(""),$("#topicsByName").val(""),$("#get_topics_form").submit()):alert("You either need to have searching On Your Canvas or In the Commons enabled")):secondVal=="selected"?(t.item.id!=undefined&&window.open("/maps/"+t.item.id),$(".find_map_by_name #map_by_name_input").val("")):thirdVal=="selected"}),$(".find_map_by_name").bind("submit",function(e,t){e.preventDefault()}),$(".find_mapper_by_name #mapper_by_name_input").bind("railsAutocomplete.select",function(e,t){firstVal=$("#sideOptionFind .select_content").children("option[value='topics']").attr("selected"),secondVal=$("#sideOptionFind .select_content").children("option[value='maps']").attr("selected"),thirdVal=$("#sideOptionFind .select_content").children("option[value='mappers']").attr("selected"),firstVal=="selected"?(firstNewVal=$("#onCanvas").attr("checked"),secondNewVal=$("#inCommons").attr("checked"),firstNewVal=="checked"&&secondNewVal=="checked"?(setTimeout(function(){onCanvasSearch(null,null,t.item.id.toString())},0),$("#topicsByUser").val(t.item.id),$("#topicsByMap").val(""),$("#topicsByName").val(""),$("#get_topics_form").submit()):firstNewVal=="checked"?setTimeout(function(){onCanvasSearch(null,null,t.item.id.toString())},0):secondNewVal=="checked"?($("#topicsByUser").val(t.item.id),$("#topicsByMap").val(""),$("#topicsByName").val(""),$("#get_topics_form").submit()):alert("You either need to have searching On Your Canvas or In the Commons enabled")):secondVal!="selected"&&thirdVal=="selected"&&(t.item.id!=undefined&&window.open("/users/"+t.item.id),$(".find_mapper_by_name #mapper_by_name_input").val(""))}),$(".find_mapper_by_name").bind("submit",function(e,t){e.preventDefault()}),$(".find_topic_by_metacode ul li").click(function(e){obj=document.getElementById("container");var t=$(this).attr("id");if(t==="showAll"||t==="hideAll"){if(t=="showAll"){showAll(),$(".find_topic_by_metacode ul li").not("#hideAll, #showAll").removeClass("toggledOff");for(var n in categoryVisible)categoryVisible[n]=!0}else if(t=="hideAll"){hideAll(),$(".find_topic_by_metacode ul li").not("#hideAll, #showAll").addClass("toggledOff");for(var n in categoryVisible)categoryVisible[n]=!1}}else{var r=$(this).children("img").attr("alt");switchVisible(r),categoryVisible[r]==1?($(this).addClass("toggledOff"),categoryVisible[r]=!1):categoryVisible[r]==0&&($(this).removeClass("toggledOff"),categoryVisible[r]=!0)}})});var MetamapsModel=new Object;MetamapsModel.selectedEdges=new Array,MetamapsModel.lastCanvasClick=0,MetamapsModel.DOUBLE_CLICK_TOLERANCE=300,MetamapsModel.edgeHoveringOver=!1;var renderMidArrow=function(e,t,n,r,i){var s=i.getCtx();if(r){var o=e;e=t,t=o}var u=new $jit.Complex(t.x-e.x,t.y-e.y);u.$scale(n/u.norm());var a=new $jit.Complex((t.x+e.x)/2,(t.y+e.y)/2),f=new $jit.Complex(u.x/.7+a.x,u.y/.7+a.y),l=new $jit.Complex(f.x-u.x,f.y-u.y),c=new $jit.Complex(-u.y/2,u.x/2),h=l.add(c),p=l.$add(c.$scale(-1));s.beginPath(),s.moveTo(e.x,e.y),s.lineTo(t.x,t.y),s.stroke(),s.beginPath(),s.moveTo(h.x,h.y),s.lineTo(f.x,f.y),s.lineTo(p.x,p.y),s.stroke()},renderMidArrows=function(e,t,n,r,i){var s=i.getCtx();if(r){var o=e;e=t,t=o}var u=new $jit.Complex(t.x-e.x,t.y-e.y);u.$scale(n/u.norm());var a=new $jit.Complex((t.x+e.x)/2,(t.y+e.y)/2),f=new $jit.Complex(u.x/.7+a.x,u.y/.7+a.y),l=new $jit.Complex(f.x-u.x,f.y-u.y),c=new $jit.Complex(-u.y/2,u.x/2),h=l.add(c),p=l.$add(c.$scale(-1));s.beginPath(),s.moveTo(h.x,h.y),s.lineTo(f.x,f.y),s.lineTo(p.x,p.y),s.stroke()},nodeSettings={customNode:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim"),i=e.getData("metacode"),s=e.getData("inCommons"),o=e.getData("onCanvas"),u=t.getCtx();s&&(u.beginPath(),u.arc(n.x,n.y,r+3,0,2*Math.PI,!1),u.strokeStyle="#67be5f",u.lineWidth=2,u.stroke()),o&&(u.beginPath(),u.arc(n.x,n.y,r+3,0,2*Math.PI,!1),u.strokeStyle="white",u.lineWidth=2,u.stroke()),u.drawImage(imgArray[i],n.x-r,n.y-r,r*2,r*2)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.circle.contains(n,t,r)}}},edgeSettings={customEdge:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("category");if(i=="none")this.edgeHelper.line.render({x:n.x,y:n.y},{x:r.x,y:r.y},t);else if(i=="both")this.edgeHelper.line.render({x:n.x,y:n.y},{x:r.x,y:r.y},t),renderMidArrows({x:n.x,y:n.y},{x:r.x,y:r.y},13,!0,t),renderMidArrows({x:n.x,y:n.y},{x:r.x,y:r.y},13,!1,t);else if(i=="from-to"){var s=e.data.$direction,o=s&&s.length>1&&s[0]!=e.nodeFrom.id;renderMidArrow({x:n.x,y:n.y},{x:r.x,y:r.y},13,o,t)}var u=e.getData("desc"),a=e.getData("showDesc");if(u!=""&&a){var f=t.getCtx(),l=t.getSize(),c=parseInt((n.x+r.x-u.length*5)/2),h=parseInt((n.y+r.y)/2);f.font="bold 14px arial",f.fillStyle="#FFF";var p=5,d=14+p,v=d/2,m=f.measureText(u).width+2*p-2*v,g=c-p+v,y=h-d+p;f.fillRect(g,y,m,d),f.beginPath(),f.arc(g,y+v,v,0,2*Math.PI,!1),f.arc(g+m,y+v,v,0,2*Math.PI,!1),f.fill(),f.fillStyle="#000",f.fillText(u,c,h)}},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(n,r,t,e.Edge.epsilon)}}};(function(){window.$jit=function(e){e=e||window;for(var t in $jit)$jit[t].$extend&&(e[t]=$jit[t])},$jit.version="2.0.0b";var e=function(e){return document.getElementById(e)};e.empty=function(){},e.extend=function(e,t){for(var n in t||{})e[n]=t[n];return e},e.lambda=function(e){return typeof e=="function"?e:function(){return e}},e.time=Date.now||function(){return+(new Date)},e.splat=function(t){var n=e.type(t);return n?n!="array"?[t]:t:[]},e.type=function(t){var n=e.type.s.call(t).match(/^\[object\s(.*)\]$/)[1].toLowerCase();return n!="object"?n:t&&t.$$family?t.$$family:t&&t.nodeName&&t.nodeType==1?"element":n},e.type.s=Object.prototype.toString,e.each=function(t,n){var r=e.type(t);if(r=="object")for(var i in t)n(t[i],i);else for(var s=0,o=t.length;s<o;s++)n(t[s],s)},e.indexOf=function(e,t){if(Array.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},e.map=function(t,n){var r=[];return e.each(t,function(e,t){r.push(n(e,t))}),r},e.reduce=function(e,t,n){var r=e.length;if(r==0)return n;var i=arguments.length==3?n:e[--r];while(r--)i=t(i,e[r]);return i},e.merge=function(){var t={};for(var n=0,r=arguments.length;n<r;n++){var i=arguments[n];if(e.type(i)!="object")continue;for(var s in i){var o=i[s],u=t[s];t[s]=u&&e.type(o)=="object"&&e.type(u)=="object"?e.merge(u,o):e.unlink(o)}}return t},e.unlink=function(t){var n;switch(e.type(t)){case"object":n={};for(var r in t)n[r]=e.unlink(t[r]);break;case"array":n=[];for(var i=0,s=t.length;i<s;i++)n[i]=e.unlink(t[i]);break;default:return t}return n},e.zip=function(){if(arguments.length===0)return[];for(var e=0,t=[],n=arguments.length,r=arguments[0].length;e<r;e++){for(var i=0,s=[];i<n;i++)s.push(arguments[i][e]);t.push(s)}return t},e.rgbToHex=function(e,t){if(e.length<3)return null;if(e.length==4&&e[3]==0&&!t)return"transparent";var n=[];for(var r=0;r<3;r++){var i=(e[r]-0).toString(16);n.push(i.length==1?"0"+i:i)}return t?n:"#"+n.join("")},e.hexToRgb=function(e){if(e.length!=7){e=e.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/),e.shift();if(e.length!=3)return null;var t=[];for(var n=0;n<3;n++){var r=e[n];r.length==1&&(r+=r),t.push(parseInt(r,16))}return t}return e=parseInt(e.slice(1),16),[e>>16,e>>8&255,e&255]},e.destroy=function(t){e.clean(t),t.parentNode&&t.parentNode.removeChild(t),t.clearAttributes&&t.clearAttributes()},e.clean=function(t){for(var n=t.childNodes,r=0,i=n.length;r<i;r++)e.destroy(n[r])},e.addEvent=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},e.addEvents=function(t,n){for(var r in n)e.addEvent(t,r,n[r])},e.hasClass=function(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1},e.addClass=function(t,n){e.hasClass(t,n)||(t.className=t.className+" "+n)},e.removeClass=function(e,t){e.className=e.className.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)"),"$1")},e.getPos=function(e){function r(e){var t={x:0,y:0};while(e&&!s(e))t.x+=e.offsetLeft,t.y+=e.offsetTop,e=e.offsetParent;return t}function i(e){var t={x:0,y:0};while(e&&!s(e))t.x+=e.scrollLeft,t.y+=e.scrollTop,e=e.parentNode;return t}function s(e){return/^(?:body|html)$/i.test(e.tagName)}var t=r(e),n=i(e);return{x:t.x-n.x,y:t.y-n.y}},e.event={get:function(e,t){return t=t||window,e||t.event},getWheel:function(e){return e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3},isRightClick:function(e){return e.which==3||e.button==2},getPos:function(e,t){t=t||window,e=e||t.event;var n=t.document;n=n.documentElement||n.body,e.touches&&e.touches.length&&(e=e.touches[0]);var r={x:e.pageX||e.clientX+n.scrollLeft,y:e.pageY||e.clientY+n.scrollTop};return r},stop:function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,e.preventDefault?e.preventDefault():e.returnValue=!1}},$jit.util=$jit.id=e;var t=function(n){n=n||{};var r=function(){for(var n in this)typeof this[n]!="function"&&(this[n]=e.unlink(this[n]));this.constructor=r;if(t.prototyping)return this;var i=this.initialize?this.initialize.apply(this,arguments):this;return this.$$family="class",i};for(var i in t.Mutators){if(!n[i])continue;n=t.Mutators[i](n,n[i]),delete n[i]}return e.extend(r,this),r.constructor=t,r.prototype=n,r};t.Mutators={Implements:function(n,r){return e.each(e.splat(r),function(e){t.prototyping=e;var r=typeof e=="function"?new e:e;for(var i in r)i in n||(n[i]=r[i]);delete t.prototyping}),n}},e.extend(t,{inherit:function(n,r){for(var i in r){var s=r[i],o=n[i],u=e.type(s);o&&u=="function"?s!=o&&t.override(n,i,s):u=="object"?n[i]=e.merge(o,s):n[i]=s}return n},override:function(e,n,r){var i=t.prototyping;i&&e[n]!=i[n]&&(i=null);var s=function(){var t=this.parent;this.parent=i?i[n]:e[n];var s=r.apply(this,arguments);return this.parent=t,s};e[n]=s}}),t.prototype.implement=function(){var n=this.prototype;return e.each(Array.prototype.slice.call(arguments||[]),function(e){t.inherit(n,e)}),this},$jit.Class=t,$jit.json={prune:function(e,t){this.each(e,function(e,n){n==t&&e.children&&(delete e.children,e.children=[])})},getParent:function(e,t){if(e.id==t)return!1;var n=e.children;if(n&&n.length>0)for(var r=0;r<n.length;r++){if(n[r].id==t)return e;var i=this.getParent(n[r],t);if(i)return i}return!1},getSubtree:function(e,t){if(e.id==t)return e;for(var n=0,r=e.children;n<r.length;n++){var i=this.getSubtree(r[n],t);if(i!=null)return i}return null},eachLevel:function(e,t,n,r){if(t<=n){r(e,t);if(!e.children)return;for(var i=0,s=e.children;i<s.length;i++)this.eachLevel(s[i],t+1,n,r)}},each:function(e,t){this.eachLevel(e,0,Number.MAX_VALUE,t)}},$jit.Trans={$extend:!0,linear:function(e){return e}};var n=$jit.Trans;(function(){var t=function(t,n){return n=e.splat(n),e.extend(t,{easeIn:function(e){return t(e,n)},easeOut:function(e){return 1-t(1-e,n)},easeInOut:function(e){return e<=.5?t(2*e,n)/2:(2-t(2*(1-e),n))/2}})},r={Pow:function(e,t){return Math.pow(e,t[0]||6)},Expo:function(e){return Math.pow(2,8*(e-1))},Circ:function(e){return 1-Math.sin(Math.acos(e))},Sine:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Back:function(e,t){return t=t[0]||1.618,Math.pow(e,2)*((t+1)*e-t)},Bounce:function(e){var t;for(var n=0,r=1;1;n+=r,r/=2)if(e>=(7-4*n)/11){t=r*r-Math.pow((11-6*n-11*e)/4,2);break}return t},Elastic:function(e,t){return Math.pow(2,10*--e)*Math.cos(20*e*Math.PI*(t[0]||1)/3)}};e.each(r,function(e,r){n[r]=t(e)}),e.each(["Quad","Cubic","Quart","Quint"],function(e,r){n[e]=t(function(e){return Math.pow(e,[r+2])})})})();var r=new t({initialize:function(e){this.setOptions(e)},setOptions:function(t){var r={duration:2500,fps:40,transition:n.Quart.easeInOut,compute:e.empty,complete:e.empty,link:"ignore"};return this.opt=e.merge(r,t||{}),this},step:function(){var t=e.time(),n=this.opt;if(t<this.time+n.duration){var r=n.transition((t-this.time)/n.duration);n.compute(r)}else this.timer=clearInterval(this.timer),n.compute(1),n.complete()},start:function(){return this.check()?(this.time=0,this.startTimer(),this):this},startTimer:function(){var t=this,n=this.opt.fps;return this.timer?!1:(this.time=e.time()-this.time,this.timer=setInterval(function(){t.step()},Math.round(1e3/n)),!0)},pause:function(){return this.stopTimer(),this},resume:function(){return this.startTimer(),this},stopTimer:function(){return this.timer?(this.time=e.time()-this.time,this.timer=clearInterval(this.timer),!0):!1},check:function(){return this.timer?this.opt.link=="cancel"?(this.stopTimer(),!0):!1:!0}}),i=function(){var t=arguments;for(var n=0,r=t.length,s={};n<r;n++){var o=i[t[n]];o.$extend?e.extend(s,o):s[t[n]]=o}return s};i.AreaChart={$extend:!0,animate:!0,labelOffset:3,type:"stacked",Tips:{enable:!1,onShow:e.empty,onHide:e.empty},Events:{enable:!1,onClick:e.empty},selectOnHover:!0,showAggregates:!0,showLabels:!0,filterOnClick:!1,restoreOnRightClick:!1},i.Margin={$extend:!1,top:0,left:0,right:0,bottom:0},i.Canvas={$extend:!0,injectInto:"id",width:!1,height:!1,useCanvas:!1,withLabels:!0,background:!1},i.Tree={$extend:!0,orientation:"left",subtreeOffset:8,siblingOffset:5,indent:10,multitree:!1,align:"center"},i.Node={$extend:!1,overridable:!1,type:"circle",color:"#ccb",alpha:1,dim:3,height:20,width:90,autoHeight:!1,autoWidth:!1,lineWidth:1,transform:!0,align:"center",angularWidth:1,span:1,CanvasStyles:{}},i.Edge={$extend:!1,overridable:!1,type:"line",color:"#ccb",lineWidth:1,dim:15,alpha:1,epsilon:7,CanvasStyles:{}},i.Fx={$extend:!0,fps:40,duration:2500,transition:$jit.Trans.Quart.easeInOut,clearCanvas:!0},i.Label={$extend:!1,overridable:!1,type:"HTML",style:" ",size:10,family:"sans-serif",textAlign:"center",textBaseline:"alphabetic",color:"#fff"},i.Tips={$extend:!1,enable:!1,type:"auto",offsetX:20,offsetY:20,force:!1,onShow:e.empty,onHide:e.empty},i.NodeStyles={$extend:!1,enable:!1,type:"auto",stylesHover:!1,stylesClick:!1},i.Events={$extend:!1,enable:!1,enableForEdges:!1,type:"auto",onClick:e.empty,onRightClick:e.empty,onMouseMove:e.empty,onMouseEnter:e.empty,onMouseLeave:e.empty,onDragStart:e.empty,onDragMove:e.empty,onDragCancel:e.empty,onDragEnd:e.empty,onTouchStart:e.empty,onTouchMove:e.empty,onTouchEnd:e.empty,onMouseWheel:e.empty},i.Navigation={$extend:!1,enable:!1,type:"auto",panning:!1,zooming:!1},i.Controller={$extend:!0,onBeforeCompute:e.empty,onAfterCompute:e.empty,onCreateLabel:e.empty,onPlaceLabel:e.empty,onComplete:e.empty,onBeforePlotLine:e.empty,onAfterPlotLine:e.empty,onBeforePlotNode:e.empty,onAfterPlotNode:e.empty,request:!1};var s={initialize:function(e,t){this.viz=t,this.canvas=t.canvas,this.config=t.config[e],this.nodeTypes=t.fx.nodeTypes;var n=this.config.type;this.dom=n=="auto"?t.config.Label.type!="Native":n!="Native",this.labelContainer=this.dom&&t.labels.getLabelContainer(),this.isEnabled()&&this.initializePost()},initializePost:e.empty,setAsProperty:e.lambda(!1),isEnabled:function(){return this.config.enable},isLabel:function(t,n){t=e.event.get(t,n);var r=this.labelContainer,i=t.target||t.srcElement;return i&&i.parentNode==r?i:!1}},o={onMouseUp:e.empty,onMouseDown:e.empty,onMouseMove:e.empty,onMouseOver:e.empty,onMouseOut:e.empty,onMouseWheel:e.empty,onTouchStart:e.empty,onTouchMove:e.empty,onTouchEnd:e.empty,onTouchCancel:e.empty},u=new t({initialize:function(e){this.viz=e,this.canvas=e.canvas,this.node=!1,this.edge=!1,this.registeredObjects=[],this.attachEvents()},attachEvents:function(){var t=this.canvas.getElement(),n=this;t.oncontextmenu=e.lambda(!1),e.addEvents(t,{mouseup:function(t,r){var i=e.event.get(t,r);n.handleEvent("MouseUp",t,r,n.makeEventObject(t,r),e.event.isRightClick(i))},mousedown:function(t,r){var i=e.event.get(t,r);n.handleEvent("MouseDown",t,r,n.makeEventObject(t,r),e.event.isRightClick(i))},mousemove:function(e,t){n.handleEvent("MouseMove",e,t,n.makeEventObject(e,t))},mouseover:function(e,t){n.handleEvent("MouseOver",e,t,n.makeEventObject(e,t))},mouseout:function(e,t){n.handleEvent("MouseOut",e,t,n.makeEventObject(e,t))},touchstart:function(e,t){n.handleEvent("TouchStart",e,t,n.makeEventObject(e,t))},touchmove:function(e,t){n.handleEvent("TouchMove",e,t,n.makeEventObject(e,t))},touchend:function(e,t){n.handleEvent("TouchEnd",e,t,n.makeEventObject(e,t))}});var r=function(t,r){var i=e.event.get(t,r),s=e.event.getWheel(i);n.handleEvent("MouseWheel",t,r,s)};!document.getBoxObjectFor&&window.mozInnerScreenX==null?e.addEvent(t,"mousewheel",r):t.addEventListener("DOMMouseScroll",r,!1)},register:function(e){this.registeredObjects.push(e)},handleEvent:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();for(var n=0,r=this.registeredObjects,i=r.length;n<i;n++)r[n]["on"+t].apply(r[n],e)},makeEventObject:function(t,n){var r=this,i=this.viz.graph,s=this.viz.fx,o=s.nodeTypes,u=s.edgeTypes;return{pos:!1,node:!1,edge:!1,contains:!1,getNodeCalled:!1,getEdgeCalled:!1,getPos:function(){var i=r.viz.canvas,s=i.getSize(),o=i.getPos(),u=i.translateOffsetX,a=i.translateOffsetY,f=i.scaleOffsetX,l=i.scaleOffsetY,c=e.event.getPos(t,n);return this.pos={x:(c.x-o.x-s.width/2-u)*1/f,y:(c.y-o.y-s.height/2-a)*1/l},this.pos},getNode:function(){if(this.getNodeCalled)return this.node;this.getNodeCalled=!0;for(var e in i.nodes){var t=i.nodes[e],n=t&&o[t.getData("type")],u=n&&n.contains&&n.contains.call(s,t,this.getPos());if(u)return this.contains=u,r.node=this.node=t}return r.node=this.node=!1},getEdge:function(){if(this.getEdgeCalled)return this.edge;this.getEdgeCalled=!0;var e={};for(var t in i.edges){var n=i.edges[t];e[t]=!0;for(var o in n){if(o in e)continue;var a=n[o],f=a&&u[a.getData("type")],l=f&&f.contains&&f.contains.call(s,a,this.getPos());if(l)return this.contains=l,r.edge=this.edge=a}}return r.edge=this.edge=!1},getContains:function(){return this.getNodeCalled?this.contains:(this.getNode(),this.contains)}}}}),a={initializeExtras:function(){var t=new u(this),n=this;e.each(["NodeStyles","Tips","Navigation","Events"],function(e){var r=new a.Classes[e](e,n);r.isEnabled()&&t.register(r),r.setAsProperty()&&(n[e.toLowerCase()]=r)})}};a.Classes={},a.Classes.Events=new t({Implements:[s,o],initializePost:function(){this.fx=this.viz.fx,this.ntypes=this.viz.fx.nodeTypes,this.etypes=this.viz.fx.edgeTypes,this.hovered=!1,this.pressed=!1,this.touched=!1,this.touchMoved=!1,this.moved=!1},setAsProperty:e.lambda(!0),onMouseUp:function(t,n,r,i){var s=e.event.get(t,n);this.moved||(i?this.config.onRightClick(this.hovered,r,s):this.config.onClick(this.pressed,r,s)),this.pressed&&(this.moved?this.config.onDragEnd(this.pressed,r,s):this.config.onDragCancel(this.pressed,r,s),this.pressed=this.moved=!1)},onMouseOut:function(t,n,r){var i=e.event.get(t,n),s;if(this.dom&&(s=this.isLabel(t,n))){this.config.onMouseLeave(this.viz.graph.getNode(s.id),r,i),this.hovered=!1;return}var o=i.relatedTarget,u=this.canvas.getElement();while(o&&o.parentNode){if(u==o.parentNode)return;o=o.parentNode}this.hovered&&(this.config.onMouseLeave(this.hovered,r,i),this.hovered=!1)},onMouseOver:function(t,n,r){var i=e.event.get(t,n),s;this.dom&&(s=this.isLabel(t,n))&&(this.hovered=this.viz.graph.getNode(s.id),this.config.onMouseEnter(this.hovered,r,i))},onMouseMove:function(t,n,r){var i,s=e.event.get(t,n);if(this.pressed){this.moved=!0,this.config.onDragMove(this.pressed,r,s);return}if(this.dom)this.config.onMouseMove(this.hovered,r,s);else{if(this.hovered){var o=this.hovered,u=o.nodeFrom?this.etypes[o.getData("type")]:this.ntypes[o.getData("type")],a=u&&u.contains&&u.contains.call(this.fx,o,r.getPos());if(a){this.config.onMouseMove(o,r,s);return}this.config.onMouseLeave(o,r,s),this.hovered=!1}(this.hovered=r.getNode()||this.config.enableForEdges&&r.getEdge())?this.config.onMouseEnter(this.hovered,r,s):this.config.onMouseMove(!1,r,s)}},onMouseWheel:function(t,n,r){this.config.onMouseWheel(r,e.event.get(t,n))},onMouseDown:function(t,n,r){var i=e.event.get(t,n);this.pressed=r.getNode()||this.config.enableForEdges&&r.getEdge(),this.config.onDragStart(this.pressed,r,i)},onTouchStart:function(t,n,r){var i=e.event.get(t,n);this.touched=r.getNode()||this.config.enableForEdges&&r.getEdge(),this.config.onTouchStart(this.touched,r,i)},onTouchMove:function(t,n,r){var i=e.event.get(t,n);this.touched&&(this.touchMoved=!0,this.config.onTouchMove(this.touched,r,i))},onTouchEnd:function(t,n,r){var i=e.event.get(t,n);this.touched&&(this.touchMoved?this.config.onTouchEnd(this.touched,r,i):this.config.onTouchCancel(this.touched,r,i),this.touched=this.touchMoved=!1)}}),a.Classes.Tips=new t({Implements:[s,o],initializePost:function(){if(document.body){var t=e("_tooltip")||document.createElement("div");t.id="_tooltip",t.className="tip",e.extend(t.style,{position:"absolute",display:"none",zIndex:13e3}),document.body.appendChild(t),this.tip=t,this.node=!1}},setAsProperty:e.lambda(!0),onMouseOut:function(e,t){if(this.dom&&this.isLabel(e,t)){this.hide(!0);return}var n=e.relatedTarget,r=this.canvas.getElement();while(n&&n.parentNode){if(r==n.parentNode)return;n=n.parentNode}this.hide(!1)},onMouseOver:function(e,t){var n;this.dom&&(n=this.isLabel(e,t))&&(this.node=this.viz.graph.getNode(n.id),this.config.onShow(this.tip,this.node,n))},onMouseMove:function(t,n,r){this.dom&&this.isLabel(t,n)&&this.setTooltipPosition(e.event.getPos(t,n));if(!this.dom){var i=r.getNode();if(!i){this.hide(!0);return}if(this.config.force||!this.node||this.node.id!=i.id)this.node=i,this.config.onShow(this.tip,i,r.getContains());this.setTooltipPosition(e.event.getPos(t,n))}},setTooltipPosition:function(e){var t=this.tip,n=t.style,r=this.config;n.display="";var i={height:document.body.clientHeight,width:document.body.clientWidth},s={width:t.offsetWidth,height:t.offsetHeight},o=r.offsetX,u=r.offsetY;n.top=(e.y+u+s.height>i.height?e.y-s.height-u:e.y+u)+"px",n.left=(e.x+s.width+o>i.width?e.x-s.width-o:e.x+o)+"px"},hide:function(e){this.tip.style.display="none",e&&this.config.onHide()}}),a.Classes.NodeStyles=new
|
||
t({Implements:[s,o],initializePost:function(){this.fx=this.viz.fx,this.types=this.viz.fx.nodeTypes,this.nStyles=this.config,this.nodeStylesOnHover=this.nStyles.stylesHover,this.nodeStylesOnClick=this.nStyles.stylesClick,this.hoveredNode=!1,this.fx.nodeFxAnimation=new r,this.down=!1,this.move=!1},onMouseOut:function(e,t){this.down=this.move=!1;if(!this.hoveredNode)return;this.dom&&this.isLabel(e,t)&&this.toggleStylesOnHover(this.hoveredNode,!1);var n=e.relatedTarget,r=this.canvas.getElement();while(n&&n.parentNode){if(r==n.parentNode)return;n=n.parentNode}this.toggleStylesOnHover(this.hoveredNode,!1),this.hoveredNode=!1},onMouseOver:function(e,t){var n;if(this.dom&&(n=this.isLabel(e,t))){var r=this.viz.graph.getNode(n.id);if(r.selected)return;this.hoveredNode=r,this.toggleStylesOnHover(this.hoveredNode,!0)}},onMouseDown:function(e,t,n,r){if(r)return;var i;this.dom&&(i=this.isLabel(e,t))?this.down=this.viz.graph.getNode(i.id):this.dom||(this.down=n.getNode()),this.move=!1},onMouseUp:function(e,t,n,r){if(r)return;this.move||this.onClick(n.getNode()),this.down=this.move=!1},getRestoredStyles:function(e,t){var n={},r=this["nodeStylesOn"+t];for(var i in r)n[i]=e.styles["$"+i];return n},toggleStylesOnHover:function(e,t){this.nodeStylesOnHover&&this.toggleStylesOn("Hover",e,t)},toggleStylesOnClick:function(e,t){this.nodeStylesOnClick&&this.toggleStylesOn("Click",e,t)},toggleStylesOn:function(t,r,i){var s=this.viz,o=this.nStyles;if(i){var u=this;r.styles||(r.styles=e.merge(r.data,{}));for(var a in this["nodeStylesOn"+t]){var f="$"+a;f in r.styles||(r.styles[f]=r.getData(a))}s.fx.nodeFx(e.extend({elements:{id:r.id,properties:u["nodeStylesOn"+t]},transition:n.Quart.easeOut,duration:300,fps:40},this.config))}else{var l=this.getRestoredStyles(r,t);s.fx.nodeFx(e.extend({elements:{id:r.id,properties:l},transition:n.Quart.easeOut,duration:300,fps:40},this.config))}},onClick:function(e){if(!e)return;var t=this.nodeStylesOnClick;if(!t)return;e.selected?(this.toggleStylesOnClick(e,!1),delete e.selected):(this.viz.graph.eachNode(function(e){if(e.selected){for(var n in t)e.setData(n,e.styles["$"+n],"end");delete e.selected}}),this.toggleStylesOnClick(e,!0),e.selected=!0,delete e.hovered,this.hoveredNode=!1)},onMouseMove:function(e,t,n){this.down&&(this.move=!0);if(this.dom&&this.isLabel(e,t))return;var r=this.nodeStylesOnHover;if(!r)return;if(!this.dom){if(this.hoveredNode){var i=this.types[this.hoveredNode.getData("type")],s=i&&i.contains&&i.contains.call(this.fx,this.hoveredNode,n.getPos());if(s)return}var o=n.getNode();if(!this.hoveredNode&&!o)return;if(o.hovered)return;o&&!o.selected?(this.fx.nodeFxAnimation.stopTimer(),this.viz.graph.eachNode(function(e){if(e.hovered&&!e.selected){for(var t in r)e.setData(t,e.styles["$"+t],"end");delete e.hovered}}),o.hovered=!0,this.hoveredNode=o,this.toggleStylesOnHover(o,!0)):this.hoveredNode&&!this.hoveredNode.selected&&(this.fx.nodeFxAnimation.stopTimer(),this.toggleStylesOnHover(this.hoveredNode,!1),delete this.hoveredNode.hovered,this.hoveredNode=!1)}}}),a.Classes.Navigation=new t({Implements:[s,o],initializePost:function(){this.pos=!1,this.pressed=!1},onMouseWheel:function(t,n,r){if(!this.config.zooming)return;e.event.stop(e.event.get(t,n));var i=this.config.zooming/1e3,s=1+r*i;this.canvas.scale(s,s)},onMouseDown:function(e,t,n){if(!this.config.panning)return;if(this.config.panning=="avoid nodes"&&n.getNode())return;this.pressed=!0,this.pos=n.getPos();var r=this.canvas,i=r.translateOffsetX,s=r.translateOffsetY,o=r.scaleOffsetX,u=r.scaleOffsetY;this.pos.x*=o,this.pos.x+=i,this.pos.y*=u,this.pos.y+=s},onMouseMove:function(e,t,n){if(!this.config.panning)return;if(!this.pressed)return;if(this.config.panning=="avoid nodes"&&n.getNode())return;var r=this.pos,i=n.getPos(),s=this.canvas,o=s.translateOffsetX,u=s.translateOffsetY,a=s.scaleOffsetX,f=s.scaleOffsetY;i.x*=a,i.y*=f,i.x+=o,i.y+=u;var l=i.x-r.x,c=i.y-r.y;this.pos=i,this.canvas.translate(l*1/a,c*1/f)},onMouseUp:function(e,t,n,r){if(!this.config.panning)return;this.pressed=!1}});var f;(function(){function i(t,n){var i=document.createElement(t);for(var s in n)typeof n[s]=="object"?e.extend(i[s],n[s]):i[s]=n[s];return t=="canvas"&&!r&&G_vmlCanvasManager&&(i=G_vmlCanvasManager.initElement(document.body.appendChild(i))),i}var n=typeof HTMLCanvasElement,r=n=="object"||n=="function";$jit.Canvas=f=new t({canvases:[],pos:!1,element:!1,labelContainer:!1,translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(t,n){this.viz=t,this.opt=n;var r=e.type(n.injectInto)=="string"?n.injectInto:n.injectInto.id,s=r+"-label",o=e(r),u=n.width||o.offsetWidth,a=n.height||o.offsetHeight;this.id=r;var l={injectInto:r,width:u,height:a};this.element=i("div",{id:r+"-canvaswidget",style:{position:"relative",width:u+"px",height:a+"px"}}),this.labelContainer=this.createLabelContainer(n.Label.type,s,l),this.canvases.push(new f.Base({config:e.extend({idSuffix:"-canvas"},l),plot:function(e){t.fx.plot()},resize:function(){t.refresh()}}));var c=n.background;if(c){var h=new f.Background[c.type](t,e.extend(c,l));this.canvases.push(new f.Base(h))}var p=this.canvases.length;while(p--)this.element.appendChild(this.canvases[p].canvas),p>0&&this.canvases[p].plot();this.element.appendChild(this.labelContainer),o.appendChild(this.element);var d=null,v=this;e.addEvent(window,"scroll",function(){clearTimeout(d),d=setTimeout(function(){v.getPos(!0)},500)})},getCtx:function(e){return this.canvases[e||0].getCtx()},getConfig:function(){return this.opt},getElement:function(){return this.element},getSize:function(e){return this.canvases[e||0].getSize()},resize:function(e,t){this.getPos(!0),this.translateOffsetX=this.translateOffsetY=0,this.scaleOffsetX=this.scaleOffsetY=1;for(var n=0,r=this.canvases.length;n<r;n++)this.canvases[n].resize(e,t);var i=this.element.style;i.width=e+"px",i.height=t+"px",this.labelContainer&&(this.labelContainer.style.width=e+"px")},translate:function(e,t,n){this.translateOffsetX+=e*this.scaleOffsetX,this.translateOffsetY+=t*this.scaleOffsetY;for(var r=0,i=this.canvases.length;r<i;r++)this.canvases[r].translate(e,t,n)},scale:function(e,t,n){var r=this.scaleOffsetX*e,i=this.scaleOffsetY*t,s=this.translateOffsetX*(e-1)/r,o=this.translateOffsetY*(t-1)/i;this.scaleOffsetX=r,this.scaleOffsetY=i;for(var u=0,a=this.canvases.length;u<a;u++)this.canvases[u].scale(e,t,!0);this.translate(s,o,!1)},getPos:function(t){return t||!this.pos?this.pos=e.getPos(this.getElement()):this.pos},clear:function(e){this.canvases[e||0].clear()},path:function(e,t){var n=this.canvases[0].getCtx();n.beginPath(),t(n),n[e](),n.closePath()},createLabelContainer:function(e,t,n){var r="http://www.w3.org/2000/svg";if(e=="HTML"||e=="Native")return i("div",{id:t,style:{overflow:"visible",position:"absolute",top:0,left:0,width:n.width+"px",height:0}});if(e=="SVG"){var s=document.createElementNS(r,"svg:svg");s.setAttribute("width",n.width),s.setAttribute("height",n.height);var o=s.style;o.position="absolute",o.left=o.top="0px";var u=document.createElementNS(r,"svg:g");return u.setAttribute("width",n.width),u.setAttribute("height",n.height),u.setAttribute("x",0),u.setAttribute("y",0),u.setAttribute("id",t),s.appendChild(u),s}}}),f.Base=new t({translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(e){this.viz=e,this.opt=e.config,this.size=!1,this.createCanvas(),this.translateToCenter()},createCanvas:function(){var e=this.opt,t=e.width,n=e.height;this.canvas=i("canvas",{id:e.injectInto+e.idSuffix,width:t,height:n,style:{position:"absolute",top:0,left:0,width:t+"px",height:n+"px"}})},getCtx:function(){return this.ctx?this.ctx:this.ctx=this.canvas.getContext("2d")},getSize:function(){if(this.size)return this.size;var e=this.canvas;return this.size={width:e.width,height:e.height}},translateToCenter:function(e){var t=this.getSize(),n=e?t.width-e.width-this.translateOffsetX*2:t.width;height=e?t.height-e.height-this.translateOffsetY*2:t.height;var r=this.getCtx();e&&r.scale(1/this.scaleOffsetX,1/this.scaleOffsetY),r.translate(n/2,height/2)},resize:function(e,t){var n=this.getSize(),i=this.canvas,s=i.style;this.size=!1,i.width=e,i.height=t,s.width=e+"px",s.height=t+"px",r?this.translateToCenter():this.translateToCenter(n),this.translateOffsetX=this.translateOffsetY=0,this.scaleOffsetX=this.scaleOffsetY=1,this.clear(),this.viz.resize(e,t,this)},translate:function(e,t,n){var r=this.scaleOffsetX,i=this.scaleOffsetY;this.translateOffsetX+=e*r,this.translateOffsetY+=t*i,this.getCtx().translate(e,t),!n&&this.plot()},scale:function(e,t,n){this.scaleOffsetX*=e,this.scaleOffsetY*=t,this.getCtx().scale(e,t),!n&&this.plot()},clear:function(){var e=this.getSize(),t=this.translateOffsetX,n=this.translateOffsetY,r=this.scaleOffsetX,i=this.scaleOffsetY;this.getCtx().clearRect((-e.width/2-t)*1/r,(-e.height/2-n)*1/i,e.width*1/r,e.height*1/i)},plot:function(){this.clear(),this.viz.plot(this)}}),f.Background={},f.Background.Circles=new t({initialize:function(t,n){this.viz=t,this.config=e.merge({idSuffix:"-bkcanvas",levelDistance:100,numberOfCircles:6,CanvasStyles:{},offset:0},n)},resize:function(e,t,n){this.plot(n)},plot:function(e){var t=e.canvas,n=e.getCtx(),r=this.config,i=r.CanvasStyles;for(var s in i)n[s]=i[s];var o=r.numberOfCircles,u=r.levelDistance;for(var a=1;a<=o;a++)n.beginPath(),n.arc(0,0,u*a,0,2*Math.PI,!1),n.stroke(),n.closePath()}})})();var l=function(e,t){this.theta=e,this.rho=t};$jit.Polar=l,l.prototype={getc:function(e){return this.toComplex(e)},getp:function(){return this},set:function(e){e=e.getp(),this.theta=e.theta,this.rho=e.rho},setc:function(e,t){this.rho=Math.sqrt(e*e+t*t),this.theta=Math.atan2(t,e),this.theta<0&&(this.theta+=Math.PI*2)},setp:function(e,t){this.theta=e,this.rho=t},clone:function(){return new l(this.theta,this.rho)},toComplex:function(e){var t=Math.cos(this.theta)*this.rho,n=Math.sin(this.theta)*this.rho;return e?{x:t,y:n}:new h(t,n)},add:function(e){return new l(this.theta+e.theta,this.rho+e.rho)},scale:function(e){return new l(this.theta,this.rho*e)},equals:function(e){return this.theta==e.theta&&this.rho==e.rho},$add:function(e){return this.theta=this.theta+e.theta,this.rho+=e.rho,this},$madd:function(e){return this.theta=(this.theta+e.theta)%(Math.PI*2),this.rho+=e.rho,this},$scale:function(e){return this.rho*=e,this},interpolate:function(e,t){var n=Math.PI,r=n*2,i=function(e){var t=e<0?e%r+r:e%r;return t},s=this.theta,o=e.theta,u,a=Math.abs(s-o);a==n?s>o?u=i(o+(s-r-o)*t):u=i(o-r+(s-o)*t):a>=n?s>o?u=i(o+(s-r-o)*t):u=i(o-r+(s-(o-r))*t):u=i(o+(s-o)*t);var f=(this.rho-e.rho)*t+e.rho;return{theta:u,rho:f}}};var c=function(e,t){return new l(e,t)};l.KER=c(0,0);var h=function(e,t){this.x=e,this.y=t};$jit.Complex=h,h.prototype={getc:function(){return this},getp:function(e){return this.toPolar(e)},set:function(e){e=e.getc(!0),this.x=e.x,this.y=e.y},setc:function(e,t){this.x=e,this.y=t},setp:function(e,t){this.x=Math.cos(e)*t,this.y=Math.sin(e)*t},clone:function(){return new h(this.x,this.y)},toPolar:function(e){var t=this.norm(),n=Math.atan2(this.y,this.x);return n<0&&(n+=Math.PI*2),e?{theta:n,rho:t}:new l(n,t)},norm:function(){return Math.sqrt(this.squaredNorm())},squaredNorm:function(){return this.x*this.x+this.y*this.y},add:function(e){return new h(this.x+e.x,this.y+e.y)},prod:function(e){return new h(this.x*e.x-this.y*e.y,this.y*e.x+this.x*e.y)},conjugate:function(){return new h(this.x,-this.y)},scale:function(e){return new h(this.x*e,this.y*e)},equals:function(e){return this.x==e.x&&this.y==e.y},$add:function(e){return this.x+=e.x,this.y+=e.y,this},$prod:function(e){var t=this.x,n=this.y;return this.x=t*e.x-n*e.y,this.y=n*e.x+t*e.y,this},$conjugate:function(){return this.y=-this.y,this},$scale:function(e){return this.x*=e,this.y*=e,this},$div:function(e){var t=this.x,n=this.y,r=e.squaredNorm();return this.x=t*e.x+n*e.y,this.y=n*e.x-t*e.y,this.$scale(1/r)}};var p=function(e,t){return new h(e,t)};h.KER=p(0,0),$jit.Graph=new t({initialize:function(t,n,r,i){var s={complex:!1,Node:{}};this.Node=n,this.Edge=r,this.Label=i,this.opt=e.merge(s,t||{}),this.nodes={},this.edges={};var o=this;this.nodeList={};for(var u in v)o.nodeList[u]=function(e){return function(){var t=Array.prototype.slice.call(arguments);o.eachNode(function(n){n[e].apply(n,t)})}}(u)},getNode:function(e){return this.hasNode(e)?this.nodes[e]:!1},getByName:function(e){for(var t in this.nodes){var n=this.nodes[t];if(n.name==e)return n}return!1},getAdjacence:function(e,t){return e in this.edges?this.edges[e][t]:!1},addNode:function(t){if(!this.nodes[t.id]){var n=this.edges[t.id]={};this.nodes[t.id]=new d.Node(e.extend({id:t.id,name:t.name,data:e.merge(t.data||{},{}),adjacencies:n},this.opt.Node),this.opt.complex,this.Node,this.Edge,this.Label)}return this.nodes[t.id]},addAdjacence:function(e,t,n){this.hasNode(e.id)||this.addNode(e),this.hasNode(t.id)||this.addNode(t),e=this.nodes[e.id],t=this.nodes[t.id];if(!e.adjacentTo(t)){var r=this.edges[e.id]=this.edges[e.id]||{},i=this.edges[t.id]=this.edges[t.id]||{};return r[t.id]=i[e.id]=new d.Adjacence(e,t,n,this.Edge,this.Label),r[t.id]}return this.edges[e.id][t.id]},removeNode:function(e){if(this.hasNode(e)){delete this.nodes[e];var t=this.edges[e];for(var n in t)delete this.edges[n][e];delete this.edges[e]}},removeAdjacence:function(e,t){delete this.edges[e][t],delete this.edges[t][e]},hasNode:function(e){return e in this.nodes},empty:function(){this.nodes={},this.edges={}}});var d=$jit.Graph,v;(function(){var t=function(e,t,n,r,i){var s;n=n||"current",e="$"+(e?e+"-":""),n=="current"?s=this.data:n=="start"?s=this.startData:n=="end"&&(s=this.endData);var o=e+t;return r?s[o]:this.Config.overridable?o in s?s[o]:o in this.data?this.data[o]:i[t]||0:i[t]||0},n=function(e,t,n,r){r=r||"current",e="$"+(e?e+"-":"");var i;r=="current"?i=this.data:r=="start"?i=this.startData:r=="end"&&(i=this.endData),i[e+t]=n},r=function(t,n){t="$"+(t?t+"-":"");var r=this;e.each(n,function(e){var n=t+e;delete r.data[n],delete r.endData[n],delete r.startData[n]})};v={getData:function(e,n,r){return t.call(this,"",e,n,r,this.Config)},setData:function(e,t,r){n.call(this,"",e,t,r)},setDataset:function(t,n){t=e.splat(t);for(var r in n)for(var i=0,s=e.splat(n[r]),o=t.length;i<o;i++)this.setData(r,s[i],t[i])},removeData:function(){r.call(this,"",Array.prototype.slice.call(arguments))},getCanvasStyle:function(e,n,r){return t.call(this,"canvas",e,n,r,this.Config.CanvasStyles)},setCanvasStyle:function(e,t,r){n.call(this,"canvas",e,t,r)},setCanvasStyles:function(t,n){t=e.splat(t);for(var r in n)for(var i=0,s=e.splat(n[r]),o=t.length;i<o;i++)this.setCanvasStyle(r,s[i],t[i])},removeCanvasStyle:function(){r.call(this,"canvas",Array.prototype.slice.call(arguments))},getLabelData:function(e,n,r){return t.call(this,"label",e,n,r,this.Label)},setLabelData:function(e,t,r){n.call(this,"label",e,t,r)},setLabelDataset:function(t,n){t=e.splat(t);for(var r in n)for(var i=0,s=e.splat(n[r]),o=t.length;i<o;i++)this.setLabelData(r,s[i],t[i])},removeLabelData:function(){r.call(this,"label",Array.prototype.slice.call(arguments))}}})(),d.Node=new t({initialize:function(t,n,r,i,s){var o={id:"",name:"",data:{},startData:{},endData:{},adjacencies:{},selected:!1,drawn:!1,exist:!1,angleSpan:{begin:0,end:0},pos:n&&p(0,0)||c(0,0),startPos:n&&p(0,0)||c(0,0),endPos:n&&p(0,0)||c(0,0)};e.extend(this,e.extend(o,t)),this.Config=this.Node=r,this.Edge=i,this.Label=s},adjacentTo:function(e){return e.id in this.adjacencies},getAdjacency:function(e){return this.adjacencies[e]},getPos:function(e){e=e||"current";if(e=="current")return this.pos;if(e=="end")return this.endPos;if(e=="start")return this.startPos},setPos:function(e,t){t=t||"current";var n;t=="current"?n=this.pos:t=="end"?n=this.endPos:t=="start"&&(n=this.startPos),n.set(e)}}),d.Node.implement(v),d.Adjacence=new t({initialize:function(e,t,n,r,i){this.nodeFrom=e,this.nodeTo=t,this.data=n||{},this.startData={},this.endData={},this.Config=this.Edge=r,this.Label=i}}),d.Adjacence.implement(v),d.Util={filter:function(t){if(!t||e.type(t)!="string")return function(){return!0};var n=t.split(" ");return function(e){for(var t=0;t<n.length;t++)if(e[n[t]])return!1;return!0}},getNode:function(e,t){return e.nodes[t]},eachNode:function(e,t,n){var r=this.filter(n);for(var i in e.nodes)r(e.nodes[i])&&t(e.nodes[i])},eachAdjacency:function(e,t,n){var r=e.adjacencies,i=this.filter(n);for(var s in r){var o=r[s];if(i(o)){if(o.nodeFrom!=e){var u=o.nodeFrom;o.nodeFrom=o.nodeTo,o.nodeTo=u}t(o,s)}}},computeLevels:function(e,t,n,r){n=n||0;var i=this.filter(r);this.eachNode(e,function(e){e._flag=!1,e._depth=-1},r);var s=e.getNode(t);s._depth=n;var o=[s];while(o.length!=0){var u=o.pop();u._flag=!0,this.eachAdjacency(u,function(e){var t=e.nodeTo;t._flag==0&&i(t)&&(t._depth<0&&(t._depth=u._depth+1+n),o.unshift(t))},r)}},eachBFS:function(e,t,n,r){var i=this.filter(r);this.clean(e);var s=[e.getNode(t)];while(s.length!=0){var o=s.pop();o._flag=!0,n(o,o._depth),this.eachAdjacency(o,function(e){var t=e.nodeTo;t._flag==0&&i(t)&&(t._flag=!0,s.unshift(t))},r)}},eachLevel:function(e,t,n,r,i){var s=e._depth,o=this.filter(i),u=this;n=n===!1?Number.MAX_VALUE-s:n,function a(e,t,n){var i=e._depth;i>=t&&i<=n&&o(e)&&r(e,i),i<n&&u.eachAdjacency(e,function(e){var r=e.nodeTo;r._depth>i&&a(r,t,n)})}(e,t+s,n+s)},eachSubgraph:function(e,t,n){this.eachLevel(e,0,!1,t,n)},eachSubnode:function(e,t,n){this.eachLevel(e,1,1,t,n)},anySubnode:function(t,n,r){var i=!1;n=n||e.lambda(!0);var s=e.type(n)=="string"?function(e){return e[n]}:n;return this.eachSubnode(t,function(e){s(e)&&(i=!0)},r),i},getSubnodes:function(t,n,r){var i=[],s=this;n=n||0;var o,u;return e.type(n)=="array"?(o=n[0],u=n[1]):(o=n,u=Number.MAX_VALUE-t._depth),this.eachLevel(t,o,u,function(e){i.push(e)},r),i},getParents:function(e){var t=[];return this.eachAdjacency(e,function(n){var r=n.nodeTo;r._depth<e._depth&&t.push(r)}),t},isDescendantOf:function(e,t){if(e.id==t)return!0;var n=this.getParents(e),r=!1;for(var i=0;!r&&i<n.length;i++)r=r||this.isDescendantOf(n[i],t);return r},clean:function(e){this.eachNode(e,function(e){e._flag=!1})},getClosestNodeToOrigin:function(e,t,n){return this.getClosestNodeToPos(e,l.KER,t,n)},getClosestNodeToPos:function(e,t,n,r){var i=null;n=n||"current",t=t&&t.getc(!0)||h.KER;var s=function(e,t){var n=e.x-t.x,r=e.y-t.y;return n*n+r*r};return this.eachNode(e,function(e){i=i==null||s(e.getPos(n).getc(!0),t)<s(i.getPos(n).getc(!0),t)?e:i},r),i}},e.each(["getNode","eachNode","computeLevels","eachBFS","clean","getClosestNodeToPos","getClosestNodeToOrigin"],function(e){d.prototype[e]=function(){return d.Util[e].apply(d.Util,[this].concat(Array.prototype.slice.call(arguments)))}}),e.each(["eachAdjacency","eachLevel","eachSubgraph","eachSubnode","anySubnode","getSubnodes","getParents","isDescendantOf"],function(e){d.Node.prototype[e]=function(){return d.Util[e].apply(d.Util,[this].concat(Array.prototype.slice.call(arguments)))}}),d.Op={options:{type:"nothing",duration:2e3,hideLabels:!0,fps:30},initialize:function(e){this.viz=e},removeNode:function(t,n){var r=this.viz,i=e.merge(this.options,r.controller,n),s=e.splat(t),o,u,a;switch(i.type){case"nothing":for(o=0;o<s.length;o++)r.graph.removeNode(s[o]);break;case"replot":this.removeNode(s,{type:"nothing"}),r.labels.clearLabels(),r.refresh(!0);break;case"fade:seq":case"fade":u=this;for(o=0;o<s.length;o++)a=r.graph.getNode(s[o]),a.setData("alpha",0,"end");r.fx.animate(e.merge(i,{modes:["node-property:alpha"],onComplete:function(){u.removeNode(s,{type:"nothing"}),r.labels.clearLabels(),r.reposition(),r.fx.animate(e.merge(i,{modes:["linear"]}))}}));break;case"fade:con":u=this;for(o=0;o<s.length;o++)a=r.graph.getNode(s[o]),a.setData("alpha",0,"end"),a.ignore=!0;r.reposition(),r.fx.animate(e.merge(i,{modes:["node-property:alpha","linear"],onComplete:function(){u.removeNode(s,{type:"nothing"})}}));break;case"iter":u=this,r.fx.sequence({condition:function(){return s.length!=0},step:function(){u.removeNode(s.shift(),{type:"nothing"}),r.labels.clearLabels()},onComplete:function(){i.onComplete()},duration:Math.ceil(i.duration/s.length)});break;default:this.doError()}},removeEdge:function(t,n){var r=this.viz,i=e.merge(this.options,r.controller,n),s=e.type(t[0])=="string"?[t]:t,o,u,a;switch(i.type){case"nothing":for(o=0;o<s.length;o++)r.graph.removeAdjacence(s[o][0],s[o][1]);break;case"replot":this.removeEdge(s,{type:"nothing"}),r.refresh(!0);break;case"fade:seq":case"fade":u=this;for(o=0;o<s.length;o++)a=r.graph.getAdjacence(s[o][0],s[o][1]),a&&a.setData("alpha",0,"end");r.fx.animate(e.merge(i,{modes:["edge-property:alpha"],onComplete:function(){u.removeEdge(s,{type:"nothing"}),r.reposition(),r.fx.animate(e.merge(i,{modes:["linear"]}))}}));break;case"fade:con":u=this;for(o=0;o<s.length;o++)a=r.graph.getAdjacence(s[o][0],s[o][1]),a&&(a.setData("alpha",0,"end"),a.ignore=!0);r.reposition(),r.fx.animate(e.merge(i,{modes:["edge-property:alpha","linear"],onComplete:function(){u.removeEdge(s,{type:"nothing"})}}));break;case"iter":u=this,r.fx.sequence({condition:function(){return s.length!=0},step:function(){u.removeEdge(s.shift(),{type:"nothing"}),r.labels.clearLabels()},onComplete:function(){i.onComplete()},duration:Math.ceil(i.duration/s.length)});break;default:this.doError()}},sum:function(t,n){var r=this.viz,i=e.merge(this.options,r.controller,n),s=r.root,o;r.root=n.id||r.root;switch(i.type){case"nothing":o=r.construct(t),o.eachNode(function(e){e.eachAdjacency(function(e){r.graph.addAdjacence(e.nodeFrom,e.nodeTo,e.data)})});break;case"replot":r.refresh(!0),this.sum(t,{type:"nothing"}),r.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,o=r.construct(t);var u=this.preprocessSum(o),a=u?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];r.reposition(),i.type!="fade:con"?r.fx.animate(e.merge(i,{modes:["linear"],onComplete:function(){r.fx.animate(e.merge(i,{modes:a,onComplete:function(){i.onComplete()}}))}})):(r.graph.eachNode(function(e){e.id!=s&&e.pos.getp().equals(l.KER)&&(e.pos.set(e.endPos),e.startPos.set(e.endPos))}),r.fx.animate(e.merge(i,{modes:["linear"].concat(a)})));break;default:this.doError()}},morph:function(t,n,r){var i=this.viz,s=e.merge(this.options,i.controller,n),o=i.root,u;i.root=n.id||i.root;switch(s.type){case"nothing":u=i.construct(t),u.eachNode(function(e){var t=i.graph.hasNode(e.id);e.eachAdjacency(function(e){var t=!!i.graph.getAdjacence(e.nodeFrom.id,e.nodeTo.id);i.graph.addAdjacence(e.nodeFrom,e.nodeTo,e.data);if(t){var n=i.graph.getAdjacence(e.nodeFrom.id,e.nodeTo.id);for(var r in e.data||{})n.data[r]=e.data[r]}});if(t){var n=i.graph.getNode(e.id);for(var r in e.data||{})n.data[r]=e.data[r]}}),i.graph.eachNode(function(e){e.eachAdjacency(function(e){u.getAdjacence(e.nodeFrom.id,e.nodeTo.id)||i.graph.removeAdjacence(e.nodeFrom.id,e.nodeTo.id)}),u.hasNode(e.id)||i.graph.removeNode(e.id)});break;case"replot":i.labels.clearLabels(!0),this.morph(t,{type:"nothing"}),i.refresh(!0),i.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,u=i.construct(t);var a=r&&"node-property"in r&&e.map(e.splat(r["node-property"]),function(e){return"$"+e});i.graph.eachNode(function(t){var n=u.getNode(t.id);if(!n)t.setData("alpha",1),t.setData("alpha",1,"start"),t.setData("alpha",0,"end"),t.ignore=!0;else{var r=n.data;for(var i in r)a&&e.indexOf(a,i)>-1?t.endData[i]=r[i]:t.data[i]=r[i]}}),i.graph.eachNode(function(e){if(e.ignore)return;e.eachAdjacency(function(e){if(e.nodeFrom.ignore||e.nodeTo.ignore)return;var t=u.getNode(e.nodeFrom.id),n=u.getNode(e.nodeTo.id);if(!t.adjacentTo(n)){var e=i.graph.getAdjacence(t.id,n.id);f=!0,e.setData("alpha",1),e.setData("alpha",1,"start"),e.setData("alpha",0,"end")}})});var f=this.preprocessSum(u),c=f?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];c[0]=c[0]+(r&&"node-property"in r?":"+e.splat(r["node-property"]).join(":"):""),c[1]=(c[1]||"edge-property:alpha")+(r&&"edge-property"in r?":"+e.splat(r["edge-property"]).join(":"):""),r&&"label-property"in r&&c.push("label-property:"+e.splat(r["label-property"]).join(":")),i.reposition(),i.graph.eachNode(function(e){e.id!=o&&e.pos.getp().equals(l.KER)&&(e.pos.set(e.endPos),e.startPos.set(e.endPos))}),i.fx.animate(e.merge(s,{modes:["polar"].concat(c),onComplete:function(){i.graph.eachNode(function(e){e.ignore&&i.graph.removeNode(e.id)}),i.graph.eachNode(function(e){e.eachAdjacency(function(e){e.ignore&&i.graph.removeAdjacence(e.nodeFrom.id,e.nodeTo.id)})}),s.onComplete()}}));break;default:}},contract:function(t,n){var r=this.viz;if(t.collapsed||!t.anySubnode(e.lambda(!0)))return;n=e.merge(this.options,r.config,n||{},{modes:["node-property:alpha:span","linear"]}),t.collapsed=!0,function i(e){e.eachSubnode(function(e){e.ignore=!0,e.setData("alpha",0,n.type=="animate"?"end":"current"),i(e)})}(t),n.type=="animate"?(r.compute("end"),r.rotated&&r.rotate(r.rotated,"none",{property:"end"}),function s(e){e.eachSubnode(function(e){e.setPos(t.getPos("end"),"end"),s(e)})}(t),r.fx.animate(n)):n.type=="replot"&&r.refresh()},expand:function(t,n){if(!("collapsed"in t))return;var r=this.viz;n=e.merge(this.options,r.config,n||{},{modes:["node-property:alpha:span","linear"]}),delete t.collapsed,function i(e){e.eachSubnode(function(e){delete e.ignore,e.setData("alpha",1,n.type=="animate"?"end":"current"),i(e)})}(t),n.type=="animate"?(r.compute("end"),r.rotated&&r.rotate(r.rotated,"none",{property:"end"}),r.fx.animate(n)):n.type=="replot"&&r.refresh()},preprocessSum:function(e){var t=this.viz;e.eachNode(function(e){if(!t.graph.hasNode(e.id)){t.graph.addNode(e);var n=t.graph.getNode(e.id);n.setData("alpha",0),n.setData("alpha",0,"start"),n.setData("alpha",1,"end")}});var n=!1;return e.eachNode(function(e){e.eachAdjacency(function(e){var r=t.graph.getNode(e.nodeFrom.id),i=t.graph.getNode(e.nodeTo.id);if(!r.adjacentTo(i)){var e=t.graph.addAdjacence(r,i,e.data);r.startAlpha==r.endAlpha&&i.startAlpha==i.endAlpha&&(n=!0,e.setData("alpha",0),e.setData("alpha",0,"start"),e.setData("alpha",1,"end"))}})}),n}};var m={none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t,n,r){var i=r.getCtx();i.beginPath(),i.arc(t.x,t.y,n,0,Math.PI*2,!0),i.closePath(),i[e]()},contains:function(e,t,n){var r=e.x-t.x,i=e.y-t.y,s=r*r+i*i;return s<=n*n}},ellipse:{render:function(e,t,n,r,i){var s=i.getCtx();r/=2,n/=2,s.save(),s.scale(n/r,r/n),s.beginPath(),s.arc(t.x*(r/n),t.y*(n/r),r,0,Math.PI*2,!0),s.closePath(),s[e](),s.restore()},contains:function(e,t,n,r){n/=2,r/=2;var i=(n+r)/2,s=e.x-t.x,o=e.y-t.y,u=s*s+o*o;return u<=i*i}},square:{render:function(e,t,n,r){r.getCtx()[e+"Rect"](t.x-n,t.y-n,2*n,2*n)},contains:function(e,t,n){return Math.abs(t.x-e.x)<=n&&Math.abs(t.y-e.y)<=n}},rectangle:{render:function(e,t,n,r,i){i.getCtx()[e+"Rect"](t.x-n/2,t.y-r/2,n,r)},contains:function(e,t,n,r){return Math.abs(t.x-e.x)<=n/2&&Math.abs(t.y-e.y)<=r/2}},triangle:{render:function(e,t,n,r){var i=r.getCtx(),s=t.x,o=t.y-n,u=s-n,a=t.y+n,f=s+n,l=a;i.beginPath(),i.moveTo(s,o),i.lineTo(u,a),i.lineTo(f,l),i.closePath(),i[e]()},contains:function(e,t,n){return m.circle.contains(e,t,n)}},star:{render:function(e,t,n,r){var i=r.getCtx(),s=Math.PI/5;i.save(),i.translate(t.x,t.y),i.beginPath(),i.moveTo(n,0);for(var o=0;o<9;o++)i.rotate(s),o%2==0?i.lineTo(n/.525731*.200811,0):i.lineTo(n,0);i.closePath(),i[e](),i.restore()},contains:function(e,t,n){return m.circle.contains(e,t,n)}}},g={line:{render:function(e,t,n){var r=n.getCtx();r.beginPath(),r.moveTo(e.x,e.y),r.lineTo(t.x,t.y),r.stroke()},contains:function(e,t,n,r){var i=Math.min,s=Math.max,o=i(e.x,t.x),u=s(e.x,t.x),a=i(e.y,t.y),f=s(e.y,t.y);if(n.x>=o&&n.x<=u&&n.y>=a&&n.y<=f){if(Math.abs(t.x-e.x)<=r)return!0;var l=(t.y-e.y)/(t.x-e.x)*(n.x-e.x)+e.y;return Math.abs(l-n.y)<=r}return!1}},arrow:{render:function(e,t,n,r,i){var s=i.getCtx();if(r){var o=e;e=t,t=o}var u=new h(t.x-e.x,t.y-e.y);u.$scale(n/u.norm());var a=new h(t.x-u.x,t.y-u.y),f=new h(-u.y/2,u.x/2),l=a.add(f),c=a.$add(f.$scale(-1));s.beginPath(),s.moveTo(e.x,e.y),s.lineTo(t.x,t.y),s.stroke(),s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.lineTo(t.x,t.y),s.closePath(),s.fill()},contains:function(e,t,n,r){return g.line.contains(e,t,n,r)}},hyperline:{render:function(e,t,n,r){function f(e,t){var n=e.x*t.y-e.y*t.x,r=n,i=e.squaredNorm(),s=t.squaredNorm();if(n==0)return{x:0,y:0,ratio:-1};var o=(e.y*s-t.y*i+e.y-t.y)/n,u=(t.x*i-e.x*s+t.x-e.x)/r,a=-o/2,f=-u/2,l=(o*o+u*u)/4-1;if(l<0)return{x:0,y:0,ratio:-1};var c=Math.sqrt(l),h={x:a,y:f,ratio:c>1e3?-1:c,a:o,b:u};return h}function a(e,t){return e<t?e+Math.PI>t?!1:!0:t+Math.PI>e?!0:!1}var i=r.getCtx(),s=f(e,t);if(s.a>1e3||s.b>1e3||s.ratio<0)i.beginPath(),i.moveTo(e.x*n,e.y*n),i.lineTo(t.x*n,t.y*n),i.stroke();else{var o=Math.atan2(t.y-s.y,t.x-s.x),u=Math.atan2(e.y-s.y,e.x-s.x),a=a(o,u);i.beginPath(),i.arc(s.x*n,s.y*n,s.ratio*n,o,u,a),i.stroke()}},contains:e.lambda(!1)}};d.Plot={initialize:function(e,t){this.viz=e,this.config=e.config,this.node=e.config.Node,this.edge=e.config.Edge,this.animation=new r,this.nodeTypes=new t.Plot.NodeTypes,this.edgeTypes=new t.Plot.EdgeTypes,this.labels=e.labels},nodeHelper:m,edgeHelper:g,Interpolator:{map:{border:"color",color:"color",width:"number",height:"number",dim:"number",alpha:"number",lineWidth:"number",angularWidth:"number",span:"number",valueArray:"array-number",dimArray:"array-number"},canvas:{globalAlpha:"number",fillStyle:"color",strokeStyle:"color",lineWidth:"number",shadowBlur:"number",shadowColor:"color",shadowOffsetX:"number",shadowOffsetY:"number",miterLimit:"number"},label:{size:"number",color:"color"},compute:function(e,t,n){return e+(t-e)*n},moebius:function(e,t,n,r){var i=r.scale(-n);if(i.norm()<1){var s=i.x,o=i.y,u=e.startPos.getc().moebiusTransformation(i);e.pos.setc(u.x,u.y),i.x=s,i.y=o}},linear:function(e,t,n){var r=e.startPos.getc(!0),i=e.endPos.getc(!0);e.pos.setc(this.compute(r.x,i.x,n),this.compute(r.y,i.y,n))},polar:function(e,t,n){var r=e.startPos.getp(!0),i=e.endPos.getp(),s=i.interpolate(r,n);e.pos.setp(s.theta,s.rho)},number:function(e,t,n,r,i){var s=e[r](t,"start"),o=e[r](t,"end");e[i](t,this.compute(s,o,n))},color:function(t,n,r,i,s){var o=e.hexToRgb(t[i](n,"start")),u=e.hexToRgb(t[i](n,"end")),a=this.compute,f=e.rgbToHex([parseInt(a(o[0],u[0],r)),parseInt(a(o[1],u[1],r)),parseInt(a(o[2],u[2],r))]);t[s](n,f)},"array-number":function(e,t,n,r,i){var s=e[r](t,"start"),o=e[r](t,"end"),u=[];for(var a=0,f=s.length;a<f;a++){var l=s[a],c=o[a];if(l.length){for(var h=0,p=l.length,d=[];h<p;h++)d.push(this.compute(l[h],c[h],n));u.push(d)}else u.push(this.compute(l,c,n))}e[i](t,u)},node:function(e,t,n,r,i,s){r=this[r];if(t){var o=t.length;for(var u=0;u<o;u++){var a=t[u];this[r[a]](e,a,n,i,s)}}else for(var a in r)this[r[a]](e,a,n,i,s)},edge:function(e,t,n,r,i,s){var o=e.adjacencies;for(var u in o)this.node(o[u],t,n,r,i,s)},"node-property":function(e,t,n){this.node(e,t,n,"map","getData","setData")},"edge-property":function(e,t,n){this.edge(e,t,n,"map","getData","setData")},"label-property":function(e,t,n){this.node(e,t,n,"label","getLabelData","setLabelData")},"node-style":function(e,t,n){this.node(e,t,n,"canvas","getCanvasStyle","setCanvasStyle")},"edge-style":function(e,t,n){this.edge(e,t,n,"canvas","getCanvasStyle","setCanvasStyle")}},sequence:function(t){var n=this;t=e.merge({condition:e.lambda(!1),step:e.empty,onComplete:e.empty,duration:200},t||{});var r=setInterval(function(){t.condition()?t.step():(clearInterval(r),t.onComplete()),n.viz.refresh(!0)},t.duration)},prepare:function(t){var n=this.viz.graph,r={"node-property":{getter:"getData",setter:"setData"},"edge-property":{getter:"getData",setter:"setData"},"node-style":{getter:"getCanvasStyle",setter:"setCanvasStyle"},"edge-style":{getter:"getCanvasStyle",setter:"setCanvasStyle"}},i={};if(e.type(t)=="array")for(var s=0,o=t.length;s<o;s++){var u=t[s].split(":");i[u.shift()]=u}else for(var a in t)a=="position"?i[t.position]=[]:i[a]=e.splat(t[a]);return n.eachNode(function(t){t.startPos.set(t.pos),e.each(["node-property","node-style"],function(e){if(e in i){var n=i[e];for(var s=0,o=n.length;s<o;s++)t[r[e].setter](n[s],t[r[e].getter](n[s]),"start")}}),e.each(["edge-property","edge-style"],function(e){if(e in i){var n=i[e];t.eachAdjacency(function(t){for(var i=0,s=n.length;i<s;i++)t[r[e].setter](n[i],t[r[e].getter](n[i]),"start")})}})}),i},animate:function(t,n){t=e.merge(this.viz.config,t||{});var r=this,i=this.viz,s=i.graph,o=this.Interpolator,u=t.type==="nodefx"?this.nodeFxAnimation:this.animation,a=this.prepare(t.modes);t.hideLabels&&this.labels.hideLabels(!0),u.setOptions(e.merge(t,{$animating:!1,compute:function(e){s.eachNode(function(t){for(var r in a)o[r](t,a[r],e,n)}),r.plot(t,this.$animating,e),this.$animating=!0},complete:function(){t.hideLabels&&r.labels.hideLabels(!1),r.plot(t),t.onComplete(),t.onAfterCompute()}})).start()},nodeFx:function(t){var n=this.viz
|
||
,r=n.graph,i=this.nodeFxAnimation,s=e.merge(this.viz.config,{elements:{id:!1,properties:{}},reposition:!1});t=e.merge(s,t||{},{onBeforeCompute:e.empty,onAfterCompute:e.empty}),i.stopTimer();var o=t.elements.properties;if(!t.elements.id)r.eachNode(function(e){for(var t in o)e.setData(t,o[t],"end")});else{var u=e.splat(t.elements.id);e.each(u,function(e){var t=r.getNode(e);if(t)for(var n in o)t.setData(n,o[n],"end")})}var a=[];for(var f in o)a.push(f);var l=["node-property:"+a.join(":")];t.reposition&&(l.push("linear"),n.compute("end")),this.animate(e.merge(t,{modes:l,type:"nodefx"}))},plot:function(e,t){var n=this.viz,r=n.graph,i=n.canvas,s=n.root,o=this,u=i.getCtx(),a=Math.min,e=e||this.viz.controller;e.clearCanvas&&i.clear();var f=r.getNode(s);if(!f)return;var l=!!f.visited;r.eachNode(function(n){var r=n.getData("alpha");n.eachAdjacency(function(s){var f=s.nodeTo;!!f.visited===l&&n.drawn&&f.drawn&&(!t&&e.onBeforePlotLine(s),u.save(),u.globalAlpha=a(r,f.getData("alpha"),s.getData("alpha")),o.plotLine(s,i,t),u.restore(),!t&&e.onAfterPlotLine(s))}),u.save(),n.drawn&&(!t&&e.onBeforePlotNode(n),o.plotNode(n,i,t),!t&&e.onAfterPlotNode(n)),!o.labelsHidden&&e.withLabels&&(n.drawn&&r>=.95?o.labels.plotLabel(i,n,e):o.labels.hideLabel(n,!1)),u.restore(),n.visited=!l})},plotTree:function(e,t,n){var r=this,i=this.viz,s=i.canvas,o=this.config,u=s.getCtx(),a=e.getData("alpha");e.eachSubnode(function(i){if(t.plotSubtree(e,i)&&i.exist&&i.drawn){var o=e.getAdjacency(i.id);!n&&t.onBeforePlotLine(o),u.globalAlpha=Math.min(a,i.getData("alpha")),r.plotLine(o,s,n),!n&&t.onAfterPlotLine(o),r.plotTree(i,t,n)}}),e.drawn?(!n&&t.onBeforePlotNode(e),this.plotNode(e,s,n),!n&&t.onAfterPlotNode(e),!t.hideLabels&&t.withLabels&&a>=.95?this.labels.plotLabel(s,e,t):this.labels.hideLabel(e,!1)):this.labels.hideLabel(e,!0)},plotNode:function(e,t,n){var r=e.getData("type"),i=this.node.CanvasStyles;if(r!="none"){var s=e.getData("lineWidth"),o=e.getData("color"),u=e.getData("alpha"),a=t.getCtx();a.lineWidth=s,a.fillStyle=a.strokeStyle=o,a.globalAlpha=u;for(var f in i)a[f]=e.getCanvasStyle(f);this.nodeTypes[r].render.call(this,e,t,n)}},plotLine:function(e,t,n){var r=e.getData("type"),i=this.edge.CanvasStyles;if(r!="none"){var s=e.getData("lineWidth"),o=e.getData("color"),u=t.getCtx();u.lineWidth=s,u.fillStyle=u.strokeStyle=o;for(var a in i)u[a]=e.getCanvasStyle(a);this.edgeTypes[r].render.call(this,e,t,n)}}},d.Label={},d.Label.Native=new t({plotLabel:function(e,t,n){var r=e.getCtx(),i=t.pos.getc(!0);r.font=t.getLabelData("style")+" "+t.getLabelData("size")+"px "+t.getLabelData("family"),r.textAlign=t.getLabelData("textAlign"),r.fillStyle=r.strokeStyle=t.getLabelData("color"),r.textBaseline=t.getLabelData("textBaseline"),this.renderLabel(e,t,n)},renderLabel:function(e,t,n){var r=e.getCtx(),i=t.pos.getc(!0);r.fillText(t.name,i.x,i.y+t.getData("height")/2)},hideLabel:e.empty,hideLabels:e.empty}),d.Label.DOM=new t({labelsHidden:!1,labelContainer:!1,labels:{},getLabelContainer:function(){return this.labelContainer?this.labelContainer:this.labelContainer=document.getElementById(this.viz.config.labelContainer)},getLabel:function(e){return e in this.labels&&this.labels[e]!=null?this.labels[e]:this.labels[e]=document.getElementById(e)},hideLabels:function(e){var t=this.getLabelContainer();e?t.style.display="none":t.style.display="",this.labelsHidden=e},clearLabels:function(e){for(var t in this.labels)if(e||!this.viz.graph.hasNode(t))this.disposeLabel(t),delete this.labels[t]},disposeLabel:function(e){var t=this.getLabel(e);t&&t.parentNode&&t.parentNode.removeChild(t)},hideLabel:function(t,n){t=e.splat(t);var r=n?"":"none",i,s=this;e.each(t,function(e){var t=s.getLabel(e.id);t&&(t.style.display=r)})},fitsInCanvas:function(e,t){var n=t.getSize();return e.x>=n.width||e.x<0||e.y>=n.height||e.y<0?!1:!0}}),d.Label.HTML=new t({Implements:d.Label.DOM,plotLabel:function(e,t,n){var r=t.id,i=this.getLabel(r);if(!i&&!(i=document.getElementById(r))){i=document.createElement("div");var s=this.getLabelContainer();i.id=r,i.className="node",i.style.position="absolute",n.onCreateLabel(i,t),s.appendChild(i),this.labels[t.id]=i}this.placeLabel(i,t,n)}}),d.Label.SVG=new t({Implements:d.Label.DOM,plotLabel:function(e,t,n){var r=t.id,i=this.getLabel(r);if(!i&&!(i=document.getElementById(r))){var s="http://www.w3.org/2000/svg";i=document.createElementNS(s,"svg:text");var o=document.createElementNS(s,"svg:tspan");i.appendChild(o);var u=this.getLabelContainer();i.setAttribute("id",r),i.setAttribute("class","node"),u.appendChild(i),n.onCreateLabel(i,t),this.labels[t.id]=i}this.placeLabel(i,t,n)}}),d.Geom=new t({initialize:function(e){this.viz=e,this.config=e.config,this.node=e.config.Node,this.edge=e.config.Edge},translate:function(t,n){n=e.splat(n),this.viz.graph.eachNode(function(r){e.each(n,function(e){r.getPos(e).$add(t)})})},setRightLevelToShow:function(t,n,r){var i=this.getRightLevelToShow(t,n),s=this.viz.labels,o=e.merge({execShow:!0,execHide:!0,onHide:e.empty,onShow:e.empty},r||{});t.eachLevel(0,this.config.levelsToShow,function(e){var n=e._depth-t._depth;n>i?(o.onHide(e),o.execHide&&(e.drawn=!1,e.exist=!1,s.hideLabel(e,!1))):(o.onShow(e),o.execShow&&(e.exist=!0))}),t.drawn=!0},getRightLevelToShow:function(e,t){var n=this.config,r=n.levelsToShow,i=n.constrained;if(!i)return r;while(!this.treeFitsInCanvas(e,t,r)&&r>1)r--;return r}});var y={construct:function(t){var n=e.type(t)=="array",r=new d(this.graphOptions,this.config.Node,this.config.Edge,this.config.Label);return n?function(t,n){var r=function(e){for(var r=0,i=n.length;r<i;r++)if(n[r].id==e)return n[r];var s={id:e,name:e};return t.addNode(s)};for(var i=0,s=n.length;i<s;i++){t.addNode(n[i]);var o=n[i].adjacencies;if(o)for(var u=0,a=o.length;u<a;u++){var f=o[u],l={};typeof o[u]!="string"&&(l=e.merge(f.data,{}),f=f.nodeTo),t.addAdjacence(n[i],r(f),l)}}}(r,t):function(e,t){e.addNode(t);if(t.children)for(var n=0,r=t.children;n<r.length;n++)e.addAdjacence(t,r[n]),arguments.callee(e,r[n])}(r,t),r},loadJSON:function(t,n){this.json=t,this.labels&&this.labels.clearLabels&&this.labels.clearLabels(!0),this.graph=this.construct(t),e.type(t)!="array"?this.root=t.id:this.root=t[n?n:0].id},toJSON:function(e){e=e||"tree";if(e=="tree"){var t={},n=this.graph.getNode(this.root),t=function i(e){var t={};t.id=e.id,t.name=e.name,t.data=e.data;var n=[];return e.eachSubnode(function(e){n.push(i(e))}),t.children=n,t}(n);return t}var t=[],r=!!this.graph.getNode(this.root).visited;return this.graph.eachNode(function(e){var n={};n.id=e.id,n.name=e.name,n.data=e.data;var i=[];e.eachAdjacency(function(e){var t=e.nodeTo;if(!!t.visited===r){var n={};n.nodeTo=t.id,n.data=e.data,i.push(n)}}),n.adjacencies=i,t.push(n),e.visited=!r}),t}},b=$jit.Layouts={},w={label:null,compute:function(t,n,r){this.initializeLabel(r);var i=this.label,s=i.style;t.eachNode(function(t){var n=t.getData("autoWidth"),r=t.getData("autoHeight");if(n||r){delete t.data.$width,delete t.data.$height,delete t.data.$dim;var o=t.getData("width"),u=t.getData("height");s.width=n?"auto":o+"px",s.height=r?"auto":u+"px",i.innerHTML=t.name;var a=i.offsetWidth,f=i.offsetHeight,l=t.getData("type");if(e.indexOf(["circle","square","triangle","star"],l)===-1)t.setData("width",a),t.setData("height",f);else{var c=a>f?a:f;t.setData("width",c),t.setData("height",c),t.setData("dim",c)}}})},initializeLabel:function(e){this.label||(this.label=document.createElement("div"),document.body.appendChild(this.label)),this.setLabelStyles(e)},setLabelStyles:function(t){e.extend(this.label.style,{visibility:"hidden",position:"absolute",width:"auto",height:"auto"}),this.label.className="jit-autoadjust-label"}};b.Tree=function(){function r(e,t,n,r,i){var s=t.Node,o=t.multitree;if(s.overridable){var u=-1,a=-1;return e.eachNode(function(e){if(e._depth==n&&(!o||"$orn"in e.data&&e.data.$orn==r)){var t=e.getData("width",i),s=e.getData("height",i);u=u<t?t:u,a=a<s?s:a}}),{width:u<0?s.width:u,height:a<0?s.height:a}}return s}function i(e,t,n,r){var i=r=="left"||r=="right"?"y":"x";e.getPos(t)[i]+=n}function s(t,r){var i=[];return e.each(t,function(e){e=n.call(e),e[0]+=r,e[1]+=r,i.push(e)}),i}function o(e,t){if(e.length==0)return t;if(t.length==0)return e;var n=e.shift(),r=t.shift();return[[n[0],r[1]]].concat(o(e,t))}function u(e,t){t=t||[];if(e.length==0)return t;var n=e.pop();return u(e,o(n,t))}function a(e,t,n,r,i){if(e.length<=i||t.length<=i)return 0;var s=e[i][1],o=t[i][0];return Math.max(a(e,t,n,r,++i)+n,s-o+r)}function f(e,t,n){function r(e,i,u){if(i.length<=u)return[];var f=i[u],l=a(e,f,t,n,0);return[l].concat(r(o(e,s(f,l)),i,++u))}return r([],e,0)}function l(e,t,r){function i(e,n,u){if(n.length<=u)return[];var f=n[u],l=-a(f,e,t,r,0);return[l].concat(i(o(s(f,l),e),n,++u))}e=n.call(e);var u=i([],e.reverse(),0);return u.reverse()}function c(e,t,n,r){var i=f(e,t,n),s=l(e,t,n);r=="left"?s=i:r=="right"&&(i=s);for(var o=0,u=[];o<i.length;o++)u[o]=(i[o]+s[o])/2;return u}function h(e,t,n,o,a){function S(t,l,h){var p=t.getData(g,n),m=l||t.getData(y,n),x=[],T=[],N=!1,C=m+o.levelDistance;t.eachSubnode(function(t){if(t.exist&&(!f||"$orn"in t.data&&t.data.$orn==a)){N||(N=r(e,o,t._depth,a,n));var i=S(t,N[y],h+C);x.push(i.tree),T.push(i.extent)}});var k=c(T,w,b,E);for(var A=0,_=[],j=[];A<x.length;A++)i(x[A],n,k[A],a),j.push(s(T[A],k[A]));var F=[[-p/2,p/2]].concat(u(j));return t.getPos(n)[d]=0,a=="top"||a=="left"?t.getPos(n)[v]=h:t.getPos(n)[v]=-h,{tree:t,extent:F}}var f=o.multitree,l=["x","y"],h=["width","height"],p=+(a=="left"||a=="right"),d=l[p],v=l[1-p],m=o.Node,g=h[p],y=h[1-p],b=o.siblingOffset,w=o.subtreeOffset,E=o.align;S(t,!1,0)}var n=Array.prototype.slice;return new t({compute:function(t,n){var r=t||"start",i=this.graph.getNode(this.root);e.extend(i,{drawn:!0,exist:!0,selected:!0}),w.compute(this.graph,r,this.config),(!!n||!("_depth"in i))&&this.graph.computeLevels(this.root,0,"ignore"),this.computePositions(i,r)},computePositions:function(t,n){var r=this.config,i=r.multitree,s=r.align,o=s!=="center"&&r.indent,u=r.orientation,a=i?["top","right","bottom","left"]:[u],f=this;e.each(a,function(e){h(f.graph,t,n,f.config,e,n);var r=["x","y"][+(e=="left"||e=="right")];(function u(t){t.eachSubnode(function(a){a.exist&&(!i||"$orn"in a.data&&a.data.$orn==e)&&(a.getPos(n)[r]+=t.getPos(n)[r],o&&(a.getPos(n)[r]+=s=="left"?o:-o),u(a))})})(t)})}})}(),$jit.ST=function(){function r(e){e=e||this.clickedNode;if(!this.config.constrained)return[];var t=this.geom,r=this.graph,i=this.canvas,s=e._depth,o=[];r.eachNode(function(t){t.exist&&!t.selected&&(t.isDescendantOf(e.id)?t._depth<=s&&o.push(t):o.push(t))});var u=t.getRightLevelToShow(e,i);e.eachLevel(u,u,function(e){e.exist&&!e.selected&&o.push(e)});for(var a=0;a<n.length;a++){var f=this.graph.getNode(n[a]);f.isDescendantOf(e.id)||o.push(f)}return o}function s(e){var t=[],n=this.config;return e=e||this.clickedNode,this.clickedNode.eachLevel(0,n.levelsToShow,function(e){!n.multitree||"$orn"in e.data||!e.anySubnode(function(e){return e.exist&&!e.drawn})?e.drawn&&!e.anySubnode("drawn")&&t.push(e):t.push(e)}),t}var n=[];return new t({Implements:[y,a,b.Tree],initialize:function(t){var n=$jit.ST,r={levelsToShow:2,levelDistance:30,constrained:!0,Node:{type:"rectangle"},duration:700,offsetX:0,offsetY:0};this.controller=this.config=e.merge(i("Canvas","Fx","Tree","Node","Edge","Controller","Tips","NodeStyles","Events","Navigation","Label"),r,t);var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(s.background&&(s.background=e.merge({type:"Circles"},s.background)),this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!0},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new n.Label[s.Label.type](this),this.fx=new n.Plot(this,n),this.op=new n.Op(this),this.group=new n.Group(this),this.geom=new n.Geom(this),this.clickedNode=null,this.initializeExtras()},plot:function(){this.fx.plot(this.controller)},switchPosition:function(e,t,n){var r=this.geom,i=this.fx,s=this;i.busy||(i.busy=!0,this.contract({onComplete:function(){r.switchOrientation(e),s.compute("end",!1),i.busy=!1,t=="animate"?s.onClick(s.clickedNode.id,n):t=="replot"&&s.select(s.clickedNode.id,n)}},e))},switchAlignment:function(e,t,n){this.config.align=e,t=="animate"?this.select(this.clickedNode.id,n):t=="replot"&&this.onClick(this.clickedNode.id,n)},addNodeInPath:function(e){n.push(e),this.select(this.clickedNode&&this.clickedNode.id||this.root)},clearNodesInPath:function(e){n.length=0,this.select(this.clickedNode&&this.clickedNode.id||this.root)},refresh:function(){this.reposition(),this.select(this.clickedNode&&this.clickedNode.id||this.root)},reposition:function(){this.graph.computeLevels(this.root,0,"ignore"),this.geom.setRightLevelToShow(this.clickedNode,this.canvas),this.graph.eachNode(function(e){e.exist&&(e.drawn=!0)}),this.compute("end")},requestNodes:function(t,n){var r=e.merge(this.controller,n),i=this.config.levelsToShow;if(r.request){var s=[],o=t._depth;t.eachLevel(0,i,function(e){e.drawn&&!e.anySubnode()&&(s.push(e),e._level=i-(e._depth-o))}),this.group.requestNodes(s,r)}else r.onComplete()},contract:function(t,n){var i=this.config.orientation,s=this.geom,o=this.group;n&&s.switchOrientation(n);var u=r.call(this);n&&s.switchOrientation(i),o.contract(u,e.merge(this.controller,t))},move:function(t,n){this.compute("end",!1);var r=n.Move,i={x:r.offsetX,y:r.offsetY};r.enable&&this.geom.translate(t.endPos.add(i).$scale(-1),"end"),this.fx.animate(e.merge(this.controller,{modes:["linear"]},n))},expand:function(t,n){var r=s.call(this,t);this.group.expand(r,e.merge(this.controller,n))},selectPath:function(t){function i(t){if(t==null||t.selected)return;t.selected=!0,e.each(r.group.getSiblings([t])[t.id],function(e){e.exist=!0,e.drawn=!0});var n=t.getParents();n=n.length>0?n[0]:null,i(n)}var r=this;this.graph.eachNode(function(e){e.selected=!1});for(var s=0,o=[t.id].concat(n);s<o.length;s++)i(this.graph.getNode(o[s]))},setRoot:function(e,t,n){function u(){if(this.config.multitree&&o.data.$orn){var t=o.data.$orn,u={left:"right",right:"left",top:"bottom",bottom:"top"}[t];s.data.$orn=u,function a(t){t.eachSubnode(function(t){t.id!=e&&(t.data.$orn=u,a(t))})}(s),delete o.data.$orn}this.root=e,this.clickedNode=o,this.graph.computeLevels(this.root,0,"ignore"),this.geom.setRightLevelToShow(o,i,{execHide:!1,onShow:function(e){e.drawn||(e.drawn=!0,e.setData("alpha",1,"end"),e.setData("alpha",0),e.pos.setc(o.pos.x,o.pos.y))}}),this.compute("end"),this.busy=!0,this.fx.animate({modes:["linear","node-property:alpha"],onComplete:function(){r.busy=!1,r.onClick(e,{onComplete:function(){n&&n.onComplete()}})}})}if(this.busy)return;this.busy=!0;var r=this,i=this.canvas,s=this.graph.getNode(this.root),o=this.graph.getNode(e);delete s.data.$orns,t=="animate"?(u.call(this),r.selectPath(o)):t=="replot"&&(u.call(this),this.select(this.root))},addSubtree:function(t,n,r){n=="replot"?this.op.sum(t,e.extend({type:"replot"},r||{})):n=="animate"&&this.op.sum(t,e.extend({type:"fade:seq"},r||{}))},removeSubtree:function(t,n,r,i){var s=this.graph.getNode(t),o=[];s.eachLevel(+!n,!1,function(e){o.push(e.id)}),r=="replot"?this.op.removeNode(o,e.extend({type:"replot"},i||{})):r=="animate"&&this.op.removeNode(o,e.extend({type:"fade:seq"},i||{}))},select:function(t,n){var i=this.group,o=this.geom,u=this.graph.getNode(t),a=this.canvas,f=this.graph.getNode(this.root),l=e.merge(this.controller,n),c=this;l.onBeforeCompute(u),this.selectPath(u),this.clickedNode=u,this.requestNodes(u,{onComplete:function(){i.hide(i.prepare(r.call(c)),l),o.setRightLevelToShow(u,a),c.compute("current"),c.graph.eachNode(function(e){var t=e.pos.getc(!0);e.startPos.setc(t.x,t.y),e.endPos.setc(t.x,t.y),e.visited=!1});var e={x:l.offsetX,y:l.offsetY};c.geom.translate(u.endPos.add(e).$scale(-1),["start","current","end"]),i.show(s.call(c)),c.plot(),l.onAfterCompute(c.clickedNode),l.onComplete()}})},onClick:function(t,n){var r=this.canvas,i=this,s=this.geom,o=this.config,u={Move:{enable:!0,offsetX:o.offsetX||0,offsetY:o.offsetY||0},setRightLevelToShowConfig:!1,onBeforeRequest:e.empty,onBeforeContract:e.empty,onBeforeMove:e.empty,onBeforeExpand:e.empty},a=e.merge(this.controller,u,n);if(!this.busy){this.busy=!0;var f=this.graph.getNode(t);this.selectPath(f,this.clickedNode),this.clickedNode=f,a.onBeforeCompute(f),a.onBeforeRequest(f),this.requestNodes(f,{onComplete:function(){a.onBeforeContract(f),i.contract({onComplete:function(){s.setRightLevelToShow(f,r,a.setRightLevelToShowConfig),a.onBeforeMove(f),i.move(f,{Move:a.Move,onComplete:function(){a.onBeforeExpand(f),i.expand(f,{onComplete:function(){i.busy=!1,a.onAfterCompute(t),a.onComplete()}})}})}})}})}}})}(),$jit.ST.$extend=!0,$jit.ST.Op=new t({Implements:d.Op}),$jit.ST.Group=new t({initialize:function(e){this.viz=e,this.canvas=e.canvas,this.config=e.config,this.animation=new r,this.nodes=null},requestNodes:function(e,t){var n=0,r=e.length,i={},s=function(){t.onComplete()},o=this.viz;r==0&&s();for(var u=0;u<r;u++)i[e[u].id]=e[u],t.request(e[u].id,e[u]._level,{onComplete:function(e,t){t&&t.children&&(t.id=e,o.op.sum(t,{type:"nothing"})),++n==r&&(o.graph.computeLevels(o.root,0),s())}})},contract:function(t,n){var r=this.viz,i=this;t=this.prepare(t),this.animation.setOptions(e.merge(n,{$animating:!1,compute:function(e){e==1&&(e=.99),i.plotStep(1-e,n,this.$animating),this.$animating="contract"},complete:function(){i.hide(t,n)}})).start()},hide:function(t,n){var r=this.viz;for(var i=0;i<t.length;i++)t[i].eachLevel(1,!1,function(t){t.exist&&e.extend(t,{drawn:!1,exist:!1})});n.onComplete()},expand:function(t,n){var r=this;this.show(t),this.animation.setOptions(e.merge(n,{$animating:!1,compute:function(e){r.plotStep(e,n,this.$animating),this.$animating="expand"},complete:function(){r.plotStep(undefined,n,!1),n.onComplete()}})).start()},show:function(t){var n=this.config;this.prepare(t),e.each(t,function(e){if(n.multitree&&!("$orn"in e.data)){delete e.data.$orns;var t=" ";e.eachSubnode(function(e){"$orn"in e.data&&t.indexOf(e.data.$orn)<0&&e.exist&&!e.drawn&&(t+=e.data.$orn+" ")}),e.data.$orns=t}e.eachLevel(0,n.levelsToShow,function(e){e.exist&&(e.drawn=!0)})})},prepare:function(e){return this.nodes=this.getNodesWithChildren(e),this.nodes},getNodesWithChildren:function(e){var t=[],n=this.config,r=this.viz.root;e.sort(function(e,t){return(e._depth<=t._depth)-(e._depth>=t._depth)});for(var i=0;i<e.length;i++)if(e[i].anySubnode("exist")){for(var s=i+1,o=!1;!o&&s<e.length;s++)if(!n.multitree||"$orn"in e[s].data)o=o||e[i].isDescendantOf(e[s].id);o||t.push(e[i])}return t},plotStep:function(t,n,r){var i=this.viz,s=this.config,o=i.canvas,u=o.getCtx(),a=this.nodes,f,l,c={};for(f=0;f<a.length;f++){l=a[f],c[l.id]=[];var h=s.multitree&&!("$orn"in l.data),p=h&&l.data.$orns;l.eachSubgraph(function(e){h&&p&&p.indexOf(e.data.$orn)>0&&e.drawn?(e.drawn=!1,c[l.id].push(e)):(!h||!p)&&e.drawn&&(e.drawn=!1,c[l.id].push(e))}),l.drawn=!0}a.length>0&&i.fx.plot();for(f in c)e.each(c[f],function(e){e.drawn=!0});for(f=0;f<a.length;f++)l=a[f],u.save(),i.fx.plotSubtree(l,n,t,r),u.restore()},getSiblings:function(t){var n={};return e.each(t,function(e){var t=e.getParents();if(t.length==0)n[e.id]=[e];else{var r=[];t[0].eachSubnode(function(e){r.push(e)}),n[e.id]=r}}),n}}),$jit.ST.Geom=new t({Implements:d.Geom,switchOrientation:function(e){this.config.orientation=e},dispatch:function(){var e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.length,r=function(e){return typeof e=="function"?e():e};if(n==2)return t=="top"||t=="bottom"?r(e[0]):r(e[1]);if(n==4)switch(t){case"top":return r(e[0]);case"right":return r(e[1]);case"bottom":return r(e[2]);case"left":return r(e[3])}return undefined},getSize:function(e,t){var n=e.data,r=this.config,i=r.siblingOffset,s=r.multitree&&"$orn"in n&&n.$orn||r.orientation,o=e.getData("width")+i,u=e.getData("height")+i;return t?this.dispatch(s,o,u):this.dispatch(s,u,o)},getTreeBaseSize:function(e,t,n){var r=this.getSize(e,!0),i=0,s=this;return n(t,e)?r:t===0?0:(e.eachSubnode(function(e){i+=s.getTreeBaseSize(e,t-1,n)}),(r>i?r:i)+this.config.subtreeOffset)},getEdge:function(e,t,n){var r=function(t,n){return function(){return e.pos.add(new h(t,n))}},i=this.node,s=e.getData("width"),o=e.getData("height");if(t=="begin"){if(i.align=="center")return this.dispatch(n,r(0,o/2),r(-s/2,0),r(0,-o/2),r(s/2,0));if(i.align=="left")return this.dispatch(n,r(0,o),r(0,0),r(0,0),r(s,0));if(i.align=="right")return this.dispatch(n,r(0,0),r(-s,0),r(0,-o),r(0,0));throw"align: not implemented"}if(t=="end"){if(i.align=="center")return this.dispatch(n,r(0,-o/2),r(s/2,0),r(0,o/2),r(-s/2,0));if(i.align=="left")return this.dispatch(n,r(0,0),r(s,0),r(0,o),r(0,0));if(i.align=="right")return this.dispatch(n,r(0,-o),r(0,0),r(0,0),r(-s,0));throw"align: not implemented"}},getScaledTreePosition:function(e,t){var n=this.node,r=e.getData("width"),i=e.getData("height"),s=this.config.multitree&&"$orn"in e.data&&e.data.$orn||this.config.orientation,o=function(n,r){return function(){return e.pos.add(new h(n,r)).$scale(1-t)}};if(n.align=="left")return this.dispatch(s,o(0,i),o(0,0),o(0,0),o(r,0));if(n.align=="center")return this.dispatch(s,o(0,i/2),o(-r/2,0),o(0,-i/2),o(r/2,0));if(n.align=="right")return this.dispatch(s,o(0,0),o(-r,0),o(0,-i),o(0,0));throw"align: not implemented"},treeFitsInCanvas:function(e,t,n){var r=t.getSize(),i=this.config.multitree&&"$orn"in e.data&&e.data.$orn||this.config.orientation,s=this.dispatch(i,r.width,r.height),o=this.getTreeBaseSize(e,n,function(e,t){return e===0||!t.anySubnode()});return o<s}}),$jit.ST.Plot=new t({Implements:d.Plot,plotSubtree:function(t,n,r,i){var s=this.viz,o=s.canvas,u=s.config;r=Math.min(Math.max(.001,r),1);if(r>=0){t.drawn=!1;var a=o.getCtx(),f=s.geom.getScaledTreePosition(t,r);a.translate(f.x,f.y),a.scale(r,r)}this.plotTree(t,e.merge(n,{withLabels:!0,hideLabels:!!r,plotSubtree:function(e,n){var r=u.multitree&&!("$orn"in t.data),i=r&&t.getData("orns");return!r||i.indexOf(elem.getData("orn"))>-1}}),i),r>=0&&(t.drawn=!0)},getAlignedPos:function(e,t,n){var r=this.node,i,s;if(r.align=="center")i={x:e.x-t/2,y:e.y-n/2};else if(r.align=="left")s=this.config.orientation,s=="bottom"||s=="top"?i={x:e.x-t/2,y:e.y}:i={x:e.x,y:e.y-n/2};else{if(r.align!="right")throw"align: not implemented";s=this.config.orientation,s=="bottom"||s=="top"?i={x:e.x-t/2,y:e.y-n}:i={x:e.x-t,y:e.y-n/2}}return i},getOrientation:function(e){var t=this.config,n=t.orientation;if(t.multitree){var r=e.nodeFrom,i=e.nodeTo;n="$orn"in r.data&&r.data.$orn||"$orn"in i.data&&i.data.$orn}return n}}),$jit.ST.Label={},$jit.ST.Label.Native=new t({Implements:d.Label.Native,renderLabel:function(e,t,n){var r=e.getCtx(),i=t.pos.getc(!0);r.fillText(t.name,i.x,i.y)}}),$jit.ST.Label.DOM=new t({Implements:d.Label.DOM,placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.config,s=i.Node,o=this.viz.canvas,u=t.getData("width"),a=t.getData("height"),f=o.getSize(),l,c,h=o.translateOffsetX,p=o.translateOffsetY,d=o.scaleOffsetX,v=o.scaleOffsetY,m=r.x*d+h,g=r.y*v+p;if(s.align=="center")l={x:Math.round(m-u/2+f.width/2),y:Math.round(g-a/2+f.height/2)};else if(s.align=="left")c=i.orientation,c=="bottom"||c=="top"?l={x:Math.round(m-u/2+f.width/2),y:Math.round(g+f.height/2)}:l={x:Math.round(m+f.width/2),y:Math.round(g-a/2+f.height/2)};else{if(s.align!="right")throw"align: not implemented";c=i.orientation,c=="bottom"||c=="top"?l={x:Math.round(m-u/2+f.width/2),y:Math.round(g-a+f.height/2)}:l={x:Math.round(m-u+f.width/2),y:Math.round(g-a/2+f.height/2)}}var y=e.style;y.left=l.x+"px",y.top=l.y+"px",y.display=this.fitsInCanvas(l,o)?"":"none",n.onPlaceLabel(e,t)}}),$jit.ST.Label.SVG=new t({Implements:[$jit.ST.Label.DOM,d.Label.SVG],initialize:function(e){this.viz=e}}),$jit.ST.Label.HTML=new t({Implements:[$jit.ST.Label.DOM,d.Label.HTML],initialize:function(e){this.viz=e}}),$jit.ST.Plot.NodeTypes=new t({none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t){var n=e.getData("dim"),r=this.getAlignedPos(e.pos.getc(!0),n,n),i=n/2;this.nodeHelper.circle.render("fill",{x:r.x+i,y:r.y+i},i,t)},contains:function(e,t){var n=e.getData("dim"),r=this.getAlignedPos(e.pos.getc(!0),n,n),i=n/2;this.nodeHelper.circle.contains({x:r.x+i,y:r.y+i},i)}},square:{render:function(e,t){var n=e.getData("dim"),r=n/2,i=this.getAlignedPos(e.pos.getc(!0),n,n);this.nodeHelper.square.render("fill",{x:i.x+r,y:i.y+r},r,t)},contains:function(e,t){var n=e.getData("dim"),r=this.getAlignedPos(e.pos.getc(!0),n,n),i=n/2;this.nodeHelper.square.contains({x:r.x+i,y:r.y+i},i)}},ellipse:{render:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=this.getAlignedPos(e.pos.getc(!0),n,r);this.nodeHelper.ellipse.render("fill",{x:i.x+n/2,y:i.y+r/2},n,r,t)},contains:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=this.getAlignedPos(e.pos.getc(!0),n,r);this.nodeHelper.ellipse.contains({x:i.x+n/2,y:i.y+r/2},n,r,canvas)}},rectangle:{render:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=this.getAlignedPos(e.pos.getc(!0),n,r);this.nodeHelper.rectangle.render("fill",{x:i.x+n/2,y:i.y+r/2},n,r,t)},contains:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=this.getAlignedPos(e.pos.getc(!0),n,r);this.nodeHelper.rectangle.contains({x:i.x+n/2,y:i.y+r/2},n,r,canvas)}}}),$jit.ST.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n);this.edgeHelper.line.render(o,u,t)},contains:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n);return this.edgeHelper.line.contains(o,u,t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=e.getData("dim"),o=this.viz.geom.getEdge(r,"begin",n),u=this.viz.geom.getEdge(i,"end",n),a=e.data.$direction,f=a&&a.length>1&&a[0]!=r.id;this.edgeHelper.arrow.render(o,u,s,f,t)},contains:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n);return this.edgeHelper.arrow.contains(o,u,t,this.edge.epsilon)}},"quadratic:begin":{render:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n),a=e.getData("dim"),f=t.getCtx();f.beginPath(),f.moveTo(o.x,o.y);switch(n){case"left":f.quadraticCurveTo(o.x+a,o.y,u.x,u.y);break;case"right":f.quadraticCurveTo(o.x-a,o.y,u.x,u.y);break;case"top":f.quadraticCurveTo(o.x,o.y+a,u.x,u.y);break;case"bottom":f.quadraticCurveTo(o.x,o.y-a,u.x,u.y)}f.stroke()}},"quadratic:end":{render:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n),a=e.getData("dim"),f=t.getCtx();f.beginPath(),f.moveTo(o.x,o.y);switch(n){case"left":f.quadraticCurveTo(u.x-a,u.y,u.x,u.y);break;case"right":f.quadraticCurveTo(u.x+a,u.y,u.x,u.y);break;case"top":f.quadraticCurveTo(u.x,u.y-a,u.x,u.y);break;case"bottom":f.quadraticCurveTo(u.x,u.y+a,u.x,u.y)}f.stroke()}},bezier:{render:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n),a=e.getData("dim"),f=t.getCtx();f.beginPath(),f.moveTo(o.x,o.y);switch(n){case"left":f.bezierCurveTo(o.x+a,o.y,u.x-a,u.y,u.x,u.y);break;case"right":f.bezierCurveTo(o.x-a,o.y,u.x+a,u.y,u.x,u.y);break;case"top":f.bezierCurveTo(o.x,o.y+a,u.x,u.y-a,u.x,u.y);break;case"bottom":f.bezierCurveTo(o.x,o.y-a,u.x,u.y+a,u.x,u.y)}f.stroke()}}}),$jit.ST.Plot.NodeTypes.implement({"areachart-stacked":{render:function(t,n){var r=t.pos.getc(!0),i=t.getData("width"),s=t.getData("height"),o=this.getAlignedPos(r,i,s),u=o.x,a=o.y,f=t.getData("stringArray"),l=t.getData("dimArray"),c=t.getData("valueArray"),h=e.reduce(c,function(e,t){return e+t[0]},0),p=e.reduce(c,function(e,t){return e+t[1]},0),d=t.getData("colorArray"),v=d.length,m=t.getData("config"),g=t.getData("gradient"),y=m.showLabels,b=m.showAggregates,w=m.Label,E=t.getData("prev"),S=n.getCtx(),x=t.getData("border");if(d&&l&&f){for(var T=0,N=l.length,C=0,k=0,L=0;T<N;T++){S.fillStyle=S.strokeStyle=d[T%v],S.save();if(g&&(l[T][0]>0||l[T][1]>0)){var A=C+l[T][0],O=k+l[T][1],M=Math.atan((O-A)/i),_=55,D=S.createLinearGradient(u+i/2,a-(A+O)/2,u+i/2+_*Math.sin(M),a-(A+O)/2+_*Math.cos(M)),P=e.rgbToHex(e.map(e.hexToRgb(d[T%v].slice(1)),function(e){return e*.85>>0}));D.addColorStop(0,d[T%v]),D.addColorStop(1,P),S.fillStyle=D}S.beginPath(),S.moveTo(u,a-C),S.lineTo(u+i,a-k),S.lineTo(u+i,a-k-l[T][1]),S.lineTo(u,a-C-l[T][0]),S.lineTo(u,a-C),S.fill(),S.restore();if(x){var H=x.name==f[T],B=H?.7:.8,P=e.rgbToHex(e.map(e.hexToRgb(d[T%v].slice(1)),function(e){return e*B>>0}));S.strokeStyle=P,S.lineWidth=H?4:1,S.save(),S.beginPath(),x.index===0?(S.moveTo(u,a-C),S.lineTo(u,a-C-l[T][0])):(S.moveTo(u+i,a-k),S.lineTo(u+i,a-k-l[T][1])),S.stroke(),S.restore()}C+=l[T][0]||0,k+=l[T][1]||0,l[T][0]>0&&(L+=c[T][0]||0)}E&&w.type=="Native"&&(S.save(),S.beginPath(),S.fillStyle=S.strokeStyle=w.color,S.font=w.style+" "+w.size+"px "+w.family,S.textAlign="center",S.textBaseline="middle",b(t.name,h,p,t)&&S.fillText(L,u,a-C-m.labelOffset-w.size/2,i),y(t.name,h,p,t)&&S.fillText(t.name,u,a+w.size/2+m.labelOffset),S.restore())}},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height"),s=this.getAlignedPos(n,r,i),o=s.x,u=s.y,a=e.getData("dimArray"),f=t.x-o;if(t.x<o||t.x>o+r||t.y>u||t.y<u-i)return!1;for(var l=0,c=a.length,h=u,p=u;l<c;l++){var d=a[l];h-=d[0],p-=d[1];var v=h+(p-h)*f/r;if(t.y>=v){var m=+(f>r/2);return{name:e.getData("stringArray")[l],color:e.getData("colorArray")[l],value:e.getData("valueArray")[l][m],index:m}}}return!1}}}),$jit.AreaChart=new t({st:null,colors:["#416D9C","#70A35E","#EBB056","#C74243","#83548B","#909291","#557EAA"],selected:{},busy:!1,initialize:function(t){this.controller=this.config=e.merge(i("Canvas","Margin","Label","AreaChart"),{Label:{type:"Native"}},t);var n=this.config.showLabels,r=e.type(n),s=this.config.showAggregates,o=e.type(s);this.config.showLabels=r=="function"?n:e.lambda(n),this.config.showAggregates=o=="function"?s:e.lambda(s),this.initializeViz()},initializeViz:function(){var t=this.config,n=this,r=t.type.split(":")[0],i={},s=new $jit.ST({injectInto:t.injectInto,orientation:"bottom",levelDistance:0,siblingOffset:0,subtreeOffset:0,withLabels:t.Label.type!="Native",useCanvas:t.useCanvas,Label:{type:t.Label.type},Node:{overridable:!0,type:"areachart-"+r,align:"left",width:1,height:1},Edge:{type:"none"},Tips:{enable:t.Tips.enable,type:"Native",force:!0,onShow:function(e,n,r){var i=r;t.Tips.onShow(e,i,n)}},Events:{enable:!0,type:"Native",onClick:function(e,r,i){if(!t.filterOnClick&&!t.Events.enable)return;var s=r.getContains();s&&t.filterOnClick&&n.filter(s.name),t.Events.enable&&t.Events.onClick(s,r,i)},onRightClick:function(e,r,i){if(!t.restoreOnRightClick)return;n.restore()},onMouseMove:function(e,r,i){if(!t.selectOnHover)return;if(e){var s=r.getContains();n.select(e.id,s.name,s.index)}else n.select(!1,!1,!1)}},onCreateLabel:function(n,r){var s=t.Label,o=r.getData("valueArray"),u=e.reduce(o,function(e,t){return e+t[0]},0),a=e.reduce(o,function(e,t){return e+t[1]},0);if(r.getData("prev")){var f={wrapper:document.createElement("div"),aggregate:document.createElement("div"),label:document.createElement("div")},l=f.wrapper,c=f.label,h=f.aggregate,p=l.style,d=c.style,v=h.style;i[r.id]=f,l.appendChild(c),l.appendChild(h),t.showLabels(r.name,u,a,r)||(c.style.display="none"),t.showAggregates(r.name,u,a,r)||(h.style.display="none"),p.position="relative",p.overflow="visible",p.fontSize=s.size+"px",p.fontFamily=s.family,p.color=s.color,p.textAlign="center",v.position=d.position="absolute",n.style.width=r.getData("width")+"px",n.style.height=r.getData("height")+"px",c.innerHTML=r.name,n.appendChild(l)}},onPlaceLabel:function(n,r){if(!r.getData("prev"))return;var s=i[r.id],o=s.wrapper.style,u=s.label.style,a=s.aggregate.style,f=r.getData("width"),l=r.getData("height"),c=r.getData("dimArray"),h=r.getData("valueArray"),p=e.reduce(h,function(e,t){return e+t[0]},0),d=e.reduce(h,function(e,t){return e+t[1]},0),v=parseInt(o.fontSize,10),m=n.style;if(c&&h){t.showLabels(r.name,p,d,r)?u.display="":u.display="none",t.showAggregates(r.name,p,d,r)?a.display="":a.display="none",o.width=a.width=u.width=n.style.width=f+"px",a.left=u.left=-f/2+"px";for(var g=0,y=h.length,b=0,w=0;g<y;g++)c[g][0]>0&&(b+=h[g][0],w+=c[g][0]);a.top=-v-t.labelOffset+"px",u.top=t
|
||
.labelOffset+w+"px",n.style.top=parseInt(n.style.top,10)-w+"px",n.style.height=o.height=w+"px",s.aggregate.innerHTML=b}}}),o=s.canvas.getSize(),u=t.Margin;s.config.offsetY=-o.height/2+u.bottom+(t.showLabels&&t.labelOffset+t.Label.size),s.config.offsetX=(u.right-u.left)/2,this.st=s,this.canvas=this.st.canvas},loadJSON:function(t){var n=e.time(),r=[],i=this.st,s=e.splat(t.label),o=e.splat(t.color||this.colors),u=this.config,a=!!u.type.split(":")[1],f=u.animate;for(var l=0,c=t.values,h=c.length;l<h-1;l++){var p=c[l],d=c[l-1],v=c[l+1],m=e.splat(c[l].values),g=e.splat(c[l+1].values),y=e.zip(m,g),b=0,w=0;r.push({id:n+p.label,name:p.label,data:{value:y,$valueArray:y,$colorArray:o,$stringArray:s,$next:v.label,$prev:d?d.label:!1,$config:u,$gradient:a},children:[]})}var E={id:n+"$root",name:"",data:{$type:"none",$width:1,$height:1},children:r};i.loadJSON(E),this.normalizeDims(),i.compute(),i.select(i.root),f&&i.fx.animate({modes:["node-property:height:dimArray"],duration:1500})},updateJSON:function(t,n){if(this.busy)return;this.busy=!0;var r=this.st,i=r.graph,s=t.label&&e.splat(t.label),o=t.values,u=this.config.animate,a=this;e.each(o,function(t){var n=i.getByName(t.label);if(n){t.values=e.splat(t.values);var r=n.getData("stringArray"),o=n.getData("valueArray");e.each(o,function(e,n){e[0]=t.values[n],s&&(r[n]=s[n])}),n.setData("valueArray",o);var u=n.getData("prev"),a=n.getData("next"),f=i.getByName(a);if(u){var l=i.getByName(u);if(l){var o=l.getData("valueArray");e.each(o,function(e,n){e[1]=t.values[n]})}}if(!f){var o=n.getData("valueArray");e.each(o,function(e,n){e[1]=t.values[n]})}}}),this.normalizeDims(),r.compute(),r.select(r.root),u&&r.fx.animate({modes:["node-property:height:dimArray"],duration:1500,onComplete:function(){a.busy=!1,n&&n.onComplete()}})},filter:function(){if(this.busy)return;this.busy=!0,this.config.Tips.enable&&this.st.tips.hide(),this.select(!1,!1,!1);var t=Array.prototype.slice.call(arguments),n=this.st.graph.getNode(this.st.root),r=this;n.eachAdjacency(function(n){var r=n.nodeTo,i=r.getData("dimArray"),s=r.getData("stringArray");r.setData("dimArray",e.map(i,function(n,r){return e.indexOf(t,s[r])>-1?n:[0,0]}),"end")}),this.st.fx.animate({modes:["node-property:dimArray"],duration:1500,onComplete:function(){r.busy=!1}})},restore:function(){if(this.busy)return;this.busy=!0,this.config.Tips.enable&&this.st.tips.hide(),this.select(!1,!1,!1),this.normalizeDims();var e=this;this.st.fx.animate({modes:["node-property:height:dimArray"],duration:1500,onComplete:function(){e.busy=!1}})},select:function(e,t,n){if(!this.config.selectOnHover)return;var r=this.selected;if(r.id!=e||r.name!=t||r.index!=n){r.id=e,r.name=t,r.index=n,this.st.graph.eachNode(function(e){e.setData("border",!1)});if(e){var i=this.st.graph.getNode(e);i.setData("border",r);var s=n===0?"prev":"next";s=i.getData(s),s&&(i=this.st.graph.getByName(s),i&&i.setData("border",{name:t,index:1-n}))}this.st.plot()}},getLegend:function(){var t={},n;this.st.graph.getNode(this.st.root).eachAdjacency(function(e){n=e.nodeTo});var r=n.getData("colorArray"),i=r.length;return e.each(n.getData("stringArray"),function(e,n){t[e]=r[n%i]}),t},getMaxValue:function(){var t=0;return this.st.graph.eachNode(function(n){var r=n.getData("valueArray"),i=0,s=0;e.each(r,function(e){i+=+e[0],s+=+e[1]});var o=s>i?s:i;t=t>o?t:o}),t},normalizeDims:function(){var t=this.st.graph.getNode(this.st.root),n=0;t.eachAdjacency(function(){n++});var r=this.getMaxValue()||1,i=this.st.canvas.getSize(),s=this.config,o=s.Margin,u=s.labelOffset+s.Label.size,a=(i.width-(o.left+o.right))/n,f=s.animate,l=i.height-(o.top+o.bottom)-(s.showAggregates&&u)-(s.showLabels&&u);this.st.graph.eachNode(function(t){var n=0,i=0,s=[];e.each(t.getData("valueArray"),function(e){n+=+e[0],i+=+e[1],s.push([0,0])});var o=i>n?i:n;t.setData("width",a);if(f){t.setData("height",o*l/r,"end"),t.setData("dimArray",e.map(t.getData("valueArray"),function(e){return[e[0]*l/r,e[1]*l/r]}),"end");var u=t.getData("dimArray");u||t.setData("dimArray",s)}else t.setData("height",o*l/r),t.setData("dimArray",e.map(t.getData("valueArray"),function(e){return[e[0]*l/r,e[1]*l/r]}))})}}),i.BarChart={$extend:!0,animate:!0,type:"stacked",labelOffset:3,barsOffset:0,hoveredColor:"#9fd4ff",orientation:"horizontal",showAggregates:!0,showLabels:!0,Tips:{enable:!1,onShow:e.empty,onHide:e.empty},Events:{enable:!1,onClick:e.empty}},$jit.ST.Plot.NodeTypes.implement({"barchart-stacked":{render:function(t,n){var r=t.pos.getc(!0),i=t.getData("width"),s=t.getData("height"),o=this.getAlignedPos(r,i,s),u=o.x,a=o.y,f=t.getData("dimArray"),l=t.getData("valueArray"),c=t.getData("colorArray"),h=c.length,p=t.getData("stringArray"),d=n.getCtx(),v={},m=t.getData("border"),g=t.getData("gradient"),y=t.getData("config"),b=y.orientation=="horizontal",w=y.showAggregates,E=y.showLabels,S=y.Label;if(c&&f&&p){for(var x=0,T=f.length,N=0,C=0;x<T;x++){d.fillStyle=d.strokeStyle=c[x%h];if(g){var k;b?k=d.createLinearGradient(u+N+f[x]/2,a,u+N+f[x]/2,a+s):k=d.createLinearGradient(u,a-N-f[x]/2,u+i,a-N-f[x]/2);var L=e.rgbToHex(e.map(e.hexToRgb(c[x%h].slice(1)),function(e){return e*.5>>0}));k.addColorStop(0,L),k.addColorStop(.5,c[x%h]),k.addColorStop(1,L),d.fillStyle=k}b?d.fillRect(u+N,a,f[x],s):d.fillRect(u,a-N-f[x],i,f[x]),m&&m.name==p[x]&&(v.acum=N,v.dimValue=f[x]),N+=f[x]||0,C+=l[x]||0}m&&(d.save(),d.lineWidth=2,d.strokeStyle=m.color,b?d.strokeRect(u+v.acum+1,a+1,v.dimValue-2,s-2):d.strokeRect(u+1,a-v.acum-v.dimValue+1,i-2,v.dimValue-2),d.restore()),S.type=="Native"&&(d.save(),d.fillStyle=d.strokeStyle=S.color,d.font=S.style+" "+S.size+"px "+S.family,d.textBaseline="middle",w(t.name,C)&&(b?(d.textAlign="right",d.fillText(C,u+N-y.labelOffset,a+s/2)):(d.textAlign="center",d.fillText(C,u+i/2,a-s-S.size/2-y.labelOffset))),E(t.name,C,t)&&(b?(d.textAlign="center",d.translate(u-y.labelOffset-S.size/2,a+s/2),d.rotate(Math.PI/2),d.fillText(t.name,0,0)):(d.textAlign="center",d.fillText(t.name,u+i/2,a+S.size/2+y.labelOffset))),d.restore())}},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height"),s=this.getAlignedPos(n,r,i),o=s.x,u=s.y,a=e.getData("dimArray"),f=e.getData("config"),l=t.x-o,c=f.orientation=="horizontal";if(c){if(t.x<o||t.x>o+r||t.y>u+i||t.y<u)return!1}else if(t.x<o||t.x>o+r||t.y>u||t.y<u-i)return!1;for(var h=0,p=a.length,d=c?o:u;h<p;h++){var v=a[h];if(c){d+=v;var m=d;if(t.x<=m)return{name:e.getData("stringArray")[h],color:e.getData("colorArray")[h],value:e.getData("valueArray")[h],label:e.name}}else{d-=v;var m=d;if(t.y>=m)return{name:e.getData("stringArray")[h],color:e.getData("colorArray")[h],value:e.getData("valueArray")[h],label:e.name}}}return!1}},"barchart-grouped":{render:function(t,n){var r=t.pos.getc(!0),i=t.getData("width"),s=t.getData("height"),o=this.getAlignedPos(r,i,s),u=o.x,a=o.y,f=t.getData("dimArray"),l=t.getData("valueArray"),c=l.length,h=t.getData("colorArray"),p=h.length,d=t.getData("stringArray"),v=n.getCtx(),m={},g=t.getData("border"),y=t.getData("gradient"),b=t.getData("config"),w=b.orientation=="horizontal",E=b.showAggregates,S=b.showLabels,x=b.Label,T=(w?s:i)/c;if(h&&f&&d){for(var N=0,C=c,k=0,L=0;N<C;N++){v.fillStyle=v.strokeStyle=h[N%p];if(y){var A;w?A=v.createLinearGradient(u+f[N]/2,a+T*N,u+f[N]/2,a+T*(N+1)):A=v.createLinearGradient(u+T*N,a-f[N]/2,u+T*(N+1),a-f[N]/2);var O=e.rgbToHex(e.map(e.hexToRgb(h[N%p].slice(1)),function(e){return e*.5>>0}));A.addColorStop(0,O),A.addColorStop(.5,h[N%p]),A.addColorStop(1,O),v.fillStyle=A}w?v.fillRect(u,a+T*N,f[N],T):v.fillRect(u+T*N,a-f[N],T,f[N]),g&&g.name==d[N]&&(m.acum=T*N,m.dimValue=f[N]),k+=f[N]||0,L+=l[N]||0}g&&(v.save(),v.lineWidth=2,v.strokeStyle=g.color,w?v.strokeRect(u+1,a+m.acum+1,m.dimValue-2,T-2):v.strokeRect(u+m.acum+1,a-m.dimValue+1,T-2,m.dimValue-2),v.restore()),x.type=="Native"&&(v.save(),v.fillStyle=v.strokeStyle=x.color,v.font=x.style+" "+x.size+"px "+x.family,v.textBaseline="middle",E(t.name,L)&&(w?(v.textAlign="right",v.fillText(L,u+Math.max.apply(null,f)-b.labelOffset,a+s/2)):(v.textAlign="center",v.fillText(L,u+i/2,a-Math.max.apply(null,f)-x.size/2-b.labelOffset))),S(t.name,L,t)&&(w?(v.textAlign="center",v.translate(u-b.labelOffset-x.size/2,a+s/2),v.rotate(Math.PI/2),v.fillText(t.name,0,0)):(v.textAlign="center",v.fillText(t.name,u+i/2,a+x.size/2+b.labelOffset))),v.restore())}},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height"),s=this.getAlignedPos(n,r,i),o=s.x,u=s.y,a=e.getData("dimArray"),f=a.length,l=e.getData("config"),c=t.x-o,h=l.orientation=="horizontal",p=(h?i:r)/f;if(h){if(t.x<o||t.x>o+r||t.y>u+i||t.y<u)return!1}else if(t.x<o||t.x>o+r||t.y>u||t.y<u-i)return!1;for(var d=0,v=a.length;d<v;d++){var m=a[d];if(h){var g=u+p*d;if(t.x<=o+m&&t.y>=g&&t.y<=g+p)return{name:e.getData("stringArray")[d],color:e.getData("colorArray")[d],value:e.getData("valueArray")[d],label:e.name}}else{var g=o+p*d;if(t.x>=g&&t.x<=g+p&&t.y>=u-m)return{name:e.getData("stringArray")[d],color:e.getData("colorArray")[d],value:e.getData("valueArray")[d],label:e.name}}}return!1}}}),$jit.BarChart=new t({st:null,colors:["#416D9C","#70A35E","#EBB056","#C74243","#83548B","#909291","#557EAA"],selected:{},busy:!1,initialize:function(t){this.controller=this.config=e.merge(i("Canvas","Margin","Label","BarChart"),{Label:{type:"Native"}},t);var n=this.config.showLabels,r=e.type(n),s=this.config.showAggregates,o=e.type(s);this.config.showLabels=r=="function"?n:e.lambda(n),this.config.showAggregates=o=="function"?s:e.lambda(s),this.initializeViz()},initializeViz:function(){var t=this.config,n=this,r=t.type.split(":")[0],i=t.orientation=="horizontal",s={},o=new $jit.ST({injectInto:t.injectInto,orientation:i?"left":"bottom",levelDistance:0,siblingOffset:t.barsOffset,subtreeOffset:0,withLabels:t.Label.type!="Native",useCanvas:t.useCanvas,Label:{type:t.Label.type},Node:{overridable:!0,type:"barchart-"+r,align:"left",width:1,height:1},Edge:{type:"none"},Tips:{enable:t.Tips.enable,type:"Native",force:!0,onShow:function(e,n,r){var i=r;t.Tips.onShow(e,i,n)}},Events:{enable:!0,type:"Native",onClick:function(e,n,r){if(!t.Events.enable)return;var i=n.getContains();t.Events.onClick(i,n,r)},onMouseMove:function(e,r,i){if(!t.hoveredColor)return;if(e){var s=r.getContains();n.select(e.id,s.name,s.index)}else n.select(!1,!1,!1)}},onCreateLabel:function(n,r){var i=t.Label,o=r.getData("valueArray"),u=e.reduce(o,function(e,t){return e+t},0),a={wrapper:document.createElement("div"),aggregate:document.createElement("div"),label:document.createElement("div")},f=a.wrapper,l=a.label,c=a.aggregate,h=f.style,p=l.style,d=c.style;s[r.id]=a,f.appendChild(l),f.appendChild(c),t.showLabels(r.name,u,r)||(p.display="none"),t.showAggregates(r.name,u,r)||(d.display="none"),h.position="relative",h.overflow="visible",h.fontSize=i.size+"px",h.fontFamily=i.family,h.color=i.color,h.textAlign="center",d.position=p.position="absolute",n.style.width=r.getData("width")+"px",n.style.height=r.getData("height")+"px",d.left=p.left="0px",l.innerHTML=r.name,n.appendChild(f)},onPlaceLabel:function(e,n){if(!s[n.id])return;var r=s[n.id],i=r.wrapper.style,o=r.label.style,u=r.aggregate.style,a=t.type.split(":")[0]=="grouped",f=t.orientation=="horizontal",l=n.getData("dimArray"),c=n.getData("valueArray"),h=a&&f?Math.max.apply(null,l):n.getData("width"),p=a&&!f?Math.max.apply(null,l):n.getData("height"),d=parseInt(i.fontSize,10),v=e.style;if(l&&c){i.width=u.width=o.width=e.style.width=h+"px";for(var m=0,g=c.length,y=0;m<g;m++)l[m]>0&&(y+=c[m]);t.showLabels(n.name,y,n)?o.display="":o.display="none",t.showAggregates(n.name,y,n)?u.display="":u.display="none",t.orientation=="horizontal"?(u.textAlign="right",o.textAlign="left",o.textIndex=u.textIndent=t.labelOffset+"px",u.top=o.top=(p-d)/2+"px",e.style.height=i.height=p+"px"):(u.top=-d-t.labelOffset+"px",o.top=t.labelOffset+p+"px",e.style.top=parseInt(e.style.top,10)-p+"px",e.style.height=i.height=p+"px"),r.aggregate.innerHTML=y}}}),u=o.canvas.getSize(),a=t.Margin;i?(o.config.offsetX=u.width/2-a.left-(t.showLabels&&t.labelOffset+t.Label.size),o.config.offsetY=(a.bottom-a.top)/2):(o.config.offsetY=-u.height/2+a.bottom+(t.showLabels&&t.labelOffset+t.Label.size),o.config.offsetX=(a.right-a.left)/2),this.st=o,this.canvas=this.st.canvas},loadJSON:function(t){if(this.busy)return;this.busy=!0;var n=e.time(),r=[],i=this.st,s=e.splat(t.label),o=e.splat(t.color||this.colors),u=this.config,a=!!u.type.split(":")[1],f=u.animate,l=u.orientation=="horizontal",c=this;for(var h=0,p=t.values,d=p.length;h<d;h++){var v=p[h],m=e.splat(p[h].values),g=0;r.push({id:n+v.label,name:v.label,data:{value:m,$valueArray:m,$colorArray:o,$stringArray:s,$gradient:a,$config:u},children:[]})}var y={id:n+"$root",name:"",data:{$type:"none",$width:1,$height:1},children:r};i.loadJSON(y),this.normalizeDims(),i.compute(),i.select(i.root),f?l?i.fx.animate({modes:["node-property:width:dimArray"],duration:1500,onComplete:function(){c.busy=!1}}):i.fx.animate({modes:["node-property:height:dimArray"],duration:1500,onComplete:function(){c.busy=!1}}):this.busy=!1},updateJSON:function(t,n){if(this.busy)return;this.busy=!0;var r=this.st,i=r.graph,s=t.values,o=this.config.animate,u=this,a=this.config.orientation=="horizontal";e.each(s,function(n){var r=i.getByName(n.label);r&&(r.setData("valueArray",e.splat(n.values)),t.label&&r.setData("stringArray",e.splat(t.label)))}),this.normalizeDims(),r.compute(),r.select(r.root),o&&(a?r.fx.animate({modes:["node-property:width:dimArray"],duration:1500,onComplete:function(){u.busy=!1,n&&n.onComplete()}}):r.fx.animate({modes:["node-property:height:dimArray"],duration:1500,onComplete:function(){u.busy=!1,n&&n.onComplete()}}))},select:function(e,t){if(!this.config.hoveredColor)return;var n=this.selected;if(n.id!=e||n.name!=t)n.id=e,n.name=t,n.color=this.config.hoveredColor,this.st.graph.eachNode(function(t){e==t.id?t.setData("border",n):t.setData("border",!1)}),this.st.plot()},getLegend:function(){var t={},n;this.st.graph.getNode(this.st.root).eachAdjacency(function(e){n=e.nodeTo});var r=n.getData("colorArray"),i=r.length;return e.each(n.getData("stringArray"),function(e,n){t[e]=r[n%i]}),t},getMaxValue:function(){var t=0,n=this.config.type.split(":")[0]=="stacked";return this.st.graph.eachNode(function(r){var i=r.getData("valueArray"),s=0;if(!i)return;n?e.each(i,function(e){s+=+e}):s=Math.max.apply(null,i),t=t>s?t:s}),t},setBarType:function(e){this.config.type=e,this.st.config.Node.type="barchart-"+e.split(":")[0]},normalizeDims:function(){var t=this.st.graph.getNode(this.st.root),n=0;t.eachAdjacency(function(){n++});var r=this.getMaxValue()||1,i=this.st.canvas.getSize(),s=this.config,o=s.Margin,u=o.left+o.right,a=o.top+o.bottom,f=s.orientation=="horizontal",l=(i[f?"height":"width"]-(f?a:u)-(n-1)*s.barsOffset)/n,c=s.animate,h=i[f?"width":"height"]-(f?u:a)-(!f&&s.showAggregates&&s.Label.size+s.labelOffset)-(s.showLabels&&s.Label.size+s.labelOffset),p=f?"height":"width",d=f?"width":"height";this.st.graph.eachNode(function(t){var n=0,i=[];e.each(t.getData("valueArray"),function(e){n+=+e,i.push(0)}),t.setData(p,l);if(c){t.setData(d,n*h/r,"end"),t.setData("dimArray",e.map(t.getData("valueArray"),function(e){return e*h/r}),"end");var s=t.getData("dimArray");s||t.setData("dimArray",i)}else t.setData(d,n*h/r),t.setData("dimArray",e.map(t.getData("valueArray"),function(e){return e*h/r}))})}}),i.PieChart={$extend:!0,animate:!0,offset:25,sliceOffset:0,labelOffset:3,type:"stacked",hoveredColor:"#9fd4ff",Events:{enable:!1,onClick:e.empty},Tips:{enable:!1,onShow:e.empty,onHide:e.empty},showLabels:!0,resizeLabels:!1,updateHeights:!1},b.Radial=new t({compute:function(t){var n=e.splat(t||["current","start","end"]);w.compute(this.graph,n,this.config),this.graph.computeLevels(this.root,0,"ignore");var r=this.createLevelDistanceFunc();this.computeAngularWidths(n),this.computePositions(n,r)},computePositions:function(e,t){var n=e,r=this.graph,i=r.getNode(this.root),s=this.parent,o=this.config;for(var u=0,a=n.length;u<a;u++){var f=n[u];i.setPos(c(0,0),f),i.setData("span",Math.PI*2,f)}i.angleSpan={begin:0,end:2*Math.PI},r.eachBFS(this.root,function(e){var r=e.angleSpan.end-e.angleSpan.begin,i=e.angleSpan.begin,o=t(e),u=0,a=[],f={};e.eachSubnode(function(e){u+=e._treeAngularWidth;for(var t=0,r=n.length;t<r;t++){var i=n[t],s=e.getData("dim",i);f[i]=i in f?s>f[i]?s:f[i]:s}a.push(e)},"ignore"),s&&s.id==e.id&&a.length>0&&a[0].dist&&a.sort(function(e,t){return(e.dist>=t.dist)-(e.dist<=t.dist)});for(var l=0,h=a.length;l<h;l++){var p=a[l];if(!p._flag){var d=p._treeAngularWidth/u*r,v=i+d/2;for(var m=0,g=n.length;m<g;m++){var y=n[m];p.setPos(c(v,o),y),p.setData("span",d,y),p.setData("dim-quotient",p.getData("dim",y)/f[y],y)}p.angleSpan={begin:i,end:i+d},i+=d}}},"ignore")},setAngularWidthForNodes:function(e){this.graph.eachBFS(this.root,function(t,n){var r=t.getData("angularWidth",e[0])||5;t._angularWidth=r/n},"ignore")},setSubtreesAngularWidth:function(){var e=this;this.graph.eachNode(function(t){e.setSubtreeAngularWidth(t)},"ignore")},setSubtreeAngularWidth:function(e){var t=this,n=e._angularWidth,r=0;e.eachSubnode(function(e){t.setSubtreeAngularWidth(e),r+=e._treeAngularWidth},"ignore"),e._treeAngularWidth=Math.max(n,r)},computeAngularWidths:function(e){this.setAngularWidthForNodes(e),this.setSubtreesAngularWidth()}}),$jit.Sunburst=new t({Implements:[y,a,b.Radial],initialize:function(t){var n=$jit.Sunburst,r={interpolation:"linear",levelDistance:100,Node:{type:"multipie",height:0},Edge:{type:"none"},Label:{textAlign:"start",textBaseline:"middle"}};this.controller=this.config=e.merge(i("Canvas","Node","Edge","Fx","Tips","NodeStyles","Events","Navigation","Controller","Label"),r,t);var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(s.background&&(s.background=e.merge({type:"Circles"},s.background)),this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!1,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new n.Label[s.Label.type](this),this.fx=new n.Plot(this,n),this.op=new n.Op(this),this.json=null,this.root=null,this.rotated=null,this.busy=!1,this.initializeExtras()},createLevelDistanceFunc:function(){var e=this.config.levelDistance;return function(t){return(t._depth+1)*e}},refresh:function(){this.compute(),this.plot()},reposition:function(){this.compute("end")},rotate:function(e,t,n){var r=e.getPos(n.property||"current").getp(!0).theta;this.rotated=e,this.rotateAngle(-r,t,n)},rotateAngle:function(t,n,r){var i=this,s=e.merge(this.config,r||{},{modes:["polar"]}),o=r.property||(n==="animate"?"end":"current");n==="animate"&&this.fx.animation.pause(),this.graph.eachNode(function(e){var n=e.getPos(o);n.theta+=t,n.theta<0&&(n.theta+=Math.PI*2)}),n=="animate"?this.fx.animate(s):n=="replot"&&(this.fx.plot(),this.busy=!1)},plot:function(){this.fx.plot()}}),$jit.Sunburst.$extend=!0,function(n){n.Op=new t({Implements:d.Op}),n.Plot=new t({Implements:d.Plot}),n.Label={},n.Label.Native=new t({Implements:d.Label.Native,initialize:function(e){this.viz=e,this.label=e.config.Label,this.config=e.config},renderLabel:function(e,t,n){var r=t.getData("span");if(r<Math.PI/2&&Math.tan(r)*this.config.levelDistance*t._depth<10)return;var i=e.getCtx(),s=i.measureText(t.name);if(t.id==this.viz.root)var o=-s.width/2,u=0,a=0,f=0;else{var l=5,f=n.levelDistance-l,c=t.pos.clone();c.rho+=l;var h=c.getp(!0),p=c.getc(!0),o=p.x,u=p.y,d=Math.PI,v=h.theta>d/2&&h.theta<3*d/2,a=v?h.theta+d:h.theta;v?(o-=Math.abs(Math.cos(h.theta)*s.width),u+=Math.sin(h.theta)*s.width):t.id==this.viz.root&&(o-=s.width/2)}i.save(),i.translate(o,u),i.rotate(a),i.fillText(t.name,0,0),i.restore()}}),n.Label.SVG=new t({Implements:d.Label.SVG,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz,s=this.viz.canvas,o=s.getSize(),u={x:Math.round(r.x+o.width/2),y:Math.round(r.y+o.height/2)};e.setAttribute("x",u.x),e.setAttribute("y",u.y);var a=e.getBBox();if(a){var f=e.getAttribute("x"),l=e.getAttribute("y"),c=t.pos.getp(!0),h=Math.PI,p=c.theta>h/2&&c.theta<3*h/2;p?(e.setAttribute("x",f-a.width),e.setAttribute("y",l-a.height)):t.id==i.root&&e.setAttribute("x",f-a.width/2);var d=p?c.theta+h:c.theta;t._depth&&e.setAttribute("transform","rotate("+d*360/(2*h)+" "+f+" "+l+")")}n.onPlaceLabel(e,t)}}),n.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.clone(),i=this.viz.canvas,s=t.getData("height"),o=(s||t._depth==0?s:this.viz.config.levelDistance)/2,u=i.getSize();r.rho+=o,r=r.getc(!0);var a={x:Math.round(r.x+u.width/2),y:Math.round(r.y+u.height/2)},f=e.style;f.left=a.x+"px",f.top=a.y+"px",f.display=this.fitsInCanvas(a,i)?"":"none",n.onPlaceLabel(e,t)}}),n.Plot.NodeTypes=new t({none:{render:e.empty,contains:e.lambda(!1),anglecontains:function(e,t){var n=e.getData("span")/2,r=e.pos.theta,i=r-n,s=r+n;i<0&&(i+=Math.PI*2);var o=Math.atan2(t.y,t.x);return o<0&&(o+=Math.PI*2),i>s?o>i&&o<=Math.PI*2||o<s:o>i&&o<s}},pie:{render:function(e,t){var n=e.getData("span")/2,r=e.pos.theta,i=r-n,s=r+n,o=e.pos.getp(!0),u=new l(o.rho,i),a=u.getc(!0);u.theta=s;var f=u.getc(!0),c=t.getCtx();c.beginPath(),c.moveTo(0,0),c.lineTo(a.x,a.y),c.moveTo(0,0),c.lineTo(f.x,f.y),c.moveTo(0,0),c.arc(0,0,o.rho*e.getData("dim-quotient"),i,s,!1),c.fill()},contains:function(e,t){if(this.nodeTypes.none.anglecontains.call(this,e,t)){var n=Math.sqrt(t.x*t.x+t.y*t.y),r=this.config.levelDistance,i=e._depth;return n<=r*i}return!1}},multipie:{render:function(e,t){var n=e.getData("height"),r=n?n:this.config.levelDistance,i=e.getData("span")/2,s=e.pos.theta,o=s-i,u=s+i,a=e.pos.getp(!0),f=new l(a.rho,o),c=f.getc(!0);f.theta=u;var h=f.getc(!0);f.rho+=r;var p=f.getc(!0);f.theta=o;var d=f.getc(!0),v=t.getCtx();v.moveTo(0,0),v.beginPath(),v.arc(0,0,a.rho,o,u,!1),v.arc(0,0,a.rho+r,u,o,!0),v.moveTo(c.x,c.y),v.lineTo(d.x,d.y),v.moveTo(h.x,h.y),v.lineTo(p.x,p.y),v.fill(),e.collapsed&&(v.save(),v.lineWidth=2,v.moveTo(0,0),v.beginPath(),v.arc(0,0,a.rho+r+5,u-.01,o+.01,!0),v.stroke(),v.restore())},contains:function(e,t){if(this.nodeTypes.none.anglecontains.call(this,e,t)){var n=Math.sqrt(t.x*t.x+t.y*t.y),r=e.getData("height"),i=r?r:this.config.levelDistance,s=this.config.levelDistance,o=e._depth;return n>=s*o&&n<=s*o+i}return!1}},"gradient-multipie":{render:function(t,n){var r=n.getCtx(),i=t.getData("height"),s=i?i:this.config.levelDistance,o=r.createRadialGradient(0,0,t.getPos().rho,0,0,t.getPos().rho+s),u=e.hexToRgb(t.getData("color")),a=[];e.each(u,function(e){a.push(parseInt(e*.5,10))});var f=e.rgbToHex(a);o.addColorStop(0,f),o.addColorStop(1,t.getData("color")),r.fillStyle=o,this.nodeTypes.multipie.render.call(this,t,n)},contains:function(e,t){return this.nodeTypes.multipie.contains.call(this,e,t)}},"gradient-pie":{render:function(t,n){var r=n.getCtx(),i=r.createRadialGradient(0,0,0,0,0,t.getPos().rho),s=e.hexToRgb(t.getData("color")),o=[];e.each(s,function(e){o.push(parseInt(e*.5,10))});var u=e.rgbToHex(o);i.addColorStop(1,u),i.addColorStop(0,t.getData("color")),r.fillStyle=i,this.nodeTypes.pie.render.call(this,t,n)},contains:function(e,t){return this.nodeTypes.pie.contains.call(this,e,t)}}}),n.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);this.edgeHelper.line.render(n,r,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(n,r,t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("dim"),s=e.data.$direction,o=s&&s.length>1&&s[0]!=e.nodeFrom.id;this.edgeHelper.arrow.render(n,r,i,o,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.arrow.contains(n,r,t,this.edge.epsilon)}},hyperline:{render:function(e,t){var n=e.nodeFrom.pos.getc(),r=e.nodeTo.pos.getc(),i=Math.max(n.norm(),r.norm());this.edgeHelper.hyperline.render(n.$scale(1/i),r.$scale(1/i),i,t)},contains:e.lambda(!1)}})}($jit.Sunburst),$jit.Sunburst.Plot.NodeTypes.implement({"piechart-stacked":{render:function(t,n){var r=t.pos.getp(!0),i=t.getData("dimArray"),s=t.getData("valueArray"),o=t.getData("colorArray"),u=o.length,a=t.getData("stringArray"),f=t.getData("span")/2,c=t.pos.theta,h=c-f,p=c+f,d=new l,v=n.getCtx(),m={},g=t.getData("gradient"),y=t.getData("border"),b=t.getData("config"),w=b.showLabels,E=b.resizeLabels,S=b.Label,x=b.sliceOffset*Math.cos((h+p)/2),T=b.sliceOffset*Math.sin((h+p)/2);if(o&&i&&a){for(var N=0,C=i.length,k=0,L=0;N<C;N++){var A=i[N],O=o[N%u];if(A<=0)continue;v.fillStyle=v.strokeStyle=O;if(g&&A){var M=v.createRadialGradient(x,T,k+b.sliceOffset,x,T,k+A+b.sliceOffset),_=e.hexToRgb(O),D=e.map(_,function(e){return e*.8>>0}),P=e.rgbToHex(D);M.addColorStop(0,O),M.addColorStop(.5,O),M.addColorStop(1,P),v.fillStyle=M}d.rho=k+b.sliceOffset,d.theta=h;var H=d.getc(!0);d.theta=p;var B=d.getc(!0);d.rho+=A;var j=d.getc(!0);d.theta=h;var F=d.getc(!0);v.beginPath(),v.arc(x,T,k+.01,h,p,!1),v.arc(x,T,k+A+.01,p,h,!0),v.fill(),y&&y.name==a[N]&&(m.acum=k,m.dimValue=i[N],m.begin=h,m.end=p),k+=A||0,L+=s[N]||0}if(y){v.save(),v.globalCompositeOperation="source-over",v.lineWidth=2,v.strokeStyle=y.color;var I=h<p?1:-1;v.beginPath(),v.arc(x,T,m.acum+.01+1,m.begin,m.end,!1),v.arc(x,T,m.acum+m.dimValue+.01-1,m.end,m.begin,!0),v.closePath(),v.stroke(),v.restore()}if(w&&S.type=="Native"){v.save(),v.fillStyle=v.strokeStyle=S.color;var q=E?t.getData("normalizedDim"):1,R=S.size*q>>0;R=R<+E?+E:R,v.font=S.style+" "+R+"px "+S.family,v.textBaseline="middle",v.textAlign="center",d.rho=k+b.labelOffset+b.sliceOffset,d.theta=t.pos.theta;var U=d.getc(!0);v.fillText(t.name,U.x,U.y),v.restore()}}},contains:function(e,t){if(this.nodeTypes.none.anglecontains.call(this,e,t)){var n=Math.sqrt(t.x*t.x+t.y*t.y),r=this.config.levelDistance,i=e._depth,s=e.getData("config");if(n<=r*i+s.sliceOffset){var o=e.getData("dimArray");for(var u=0,a=o.length,f=s.sliceOffset;u<a;u++){var l=o[u];if(n>=f&&n<=f+l)return{name:e.getData("stringArray")[u],color:e.getData("colorArray")[u],value:e.getData("valueArray")[u],label:e.name};f+=l}}return!1}return!1}}}),$jit.PieChart=new t({sb:null,colors:["#416D9C","#70A35E","#EBB056","#C74243","#83548B","#909291","#557EAA"],selected:{},busy:!1,initialize:function(t){this.controller=this.config=e.merge(i("Canvas","PieChart","Label"),{Label:{type:"Native"}},t),this.initializeViz()},initializeViz:function(){var e=this.config,t=this,n=e.type.split(":")[0],r=new $jit.Sunburst({injectInto:e.injectInto,useCanvas:e.useCanvas,withLabels:e.Label.type!="Native",Label:{type:e.Label.type},Node:{overridable:!0,type:"piechart-"+n,width:1,height:1},Edge:{type:"none"},Tips:{enable:e.Tips.enable,type:"Native",force:!0,onShow:function(t,n,r){var i=r;e.Tips.onShow(t,i,n)}},Events:{enable:!0,type:"Native",onClick:function(t,n,r){if(!e.Events.enable)return;var i=n.getContains();e.Events.onClick(i,n,r)},onMouseMove:function(n,r,i){if(!e.hoveredColor)return;if(n){var s=r.getContains();t.select(n.id,s.name,s.index)}else t.select(!1,!1,!1)}},onCreateLabel:function(t,n){var r=e.Label;if(e.showLabels){var i=t.style;i.fontSize=r.size+"px",i.fontFamily=r.family,i.color=r.color,i.textAlign="center",t.innerHTML=n.name}},onPlaceLabel:function(n,r){if(!e.showLabels)return;var i=r.pos.getp(!0),s=r.getData("dimArray"),o=r.getData("span")/2,u=r.pos.theta,a=u-o,f=u+o,c=new l,h=e.showLabels,p=e.resizeLabels,d=e.Label;if(s){for(var v=0,m=s.length,g=0;v<m;v++)g+=s[v];var y=p?r.getData("normalizedDim"):1,b=d.size*y>>0;b=b<+p?+p:b,n.style.fontSize=b+"px",c.rho=g+e.labelOffset+e.sliceOffset,c.theta=(a+f)/2;var i=c.getc(!0),w=t.canvas.getSize(),E={x:Math.round(i.x+w.width/2),y:Math.round(i.y+w.height/2)};n.style.left=E.x+"px",n.style.top=E.y+"px"}}}),i=r.canvas.getSize(),s=Math.min;r.config.levelDistance=s(i.width,i.height)/2-e.offset-e.sliceOffset,this.sb=r,this.canvas=this.sb.canvas,this.canvas.getCtx().globalCompositeOperation="lighter"},loadJSON:function(t){var n=e.time(),r=[],i=this.sb,s=e.splat(t.label),o=s.length,u=e.splat(t.color||this.colors),a=u.length,f=this.config,l=!!f.type.split(":")[1],c=f.animate,h=o==1;for(var p=0,d=t.values,v=d.length;p<v;p++){var m=d[p],g=e.splat(m.values);r.push({id:n+m.label,name:m.label,data:{value:g,$valueArray:g,$colorArray:h?e.splat(u[p%a]):u,$stringArray:s,$gradient:l,$config:f,$angularWidth:e.reduce(g,function(e,t){return e+t})},children:[]})}var y={id:n+"$root",name:"",data:{$type:"none",$width:1,$height:1},children:r};i.loadJSON(y),this.normalizeDims(),i.refresh(),c&&i.fx.animate({modes:["node-property:dimArray"],duration:1500})},updateJSON:function(t,n){if(this.busy)return;this.busy=!0;var r=this.sb,i=r.graph,s=t.values,o=this.config.animate,u=this;e.each(s,function(n){var r=i.getByName(n.label),s=e.splat(n.values);r&&(r.setData("valueArray",s),r.setData("angularWidth",e.reduce(s,function(e,t){return e+t})),t.label&&r.setData("stringArray",e.splat(t.label)))}),this.normalizeDims(),o?(r.compute("end"),r.fx.animate({modes:["node-property:dimArray:span","linear"],duration:1500,onComplete:function(){u.busy=!1,n&&n.onComplete()}})):r.refresh()},select:function(e,t){if(!this.config.hoveredColor)return;var n=this.selected;if(n.id!=e||n.name!=t)n.id=e,n.name=t,n.color=this.config.hoveredColor,this.sb.graph.eachNode(function(t){e==t.id?t.setData("border",n):t.setData("border",!1)}),this.sb.plot()},getLegend:function(){var t={},n;this.sb.graph.getNode(this.sb.root).eachAdjacency(function(e){n=e.nodeTo});var r=n.getData("colorArray"),i=r.length;return e.each(n.getData("stringArray"),function(e,n){t[e]=r[n%i]}),t},getMaxValue:function(){var t=0;return this.sb.graph.eachNode(function(n){var r=n.getData("valueArray"),i=0;e.each(r,function(e){i+=+e}),t=t>i?t:i}),t},normalizeDims:function(){var t=this.sb.graph.getNode(this.sb.root),n=0;t.eachAdjacency(function(){n++});var r=this.getMaxValue()||1,i=this.config,s=i.animate,o=this.sb.config.levelDistance;this.sb.graph.eachNode(function(t){var n=0,u=[];e.each(t.getData("valueArray"),function(e){n+=+e,u.push(1)});var a=u.length==1&&!i.updateHeights;if(s){t.setData("dimArray",e.map(t.getData("valueArray"),function(e){return a?o:e*o/r}),"end");var f=t.getData("dimArray");f||t.setData("dimArray",u)}else t.setData("dimArray",e.map(t.getData("valueArray"),function(e){return a?o:e*o/r}));t.setData("normalizedDim",n/r)})}}),b.TM={},b.TM.SliceAndDice=new t({compute:function(e){var t=this.graph.getNode(this.clickedNode&&this.clickedNode.id||this.root);this.controller.onBeforeCompute(t);var n=this.canvas.getSize(),r=this.config,i=n.width,s=n.height;this.graph.computeLevels(this.root,0,"ignore"),t.getPos(e).setc(-i/2,-s/2),t.setData("width",i,e),t.setData("height",s+r.titleHeight,e),this.computePositions(t,t,this.layout.orientation,e),this.controller.onAfterCompute(t)},computePositions:function(e,t,n,r){var i=0;e.eachSubnode(function(e){i+=e.getData("area",r)});var s=this.config,o=s.offset,u=e.getData("width",r),a=e.getData("height",r)-s.titleHeight,f=e==t?1:t.getData("area",r)/i,l,c,h,p,d,v,m,g=n=="h";g?(n="v",l=a,c=u*f,h="height",p="y",d="x",v=s.titleHeight,m=0):(n="h",l=a*f,c=u,h="width",p="x",d="y",v=0,m=s.titleHeight);var y=t.getPos(r);t.setData("width",c,r),t.setData("height",l,r);var b=0,w=this;t.eachSubnode(function(e){var i=e.getPos(r);i[p]=b+y[p]+v,i[d]=y[d]+m,w.computePositions(t,e,n,r),b+=e.getData(h,r)})}}),b.TM.Area={compute:function(e){e=e||"current";var t=this.graph.getNode(this.clickedNode&&this.clickedNode.id||this.root);this.controller.onBeforeCompute(t);var n=this.config,r=this.canvas.getSize(),i=r.width,s=r.height,o=n.offset,u=i-o,a=s-o;this.graph.computeLevels(this.root,0,"ignore"),t.getPos(e).setc(-i/2,-s/2),t.setData("width",i,e),t.setData("height",s,e);var f={top:-s/2+n.titleHeight,left:-i/2,width:u,height:a-n.titleHeight};this.computePositions(t,f,e),this.controller.onAfterCompute(t)},computeDim:function(e,t,n,r,i,s){if(e.length+t.length==1){var o=e.length==1?e:t;this.layoutLast(o,n,r,s);return}e.length>=2&&t.length==0&&(t=[e.shift()]);if(e.length==0){t.length>0&&this.layoutRow(t,n,r,s);return}var u=e[0];if(i(t,n)>=i([u].concat(t),n))this.computeDim(e.slice(1),t.concat([u]),n,r,i,s);else{var a=this.layoutRow(t,n,r,s);this.computeDim(e,[],a.dim,a,i,s)}},worstAspectRatio:function(e,t){if(!e||e.length==0)return Number.MAX_VALUE;var n=0,r=0,i=Number.MAX_VALUE;for(var s=0,o=e.length;s<o;s++){var u=e[s]._area;n+=u,i=i<u?i:u,r=r>u?r:u}var a=t*t,f=n*n;return Math.max(a*r/f,f/(a*i))},avgAspectRatio:function(e,t){if(!e||e.length==0)return Number.MAX_VALUE;var n=0;for(var r=0,i=e.length;r<i;r++){var s=e[r]._area,o=s/t;n+=t>o?t/o:o/t}return n/i},layoutLast:function(e,t,n,r){var i=e[0];i.getPos(r).setc(n.left,n.top),i.setData("width"
|
||
,n.width,r),i.setData("height",n.height,r)}},b.TM.Squarified=new t({Implements:b.TM.Area,computePositions:function(e,t,n){var r=this.config;t.width>=t.height?this.layout.orientation="h":this.layout.orientation="v";var i=e.getSubnodes([1,1],"ignore");if(i.length>0){this.processChildrenLayout(e,i,t,n);for(var s=0,o=i.length;s<o;s++){var u=i[s],a=r.offset,f=u.getData("height",n)-a-r.titleHeight,l=u.getData("width",n)-a,c=u.getPos(n);t={width:l,height:f,top:c.y+r.titleHeight,left:c.x},this.computePositions(u,t,n)}}},processChildrenLayout:function(e,t,n,r){var i=n.width*n.height,s,o=t.length,u=0,a=[];for(s=0;s<o;s++)a[s]=parseFloat(t[s].getData("area",r)),u+=a[s];for(s=0;s<o;s++)t[s]._area=i*a[s]/u;var f=this.layout.horizontal()?n.height:n.width;t.sort(function(e,t){var n=t._area-e._area;return n?n:t.id==e.id?0:t.id<e.id?1:-1});var l=[t[0]],c=t.slice(1);this.squarify(c,l,f,n,r)},squarify:function(e,t,n,r,i){this.computeDim(e,t,n,r,this.worstAspectRatio,i)},layoutRow:function(e,t,n,r){return this.layout.horizontal()?this.layoutV(e,t,n,r):this.layoutH(e,t,n,r)},layoutV:function(t,n,r,i){var s=0,o=function(e){return e};e.each(t,function(e){s+=e._area});var u=o(s/n),a=0;for(var f=0,l=t.length;f<l;f++){var c=o(t[f]._area/u),h=t[f];h.getPos(i).setc(r.left,r.top+a),h.setData("width",u,i),h.setData("height",c,i),a+=c}var p={height:r.height,width:r.width-u,top:r.top,left:r.left+u};return p.dim=Math.min(p.width,p.height),p.dim!=p.height&&this.layout.change(),p},layoutH:function(t,n,r,i){var s=0;e.each(t,function(e){s+=e._area});var o=s/n,u=r.top,a=0;for(var f=0,l=t.length;f<l;f++){var c=t[f],n=c._area/o;c.getPos(i).setc(r.left+a,u),c.setData("width",n,i),c.setData("height",o,i),a+=n}var h={height:r.height-o,width:r.width,top:r.top+o,left:r.left};return h.dim=Math.min(h.width,h.height),h.dim!=h.width&&this.layout.change(),h}}),b.TM.Strip=new t({Implements:b.TM.Area,computePositions:function(e,t,n){var r=e.getSubnodes([1,1],"ignore"),i=this.config;if(r.length>0){this.processChildrenLayout(e,r,t,n);for(var s=0,o=r.length;s<o;s++){var u=r[s],a=i.offset,f=u.getData("height",n)-a-i.titleHeight,l=u.getData("width",n)-a,c=u.getPos(n);t={width:l,height:f,top:c.y+i.titleHeight,left:c.x},this.computePositions(u,t,n)}}},processChildrenLayout:function(e,t,n,r){var i=n.width*n.height,s,o=t.length,u=0,a=[];for(s=0;s<o;s++)a[s]=+t[s].getData("area",r),u+=a[s];for(s=0;s<o;s++)t[s]._area=i*a[s]/u;var f=this.layout.horizontal()?n.width:n.height,l=[t[0]],c=t.slice(1);this.stripify(c,l,f,n,r)},stripify:function(e,t,n,r,i){this.computeDim(e,t,n,r,this.avgAspectRatio,i)},layoutRow:function(e,t,n,r){return this.layout.horizontal()?this.layoutH(e,t,n,r):this.layoutV(e,t,n,r)},layoutV:function(t,n,r,i){var s=0;e.each(t,function(e){s+=e._area});var o=s/n,u=0;for(var a=0,f=t.length;a<f;a++){var l=t[a],c=l._area/o;l.getPos(i).setc(r.left,r.top+(n-c-u)),l.setData("width",o,i),l.setData("height",c,i),u+=c}return{height:r.height,width:r.width-o,top:r.top,left:r.left+o,dim:n}},layoutH:function(t,n,r,i){var s=0;e.each(t,function(e){s+=e._area});var o=s/n,u=r.height-o,a=0;for(var f=0,l=t.length;f<l;f++){var c=t[f],h=c._area/o;c.getPos(i).setc(r.left+a,r.top+u),c.setData("width",h,i),c.setData("height",o,i),a+=h}return{height:r.height-o,width:r.width,top:r.top,left:r.left,dim:n}}}),b.Icicle=new t({compute:function(e){e=e||"current";var t=this.graph.getNode(this.root),n=this.config,r=this.canvas.getSize(),i=r.width,s=r.height,o=n.offset,u=n.constrained?n.levelsToShow:Number.MAX_VALUE;this.controller.onBeforeCompute(t),d.Util.computeLevels(this.graph,t.id,0,"ignore");var a=0;d.Util.eachLevel(t,0,!1,function(e,t){t>a&&(a=t)});var f=this.graph.getNode(this.clickedNode&&this.clickedNode.id||t.id),l=Math.min(a,u-1),c=f._depth;this.layout.horizontal()?this.computeSubtree(f,-i/2,-s/2,i/(l+1),s,c,l,e):this.computeSubtree(f,-i/2,-s/2,i,s/(l+1),c,l,e)},computeSubtree:function(t,n,r,i,s,o,u,a){t.getPos(a).setc(n,r),t.setData("width",i,a),t.setData("height",s,a);var f,l=0,c=0,h=d.Util.getSubnodes(t,[1,1]);if(!h.length)return;e.each(h,function(e){c+=e.getData("dim")});for(var p=0,v=h.length;p<v;p++)this.layout.horizontal()?(f=s*h[p].getData("dim")/c,this.computeSubtree(h[p],n+i,r,i,f,o,u,a),r+=f):(f=i*h[p].getData("dim")/c,this.computeSubtree(h[p],n,r+s,f,s,o,u,a),n+=f)}}),$jit.Icicle=new t({Implements:[y,a,b.Icicle],layout:{orientation:"h",vertical:function(){return this.orientation=="v"},horizontal:function(){return this.orientation=="h"},change:function(){this.orientation=this.vertical()?"h":"v"}},initialize:function(t){var n={animate:!1,orientation:"h",offset:2,levelsToShow:Number.MAX_VALUE,constrained:!1,Node:{type:"rectangle",overridable:!0},Edge:{type:"none"},Label:{type:"Native"},duration:700,fps:45},r=i("Canvas","Node","Edge","Fx","Tips","NodeStyles","Events","Navigation","Controller","Label");this.controller=this.config=e.merge(r,n,t),this.layout.orientation=this.config.orientation;var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!0,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge,this.config.Label),this.labels=new $jit.Icicle.Label[this.config.Label.type](this),this.fx=new $jit.Icicle.Plot(this,$jit.Icicle),this.op=new $jit.Icicle.Op(this),this.group=new $jit.Icicle.Group(this),this.clickedNode=null,this.initializeExtras()},refresh:function(){var e=this.config.Label.type;if(e!="Native"){var t=this;this.graph.eachNode(function(e){t.labels.hideLabel(e,!1)})}this.compute(),this.plot()},plot:function(){this.fx.plot(this.config)},enter:function(e){if(this.busy)return;this.busy=!0;var t=this,n=this.config,r={onComplete:function(){n.request&&t.compute(),n.animate?(t.graph.nodeList.setDataset(["current","end"],{alpha:[1,0]}),d.Util.eachSubgraph(e,function(e){e.setData("alpha",1,"end")},"ignore"),t.fx.animate({duration:500,modes:["node-property:alpha"],onComplete:function(){t.clickedNode=e,t.compute("end"),t.fx.animate({modes:["linear","node-property:width:height"],duration:1e3,onComplete:function(){t.busy=!1,t.clickedNode=e}})}})):(t.clickedNode=e,t.busy=!1,t.refresh())}};n.request?this.requestNodes(clickedNode,r):r.onComplete()},out:function(){if(this.busy)return;var e=this,t=d.Util,n=this.config,r=this.graph,i=t.getParents(r.getNode(this.clickedNode&&this.clickedNode.id||this.root)),s=i[0],o=s,u=this.clickedNode;this.busy=!0,this.events.hoveredNode=!1;if(!s){this.busy=!1;return}callback={onComplete:function(){e.clickedNode=s,n.request?e.requestNodes(s,{onComplete:function(){e.compute(),e.plot(),e.busy=!1}}):(e.compute(),e.plot(),e.busy=!1)}},n.animate?(this.clickedNode=o,this.compute("end"),this.clickedNode=u,this.fx.animate({modes:["linear","node-property:width:height"],duration:1e3,onComplete:function(){e.clickedNode=o,r.nodeList.setDataset(["current","end"],{alpha:[0,1]}),t.eachSubgraph(u,function(e){e.setData("alpha",1)},"ignore"),e.fx.animate({duration:500,modes:["node-property:alpha"],onComplete:function(){callback.onComplete()}})}})):callback.onComplete()},requestNodes:function(t,n){var r=e.merge(this.controller,n),i=this.config.constrained?this.config.levelsToShow:Number.MAX_VALUE;if(r.request){var s=[],o=t._depth;d.Util.eachLevel(t,0,i,function(e){e.drawn&&!d.Util.anySubnode(e)&&(s.push(e),e._level=e._depth-o,this.config.constrained&&(e._level=i-e._level))}),this.group.requestNodes(s,r)}else r.onComplete()}}),$jit.Icicle.Op=new t({Implements:d.Op}),$jit.Icicle.Group=new t({initialize:function(e){this.viz=e,this.canvas=e.canvas,this.config=e.config},requestNodes:function(e,t){var n=0,r=e.length,i={},s=function(){t.onComplete()},o=this.viz;r==0&&s();for(var u=0;u<r;u++)i[e[u].id]=e[u],t.request(e[u].id,e[u]._level,{onComplete:function(e,t){t&&t.children&&(t.id=e,o.op.sum(t,{type:"nothing"})),++n==r&&(d.Util.computeLevels(o.graph,o.root,0),s())}})}}),$jit.Icicle.Plot=new t({Implements:d.Plot,plot:function(t,n){t=t||this.viz.controller;var r=this.viz,i=r.graph,s=i.getNode(r.clickedNode&&r.clickedNode.id||r.root),o=s._depth;r.canvas.clear(),this.plotTree(s,e.merge(t,{withLabels:!0,hideLabels:!1,plotSubtree:function(e,t){return!r.config.constrained||t._depth-o<r.config.levelsToShow}}),n)}}),$jit.Icicle.Label={},$jit.Icicle.Label.Native=new t({Implements:d.Label.Native,renderLabel:function(e,t,n){var r=e.getCtx(),i=t.getData("width"),s=t.getData("height"),o=t.getLabelData("size"),u=r.measureText(t.name);if(s<o*1.5||i<u.width)return;var a=t.pos.getc(!0);r.fillText(t.name,a.x+i/2,a.y+s/2)}}),$jit.Icicle.Label.SVG=new t({Implements:d.Label.SVG,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.getSize(),o={x:Math.round(r.x+s.width/2),y:Math.round(r.y+s.height/2)};e.setAttribute("x",o.x),e.setAttribute("y",o.y),n.onPlaceLabel(e,t)}}),$jit.Icicle.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.getSize(),o={x:Math.round(r.x+s.width/2),y:Math.round(r.y+s.height/2)},u=e.style;u.left=o.x+"px",u.top=o.y+"px",u.display="",n.onPlaceLabel(e,t)}}),$jit.Icicle.Plot.NodeTypes=new t({none:{render:e.empty},rectangle:{render:function(t,n,r){var i=this.viz.config,s=i.offset,o=t.getData("width"),u=t.getData("height"),a=t.getData("border"),f=t.pos.getc(!0),l=f.x+s/2,c=f.y+s/2,h=n.getCtx();if(o-s<2||u-s<2)return;if(i.cushion){var p=t.getData("color"),d=h.createRadialGradient(l+(o-s)/2,c+(u-s)/2,1,l+(o-s)/2,c+(u-s)/2,o<u?u:o),v=e.rgbToHex(e.map(e.hexToRgb(p),function(e){return e*.3>>0}));d.addColorStop(0,p),d.addColorStop(1,v),h.fillStyle=d}a&&(h.strokeStyle=a,h.lineWidth=3),h.fillRect(l,c,Math.max(0,o-s),Math.max(0,u-s)),a&&h.strokeRect(f.x,f.y,o,u)},contains:function(e,t){if(this.viz.clickedNode&&!$jit.Graph.Util.isDescendantOf(e,this.viz.clickedNode.id))return!1;var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.rectangle.contains({x:n.x+r/2,y:n.y+i/2},t,r,i)}}}),$jit.Icicle.Plot.EdgeTypes=new t({none:e.empty}),b.ForceDirected=new t({getOptions:function(e){var t=this.canvas.getSize(),n=t.width,r=t.height,i=0;this.graph.eachNode(function(e){i++});var s=n*r/i,o=Math.sqrt(s),u=this.config.levelDistance;return{width:n,height:r,tstart:n*.1,nodef:function(e){return s/(e||1)},edgef:function(e){return o*(e-u)}}},compute:function(t,n){var r=e.splat(t||["current","start","end"]),i=this.getOptions();w.compute(this.graph,r,this.config),this.graph.computeLevels(this.root,0,"ignore"),this.graph.eachNode(function(t){e.each(r,function(n){var s=t.getPos(n);s.equals(h.KER)&&(s.x=i.width/5*(Math.random()-.5),s.y=i.height/5*(Math.random()-.5)),t.disp={},e.each(r,function(e){t.disp[e]=p(0,0)})})}),this.computePositions(r,i,n)},computePositions:function(e,t,n){var r=this.config.iterations,i=0,s=this;if(n)(function o(){for(var u=n.iter,a=0;a<u;a++){t.t=t.tstart*(1-i++/(r-1)),s.computePositionStep(e,t);if(i>=r){n.onComplete();return}}n.onStep(Math.round(i/(r-1)*100)),setTimeout(o,1)})();else for(;i<r;i++)t.t=t.tstart*(1-i/(r-1)),this.computePositionStep(e,t)},computePositionStep:function(t,n){var r=this.graph,i=Math.min,s=Math.max,o=p(0,0);r.eachNode(function(i){e.each(t,function(e){i.disp[e].x=0,i.disp[e].y=0}),r.eachNode(function(r){r.id!=i.id&&e.each(t,function(e){var t=i.getPos(e),s=r.getPos(e);o.x=t.x-s.x,o.y=t.y-s.y;var u=o.norm()||1;i.disp[e].$add(o.$scale(n.nodef(u)/u))})})});var u=!!r.getNode(this.root).visited;r.eachNode(function(r){r.eachAdjacency(function(i){var s=i.nodeTo;!!s.visited===u&&e.each(t,function(e){var t=r.getPos(e),i=s.getPos(e);o.x=t.x-i.x,o.y=t.y-i.y;var u=o.norm()||1;r.disp[e].$add(o.$scale(-n.edgef(u)/u)),s.disp[e].$add(o.$scale(-1))})}),r.visited=!u});var a=n.t,f=n.width/2,l=n.height/2;r.eachNode(function(n){e.each(t,function(e){var t=n.disp[e],r=t.norm()||1,e=n.getPos(e);e.$add(p(t.x*i(Math.abs(t.x),a)/r,t.y*i(Math.abs(t.y),a)/r)),e.x=i(f,s(-f,e.x)),e.y=i(l,s(-l,e.y))})})}}),$jit.ForceDirected=new t({Implements:[y,a,b.ForceDirected],initialize:function(t){var n=$jit.ForceDirected,r={iterations:50,levelDistance:50};this.controller=this.config=e.merge(i("Canvas","Node","Edge","Fx","Tips","NodeStyles","Events","Navigation","Controller","Label"),r,t);var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(s.background&&(s.background=e.merge({type:"Circles"},s.background)),this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!0,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new n.Label[s.Label.type](this),this.fx=new n.Plot(this,n),this.op=new n.Op(this),this.json=null,this.busy=!1,this.initializeExtras()},refresh:function(){this.compute(),this.plot()},reposition:function(){this.compute("end")},computeIncremental:function(t){t=e.merge({iter:20,property:"end",onStep:e.empty,onComplete:e.empty},t||{}),this.config.onBeforeCompute(this.graph.getNode(this.root)),this.compute(t.property,t)},plot:function(){this.fx.plot()},animate:function(t){this.fx.animate(e.merge({modes:["linear"]},t||{}))}}),$jit.ForceDirected.$extend=!0,function(n){n.Op=new t({Implements:d.Op}),n.Plot=new t({Implements:d.Plot}),n.Label={},n.Label.Native=new t({Implements:d.Label.Native}),n.Label.SVG=new t({Implements:d.Label.SVG,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)};e.setAttribute("x",l.x),e.setAttribute("y",l.y),n.onPlaceLabel(e,t)}}),n.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)},c=e.style;c.left=l.x+"px",c.top=l.y+"px",c.display=this.fitsInCanvas(l,i)?"":"none",n.onPlaceLabel(e,t)}}),n.Plot.NodeTypes=new t({none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.circle.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.circle.contains(n,t,r)}},ellipse:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");this.nodeHelper.ellipse.render("fill",n,r,i,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.ellipse.contains(n,t,r,i)}},square:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.square.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.square.contains(n,t,r)}},rectangle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");this.nodeHelper.rectangle.render("fill",n,r,i,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.rectangle.contains(n,t,r,i)}},triangle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.triangle.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.triangle.contains(n,t,r)}},star:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.star.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.star.contains(n,t,r)}}}),n.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);this.edgeHelper.line.render(n,r,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(n,r,t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("dim"),s=e.data.$direction,o=s&&s.length>1&&s[0]!=e.nodeFrom.id;this.edgeHelper.arrow.render(n,r,i,o,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.arrow.contains(n,r,t,this.edge.epsilon)}}})}($jit.ForceDirected),$jit.TM={};var E=$jit.TM;$jit.TM.$extend=!0,E.Base={layout:{orientation:"h",vertical:function(){return this.orientation=="v"},horizontal:function(){return this.orientation=="h"},change:function(){this.orientation=this.vertical()?"h":"v"}},initialize:function(t){var n={orientation:"h",titleHeight:13,offset:2,levelsToShow:0,constrained:!1,animate:!1,Node:{type:"rectangle",overridable:!0,width:3,height:3,color:"#444"},Label:{textAlign:"center",textBaseline:"top"},Edge:{type:"none"},duration:700,fps:45};this.controller=this.config=e.merge(i("Canvas","Node","Edge","Fx","Controller","Tips","NodeStyles","Events","Navigation","Label"),n,t),this.layout.orientation=this.config.orientation;var r=this.config;r.useCanvas?(this.canvas=r.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(r.background&&(r.background=e.merge({type:"Circles"},r.background)),this.canvas=new f(this,r),this.config.labelContainer=(typeof r.injectInto=="string"?r.injectInto:r.injectInto.id)+"-label"),this.graphOptions={complex:!0,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new E.Label[r.Label.type](this),this.fx=new E.Plot(this),this.op=new E.Op(this),this.group=new E.Group(this),this.geom=new E.Geom(this),this.clickedNode=null,this.busy=!1,this.initializeExtras()},refresh:function(){if(this.busy)return;this.busy=!0;var t=this;if(this.config.animate)this.compute("end"),this.config.levelsToShow>0&&this.geom.setRightLevelToShow(this.graph.getNode(this.clickedNode&&this.clickedNode.id||this.root)),this.fx.animate(e.merge(this.config,{modes:["linear","node-property:width:height"],onComplete:function(){t.busy=!1}}));else{var n=this.config.Label.type;if(n!="Native"){var t=this;this.graph.eachNode(function(e){t.labels.hideLabel(e,!1)})}this.busy=!1,this.compute(),this.config.levelsToShow>0&&this.geom.setRightLevelToShow(this.graph.getNode(this.clickedNode&&this.clickedNode.id||this.root)),this.plot()}},plot:function(){this.fx.plot()},leaf:function(e){return e.getSubnodes([1,1],"ignore").length==0},enter:function(e){if(this.busy)return;this.busy=!0;var t=this,n=this.config,r=this.graph,i=e,s=this.clickedNode,o={onComplete:function(){n.levelsToShow>0&&t.geom.setRightLevelToShow(e),(n.levelsToShow>0||n.request)&&t.compute(),n.animate?(r.nodeList.setData("alpha",0,"end"),e.eachSubgraph(function(e){e.setData("alpha",1,"end")},"ignore"),t.fx.animate({duration:500,modes:["node-property:alpha"],onComplete:function(){t.clickedNode=i,t.compute("end"),t.clickedNode=s,t.fx.animate({modes:["linear","node-property:width:height"],duration:1e3,onComplete:function(){t.busy=!1,t.clickedNode=i}})}})):(t.busy=!1,t.clickedNode=e,t.refresh())}};n.request?this.requestNodes(i,o):o.onComplete()},out:function(){if(this.busy)return;this.busy=!0,this.events.hoveredNode=!1;var e=this,t=this.config,n=this.graph,r=n.getNode(this.clickedNode&&this.clickedNode.id||this.root).getParents(),i=r[0],s=i,o=this.clickedNode;if(!i){this.busy=!1;return}callback={onComplete:function(){e.clickedNode=i,t.request?e.requestNodes(i,{onComplete:function(){e.compute(),e.plot(),e.busy=!1}}):(e.compute(),e.plot(),e.busy=!1)}},t.levelsToShow>0&&this.geom.setRightLevelToShow(i),t.animate?(this.clickedNode=s,this.compute("end"),this.clickedNode=o,this.fx.animate({modes:["linear","node-property:width:height"],duration:1e3,onComplete:function(){e.clickedNode=s,n.eachNode(function(e){e.setDataset(["current","end"],{alpha:[0,1]})},"ignore"),o.eachSubgraph(function(e){e.setData("alpha",1)},"ignore"),e.fx.animate({duration:500,modes:["node-property:alpha"],onComplete:function(){callback.onComplete()}})}})):callback.onComplete()},requestNodes:function(t,n){var r=e.merge(this.controller,n),i=this.config.levelsToShow;if(r.request){var s=[],o=t._depth;t.eachLevel(0,i,function(e){var t=i-(e._depth-o);e.drawn&&!e.anySubnode()&&t>0&&(s.push(e),e._level=t)}),this.group.requestNodes(s,r)}else r.onComplete()}},E.Op=new t({Implements:d.Op,initialize:function(e){this.viz=e}}),E.Geom=new t({Implements:d.Geom,getRightLevelToShow:function(){return this.viz.config.levelsToShow},setRightLevelToShow:function(e){var t=this.getRightLevelToShow(),n=this.viz.labels;e.eachLevel(0,t+1,function(r){var i=r._depth-e._depth;i>t?(r.drawn=!1,r.exist=!1,r.ignore=!0,n.hideLabel(r,!1)):(r.drawn=!0,r.exist=!0,delete r.ignore)}),e.drawn=!0,delete e.ignore}}),E.Group=new t({initialize:function(e){this.viz=e,this.canvas=e.canvas,this.config=e.config},requestNodes:function(e,t){var n=0,r=e.length,i={},s=function(){t.onComplete()},o=this.viz;r==0&&s();for(var u=0;u<r;u++)i[e[u].id]=e[u],t.request(e[u].id,e[u]._level,{onComplete:function(e,t){t&&t.children&&(t.id=e,o.op.sum(t,{type:"nothing"})),++n==r&&(o.graph.computeLevels(o.root,0),s())}})}}),E.Plot=new t({Implements:d.Plot,initialize:function(e){this.viz=e,this.config=e.config,this.node=this.config.Node,this.edge=this.config.Edge,this.animation=new r,this.nodeTypes=new E.Plot.NodeTypes,this.edgeTypes=new E.Plot.EdgeTypes,this.labels=e.labels},plot:function(t,n){var r=this.viz,i=r.graph;r.canvas.clear(),this.plotTree(i.getNode(r.clickedNode&&r.clickedNode.id||r.root),e.merge(r.config,t||{},{withLabels:!0,hideLabels:!1,plotSubtree:function(e,t){return e.anySubnode("exist")}}),n)}}),E.Label={},E.Label.Native=new t({Implements:d.Label.Native,initialize:function(e){this.config=e.config,this.leaf=e.leaf},renderLabel:function(e,t,n){if(!this.leaf(t)&&!this.config.titleHeight)return;var r=t.pos.getc(!0),i=e.getCtx(),s=t.getData("width"),o=t.getData("height"),u=r.x+s/2,a=r.y;i.fillText(t.name,u,a,s)}}),E.Label.SVG=new t({Implements:d.Label.SVG,initialize:function(e){this.viz=e,this.leaf=e.leaf,this.config=e.config},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)};e.setAttribute("x",l.x),e.setAttribute("y",l.y),!this.leaf(t)&&!this.config.titleHeight&&(e.style.display="none"),n.onPlaceLabel(e,t)}}),E.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e,this.leaf=e.leaf,this.config=e.config},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)},c=e.style;c.left=l.x+"px",c.top=l.y+"px",c.width=t.getData("width")*u+"px",c.height=t.getData("height")*a+"px",c.zIndex=t._depth*100,c.display="",!this.leaf(t)&&!this.config.titleHeight&&(e.style.display="none"),n.onPlaceLabel(e,t)}}),E.Plot.NodeTypes=new t({none:{render:e.empty},rectangle:{render:function(t,n,r){var i=this.viz.leaf(t),s=this.config,o=s.offset,u=s.titleHeight,a=t.pos.getc(!0),f=t.getData("width"),l=t.getData("height"),c=t.getData("border"),h=n.getCtx(),p=a.x+o/2,d=a.y+o/2;if(f<=o||l<=o)return;if(i){if(s.cushion){var v=h.createRadialGradient(p+(f-o)/2,d+(l-o)/2,1,p+(f-o)/2,d+(l-o)/2,f<l?l:f),m=t.getData("color"),g=e.rgbToHex(e.map(e.hexToRgb(m),function(e){return e*.2>>0}));v.addColorStop(0,m),v.addColorStop(1,g),h.fillStyle=v}h.fillRect(p,d,f-o,l-o),c&&(h.save(),h.strokeStyle=c,h.strokeRect(p,d,f-o,l-o),h.restore())}else u>0&&(h.fillRect(a.x+o/2,a.y+o/2,f-o,u-o),c&&(h.save(),h.strokeStyle=c,h.strokeRect(a.x+o/2,a.y+o/2,f-o,l-o),h.restore()))},contains:function(e,t){if(this.viz.clickedNode&&!e.isDescendantOf(this.viz.clickedNode.id)||e.ignore)return!1;var n=e.pos.getc(!0),r=e.getData("width"),i=this.viz.leaf(e),s=i?e.getData("height"):this.config.titleHeight;return this.nodeHelper.rectangle.contains({x:n.x+r/2,y:n.y+s/2},t,r,s)}}}),E.Plot.EdgeTypes=new t({none:e.empty}),E.SliceAndDice=new t({Implements:[y,a,E.Base,b.TM.SliceAndDice]}),E.Squarified=new t({Implements:[y,a,E.Base,b.TM.Squarified]}),E.Strip=new t({Implements:[y,a,E.Base,b.TM.Strip]}),$jit.RGraph=new t({Implements:[y,a,b.Radial],initialize:function(t){var n=$jit.RGraph,r={interpolation:"linear",levelDistance:100};this.controller=this.config=e.merge(i("Canvas","Node","Edge","Fx","Controller","Tips","NodeStyles","Events","Navigation","Label"),r,t);var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(s.background&&(s.background=e.merge({type:"Circles"},s.background)),this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!1,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new n.Label[s.Label.type](this),this.fx=new n.Plot(this,n),this.op=new n.Op(this),this.json=null,this.root=null,this.busy=!1,this.parent=!1,this.initializeExtras()},createLevelDistanceFunc:function(){var e=this.config.levelDistance;return function(t){return(t._depth+1)*e}},refresh:function(){this.compute(),this.plot()},reposition:function(){this.compute("end")},plot:function(){this.fx.plot()},getNodeAndParentAngle:function(e){var t=!1,n=this.graph.getNode(e),r=n.getParents(),i=r.length>0?r[0]:!1;if(i){var s=i.pos.getc(),o=n.pos.getc(),u=s.add(o.scale(-1));t=Math.atan2(u.y,u.x),t<0&&(t+=2*Math.PI)}return{parent:i,theta:t}},tagChildren:function(e,t){if(e.angleSpan){var n=[];e.eachAdjacency(function(e){n.push(e.nodeTo)},"ignore");var r=n.length;for(var i=0;i<r&&t!=n[i].id;i++);for(var s=(i+1)%r,o=0;t!=n[s].id;s=(s+1)%r)n[s].dist=o++}},onClick:function(t,n){if(this.root!=t&&!this.busy){this.busy=!0,this.root=t,that=this,this.controller.onBeforeCompute(this.graph.getNode(t));var r=this.getNodeAndParentAngle(t);this.tagChildren(r.parent,t),this.parent=r.parent,this.compute("end");var i=r.theta-r.parent.endPos.theta;this.graph.eachNode(function(e){e.endPos.set(e.endPos.getp().add(c(i,0)))});var s=this.config.interpolation;n=e.merge({onComplete:e.empty},n||{}),this.fx.animate(e.merge({hideLabels:!0,modes:[s]},n,{onComplete:function(){that.busy=!1,n.onComplete()}}))}}}),$jit.RGraph.$extend=!0,function(n){n.Op=new t({Implements:d.Op}),n.Plot=new t({Implements:d.Plot}),n.Label={},n.Label.Native=new t({Implements:d.Label.Native}),n.Label.SVG=new t({Implements:d.Label.SVG,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)};e.setAttribute("x",l.x),e.setAttribute("y",l.y),n.onPlaceLabel(e,t)}}),n.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)},c=e.style;c.left=l.x+"px",c.top=l.y+"px",c.display=this.fitsInCanvas(l,i)?"":"none",n.onPlaceLabel(e,t)}}),n.Plot.NodeTypes=new t({none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.circle.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.circle.contains(n,t,r)}},ellipse:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");this.nodeHelper.ellipse.render("fill",n,r,i,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.ellipse.contains(n,t,r,i)}},square:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.square.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.square.contains(n,t,r)}},rectangle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");this.nodeHelper.rectangle.render("fill",n,r,i,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.rectangle.contains(n,t,r,i)}},triangle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.triangle.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.triangle.contains(n,t,r)}},star:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.star.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.star.contains(n,t,r)}}}),n.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);this.edgeHelper.line.render(n,r,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(n,r,t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("dim"),s=e.data.$direction,o=s&&s.length>1&&s[0]!=e.nodeFrom.id;this.edgeHelper.arrow.render(n,r,i,o,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.arrow.contains(n,r,t,this.edge.epsilon)}}})}($jit.RGraph),h.prototype.moebiusTransformation=function(e){var t=this.add(e),n=e.$conjugate().$prod(this);return n.x++,t.$div(n)},d.Util.moebiusTransformation=function(e,t,n,r,i){this.eachNode(e,function(e){for(var i=0;i<n.length;i++){var s=t[i].scale(-1),o=r?r:n[i];e.getPos(n[i]).set(e.getPos(o).getc().moebiusTransformation(s))}},i)},$jit.Hypertree=new t({Implements:[y,a,b.Radial],initialize:function(t){var n=$jit.Hypertree,r={radius:"auto",offset:0,Edge:{type:"hyperline"},duration:1500,fps:35};this.controller=this.config=e.merge(i("Canvas","Node","Edge","Fx","Tips","NodeStyles","Events","Navigation","Controller","Label"),r,t);var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(s.background&&(s.background=e.merge({type:"Circles"},s.background)),this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!1,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new n.Label[s.Label.type](this),this.fx=new n.Plot(this,n),this.op=new n.Op(this),this.json=null,this.root=null,this.busy=!1,this.initializeExtras()},createLevelDistanceFunc:function(){var e=this.getRadius(),t=0,n=Math.max,r=this.config;this.graph.eachNode(function(e){t=n(e._depth,t)},"ignore"),t++;var i=function(t){return function(n){n.scale=e;var i=n._depth+1,s=0,o=Math.pow;while(i)s+=o(t,i--);return s-r.offset}};for(var s=.51;s<=1;s+=.01){var o=(1-Math.pow(s,t))/(1-s);if(o>=2)return i(s-.01)}return i(.75)},getRadius:function(){var e=this.config.radius;if(e!=="auto")return e;var t=this.canvas.getSize();return Math.min(t.width,t.height)/2},refresh:function(e){e?(this.reposition(),this.graph.eachNode(function(e){e.startPos.rho=e.pos.rho=e.endPos.rho,e.startPos.theta=e.pos.theta=e.endPos.theta})):this.compute(),this.plot()},reposition:function(){this.compute("end");var e=this.graph.getNode(this.root).pos.getc().scale(-1);d.Util.moebiusTransformation(this.graph,[e],["end"],"end","ignore"),this.graph.eachNode(function(e){e.ignore&&(e.endPos.rho=e.pos.rho,e.endPos.theta=e.pos.theta)})},plot:function(){this.fx.plot()},onClick:function(e,t){var n=this.graph.getNode(e).pos.getc(!0);this.move(n,t)},move:function(t,n){var r=p(t.x,t.y);if(this.busy===!1&&r.norm()<1){this.busy=!0;var i=this.graph.getClosestNodeToPos(r),s=this;this.graph.computeLevels(i.id,0),this.controller.onBeforeCompute(i),n=e.merge({onComplete:e.empty},n||{}),this.fx.animate(e.merge({modes:["moebius"],hideLabels:!0},n,{onComplete:function(){s.busy=!1,n.onComplete()}}),r)}}}),$jit.Hypertree.$extend=!0,function(n){n.Op=new t({Implements:d.Op}),n.Plot=new t({Implements:d.Plot}),n.Label={},n.Label.Native=new t({Implements:d.Label.Native,initialize:function(e){this.viz=e},renderLabel:function(e,t,n){var r=e.getCtx(),i=t.pos.getc(!0),s=this.viz.getRadius();r.fillText(t.name,i.x*s,i.y*s)}}),n.Label.SVG=new t({Implements:d.Label.SVG,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i
|
||
.scaleOffsetY,f=i.getSize(),l=this.viz.getRadius(),c={x:Math.round(r.x*u*l+s+f.width/2),y:Math.round(r.y*a*l+o+f.height/2)};e.setAttribute("x",c.x),e.setAttribute("y",c.y),n.onPlaceLabel(e,t)}}),n.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l=this.viz.getRadius(),c={x:Math.round(r.x*u*l+s+f.width/2),y:Math.round(r.y*a*l+o+f.height/2)},h=e.style;h.left=c.x+"px",h.top=c.y+"px",h.display=this.fitsInCanvas(c,i)?"":"none",n.onPlaceLabel(e,t)}}),n.Plot.NodeTypes=new t({none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t){var n=this.node,r=e.getData("dim"),i=e.pos.getc();r=n.transform?r*(1-i.squaredNorm()):r,i.$scale(e.scale),r>.2&&this.nodeHelper.circle.render("fill",i,r,t)},contains:function(e,t){var n=e.getData("dim"),r=e.pos.getc().$scale(e.scale);return this.nodeHelper.circle.contains(r,t,n)}},ellipse:{render:function(e,t){var n=e.pos.getc().$scale(e.scale),r=e.getData("width"),i=e.getData("height");this.nodeHelper.ellipse.render("fill",n,r,i,t)},contains:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=e.pos.getc().$scale(e.scale);return this.nodeHelper.circle.contains(i,t,n,r)}},square:{render:function(e,t){var n=this.node,r=e.getData("dim"),i=e.pos.getc();r=n.transform?r*(1-i.squaredNorm()):r,i.$scale(e.scale),r>.2&&this.nodeHelper.square.render("fill",i,r,t)},contains:function(e,t){var n=e.getData("dim"),r=e.pos.getc().$scale(e.scale);return this.nodeHelper.square.contains(r,t,n)}},rectangle:{render:function(e,t){var n=this.node,r=e.getData("width"),i=e.getData("height"),s=e.pos.getc();r=n.transform?r*(1-s.squaredNorm()):r,i=n.transform?i*(1-s.squaredNorm()):i,s.$scale(e.scale),r>.2&&i>.2&&this.nodeHelper.rectangle.render("fill",s,r,i,t)},contains:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=e.pos.getc().$scale(e.scale);return this.nodeHelper.square.contains(i,t,n,r)}},triangle:{render:function(e,t){var n=this.node,r=e.getData("dim"),i=e.pos.getc();r=n.transform?r*(1-i.squaredNorm()):r,i.$scale(e.scale),r>.2&&this.nodeHelper.triangle.render("fill",i,r,t)},contains:function(e,t){var n=e.getData("dim"),r=e.pos.getc().$scale(e.scale);return this.nodeHelper.triangle.contains(r,t,n)}},star:{render:function(e,t){var n=this.node,r=e.getData("dim"),i=e.pos.getc();r=n.transform?r*(1-i.squaredNorm()):r,i.$scale(e.scale),r>.2&&this.nodeHelper.star.render("fill",i,r,t)},contains:function(e,t){var n=e.getData("dim"),r=e.pos.getc().$scale(e.scale);return this.nodeHelper.star.contains(r,t,n)}}}),n.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.nodeFrom.scale;this.edgeHelper.line.render({x:n.x*i,y:n.y*i},{x:r.x*i,y:r.y*i},t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.nodeFrom.scale;this.edgeHelper.line.contains({x:n.x*i,y:n.y*i},{x:r.x*i,y:r.y*i},t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.nodeFrom.scale,s=e.getData("dim"),o=e.data.$direction,u=o&&o.length>1&&o[0]!=e.nodeFrom.id;this.edgeHelper.arrow.render({x:n.x*i,y:n.y*i},{x:r.x*i,y:r.y*i},s,u,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.nodeFrom.scale;this.edgeHelper.arrow.contains({x:n.x*i,y:n.y*i},{x:r.x*i,y:r.y*i},t,this.edge.epsilon)}},hyperline:{render:function(e,t){var n=e.nodeFrom.pos.getc(),r=e.nodeTo.pos.getc(),i=this.viz.getRadius();this.edgeHelper.hyperline.render(n,r,i,t)},contains:e.lambda(!1)}})}($jit.Hypertree)})(),function(){window.$jit=function(e){e=e||window;for(var t in $jit)$jit[t].$extend&&(e[t]=$jit[t])},$jit.version="2.0.0b";var e=function(e){return document.getElementById(e)};e.empty=function(){},e.extend=function(e,t){for(var n in t||{})e[n]=t[n];return e},e.lambda=function(e){return typeof e=="function"?e:function(){return e}},e.time=Date.now||function(){return+(new Date)},e.splat=function(t){var n=e.type(t);return n?n!="array"?[t]:t:[]},e.type=function(t){var n=e.type.s.call(t).match(/^\[object\s(.*)\]$/)[1].toLowerCase();return n!="object"?n:t&&t.$$family?t.$$family:t&&t.nodeName&&t.nodeType==1?"element":n},e.type.s=Object.prototype.toString,e.each=function(t,n){var r=e.type(t);if(r=="object")for(var i in t)n(t[i],i);else for(var s=0,o=t.length;s<o;s++)n(t[s],s)},e.indexOf=function(e,t){if(Array.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},e.map=function(t,n){var r=[];return e.each(t,function(e,t){r.push(n(e,t))}),r},e.reduce=function(e,t,n){var r=e.length;if(r==0)return n;var i=arguments.length==3?n:e[--r];while(r--)i=t(i,e[r]);return i},e.merge=function(){var t={};for(var n=0,r=arguments.length;n<r;n++){var i=arguments[n];if(e.type(i)!="object")continue;for(var s in i){var o=i[s],u=t[s];t[s]=u&&e.type(o)=="object"&&e.type(u)=="object"?e.merge(u,o):e.unlink(o)}}return t},e.unlink=function(t){var n;switch(e.type(t)){case"object":n={};for(var r in t)n[r]=e.unlink(t[r]);break;case"array":n=[];for(var i=0,s=t.length;i<s;i++)n[i]=e.unlink(t[i]);break;default:return t}return n},e.zip=function(){if(arguments.length===0)return[];for(var e=0,t=[],n=arguments.length,r=arguments[0].length;e<r;e++){for(var i=0,s=[];i<n;i++)s.push(arguments[i][e]);t.push(s)}return t},e.rgbToHex=function(e,t){if(e.length<3)return null;if(e.length==4&&e[3]==0&&!t)return"transparent";var n=[];for(var r=0;r<3;r++){var i=(e[r]-0).toString(16);n.push(i.length==1?"0"+i:i)}return t?n:"#"+n.join("")},e.hexToRgb=function(e){if(e.length!=7){e=e.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/),e.shift();if(e.length!=3)return null;var t=[];for(var n=0;n<3;n++){var r=e[n];r.length==1&&(r+=r),t.push(parseInt(r,16))}return t}return e=parseInt(e.slice(1),16),[e>>16,e>>8&255,e&255]},e.destroy=function(t){e.clean(t),t.parentNode&&t.parentNode.removeChild(t),t.clearAttributes&&t.clearAttributes()},e.clean=function(t){for(var n=t.childNodes,r=0,i=n.length;r<i;r++)e.destroy(n[r])},e.addEvent=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},e.addEvents=function(t,n){for(var r in n)e.addEvent(t,r,n[r])},e.hasClass=function(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1},e.addClass=function(t,n){e.hasClass(t,n)||(t.className=t.className+" "+n)},e.removeClass=function(e,t){e.className=e.className.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)"),"$1")},e.getPos=function(e){function r(e){var t={x:0,y:0};while(e&&!s(e))t.x+=e.offsetLeft,t.y+=e.offsetTop,e=e.offsetParent;return t}function i(e){var t={x:0,y:0};while(e&&!s(e))t.x+=e.scrollLeft,t.y+=e.scrollTop,e=e.parentNode;return t}function s(e){return/^(?:body|html)$/i.test(e.tagName)}var t=r(e),n=i(e);return{x:t.x-n.x,y:t.y-n.y}},e.event={get:function(e,t){return t=t||window,e||t.event},getWheel:function(e){return e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3},isRightClick:function(e){return e.which==3||e.button==2},getPos:function(e,t){t=t||window,e=e||t.event;var n=t.document;n=n.documentElement||n.body,e.touches&&e.touches.length&&(e=e.touches[0]);var r={x:e.pageX||e.clientX+n.scrollLeft,y:e.pageY||e.clientY+n.scrollTop};return r},stop:function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,e.preventDefault?e.preventDefault():e.returnValue=!1}},$jit.util=$jit.id=e;var t=function(n){n=n||{};var r=function(){for(var n in this)typeof this[n]!="function"&&(this[n]=e.unlink(this[n]));this.constructor=r;if(t.prototyping)return this;var i=this.initialize?this.initialize.apply(this,arguments):this;return this.$$family="class",i};for(var i in t.Mutators){if(!n[i])continue;n=t.Mutators[i](n,n[i]),delete n[i]}return e.extend(r,this),r.constructor=t,r.prototype=n,r};t.Mutators={Implements:function(n,r){return e.each(e.splat(r),function(e){t.prototyping=e;var r=typeof e=="function"?new e:e;for(var i in r)i in n||(n[i]=r[i]);delete t.prototyping}),n}},e.extend(t,{inherit:function(n,r){for(var i in r){var s=r[i],o=n[i],u=e.type(s);o&&u=="function"?s!=o&&t.override(n,i,s):u=="object"?n[i]=e.merge(o,s):n[i]=s}return n},override:function(e,n,r){var i=t.prototyping;i&&e[n]!=i[n]&&(i=null);var s=function(){var t=this.parent;this.parent=i?i[n]:e[n];var s=r.apply(this,arguments);return this.parent=t,s};e[n]=s}}),t.prototype.implement=function(){var n=this.prototype;return e.each(Array.prototype.slice.call(arguments||[]),function(e){t.inherit(n,e)}),this},$jit.Class=t,$jit.json={prune:function(e,t){this.each(e,function(e,n){n==t&&e.children&&(delete e.children,e.children=[])})},getParent:function(e,t){if(e.id==t)return!1;var n=e.children;if(n&&n.length>0)for(var r=0;r<n.length;r++){if(n[r].id==t)return e;var i=this.getParent(n[r],t);if(i)return i}return!1},getSubtree:function(e,t){if(e.id==t)return e;for(var n=0,r=e.children;n<r.length;n++){var i=this.getSubtree(r[n],t);if(i!=null)return i}return null},eachLevel:function(e,t,n,r){if(t<=n){r(e,t);if(!e.children)return;for(var i=0,s=e.children;i<s.length;i++)this.eachLevel(s[i],t+1,n,r)}},each:function(e,t){this.eachLevel(e,0,Number.MAX_VALUE,t)}},$jit.Trans={$extend:!0,linear:function(e){return e}};var n=$jit.Trans;(function(){var t=function(t,n){return n=e.splat(n),e.extend(t,{easeIn:function(e){return t(e,n)},easeOut:function(e){return 1-t(1-e,n)},easeInOut:function(e){return e<=.5?t(2*e,n)/2:(2-t(2*(1-e),n))/2}})},r={Pow:function(e,t){return Math.pow(e,t[0]||6)},Expo:function(e){return Math.pow(2,8*(e-1))},Circ:function(e){return 1-Math.sin(Math.acos(e))},Sine:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Back:function(e,t){return t=t[0]||1.618,Math.pow(e,2)*((t+1)*e-t)},Bounce:function(e){var t;for(var n=0,r=1;1;n+=r,r/=2)if(e>=(7-4*n)/11){t=r*r-Math.pow((11-6*n-11*e)/4,2);break}return t},Elastic:function(e,t){return Math.pow(2,10*--e)*Math.cos(20*e*Math.PI*(t[0]||1)/3)}};e.each(r,function(e,r){n[r]=t(e)}),e.each(["Quad","Cubic","Quart","Quint"],function(e,r){n[e]=t(function(e){return Math.pow(e,[r+2])})})})();var r=new t({initialize:function(e){this.setOptions(e)},setOptions:function(t){var r={duration:2500,fps:40,transition:n.Quart.easeInOut,compute:e.empty,complete:e.empty,link:"ignore"};return this.opt=e.merge(r,t||{}),this},step:function(){var t=e.time(),n=this.opt;if(t<this.time+n.duration){var r=n.transition((t-this.time)/n.duration);n.compute(r)}else this.timer=clearInterval(this.timer),n.compute(1),n.complete()},start:function(){return this.check()?(this.time=0,this.startTimer(),this):this},startTimer:function(){var t=this,n=this.opt.fps;return this.timer?!1:(this.time=e.time()-this.time,this.timer=setInterval(function(){t.step()},Math.round(1e3/n)),!0)},pause:function(){return this.stopTimer(),this},resume:function(){return this.startTimer(),this},stopTimer:function(){return this.timer?(this.time=e.time()-this.time,this.timer=clearInterval(this.timer),!0):!1},check:function(){return this.timer?this.opt.link=="cancel"?(this.stopTimer(),!0):!1:!0}}),i=function(){var t=arguments;for(var n=0,r=t.length,s={};n<r;n++){var o=i[t[n]];o.$extend?e.extend(s,o):s[t[n]]=o}return s};i.AreaChart={$extend:!0,animate:!0,labelOffset:3,type:"stacked",Tips:{enable:!1,onShow:e.empty,onHide:e.empty},Events:{enable:!1,onClick:e.empty},selectOnHover:!0,showAggregates:!0,showLabels:!0,filterOnClick:!1,restoreOnRightClick:!1},i.Margin={$extend:!1,top:0,left:0,right:0,bottom:0},i.Canvas={$extend:!0,injectInto:"id",width:!1,height:!1,useCanvas:!1,withLabels:!0,background:!1},i.Tree={$extend:!0,orientation:"left",subtreeOffset:8,siblingOffset:5,indent:10,multitree:!1,align:"center"},i.Node={$extend:!1,overridable:!1,type:"circle",color:"#ccb",alpha:1,dim:3,height:20,width:90,autoHeight:!1,autoWidth:!1,lineWidth:1,transform:!0,align:"center",angularWidth:1,span:1,CanvasStyles:{}},i.Edge={$extend:!1,overridable:!1,type:"line",color:"#ccb",lineWidth:1,dim:15,alpha:1,epsilon:7,CanvasStyles:{}},i.Fx={$extend:!0,fps:40,duration:2500,transition:$jit.Trans.Quart.easeInOut,clearCanvas:!0},i.Label={$extend:!1,overridable:!1,type:"HTML",style:" ",size:10,family:"sans-serif",textAlign:"center",textBaseline:"alphabetic",color:"#fff"},i.Tips={$extend:!1,enable:!1,type:"auto",offsetX:20,offsetY:20,force:!1,onShow:e.empty,onHide:e.empty},i.NodeStyles={$extend:!1,enable:!1,type:"auto",stylesHover:!1,stylesClick:!1},i.Events={$extend:!1,enable:!1,enableForEdges:!1,type:"auto",onClick:e.empty,onRightClick:e.empty,onMouseMove:e.empty,onMouseEnter:e.empty,onMouseLeave:e.empty,onDragStart:e.empty,onDragMove:e.empty,onDragCancel:e.empty,onDragEnd:e.empty,onTouchStart:e.empty,onTouchMove:e.empty,onTouchEnd:e.empty,onMouseWheel:e.empty},i.Navigation={$extend:!1,enable:!1,type:"auto",panning:!1,zooming:!1},i.Controller={$extend:!0,onBeforeCompute:e.empty,onAfterCompute:e.empty,onCreateLabel:e.empty,onPlaceLabel:e.empty,onComplete:e.empty,onBeforePlotLine:e.empty,onAfterPlotLine:e.empty,onBeforePlotNode:e.empty,onAfterPlotNode:e.empty,request:!1};var s={initialize:function(e,t){this.viz=t,this.canvas=t.canvas,this.config=t.config[e],this.nodeTypes=t.fx.nodeTypes;var n=this.config.type;this.dom=n=="auto"?t.config.Label.type!="Native":n!="Native",this.labelContainer=this.dom&&t.labels.getLabelContainer(),this.isEnabled()&&this.initializePost()},initializePost:e.empty,setAsProperty:e.lambda(!1),isEnabled:function(){return this.config.enable},isLabel:function(t,n){t=e.event.get(t,n);var r=this.labelContainer,i=t.target||t.srcElement;return i&&i.parentNode==r?i:!1}},o={onMouseUp:e.empty,onMouseDown:e.empty,onMouseMove:e.empty,onMouseOver:e.empty,onMouseOut:e.empty,onMouseWheel:e.empty,onTouchStart:e.empty,onTouchMove:e.empty,onTouchEnd:e.empty,onTouchCancel:e.empty},u=new t({initialize:function(e){this.viz=e,this.canvas=e.canvas,this.node=!1,this.edge=!1,this.registeredObjects=[],this.attachEvents()},attachEvents:function(){var t=this.canvas.getElement(),n=this;t.oncontextmenu=e.lambda(!1),e.addEvents(t,{mouseup:function(t,r){var i=e.event.get(t,r);n.handleEvent("MouseUp",t,r,n.makeEventObject(t,r),e.event.isRightClick(i))},mousedown:function(t,r){var i=e.event.get(t,r);n.handleEvent("MouseDown",t,r,n.makeEventObject(t,r),e.event.isRightClick(i))},mousemove:function(e,t){n.handleEvent("MouseMove",e,t,n.makeEventObject(e,t))},mouseover:function(e,t){n.handleEvent("MouseOver",e,t,n.makeEventObject(e,t))},mouseout:function(e,t){n.handleEvent("MouseOut",e,t,n.makeEventObject(e,t))},touchstart:function(e,t){n.handleEvent("TouchStart",e,t,n.makeEventObject(e,t))},touchmove:function(e,t){n.handleEvent("TouchMove",e,t,n.makeEventObject(e,t))},touchend:function(e,t){n.handleEvent("TouchEnd",e,t,n.makeEventObject(e,t))}});var r=function(t,r){var i=e.event.get(t,r),s=e.event.getWheel(i);n.handleEvent("MouseWheel",t,r,s)};!document.getBoxObjectFor&&window.mozInnerScreenX==null?e.addEvent(t,"mousewheel",r):t.addEventListener("DOMMouseScroll",r,!1)},register:function(e){this.registeredObjects.push(e)},handleEvent:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();for(var n=0,r=this.registeredObjects,i=r.length;n<i;n++)r[n]["on"+t].apply(r[n],e)},makeEventObject:function(t,n){var r=this,i=this.viz.graph,s=this.viz.fx,o=s.nodeTypes,u=s.edgeTypes;return{pos:!1,node:!1,edge:!1,contains:!1,getNodeCalled:!1,getEdgeCalled:!1,getPos:function(){var i=r.viz.canvas,s=i.getSize(),o=i.getPos(),u=i.translateOffsetX,a=i.translateOffsetY,f=i.scaleOffsetX,l=i.scaleOffsetY,c=e.event.getPos(t,n);return this.pos={x:(c.x-o.x-s.width/2-u)*1/f,y:(c.y-o.y-s.height/2-a)*1/l},this.pos},getNode:function(){if(this.getNodeCalled)return this.node;this.getNodeCalled=!0;for(var e in i.nodes){var t=i.nodes[e],n=t&&o[t.getData("type")],u=n&&n.contains&&n.contains.call(s,t,this.getPos());if(u)return this.contains=u,r.node=this.node=t}return r.node=this.node=!1},getEdge:function(){if(this.getEdgeCalled)return this.edge;this.getEdgeCalled=!0;var e={};for(var t in i.edges){var n=i.edges[t];e[t]=!0;for(var o in n){if(o in e)continue;var a=n[o],f=a&&u[a.getData("type")],l=f&&f.contains&&f.contains.call(s,a,this.getPos());if(l)return this.contains=l,r.edge=this.edge=a}}return r.edge=this.edge=!1},getContains:function(){return this.getNodeCalled?this.contains:(this.getNode(),this.contains)}}}}),a={initializeExtras:function(){var t=new u(this),n=this;e.each(["NodeStyles","Tips","Navigation","Events"],function(e){var r=new a.Classes[e](e,n);r.isEnabled()&&t.register(r),r.setAsProperty()&&(n[e.toLowerCase()]=r)})}};a.Classes={},a.Classes.Events=new t({Implements:[s,o],initializePost:function(){this.fx=this.viz.fx,this.ntypes=this.viz.fx.nodeTypes,this.etypes=this.viz.fx.edgeTypes,this.hovered=!1,this.pressed=!1,this.touched=!1,this.touchMoved=!1,this.moved=!1},setAsProperty:e.lambda(!0),onMouseUp:function(t,n,r,i){var s=e.event.get(t,n);this.moved||(i?this.config.onRightClick(this.hovered,r,s):this.config.onClick(this.pressed,r,s)),this.pressed&&(this.moved?this.config.onDragEnd(this.pressed,r,s):this.config.onDragCancel(this.pressed,r,s),this.pressed=this.moved=!1)},onMouseOut:function(t,n,r){var i=e.event.get(t,n),s;if(this.dom&&(s=this.isLabel(t,n))){this.config.onMouseLeave(this.viz.graph.getNode(s.id),r,i),this.hovered=!1;return}var o=i.relatedTarget,u=this.canvas.getElement();while(o&&o.parentNode){if(u==o.parentNode)return;o=o.parentNode}this.hovered&&(this.config.onMouseLeave(this.hovered,r,i),this.hovered=!1)},onMouseOver:function(t,n,r){var i=e.event.get(t,n),s;this.dom&&(s=this.isLabel(t,n))&&(this.hovered=this.viz.graph.getNode(s.id),this.config.onMouseEnter(this.hovered,r,i))},onMouseMove:function(t,n,r){var i,s=e.event.get(t,n);if(this.pressed){this.moved=!0,this.config.onDragMove(this.pressed,r,s);return}if(this.dom)this.config.onMouseMove(this.hovered,r,s);else{if(this.hovered){var o=this.hovered,u=o.nodeFrom?this.etypes[o.getData("type")]:this.ntypes[o.getData("type")],a=u&&u.contains&&u.contains.call(this.fx,o,r.getPos());if(a){this.config.onMouseMove(o,r,s);return}this.config.onMouseLeave(o,r,s),this.hovered=!1}(this.hovered=r.getNode()||this.config.enableForEdges&&r.getEdge())?this.config.onMouseEnter(this.hovered,r,s):this.config.onMouseMove(!1,r,s)}},onMouseWheel:function(t,n,r){this.config.onMouseWheel(r,e.event.get(t,n))},onMouseDown:function(t,n,r){var i=e.event.get(t,n);this.pressed=r.getNode()||this.config.enableForEdges&&r.getEdge(),this.config.onDragStart(this.pressed,r,i)},onTouchStart:function(t,n,r){var i=e.event.get(t,n);this.touched=r.getNode()||this.config.enableForEdges&&r.getEdge(),this.config.onTouchStart(this.touched,r,i)},onTouchMove:function(t,n,r){var i=e.event.get(t,n);this.touched&&(this.touchMoved=!0,this.config.onTouchMove(this.touched,r,i))},onTouchEnd:function(t,n,r){var i=e.event.get(t,n);this.touched&&(this.touchMoved?this.config.onTouchEnd(this.touched,r,i):this.config.onTouchCancel(this.touched,r,i),this.touched=this.touchMoved=!1)}}),a.Classes.Tips=new t({Implements:[s,o],initializePost:function(){if(document.body){var t=e("_tooltip")||document.createElement("div");t.id="_tooltip",t.className="tip",e.extend(t.style,{position:"absolute",display:"none",zIndex:13e3}),document.body.appendChild(t),this.tip=t,this.node=!1}},setAsProperty:e.lambda(!0),onMouseOut:function(e,t){if(this.dom&&this.isLabel(e,t)){this.hide(!0);return}var n=e.relatedTarget,r=this.canvas.getElement();while(n&&n.parentNode){if(r==n.parentNode)return;n=n.parentNode}this.hide(!1)},onMouseOver:function(e,t){var n;this.dom&&(n=this.isLabel(e,t))&&(this.node=this.viz.graph.getNode(n.id),this.config.onShow(this.tip,this.node,n))},onMouseMove:function(t,n,r){this.dom&&this.isLabel(t,n)&&this.setTooltipPosition(e.event.getPos(t,n));if(!this.dom){var i=r.getNode();if(!i){this.hide(!0);return}if(this.config.force||!this.node||this.node.id!=i.id)this.node=i,this.config.onShow(this.tip,i,r.getContains());this.setTooltipPosition(e.event.getPos(t,n))}},setTooltipPosition:function(e){var t=this.tip,n=t.style,r=this.config;n.display="";var i={height:document.body.clientHeight,width:document.body.clientWidth},s={width:t.offsetWidth,height:t.offsetHeight},o=r.offsetX,u=r.offsetY;n.top=(e.y+u+s.height>i.height?e.y-s.height-u:e.y+u)+"px",n.left=(e.x+s.width+o>i.width?e.x-s.width-o:e.x+o)+"px"},hide:function(e){this.tip.style.display="none",e&&this.config.onHide()}}),a.Classes.NodeStyles=new t({Implements:[s,o],initializePost:function(){this.fx=this.viz.fx,this.types=this.viz.fx.nodeTypes,this.nStyles=this.config,this.nodeStylesOnHover=this.nStyles.stylesHover,this.nodeStylesOnClick=this.nStyles.stylesClick,this.hoveredNode=!1,this.fx.nodeFxAnimation=new r,this.down=!1,this.move=!1},onMouseOut:function(e,t){this.down=this.move=!1;if(!this.hoveredNode)return;this.dom&&this.isLabel(e,t)&&this.toggleStylesOnHover(this.hoveredNode,!1);var n=e.relatedTarget,r=this.canvas.getElement();while(n&&n.parentNode){if(r==n.parentNode)return;n=n.parentNode}this.toggleStylesOnHover(this.hoveredNode,!1),this.hoveredNode=!1},onMouseOver:function(e,t){var n;if(this.dom&&(n=this.isLabel(e,t))){var r=this.viz.graph.getNode(n.id);if(r.selected)return;this.hoveredNode=r,this.toggleStylesOnHover(this.hoveredNode,!0)}},onMouseDown:function(e,t,n,r){if(r)return;var i;this.dom&&(i=this.isLabel(e,t))?this.down=this.viz.graph.getNode(i.id):this.dom||(this.down=n.getNode()),this.move=!1},onMouseUp:function(e,t,n,r){if(r)return;this.move||this.onClick(n.getNode()),this.down=this.move=!1},getRestoredStyles:function(e,t){var n={},r=this["nodeStylesOn"+t];for(var i in r)n[i]=e.styles["$"+i];return n},toggleStylesOnHover:function(e,t){this.nodeStylesOnHover&&this.toggleStylesOn("Hover",e,t)},toggleStylesOnClick:function(e,t){this.nodeStylesOnClick&&this.toggleStylesOn("Click",e,t)},toggleStylesOn:function(t,r,i){var s=this.viz,o=this.nStyles;if(i){var u=this;r.styles||(r.styles=e.merge(r.data,{}));for(var a in this["nodeStylesOn"+t]){var f="$"+a;f in r.styles||(r.styles[f]=r.getData(a))}s.fx.nodeFx(e.extend({elements:{id:r.id,properties:u["nodeStylesOn"+t]},transition:n.Quart.easeOut,duration:300,fps:40},this.config))}else{var l=this.getRestoredStyles(r,t);s.fx.nodeFx(e.extend({elements:{id:r.id,properties:l},transition:n.Quart.easeOut,duration:300,fps:40},this.config))}},onClick:function(e){if(!e)return;var t=this.nodeStylesOnClick;if(!t)return;e.selected?(this.toggleStylesOnClick(e,!1),delete e.selected):(this.viz.graph.eachNode(function(e){if(e.selected){for(var n in t)e.setData(n,e.styles["$"+n],"end");delete e.selected}}),this.toggleStylesOnClick(e,!0),e.selected=!0,delete e.hovered,this.hoveredNode=!1)},onMouseMove:function(e,t,n){this.down&&(this.move=!0);if(this.dom&&this.isLabel(e,t))return;var r=this.nodeStylesOnHover;if(!r)return;if(!this.dom){if(this.hoveredNode){var i=this.types[this.hoveredNode.getData("type")],s=i&&i.contains&&i.contains.call(this.fx,this.hoveredNode,n.getPos());if(s)return}var o=n.getNode();if(!this.hoveredNode&&!o)return;if(o.hovered)return;o&&!o.selected?(this.fx.nodeFxAnimation.stopTimer(),this.viz.graph.eachNode(function(e){if(e.hovered&&!e.selected){for(var t in r)e.setData(t,e.styles["$"+t],"end");delete e.hovered}}),o.hovered=!0,this.hoveredNode=o,this.toggleStylesOnHover(o,!0)):this.hoveredNode&&!this.hoveredNode.selected&&(this.fx.nodeFxAnimation.stopTimer(),this.toggleStylesOnHover(this.hoveredNode,!1),delete this.hoveredNode.hovered,this.hoveredNode=!1)}}}),a.Classes.Navigation=new t({Implements:[s,o],initializePost:function(){this.pos=!1,this.pressed=!1},onMouseWheel:function(t,n,r){if(!this.config.zooming)return;if(t.target.id!="infovis-canvas")return;e.event.stop(e.event.get(t,n));var i=this.config.zooming/1e3,s=1+r*i;s>1?5>=this.canvas.scaleOffsetX&&this.canvas.scale(s,s):s<1&&this.canvas.scaleOffsetX>=.2&&this.canvas.scale(s,s),this.canvas.scaleOffsetX<.5?this.canvas.viz.labels.hideLabels(!0):this.canvas.scaleOffsetX>.5&&this.canvas.viz.labels.hideLabels(!1)},onMouseDown:function(e,t,n){if(!this.config.panning)return;if(this.config.panning=="avoid nodes"&&n.getNode())return;this.pressed=!0,this.pos=n.getPos();var r=this.canvas,i=r.translateOffsetX,s=r.translateOffsetY,o=r.scaleOffsetX,u=r.scaleOffsetY;this.pos.x*=o,this.pos.x+=i,this.pos.y*=u,this.pos.y+=s},onMouseMove:function(e,t,n){if(!this.config.panning)return;if(!this.pressed)return;if(this.config.panning=="avoid nodes"&&n.getNode())return;if(e.target.id!="infovis-canvas"){this.pressed=!1;return}var r=this.pos,i=n.getPos(),s=this.canvas,o=s.translateOffsetX,u=s.translateOffsetY,a=s.scaleOffsetX,f=s.scaleOffsetY;i.x*=a,i.y*=f,i.x+=o,i.y+=u;var l=i.x-r.x,c=i.y-r.y;this.pos=i,this.canvas.translate(l*1/a,c*1/f)},onMouseUp:function(e,t,n,r){if(!this.config.panning)return;this.pressed=!1}});var f;(function(){function i(t,n){var i=document.createElement(t);for(var s in n)typeof n[s]=="object"?e.extend(i[s],n[s]):i[s]=n[s];return t=="canvas"&&!r&&G_vmlCanvasManager&&(i=G_vmlCanvasManager.initElement(document.body.appendChild(i))),i}var n=typeof HTMLCanvasElement,r=n=="object"||n=="function";$jit.Canvas=f=new t({canvases:[],pos:!1,element:!1,labelContainer:!1,translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(t,n){this.viz=t,this.opt=n;var r=e.type(n.injectInto)=="string"?n.injectInto:n.injectInto.id,s=r+"-label",o=e(r),u=n.width||o.offsetWidth,a=n.height||o.offsetHeight;this.id=r;var l={injectInto:r,width:u,height:a};this.element=i("div",{id:r+"-canvaswidget",style:{position:"relative",width:u+"px",height:a+"px"}}),this.labelContainer=this.createLabelContainer(n.Label.type,s,l),this.canvases.push(new f.Base({config:e.extend({idSuffix:"-canvas"},l),plot:function(e){t.fx.plot()},resize:function(){t.refresh()}}));var c=n.background;if(c){var h=new f.Background[c.type](t,e.extend(c,l));this.canvases.push(new f.Base(h))}var p=this.canvases.length;while(p--)this.element.appendChild(this.canvases[p].canvas),p>0&&this.canvases[p].plot();this.element.appendChild(this.labelContainer),o.appendChild(this.element);var d=null,v=this;e.addEvent(window,"scroll",function(){clearTimeout(d),d=setTimeout(function(){v.getPos(!0)},500)})},getCtx:function(e){return this.canvases[e||0].getCtx()},getConfig:function(){return this.opt},getElement:function(){return this.element},getSize:function(e){return this.canvases[e||0].getSize()},resize:function(e,t){this.getPos(!0),this.translateOffsetX=this.translateOffsetY=0,this.scaleOffsetX=this.scaleOffsetY=1;for(var n=0,r=this.canvases.length;n<r;n++)this.canvases[n].resize(e,t);var i=this.element.style;i.width=e+"px",i.height=t+"px",this.labelContainer&&(this.labelContainer.style.width=e+"px")},translate:function(e,t,n){this.translateOffsetX+=e*this.scaleOffsetX,this.translateOffsetY+=t*this.scaleOffsetY;for(var r=0,i=this.canvases.length;r<i;r++)this.canvases[r].translate(e,t,n)},scale:function(e,t,n){var r=this.scaleOffsetX*e,i=this.scaleOffsetY*t,s=this.translateOffsetX*(e-1)/r,o=this.translateOffsetY*(t-1)/i;this.scaleOffsetX=r,this.scaleOffsetY=i;for(var u=0,a=this.canvases.length;u<a;u++)this.canvases[u].scale(e,t,!0);this.translate(s,o,!1)},getPos:function(t){return t||!this.pos?this.pos=e.getPos(this.getElement()):this.pos},clear:function(e){this.canvases[e||0].clear()},path:function(e,t){var n=this.canvases[0].getCtx();n.beginPath(),t(n),n[e](),n.closePath()},createLabelContainer:function(e,t,n){var r="http://www.w3.org/2000/svg";if(e=="HTML"||e=="Native")return i("div",{id:t,style:{overflow:"visible",position:"absolute",top:0,left:0,width:n.width+"px",height:0}});if(e=="SVG"){var s=document.createElementNS(r,"svg:svg");s.setAttribute("width",n.width),s.setAttribute("height",n.height);var o=s.style;o.position="absolute",o.left=o.top="0px";var u=document.createElementNS(r,"svg:g");return u.setAttribute("width",n.width),u.setAttribute("height",n.height),u.setAttribute("x",0),u.setAttribute("y",0),u.setAttribute("id",t),s.appendChild(u),s}}}),f.Base=new t({translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(e){this.viz=e,this.opt=e.config,this.size=!1,this.createCanvas(),this.translateToCenter()},createCanvas:function(){var e=this.opt,t=e.width,n=e.height;this.canvas=i("canvas",{id:e.injectInto+e.idSuffix,width:t,height:n,style:{position:"absolute",top:0,left:0,width:t+"px",height:n+"px"}})},getCtx:function(){return this.ctx?this.ctx:this.ctx=this.canvas.getContext("2d")},getSize:function(){if(this.size)return this.size;var e=this.canvas;return this.size={width:e.width,height:e.height}},translateToCenter:function(e){var t=this.getSize(),n=e?t.width-e.width-this.translateOffsetX*2:t.width;height=e?t.height-e.height-this.translateOffsetY*2:t.height;var r=this.getCtx();e&&r.scale(1/this.scaleOffsetX,1/this.scaleOffsetY),r.translate(n/2,height/2)},resize:function(e,t){var n=this.getSize(),i=this.canvas,s=i.style;this.size=!1,i.width=e,i.height=t,s.width=e+"px",s.height=t+"px",r?this.translateToCenter():this.translateToCenter(n),this.translateOffsetX=this.translateOffsetY=0,this.scaleOffsetX=this.scaleOffsetY=1,this.clear(),this.viz.resize(e,t,this)},translate:function(e,t,n){var r=this.scaleOffsetX,i=this.scaleOffsetY;this.translateOffsetX+=e*r,this.translateOffsetY+=t*i,this.getCtx().translate(e,t),!n&&this.plot()},scale:function(e,t,n){this.scaleOffsetX*=e,this.scaleOffsetY*=t,this.getCtx().scale(e,t),!n&&this.plot()},clear:function(){var e=this.getSize(),t=this.translateOffsetX,n=this.translateOffsetY,r=this.scaleOffsetX,i=this.scaleOffsetY;this.getCtx().clearRect((-e.width/2-t)*1/r,(-e.height/2-n)*1/i,e.width*1/r,e.height*1/i)},plot:function(){this.clear(),this.viz.plot(this)}}),f.Background={},f.Background.Circles=new t({initialize:function(t,n){this.viz=t,this.config=e.merge({idSuffix:"-bkcanvas",levelDistance:200,numberOfCircles:4,CanvasStyles:{},offset:0},n)},resize:function(e,t,n){this.plot(n)},plot:function(e){var t=e.canvas,n=e.getCtx(),r=this.config,i=r.CanvasStyles;for(var s in i)n[s]=i[s];var o=r.numberOfCircles,u=r.levelDistance;for(var a=1;a<=o;a++)n.beginPath(),n.arc(0,0,u*a,0,2*Math.PI,!1),n.stroke(),n.closePath()}})})();var l=function(e,t){this.theta=e,this.rho=t};$jit.Polar=l,l.prototype={getc:function(e){return this.toComplex(e)},getp:function(){return this},set:function(e){e=e.getp(),this.theta=e.theta,this.rho=e.rho},setc:function(e,t){this.rho=Math.sqrt(e*e+t*t),this.theta=Math.atan2(t,e),this.theta<0&&(this.theta+=Math.PI*2)},setp:function(e,t){this.theta=e,this.rho=t},clone:function(){return new l(this.theta,this.rho)},toComplex:function(e){var t=Math.cos(this.theta)*this.rho,n=Math.sin(this.theta)*this.rho;return e?{x:t,y:n}:new h(t,n)},add:function(e){return new l(this.theta+e.theta,this.rho+e.rho)},scale:function(e){return new l(this.theta,this.rho*e)},equals:function(e){return this.theta==e.theta&&this.rho==e.rho},$add:function(e){return this.theta=this.theta+e.theta,this.rho+=e.rho,this},$madd:function(e){return this.theta=(this.theta+e.theta)%(Math.PI*2),this.rho+=e.rho,this},$scale:function(e){return this.rho*=e,this},interpolate:function(e,t){var n=Math.PI,r=n*2,i=function(e){var t=e<0?e%r+r:e%r;return t},s=this.theta,o=e.theta,u,a=Math.abs(s-o);a==n?s>o?u=i(o+(s-r-o)*t):u=i(o-r+(s-o)*t):a>=n?s>o?u=i(o+(s-r-o)*t):u=i(o-r+(s-(o-r))*t):u=i(o+(s-o)*t);var f=(this.rho-e.rho)*t+e.rho;return{theta:u,rho:f}}};var c=function(e,t){return new l(e,t)};l.KER=c(0,0);var h=function(e,t){this.x=e,this.y=t};$jit.Complex=h,h.prototype={getc:function(){return this},getp:function(e){return this.toPolar(e)},set:function(e){e=e.getc(!0),this.x=e.x,this.y=e.y},setc:function(e,t){this.x=e,this.y=t},setp:function(e,t){this.x=Math.cos(e)*t,this.y=Math.sin(e)*t},clone:function(){return new h(this.x,this.y)},toPolar:function(e){var t=this.norm(),n=Math.atan2(this.y,this.x);return n<0&&(n+=Math.PI*2),e?{theta:n,rho:t}:new l(n,t)},norm:function(){return Math.sqrt(this.squaredNorm())},squaredNorm:function(){return this.x*this.x+this.y*this.y},add:function(e){return new h(this.x+e.x,this.y+e.y)},prod:function(e){return new h(this.x*e.x-this.y*e.y,this.y*e.x+this.x*e.y)},conjugate:function(){return new h(this.x,-this.y)},scale:function(e){return new h(this.x*e,this.y*e)},equals:function(e){return this.x==e.x&&this.y==e.y},$add:function(e){return this.x+=e.x,this.y+=e.y,this},$prod:function(e){var t=this.x,n=this.y;return this.x=t*e.x-n*e.y,this.y=n*e.x+t*e.y,this},$conjugate:function(){return this.y=-this.y,this},$scale:function(e){return this.x*=e,this.y*=e,this},$div:function(e){var t=this.x,n=this.y,r=e.squaredNorm();return this.x=t*e.x+n*e.y,this.y=n*e.x-t*e.y,this.$scale(1/r)}};var p=function(e,t){return new h(e,t)};h.KER=p(0,0),$jit.Graph=new t({initialize:function(t,n,r,i){var s={complex:!1,Node:{}};this.Node=n,this.Edge=r,this.Label=i,this.opt=e.merge(s,t||{}),this.nodes={},this.edges={};var o=this;this.nodeList={};for(var u in
|
||
v)o.nodeList[u]=function(e){return function(){var t=Array.prototype.slice.call(arguments);o.eachNode(function(n){n[e].apply(n,t)})}}(u)},getNode:function(e){return this.hasNode(e)?this.nodes[e]:!1},getByName:function(e){for(var t in this.nodes){var n=this.nodes[t];if(n.name==e)return n}return!1},getAdjacence:function(e,t){return e in this.edges?this.edges[e][t]:!1},addNode:function(t){if(!this.nodes[t.id]){var n=this.edges[t.id]={};this.nodes[t.id]=new d.Node(e.extend({id:t.id,name:t.name,data:e.merge(t.data||{},{}),adjacencies:n},this.opt.Node),this.opt.complex,this.Node,this.Edge,this.Label)}return this.nodes[t.id]},addAdjacence:function(e,t,n){this.hasNode(e.id)||this.addNode(e),this.hasNode(t.id)||this.addNode(t),e=this.nodes[e.id],t=this.nodes[t.id];if(!e.adjacentTo(t)){var r=this.edges[e.id]=this.edges[e.id]||{},i=this.edges[t.id]=this.edges[t.id]||{};return r[t.id]=i[e.id]=new d.Adjacence(e,t,n,this.Edge,this.Label),r[t.id]}return this.edges[e.id][t.id]},removeNode:function(e){if(this.hasNode(e)){delete this.nodes[e];var t=this.edges[e];for(var n in t)delete this.edges[n][e];delete this.edges[e]}},removeAdjacence:function(e,t){delete this.edges[e][t],delete this.edges[t][e]},hasNode:function(e){return e in this.nodes},empty:function(){this.nodes={},this.edges={}}});var d=$jit.Graph,v;(function(){var t=function(e,t,n,r,i){var s;n=n||"current",e="$"+(e?e+"-":""),n=="current"?s=this.data:n=="start"?s=this.startData:n=="end"&&(s=this.endData);var o=e+t;return r?s[o]:this.Config.overridable?o in s?s[o]:o in this.data?this.data[o]:i[t]||0:i[t]||0},n=function(e,t,n,r){r=r||"current",e="$"+(e?e+"-":"");var i;r=="current"?i=this.data:r=="start"?i=this.startData:r=="end"&&(i=this.endData),i[e+t]=n},r=function(t,n){t="$"+(t?t+"-":"");var r=this;e.each(n,function(e){var n=t+e;delete r.data[n],delete r.endData[n],delete r.startData[n]})};v={getData:function(e,n,r){return t.call(this,"",e,n,r,this.Config)},setData:function(e,t,r){n.call(this,"",e,t,r)},setDataset:function(t,n){t=e.splat(t);for(var r in n)for(var i=0,s=e.splat(n[r]),o=t.length;i<o;i++)this.setData(r,s[i],t[i])},removeData:function(){r.call(this,"",Array.prototype.slice.call(arguments))},getCanvasStyle:function(e,n,r){return t.call(this,"canvas",e,n,r,this.Config.CanvasStyles)},setCanvasStyle:function(e,t,r){n.call(this,"canvas",e,t,r)},setCanvasStyles:function(t,n){t=e.splat(t);for(var r in n)for(var i=0,s=e.splat(n[r]),o=t.length;i<o;i++)this.setCanvasStyle(r,s[i],t[i])},removeCanvasStyle:function(){r.call(this,"canvas",Array.prototype.slice.call(arguments))},getLabelData:function(e,n,r){return t.call(this,"label",e,n,r,this.Label)},setLabelData:function(e,t,r){n.call(this,"label",e,t,r)},setLabelDataset:function(t,n){t=e.splat(t);for(var r in n)for(var i=0,s=e.splat(n[r]),o=t.length;i<o;i++)this.setLabelData(r,s[i],t[i])},removeLabelData:function(){r.call(this,"label",Array.prototype.slice.call(arguments))}}})(),d.Node=new t({initialize:function(t,n,r,i,s){var o={id:"",name:"",data:{},startData:{},endData:{},adjacencies:{},selected:!1,drawn:!1,exist:!1,angleSpan:{begin:0,end:0},pos:n&&p(0,0)||c(0,0),startPos:n&&p(0,0)||c(0,0),endPos:n&&p(0,0)||c(0,0)};e.extend(this,e.extend(o,t)),this.Config=this.Node=r,this.Edge=i,this.Label=s},adjacentTo:function(e){return e.id in this.adjacencies},getAdjacency:function(e){return this.adjacencies[e]},getPos:function(e){e=e||"current";if(e=="current")return this.pos;if(e=="end")return this.endPos;if(e=="start")return this.startPos},setPos:function(e,t){t=t||"current";var n;t=="current"?n=this.pos:t=="end"?n=this.endPos:t=="start"&&(n=this.startPos),n.set(e)}}),d.Node.implement(v),d.Adjacence=new t({initialize:function(e,t,n,r,i){this.nodeFrom=e,this.nodeTo=t,this.data=n||{},this.startData={},this.endData={},this.Config=this.Edge=r,this.Label=i}}),d.Adjacence.implement(v),d.Util={filter:function(t){if(!t||e.type(t)!="string")return function(){return!0};var n=t.split(" ");return function(e){for(var t=0;t<n.length;t++)if(e[n[t]])return!1;return!0}},getNode:function(e,t){return e.nodes[t]},eachNode:function(e,t,n){var r=this.filter(n);for(var i in e.nodes)r(e.nodes[i])&&t(e.nodes[i])},eachAdjacency:function(e,t,n){var r=e.adjacencies,i=this.filter(n);for(var s in r){var o=r[s];if(i(o)){if(o.nodeFrom!=e){var u=o.nodeFrom;o.nodeFrom=o.nodeTo,o.nodeTo=u}t(o,s)}}},computeLevels:function(e,t,n,r){n=n||0;var i=this.filter(r);this.eachNode(e,function(e){e._flag=!1,e._depth=-1},r);var s=e.getNode(t);s._depth=n;var o=[s];while(o.length!=0){var u=o.pop();u._flag=!0,this.eachAdjacency(u,function(e){var t=e.nodeTo;t._flag==0&&i(t)&&(t._depth<0&&(t._depth=u._depth+1+n),o.unshift(t))},r)}},eachBFS:function(e,t,n,r){var i=this.filter(r);this.clean(e);var s=[e.getNode(t)];while(s.length!=0){var o=s.pop();o._flag=!0,n(o,o._depth),this.eachAdjacency(o,function(e){var t=e.nodeTo;t._flag==0&&i(t)&&(t._flag=!0,s.unshift(t))},r)}},eachLevel:function(e,t,n,r,i){var s=e._depth,o=this.filter(i),u=this;n=n===!1?Number.MAX_VALUE-s:n,function a(e,t,n){var i=e._depth;i>=t&&i<=n&&o(e)&&r(e,i),i<n&&u.eachAdjacency(e,function(e){var r=e.nodeTo;r._depth>i&&a(r,t,n)})}(e,t+s,n+s)},eachSubgraph:function(e,t,n){this.eachLevel(e,0,!1,t,n)},eachSubnode:function(e,t,n){this.eachLevel(e,1,1,t,n)},anySubnode:function(t,n,r){var i=!1;n=n||e.lambda(!0);var s=e.type(n)=="string"?function(e){return e[n]}:n;return this.eachSubnode(t,function(e){s(e)&&(i=!0)},r),i},getSubnodes:function(t,n,r){var i=[],s=this;n=n||0;var o,u;return e.type(n)=="array"?(o=n[0],u=n[1]):(o=n,u=Number.MAX_VALUE-t._depth),this.eachLevel(t,o,u,function(e){i.push(e)},r),i},getParents:function(e){var t=[];return this.eachAdjacency(e,function(n){var r=n.nodeTo;r._depth<e._depth&&t.push(r)}),t},isDescendantOf:function(e,t){if(e.id==t)return!0;var n=this.getParents(e),r=!1;for(var i=0;!r&&i<n.length;i++)r=r||this.isDescendantOf(n[i],t);return r},clean:function(e){this.eachNode(e,function(e){e._flag=!1})},getClosestNodeToOrigin:function(e,t,n){return this.getClosestNodeToPos(e,l.KER,t,n)},getClosestNodeToPos:function(e,t,n,r){var i=null;n=n||"current",t=t&&t.getc(!0)||h.KER;var s=function(e,t){var n=e.x-t.x,r=e.y-t.y;return n*n+r*r};return this.eachNode(e,function(e){i=i==null||s(e.getPos(n).getc(!0),t)<s(i.getPos(n).getc(!0),t)?e:i},r),i}},e.each(["getNode","eachNode","computeLevels","eachBFS","clean","getClosestNodeToPos","getClosestNodeToOrigin"],function(e){d.prototype[e]=function(){return d.Util[e].apply(d.Util,[this].concat(Array.prototype.slice.call(arguments)))}}),e.each(["eachAdjacency","eachLevel","eachSubgraph","eachSubnode","anySubnode","getSubnodes","getParents","isDescendantOf"],function(e){d.Node.prototype[e]=function(){return d.Util[e].apply(d.Util,[this].concat(Array.prototype.slice.call(arguments)))}}),d.Op={options:{type:"nothing",duration:2e3,hideLabels:!0,fps:30},initialize:function(e){this.viz=e},removeNode:function(t,n){var r=this.viz,i=e.merge(this.options,r.controller,n),s=e.splat(t),o,u,a;switch(i.type){case"nothing":for(o=0;o<s.length;o++)r.graph.removeNode(s[o]);break;case"replot":this.removeNode(s,{type:"nothing"}),r.labels.clearLabels(),r.refresh(!0);break;case"fade:seq":case"fade":u=this;for(o=0;o<s.length;o++)a=r.graph.getNode(s[o]),a.setData("alpha",0,"end");r.fx.animate(e.merge(i,{modes:["node-property:alpha"],onComplete:function(){u.removeNode(s,{type:"nothing"}),r.labels.clearLabels(),r.reposition(),r.fx.animate(e.merge(i,{modes:["linear"]}))}}));break;case"fade:con":u=this;for(o=0;o<s.length;o++)a=r.graph.getNode(s[o]),a.setData("alpha",0,"end"),a.ignore=!0;r.reposition(),r.fx.animate(e.merge(i,{modes:["node-property:alpha","linear"],onComplete:function(){u.removeNode(s,{type:"nothing"})}}));break;case"iter":u=this,r.fx.sequence({condition:function(){return s.length!=0},step:function(){u.removeNode(s.shift(),{type:"nothing"}),r.labels.clearLabels()},onComplete:function(){i.onComplete()},duration:Math.ceil(i.duration/s.length)});break;default:this.doError()}},removeEdge:function(t,n){var r=this.viz,i=e.merge(this.options,r.controller,n),s=e.type(t[0])=="string"?[t]:t,o,u,a;switch(i.type){case"nothing":for(o=0;o<s.length;o++)r.graph.removeAdjacence(s[o][0],s[o][1]);break;case"replot":this.removeEdge(s,{type:"nothing"}),r.refresh(!0);break;case"fade:seq":case"fade":u=this;for(o=0;o<s.length;o++)a=r.graph.getAdjacence(s[o][0],s[o][1]),a&&a.setData("alpha",0,"end");r.fx.animate(e.merge(i,{modes:["edge-property:alpha"],onComplete:function(){u.removeEdge(s,{type:"nothing"}),r.reposition(),r.fx.animate(e.merge(i,{modes:["linear"]}))}}));break;case"fade:con":u=this;for(o=0;o<s.length;o++)a=r.graph.getAdjacence(s[o][0],s[o][1]),a&&(a.setData("alpha",0,"end"),a.ignore=!0);r.reposition(),r.fx.animate(e.merge(i,{modes:["edge-property:alpha","linear"],onComplete:function(){u.removeEdge(s,{type:"nothing"})}}));break;case"iter":u=this,r.fx.sequence({condition:function(){return s.length!=0},step:function(){u.removeEdge(s.shift(),{type:"nothing"}),r.labels.clearLabels()},onComplete:function(){i.onComplete()},duration:Math.ceil(i.duration/s.length)});break;default:this.doError()}},sum:function(t,n){var r=this.viz,i=e.merge(this.options,r.controller,n),s=r.root,o;r.root=n.id||r.root;switch(i.type){case"nothing":o=r.construct(t),o.eachNode(function(e){e.eachAdjacency(function(e){r.graph.addAdjacence(e.nodeFrom,e.nodeTo,e.data)})});break;case"replot":r.refresh(!0),this.sum(t,{type:"nothing"}),r.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,o=r.construct(t);var u=this.preprocessSum(o),a=u?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];r.reposition(),i.type!="fade:con"?r.fx.animate(e.merge(i,{modes:["linear"],onComplete:function(){r.fx.animate(e.merge(i,{modes:a,onComplete:function(){i.onComplete()}}))}})):(r.graph.eachNode(function(e){e.id!=s&&e.pos.getp().equals(l.KER)&&(e.pos.set(e.endPos),e.startPos.set(e.endPos))}),r.fx.animate(e.merge(i,{modes:["linear"].concat(a)})));break;default:this.doError()}},morph:function(t,n,r){var i=this.viz,s=e.merge(this.options,i.controller,n),o=i.root,u;i.root=n.id||i.root;switch(s.type){case"nothing":u=i.construct(t),u.eachNode(function(e){var t=i.graph.hasNode(e.id);e.eachAdjacency(function(e){var t=!!i.graph.getAdjacence(e.nodeFrom.id,e.nodeTo.id);i.graph.addAdjacence(e.nodeFrom,e.nodeTo,e.data);if(t){var n=i.graph.getAdjacence(e.nodeFrom.id,e.nodeTo.id);for(var r in e.data||{})n.data[r]=e.data[r]}});if(t){var n=i.graph.getNode(e.id);for(var r in e.data||{})n.data[r]=e.data[r]}}),i.graph.eachNode(function(e){e.eachAdjacency(function(e){u.getAdjacence(e.nodeFrom.id,e.nodeTo.id)||i.graph.removeAdjacence(e.nodeFrom.id,e.nodeTo.id)}),u.hasNode(e.id)||i.graph.removeNode(e.id)});break;case"replot":i.labels.clearLabels(!0),this.morph(t,{type:"nothing"}),i.refresh(!0),i.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,u=i.construct(t);var a=r&&"node-property"in r&&e.map(e.splat(r["node-property"]),function(e){return"$"+e});i.graph.eachNode(function(t){var n=u.getNode(t.id);if(!n)t.setData("alpha",1),t.setData("alpha",1,"start"),t.setData("alpha",0,"end"),t.ignore=!0;else{var r=n.data;for(var i in r)a&&e.indexOf(a,i)>-1?t.endData[i]=r[i]:t.data[i]=r[i]}}),i.graph.eachNode(function(e){if(e.ignore)return;e.eachAdjacency(function(e){if(e.nodeFrom.ignore||e.nodeTo.ignore)return;var t=u.getNode(e.nodeFrom.id),n=u.getNode(e.nodeTo.id);if(!t.adjacentTo(n)){var e=i.graph.getAdjacence(t.id,n.id);f=!0,e.setData("alpha",1),e.setData("alpha",1,"start"),e.setData("alpha",0,"end")}})});var f=this.preprocessSum(u),c=f?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];c[0]=c[0]+(r&&"node-property"in r?":"+e.splat(r["node-property"]).join(":"):""),c[1]=(c[1]||"edge-property:alpha")+(r&&"edge-property"in r?":"+e.splat(r["edge-property"]).join(":"):""),r&&"label-property"in r&&c.push("label-property:"+e.splat(r["label-property"]).join(":")),i.reposition(),i.graph.eachNode(function(e){e.id!=o&&e.pos.getp().equals(l.KER)&&(e.pos.set(e.endPos),e.startPos.set(e.endPos))}),i.fx.animate(e.merge(s,{modes:["polar"].concat(c),onComplete:function(){i.graph.eachNode(function(e){e.ignore&&i.graph.removeNode(e.id)}),i.graph.eachNode(function(e){e.eachAdjacency(function(e){e.ignore&&i.graph.removeAdjacence(e.nodeFrom.id,e.nodeTo.id)})}),s.onComplete()}}));break;default:}},contract:function(t,n){var r=this.viz;if(t.collapsed||!t.anySubnode(e.lambda(!0)))return;n=e.merge(this.options,r.config,n||{},{modes:["node-property:alpha:span","linear"]}),t.collapsed=!0,function i(e){e.eachSubnode(function(e){e.ignore=!0,e.setData("alpha",0,n.type=="animate"?"end":"current"),i(e)})}(t),n.type=="animate"?(r.compute("end"),r.rotated&&r.rotate(r.rotated,"none",{property:"end"}),function s(e){e.eachSubnode(function(e){e.setPos(t.getPos("end"),"end"),s(e)})}(t),r.fx.animate(n)):n.type=="replot"&&r.refresh()},expand:function(t,n){if(!("collapsed"in t))return;var r=this.viz;n=e.merge(this.options,r.config,n||{},{modes:["node-property:alpha:span","linear"]}),delete t.collapsed,function i(e){e.eachSubnode(function(e){delete e.ignore,e.setData("alpha",1,n.type=="animate"?"end":"current"),i(e)})}(t),n.type=="animate"?(r.compute("end"),r.rotated&&r.rotate(r.rotated,"none",{property:"end"}),r.fx.animate(n)):n.type=="replot"&&r.refresh()},preprocessSum:function(e){var t=this.viz;e.eachNode(function(e){if(!t.graph.hasNode(e.id)){t.graph.addNode(e);var n=t.graph.getNode(e.id);n.setData("alpha",0),n.setData("alpha",0,"start"),n.setData("alpha",1,"end")}});var n=!1;return e.eachNode(function(e){e.eachAdjacency(function(e){var r=t.graph.getNode(e.nodeFrom.id),i=t.graph.getNode(e.nodeTo.id);if(!r.adjacentTo(i)){var e=t.graph.addAdjacence(r,i,e.data);r.startAlpha==r.endAlpha&&i.startAlpha==i.endAlpha&&(n=!0,e.setData("alpha",0),e.setData("alpha",0,"start"),e.setData("alpha",1,"end"))}})}),n}};var m={none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t,n,r){var i=r.getCtx();i.beginPath(),i.arc(t.x,t.y,n,0,Math.PI*2,!0),i.closePath(),i[e]()},contains:function(e,t,n){var r=e.x-t.x,i=e.y-t.y,s=r*r+i*i;return s<=n*n}},ellipse:{render:function(e,t,n,r,i){var s=i.getCtx();r/=2,n/=2,s.save(),s.scale(n/r,r/n),s.beginPath(),s.arc(t.x*(r/n),t.y*(n/r),r,0,Math.PI*2,!0),s.closePath(),s[e](),s.restore()},contains:function(e,t,n,r){n/=2,r/=2;var i=(n+r)/2,s=e.x-t.x,o=e.y-t.y,u=s*s+o*o;return u<=i*i}},square:{render:function(e,t,n,r){r.getCtx()[e+"Rect"](t.x-n,t.y-n,2*n,2*n)},contains:function(e,t,n){return Math.abs(t.x-e.x)<=n&&Math.abs(t.y-e.y)<=n}},rectangle:{render:function(e,t,n,r,i){i.getCtx()[e+"Rect"](t.x-n/2,t.y-r/2,n,r)},contains:function(e,t,n,r){return Math.abs(t.x-e.x)<=n/2&&Math.abs(t.y-e.y)<=r/2}},triangle:{render:function(e,t,n,r){var i=r.getCtx(),s=t.x,o=t.y-n,u=s-n,a=t.y+n,f=s+n,l=a;i.beginPath(),i.moveTo(s,o),i.lineTo(u,a),i.lineTo(f,l),i.closePath(),i[e]()},contains:function(e,t,n){return m.circle.contains(e,t,n)}},star:{render:function(e,t,n,r){var i=r.getCtx(),s=Math.PI/5;i.save(),i.translate(t.x,t.y),i.beginPath(),i.moveTo(n,0);for(var o=0;o<9;o++)i.rotate(s),o%2==0?i.lineTo(n/.525731*.200811,0):i.lineTo(n,0);i.closePath(),i[e](),i.restore()},contains:function(e,t,n){return m.circle.contains(e,t,n)}}},g={line:{render:function(e,t,n){var r=n.getCtx();r.beginPath(),r.moveTo(e.x,e.y),r.lineTo(t.x,t.y),r.stroke()},contains:function(e,t,n,r){var i=Math.min,s=Math.max,o=i(e.x,t.x),u=s(e.x,t.x),a=i(e.y,t.y),f=s(e.y,t.y);if(n.x>=o&&n.x<=u&&n.y>=a&&n.y<=f){if(Math.abs(t.x-e.x)<=r)return!0;var l=(t.y-e.y)/(t.x-e.x)*(n.x-e.x)+e.y;return Math.abs(l-n.y)<=r}return!1}},arrow:{render:function(e,t,n,r,i){var s=i.getCtx();if(r){var o=e;e=t,t=o}var u=new h(t.x-e.x,t.y-e.y);u.$scale(n/u.norm());var a=new h(t.x-u.x,t.y-u.y),f=new h(-u.y/2.5,u.x/2.5),l=a.add(f),c=a.$add(f.$scale(-1)),p=new h(t.x-e.x,t.y-e.y);p.$scale(15/p.norm());var d=new h(t.x-p.x,t.y-p.y);t.x=d.x,t.y=d.y,s.beginPath(),s.moveTo(e.x,e.y),s.lineTo(t.x,t.y),s.stroke(),s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.lineTo(t.x,t.y),s.closePath(),s.fill()},contains:function(e,t,n,r){return g.line.contains(e,t,n,r)}},hyperline:{render:function(e,t,n,r){function f(e,t){var n=e.x*t.y-e.y*t.x,r=n,i=e.squaredNorm(),s=t.squaredNorm();if(n==0)return{x:0,y:0,ratio:-1};var o=(e.y*s-t.y*i+e.y-t.y)/n,u=(t.x*i-e.x*s+t.x-e.x)/r,a=-o/2,f=-u/2,l=(o*o+u*u)/4-1;if(l<0)return{x:0,y:0,ratio:-1};var c=Math.sqrt(l),h={x:a,y:f,ratio:c>1e3?-1:c,a:o,b:u};return h}function a(e,t){return e<t?e+Math.PI>t?!1:!0:t+Math.PI>e?!0:!1}var i=r.getCtx(),s=f(e,t);if(s.a>1e3||s.b>1e3||s.ratio<0)i.beginPath(),i.moveTo(e.x*n,e.y*n),i.lineTo(t.x*n,t.y*n),i.stroke();else{var o=Math.atan2(t.y-s.y,t.x-s.x),u=Math.atan2(e.y-s.y,e.x-s.x),a=a(o,u);i.beginPath(),i.arc(s.x*n,s.y*n,s.ratio*n,o,u,a),i.stroke()}},contains:e.lambda(!1)}};d.Plot={initialize:function(e,t){this.viz=e,this.config=e.config,this.node=e.config.Node,this.edge=e.config.Edge,this.animation=new r,this.nodeTypes=new t.Plot.NodeTypes,this.edgeTypes=new t.Plot.EdgeTypes,this.labels=e.labels},nodeHelper:m,edgeHelper:g,Interpolator:{map:{border:"color",color:"color",width:"number",height:"number",dim:"number",alpha:"number",lineWidth:"number",angularWidth:"number",span:"number",valueArray:"array-number",dimArray:"array-number"},canvas:{globalAlpha:"number",fillStyle:"color",strokeStyle:"color",lineWidth:"number",shadowBlur:"number",shadowColor:"color",shadowOffsetX:"number",shadowOffsetY:"number",miterLimit:"number"},label:{size:"number",color:"color"},compute:function(e,t,n){return e+(t-e)*n},moebius:function(e,t,n,r){var i=r.scale(-n);if(i.norm()<1){var s=i.x,o=i.y,u=e.startPos.getc().moebiusTransformation(i);e.pos.setc(u.x,u.y),i.x=s,i.y=o}},linear:function(e,t,n){var r=e.startPos.getc(!0),i=e.endPos.getc(!0);e.pos.setc(this.compute(r.x,i.x,n),this.compute(r.y,i.y,n))},polar:function(e,t,n){var r=e.startPos.getp(!0),i=e.endPos.getp(),s=i.interpolate(r,n);e.pos.setp(s.theta,s.rho)},number:function(e,t,n,r,i){var s=e[r](t,"start"),o=e[r](t,"end");e[i](t,this.compute(s,o,n))},color:function(t,n,r,i,s){var o=e.hexToRgb(t[i](n,"start")),u=e.hexToRgb(t[i](n,"end")),a=this.compute,f=e.rgbToHex([parseInt(a(o[0],u[0],r)),parseInt(a(o[1],u[1],r)),parseInt(a(o[2],u[2],r))]);t[s](n,f)},"array-number":function(e,t,n,r,i){var s=e[r](t,"start"),o=e[r](t,"end"),u=[];for(var a=0,f=s.length;a<f;a++){var l=s[a],c=o[a];if(l.length){for(var h=0,p=l.length,d=[];h<p;h++)d.push(this.compute(l[h],c[h],n));u.push(d)}else u.push(this.compute(l,c,n))}e[i](t,u)},node:function(e,t,n,r,i,s){r=this[r];if(t){var o=t.length;for(var u=0;u<o;u++){var a=t[u];this[r[a]](e,a,n,i,s)}}else for(var a in r)this[r[a]](e,a,n,i,s)},edge:function(e,t,n,r,i,s){var o=e.adjacencies;for(var u in o)this.node(o[u],t,n,r,i,s)},"node-property":function(e,t,n){this.node(e,t,n,"map","getData","setData")},"edge-property":function(e,t,n){this.edge(e,t,n,"map","getData","setData")},"label-property":function(e,t,n){this.node(e,t,n,"label","getLabelData","setLabelData")},"node-style":function(e,t,n){this.node(e,t,n,"canvas","getCanvasStyle","setCanvasStyle")},"edge-style":function(e,t,n){this.edge(e,t,n,"canvas","getCanvasStyle","setCanvasStyle")}},sequence:function(t){var n=this;t=e.merge({condition:e.lambda(!1),step:e.empty,onComplete:e.empty,duration:200},t||{});var r=setInterval(function(){t.condition()?t.step():(clearInterval(r),t.onComplete()),n.viz.refresh(!0)},t.duration)},prepare:function(t){var n=this.viz.graph,r={"node-property":{getter:"getData",setter:"setData"},"edge-property":{getter:"getData",setter:"setData"},"node-style":{getter:"getCanvasStyle",setter:"setCanvasStyle"},"edge-style":{getter:"getCanvasStyle",setter:"setCanvasStyle"}},i={};if(e.type(t)=="array")for(var s=0,o=t.length;s<o;s++){var u=t[s].split(":");i[u.shift()]=u}else for(var a in t)a=="position"?i[t.position]=[]:i[a]=e.splat(t[a]);return n.eachNode(function(t){t.startPos.set(t.pos),e.each(["node-property","node-style"],function(e){if(e in i){var n=i[e];for(var s=0,o=n.length;s<o;s++)t[r[e].setter](n[s],t[r[e].getter](n[s]),"start")}}),e.each(["edge-property","edge-style"],function(e){if(e in i){var n=i[e];t.eachAdjacency(function(t){for(var i=0,s=n.length;i<s;i++)t[r[e].setter](n[i],t[r[e].getter](n[i]),"start")})}})}),i},animate:function(t,n){t=e.merge(this.viz.config,t||{});var r=this,i=this.viz,s=i.graph,o=this.Interpolator,u=t.type==="nodefx"?this.nodeFxAnimation:this.animation,a=this.prepare(t.modes);t.hideLabels&&this.labels.hideLabels(!0),u.setOptions(e.merge(t,{$animating:!1,compute:function(e){s.eachNode(function(t){for(var r in a)o[r](t,a[r],e,n)}),r.plot(t,this.$animating,e),this.$animating=!0},complete:function(){t.hideLabels&&r.labels.hideLabels(!1),r.plot(t),t.onComplete(),t.onAfterCompute()}})).start()},nodeFx:function(t){var n=this.viz,r=n.graph,i=this.nodeFxAnimation,s=e.merge(this.viz.config,{elements:{id:!1,properties:{}},reposition:!1});t=e.merge(s,t||{},{onBeforeCompute:e.empty,onAfterCompute:e.empty}),i.stopTimer();var o=t.elements.properties;if(!t.elements.id)r.eachNode(function(e){for(var t in o)e.setData(t,o[t],"end")});else{var u=e.splat(t.elements.id);e.each(u,function(e){var t=r.getNode(e);if(t)for(var n in o)t.setData(n,o[n],"end")})}var a=[];for(var f in o)a.push(f);var l=["node-property:"+a.join(":")];t.reposition&&(l.push("linear"),n.compute("end")),this.animate(e.merge(t,{modes:l,type:"nodefx"}))},plot:function(e,t){var n=this.viz,r=n.graph,i=n.canvas,s=n.root,o=this,u=i.getCtx(),a=Math.min,e=e||this.viz.controller;e.clearCanvas&&i.clear();var f=r.getNode(s);if(!f)return;var l=!!f.visited;r.eachNode(function(n){var r=n.getData("alpha");n.eachAdjacency(function(s){var f=s.nodeTo;!!f.visited===l&&n.drawn&&f.drawn&&(!t&&e.onBeforePlotLine(s),u.save(),u.globalAlpha=a(r,f.getData("alpha"),s.getData("alpha")),o.plotLine(s,i,t),u.restore(),!t&&e.onAfterPlotLine(s))}),u.save(),n.drawn&&(!t&&e.onBeforePlotNode(n),o.plotNode(n,i,t),!t&&e.onAfterPlotNode(n)),!o.labelsHidden&&e.withLabels&&(n.drawn&&r>=.95?o.labels.plotLabel(i,n,e):o.labels.hideLabel(n,!1)),u.restore(),n.visited=!l})},plotTree:function(e,t,n){var r=this,i=this.viz,s=i.canvas,o=this.config,u=s.getCtx(),a=e.getData("alpha");e.eachSubnode(function(i){if(t.plotSubtree(e,i)&&i.exist&&i.drawn){var o=e.getAdjacency(i.id);!n&&t.onBeforePlotLine(o),u.globalAlpha=Math.min(a,i.getData("alpha")),r.plotLine(o,s,n),!n&&t.onAfterPlotLine(o),r.plotTree(i,t,n)}}),e.drawn?(!n&&t.onBeforePlotNode(e),this.plotNode(e,s,n),!n&&t.onAfterPlotNode(e),!t.hideLabels&&t.withLabels&&a>=.95?this.labels.plotLabel(s,e,t):this.labels.hideLabel(e,!1)):this.labels.hideLabel(e,!0)},plotNode:function(e,t,n){var r=e.getData("type"),i=this.node.CanvasStyles;if(r!="none"){var s=e.getData("lineWidth"),o=e.getData("color"),u=e.getData("alpha"),a=t.getCtx();a.lineWidth=s,a.fillStyle=a.strokeStyle=o,a.globalAlpha=u;for(var f in i)a[f]=e.getCanvasStyle(f);this.nodeTypes[r].render.call(this,e,t,n)}},plotLine:function(e,t,n){var r=e.getData("type"),i=this.edge.CanvasStyles;if(r!="none"){var s=e.getData("lineWidth"),o=e.getData("color"),u=t.getCtx();u.lineWidth=s,u.fillStyle=u.strokeStyle=o;for(var a in i)u[a]=e.getCanvasStyle(a);this.edgeTypes[r].render.call(this,e,t,n)}}},d.Label={},d.Label.Native=new t({plotLabel:function(e,t,n){var r=e.getCtx(),i=t.pos.getc(!0);r.font=t.getLabelData("style")+" "+t.getLabelData("size")+"px "+t.getLabelData("family"),r.textAlign=t.getLabelData("textAlign"),r.fillStyle=r.strokeStyle=t.getLabelData("color"),r.textBaseline=t.getLabelData("textBaseline"),this.renderLabel(e,t,n)},renderLabel:function(e,t,n){var r=e.getCtx(),i=t.pos.getc(!0);r.fillText(t.name,i.x,i.y+t.getData("height")/2)},hideLabel:e.empty,hideLabels:e.empty}),d.Label.DOM=new t({labelsHidden:!1,labelContainer:!1,labels:{},getLabelContainer:function(){return this.labelContainer?this.labelContainer:this.labelContainer=document.getElementById(this.viz.config.labelContainer)},getLabel:function(e){return e in this.labels&&this.labels[e]!=null?this.labels[e]:this.labels[e]=document.getElementById(e)},hideLabels:function(e){var t=this.getLabelContainer();e?t.style.display="none":t.style.display="",this.labelsHidden=e},clearLabels:function(e){for(var t in this.labels)if(e||!this.viz.graph.hasNode(t))this.disposeLabel(t),delete this.labels[t]},disposeLabel:function(e){var t=this.getLabel(e);t&&t.parentNode&&t.parentNode.removeChild(t)},hideLabel:function(t,n){t=e.splat(t);var r=n?"":"none",i,s=this;e.each(t,function(e){var t=s.getLabel(e.id);t&&(t.style.display=r)})},fitsInCanvas:function(e,t){var n=t.getSize();return e.x>=n.width||e.x<0||e.y>=n.height||e.y<0?!1:!0}}),d.Label.HTML=new t({Implements:d.Label.DOM,plotLabel:function(e,t,n){var r=t.id,i=this.getLabel(r);if(!i&&!(i=document.getElementById(r))){i=document.createElement("div");var s=this.getLabelContainer();i.id=r,i.className="node",i.style.position="absolute",n.onCreateLabel(i,t),s.appendChild(i),this.labels[t.id]=i}this.placeLabel(i,t,n)}}),d.Label.SVG=new t({Implements:d.Label.DOM,plotLabel:function(e,t,n){var r=t.id,i=this.getLabel(r);if(!i&&!(i=document.getElementById(r))){var s="http://www.w3.org/2000/svg";i=document.createElementNS(s,"svg:text");var o=document.createElementNS(s,"svg:tspan");i.appendChild(o);var u=this.getLabelContainer();i.setAttribute("id",r),i.setAttribute("class","node"),u.appendChild(i),n.onCreateLabel(i,t),this.labels[t.id]=i}this.placeLabel(i,t,n)}}),d.Geom=new t({initialize:function(e){this.viz=e,this.config=e.config,this.node=e.config.Node,this.edge=e.config.Edge},translate:function(t,n){n=e.splat(n),this.viz.graph.eachNode(function(r){e.each(n,function(e){r.getPos(e).$add(t)})})},setRightLevelToShow:function(t,n,r){var i=this.getRightLevelToShow(t,n),s=this.viz.labels,o=e.merge({execShow:!0,execHide:!0,onHide:e.empty,onShow:e.empty},r||{});t.eachLevel(0,this.config.levelsToShow,function(e){var n=e._depth-t._depth;n>i?(o.onHide(e),o.execHide&&(e.drawn=!1,e.exist=!1,s.hideLabel(e,!1))):(o.onShow(e),o.execShow&&(e.exist=!0))}),t.drawn=!0},getRightLevelToShow:function(e,t){var n=this.config,r=n.levelsToShow,i=n.constrained;if(!i)return r;while(!this.treeFitsInCanvas(e,t,r)&&r>1)r--;return r}});var y={construct:function(t){var n=e.type(t)=="array",r=new d(this.graphOptions,this.config.Node,this.config.Edge,this.config.Label);return n?function(t,n){var r=function(e){for(var r=0,i=n.length;r<i;r++)if(n[r].id==e)return n[r];var s={id:e,name:e};return t.addNode(s)};for(var i=0,s=n.length;i<s;i++){t.addNode(n[i]);var o=n[i].adjacencies;if(o)for(var u=0,a=o.length;u<a;u++){var f=o[u],l={};typeof o[u]!="string"&&(l=e.merge(f.data,{}),f=f.nodeTo),t.addAdjacence(n[i],r(f),l)}}}(r,t):function(e,t){e.addNode(t);if(t.children)for(var n=0,r=t.children;n<r.length;n++)e.addAdjacence(t,r[n]),arguments.callee(e,r[n])}(r,t),r},loadJSON:function(t,n){this.json=t,this.labels&&this.labels.clearLabels&&this.labels.clearLabels(!0),this.graph=this.construct(t),e.type(t)!="array"?this.root=t.id:this.root=t[n?n:0].id},toJSON:function(e){e=e||"tree";if(e=="tree"){var t={},n=this.graph.getNode(this.root),t=function i(e){var t={};t.id=e.id,t.name=e.name,t.data=e.data;var n=[];return e.eachSubnode(function(e){n.push(i(e))}),t.children=n,t}(n);return t}var t=[],r=!!this.graph.getNode(this.root).visited;return this.graph.eachNode(function(e){var n={};n.id=e.id,n.name=e.name,n.data=e.data;var i=[];e.eachAdjacency(function(e){var t=e.nodeTo;if(!!t.visited===r){var n={};n.nodeTo=t.id,n.data=e.data,i.push(n)}}),n.adjacencies=i,t.push(n),e.visited=!r}),t}},b=$jit.Layouts={},w={label:null,compute:function(t,n,r){this.initializeLabel(r);var i=this.label,s=i.style;t.eachNode(function(t){var n=t.getData("autoWidth"),r=t.getData("autoHeight");if(n||r){delete t.data.$width,delete t.data.$height,delete t.data.$dim;var o=t.getData("width"),u=t.getData("height");s.width=n?"auto":o+"px",s.height=r?"auto":u+"px",i.innerHTML=t.name;var a=i.offsetWidth,f=i.offsetHeight,l=t.getData("type");if(e.indexOf(["circle","square","triangle","star"],l)===-1)t.setData("width",a),t.setData("height",f);else{var c=a>f?a:f;t.setData("width",c),t.setData("height",c),t.setData("dim",c)}}})},initializeLabel:function(e){this.label||(this.label=document.createElement("div"),document.body.appendChild(this.label)),this.setLabelStyles(e)},setLabelStyles:function(t){e.extend(this.label.style,{visibility:"hidden",position:"absolute",width:"auto",height:"auto"}),this.label.className="jit-autoadjust-label"}};b.Tree=function(){function r(e,t,n,r,i){var s=t.Node,o=t.multitree;if(s.overridable){var u=-1,a=-1;return e.eachNode(function(e){if(e._depth==n&&(!o||"$orn"in e.data&&e.data.$orn==r)){var t=e.getData("width",i),s=e.getData("height",i);u=u<t?t:u,a=a<s?s:a}}),{width:u<0?s.width:u,height:a<0?s.height:a}}return s}function i(e,t,n,r){var i=r=="left"||r=="right"?"y":"x";e.getPos(t)[i]+=n}function s(t,r){var i=[];return e.each(t,function(e){e=n.call(e),e[0]+=r,e[1]+=r,i.push(e)}),i}function o(e,t){if(e.length==0)return t;if(t.length==0)return e;var n=e.shift(),r=t.shift();return[[n[0],r[1]]].concat(o(e,t))}function u(e,t){t=t||[];if(e.length==0)return t;var n=e.pop();return u(e,o(n,t))}function a(e,t,n,r,i){if(e.length<=i||t.length<=i)return 0;var s=e[i][1],o=t[i][0];return Math.max(a(e,t,n,r,++i)+n,s-o+r)}function f(e,t,n){function r(e,i,u){if(i.length<=u)return[];var f=i[u],l=a(e,f,t,n,0);return[l].concat(r(o(e,s(f,l)),i,++u))}return r([],e,0)}function l(e,t,r){function i(e,n,u){if(n.length<=u)return[];var f=n[u],l=-a(f,e,t,r,0);return[l].concat(i(o(s(f,l),e),n,++u))}e=n.call(e);var u=i([],e.reverse(),0);return u.reverse()}function c(e,t,n,r){var i=f(e,t,n),s=l(e,t,n);r=="left"?s=i:r=="right"&&(i=s);for(var o=0,u=[];o<i.length;o++)u[o]=(i[o]+s[o])/2;return u}function h(e,t,n,o,a){function S(t,l,h){var p=t.getData(g,n),m=l||t.getData(y,n),x=[],T=[],N=!1,C=m+o.levelDistance;t.eachSubnode(function(t){if(t.exist&&(!f||"$orn"in t.data&&t.data.$orn==a)){N||(N=r(e,o,t._depth,a,n));var i=S(t,N[y],h+C);x.push(i.tree),T.push(i.extent)}});var k=c(T,w,b,E);for(var L=0,A=[],O=[];L<x.length;L++)i(x[L],n,k[L],a),O.push(s(T[L],k[L]));var M=[[-p/2,p/2]].concat(u(O));return t.getPos(n)[d]=0,a=="top"||a=="left"?t.getPos(n)[v]=h:t.getPos(n)[v]=-h,{tree:t,extent:M}}var f=o.multitree,l=["x","y"],h=["width","height"],p=+(a=="left"||a=="right"),d=l[p],v=l[1-p],m=o.Node,g=h[p],y=h[1-p],b=o.siblingOffset,w=o.subtreeOffset,E=o.align;S(t,!1,0)}var n=Array.prototype.slice;return new t({compute:function(t,n){var r=t||"start",i=this.graph.getNode(this.root);e.extend(i,{drawn:!0,exist:!0,selected:!0}),w.compute(this.graph,r,this.config),(!!n||!("_depth"in i))&&this.graph.computeLevels(this.root,0,"ignore"),this.computePositions(i,r)},computePositions:function(t,n){var r=this.config,i=r.multitree,s=r.align,o=s!=="center"&&r.indent,u=r.orientation,a=i?["top","right","bottom","left"]:[u],f=this;e.each(a,function(e){h(f.graph,t,n,f.config,e,n);var r=["x","y"][+(e=="left"||e=="right")];(function u(t){t.eachSubnode(function(a){a.exist&&(!i||"$orn"in a.data&&a.data.$orn==e)&&(a.getPos(n)[r]+=t.getPos(n)[r],o&&(a.getPos(n)[r]+=s=="left"?o:-o),u(a))})})(t)})}})}(),b.ForceDirected=new t({getOptions:function(e){var t=this.canvas.getSize(),n=t.width,r=t.height,i=0;this.graph.eachNode(function(e){i++});var s=n*r/i,o=Math.sqrt(s),u=this.config.levelDistance;return{width:n,height:r,tstart:n*.1,nodef:function(e){return s/(e||1)},edgef:function(e){return o*(e-u)}}},compute:function(t,n){var r=e.splat(t||["current","start","end"]),i=this.getOptions();w.compute(this.graph,r,this.config),this.graph.computeLevels(this.root,0,"ignore"),this.graph.eachNode(function(t){e.each(r,function(n){var s=t.getPos(n);s.equals(h.KER)&&(s.x=i.width/5*(Math.random()-.5),s.y=i.height/5*(Math.random()-.5)),t.disp={},e.each(r,function(e){t.disp[e]=p(0,0)})})}),this.computePositions(r,i,n)},computePositions:function(e,t,n){var r=this.config.iterations,i=0,s=this;if(n)(function o(){for(var u=n.iter,a=0;a<u;a++){t.t=t.tstart*(1-i++/(r-1)),s.computePositionStep(e,t);if(i>=r){n.onComplete();return}}n.onStep(Math.round(i/(r-1)*100)),setTimeout(o,1)})();else for(;i<r;i++)t.t=t.tstart*(1-i/(r-1)),this.computePositionStep(e,t)},computePositionStep:function(t,n){var r=this.graph,i=Math.min,s=Math.max,o=p(0,0);r.eachNode(function(i){e.each(t,function(e){i.disp[e].x=0,i.disp[e].y=0}),r.eachNode(function(r){r.id!=i.id&&e.each(t,function(e){var t=i.getPos(e),s=r.getPos(e);o.x=t.x-s.x,o.y=t.y-s.y;var u=o.norm()||1;i.disp[e].$add(o.$scale(n.nodef(u)/u))})})});var u=!!r.getNode(this.root).visited;r.eachNode(function(r){r.eachAdjacency(function(i){var s=i.nodeTo;!!s.visited===u&&e.each(t,function(e){var t=r.getPos(e),i=s.getPos(e);o.x=t.x-i.x,o.y=t.y-i.y;var u=o.norm()||1;r.disp[e].$add(o.$scale(-n.edgef(u)/u)),s.disp[e].$add(o.$scale(-1))})}),r.visited=!u});var a=n.t,f=n.width/2,l=n.height/2;
|
||
r.eachNode(function(n){e.each(t,function(e){var t=n.disp[e],r=t.norm()||1,e=n.getPos(e);e.$add(p(t.x*i(Math.abs(t.x),a)/r,t.y*i(Math.abs(t.y),a)/r)),e.x=i(f,s(-f,e.x)),e.y=i(l,s(-l,e.y))})})}}),b.Radial=new t({compute:function(t){var n=e.splat(t||["current","start","end"]);w.compute(this.graph,n,this.config),this.graph.computeLevels(this.root,0,"ignore");var r=this.createLevelDistanceFunc();this.computeAngularWidths(n),this.computePositions(n,r)},computePositions:function(e,t){var n=e,r=this.graph,i=r.getNode(this.root),s=this.parent,o=this.config;for(var u=0,a=n.length;u<a;u++){var f=n[u];i.setPos(c(0,0),f),i.setData("span",Math.PI*2,f)}i.angleSpan={begin:0,end:2*Math.PI},r.eachBFS(this.root,function(e){var r=e.angleSpan.end-e.angleSpan.begin,i=e.angleSpan.begin,o=t(e),u=0,a=[],f={};e.eachSubnode(function(e){u+=e._treeAngularWidth;for(var t=0,r=n.length;t<r;t++){var i=n[t],s=e.getData("dim",i);f[i]=i in f?s>f[i]?s:f[i]:s}a.push(e)},"ignore"),s&&s.id==e.id&&a.length>0&&a[0].dist&&a.sort(function(e,t){return(e.dist>=t.dist)-(e.dist<=t.dist)});for(var l=0,h=a.length;l<h;l++){var p=a[l];if(!p._flag){var d=p._treeAngularWidth/u*r,v=i+d/2;for(var m=0,g=n.length;m<g;m++){var y=n[m];p.setPos(c(v,o),y),p.setData("span",d,y),p.setData("dim-quotient",p.getData("dim",y)/f[y],y)}p.angleSpan={begin:i,end:i+d},i+=d}}},"ignore")},setAngularWidthForNodes:function(e){this.graph.eachBFS(this.root,function(t,n){var r=t.getData("angularWidth",e[0])||5;t._angularWidth=r/n},"ignore")},setSubtreesAngularWidth:function(){var e=this;this.graph.eachNode(function(t){e.setSubtreeAngularWidth(t)},"ignore")},setSubtreeAngularWidth:function(e){var t=this,n=e._angularWidth,r=0;e.eachSubnode(function(e){t.setSubtreeAngularWidth(e),r+=e._treeAngularWidth},"ignore"),e._treeAngularWidth=Math.max(n,r)},computeAngularWidths:function(e){this.setAngularWidthForNodes(e),this.setSubtreesAngularWidth()}}),$jit.ForceDirected=new t({Implements:[y,a,b.ForceDirected],initialize:function(t){var n=$jit.ForceDirected,r={iterations:50,levelDistance:50};this.controller=this.config=e.merge(i("Canvas","Node","Edge","Fx","Tips","NodeStyles","Events","Navigation","Controller","Label"),r,t);var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(s.background&&(s.background=e.merge({type:"Circles"},s.background)),this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!0,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new n.Label[s.Label.type](this),this.fx=new n.Plot(this,n),this.op=new n.Op(this),this.json=null,this.busy=!1,this.initializeExtras()},refresh:function(){this.compute(),this.plot()},reposition:function(){this.compute("end")},computeIncremental:function(t){t=e.merge({iter:20,property:"end",onStep:e.empty,onComplete:e.empty},t||{}),this.config.onBeforeCompute(this.graph.getNode(this.root)),this.compute(t.property,t)},plot:function(){this.fx.plot()},animate:function(t){this.fx.animate(e.merge({modes:["linear"]},t||{}))}}),$jit.ForceDirected.$extend=!0,function(n){n.Op=new t({Implements:d.Op}),n.Plot=new t({Implements:d.Plot}),n.Label={},n.Label.Native=new t({Implements:d.Label.Native}),n.Label.SVG=new t({Implements:d.Label.SVG,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)};e.setAttribute("x",l.x),e.setAttribute("y",l.y),n.onPlaceLabel(e,t)}}),n.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)},c=e.style;c.left=l.x+"px",c.top=l.y+"px",c.display=this.fitsInCanvas(l,i)?"":"none",n.onPlaceLabel(e,t)}}),n.Plot.NodeTypes=new t({none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.circle.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.circle.contains(n,t,r)}},ellipse:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");this.nodeHelper.ellipse.render("fill",n,r,i,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.ellipse.contains(n,t,r,i)}},square:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.square.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.square.contains(n,t,r)}},rectangle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");this.nodeHelper.rectangle.render("fill",n,r,i,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.rectangle.contains(n,t,r,i)}},triangle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.triangle.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.triangle.contains(n,t,r)}},star:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.star.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.star.contains(n,t,r)}}}),n.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);this.edgeHelper.line.render(n,r,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(n,r,t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("dim"),s=e.data.$direction,o=s&&s.length>1&&s[0]!=e.nodeFrom.id;this.edgeHelper.arrow.render(n,r,i,o,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.arrow.contains(n,r,t,this.edge.epsilon)}}})}($jit.ForceDirected),$jit.RGraph=new t({Implements:[y,a,b.Radial],initialize:function(t){var n=$jit.RGraph,r={interpolation:"linear",levelDistance:100};this.controller=this.config=e.merge(i("Canvas","Node","Edge","Fx","Controller","Tips","NodeStyles","Events","Navigation","Label"),r,t);var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(s.background&&(s.background=e.merge({type:"Circles"},s.background)),this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!1,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new n.Label[s.Label.type](this),this.fx=new n.Plot(this,n),this.op=new n.Op(this),this.json=null,this.root=null,this.busy=!1,this.parent=!1,this.initializeExtras()},createLevelDistanceFunc:function(){var e=this.config.levelDistance;return function(t){return(t._depth+1)*e}},refresh:function(){this.compute(),this.plot()},reposition:function(){this.compute("end")},plot:function(){this.fx.plot()},getNodeAndParentAngle:function(e){var t=!1,n=this.graph.getNode(e),r=n.getParents(),i=r.length>0?r[0]:!1;if(i){var s=i.pos.getc(),o=n.pos.getc(),u=s.add(o.scale(-1));t=Math.atan2(u.y,u.x),t<0&&(t+=2*Math.PI)}return{parent:i,theta:t}},tagChildren:function(e,t){if(e.angleSpan){var n=[];e.eachAdjacency(function(e){n.push(e.nodeTo)},"ignore");var r=n.length;for(var i=0;i<r&&t!=n[i].id;i++);for(var s=(i+1)%r,o=0;t!=n[s].id;s=(s+1)%r)n[s].dist=o++}},onClick:function(t,n){if(this.root!=t&&!this.busy){this.busy=!0,this.root=t,that=this,this.controller.onBeforeCompute(this.graph.getNode(t));var r=this.getNodeAndParentAngle(t);this.tagChildren(r.parent,t),this.parent=r.parent,this.compute("end");var i=r.theta-r.parent.endPos.theta;this.graph.eachNode(function(e){e.endPos.set(e.endPos.getp().add(c(i,0)))});var s=this.config.interpolation;n=e.merge({onComplete:e.empty},n||{}),this.fx.animate(e.merge({hideLabels:!0,modes:[s]},n,{onComplete:function(){that.busy=!1,n.onComplete()}}))}}}),$jit.RGraph.$extend=!0,function(n){n.Op=new t({Implements:d.Op}),n.Plot=new t({Implements:d.Plot}),n.Label={},n.Label.Native=new t({Implements:d.Label.Native}),n.Label.SVG=new t({Implements:d.Label.SVG,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)};e.setAttribute("x",l.x),e.setAttribute("y",l.y),n.onPlaceLabel(e,t)}}),n.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)},c=e.style;c.left=l.x+"px",c.top=l.y+"px",c.display=this.fitsInCanvas(l,i)?"":"none",n.onPlaceLabel(e,t)}}),n.Plot.NodeTypes=new t({none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.circle.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.circle.contains(n,t,r)}},ellipse:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");this.nodeHelper.ellipse.render("fill",n,r,i,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.ellipse.contains(n,t,r,i)}},square:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.square.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.square.contains(n,t,r)}},rectangle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");this.nodeHelper.rectangle.render("fill",n,r,i,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("width"),i=e.getData("height");return this.nodeHelper.rectangle.contains(n,t,r,i)}},triangle:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.triangle.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.triangle.contains(n,t,r)}},star:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");this.nodeHelper.star.render("fill",n,r,t)},contains:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim");return this.nodeHelper.star.contains(n,t,r)}}}),n.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);this.edgeHelper.line.render(n,r,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(n,r,t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("dim"),s=e.data.$direction,o=s&&s.length>1&&s[0]!=e.nodeFrom.id;this.edgeHelper.arrow.render(n,r,i,o,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.arrow.contains(n,r,t,this.edge.epsilon)}}})}($jit.RGraph),h.prototype.moebiusTransformation=function(e){var t=this.add(e),n=e.$conjugate().$prod(this);return n.x++,t.$div(n)},d.Util.moebiusTransformation=function(e,t,n,r,i){this.eachNode(e,function(e){for(var i=0;i<n.length;i++){var s=t[i].scale(-1),o=r?r:n[i];e.getPos(n[i]).set(e.getPos(o).getc().moebiusTransformation(s))}},i)}}(),function(){var e=navigator.userAgent,t=e.match(/iPhone/i)||e.match(/iPad/i),n=typeof HTMLCanvasElement,r=n=="object"||n=="function",i=r&&typeof document.createElement("canvas").getContext("2d").fillText=="function";labelType=!r||i&&!t?"Native":"HTML",nativeTextSupport=labelType=="Native",useGradients=r,animate=!t&&!!r}(),$jit.ForceDirected.Plot.NodeTypes.implement(nodeSettings),$jit.ForceDirected.Plot.EdgeTypes.implement(edgeSettings),$jit.RGraph.Plot.NodeTypes.implement(nodeSettings),$jit.RGraph.Plot.EdgeTypes.implement(edgeSettings),$(document).ready(function(){$("#sideOptionOrganize").bind("click",function(){organizeOpen||openOrganize()}),$("#closeOrganize").bind("click",function(){organizeOpen&&closeOrganize()})}),function(e){function t(t,n,r){var i,s,o=t.width,u=t.width,a,f;f=e(t.parentNode),this.element=i=f.append("<canvas class='reflection' style='position:absolute'/>").find(":last")[0];if(!i.getContext&&e.browser.msie)this.element=i=f.append("<img class='reflection' style='position:absolute'/>").find(":last")[0],i.src=t.src,i.style.filter="flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+r*100+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+n/u*100+")";else{s=i.getContext("2d");try{e(i).attr({width:o,height:n}),s.save(),s.translate(0,u-1),s.scale(1,-1),s.drawImage(t,0,0,o,u),s.restore(),s.globalCompositeOperation="destination-out",a=s.createLinearGradient(0,0,0,n),a.addColorStop(0,"rgba(255, 255, 255, "+(1-r)+")"),a.addColorStop(1,"rgba(255, 255, 255, 1.0)"),s.fillStyle=a,s.fillRect(0,0,o,n)}catch(l){return}}e(i).attr({alt:e(t).attr("alt"),title:e(t).attr("title")})}var n=function(n,r){this.orgWidth=n.width,this.orgHeight=n.height,this.image=n,this.reflection=null,this.alt=n.alt,this.title=n.title,this.imageOK=!1,this.options=r,this.imageOK=!0,this.options.reflHeight>0&&(this.reflection=new t(this.image,this.options.reflHeight,this.options.reflOpacity)),e(this.image).css("position","absolute")},r=function(t,r,i){var s=[],o=Math.sin,u=Math.cos,a=this;this.controlTimer=0,this.stopped=!1,this.container=t,this.xRadius=i.xRadius,this.yRadius=i.yRadius,this.showFrontTextTimer=0,this.autoRotateTimer=0,i.xRadius===0&&(this.xRadius=e(t).width()/2.3),i.yRadius===0&&(this.yRadius=e(t).height()/6),this.xCentre=i.xPos,this.yCentre=i.yPos,this.frontIndex=0,this.rotation=this.destRotation=Math.PI/2,this.timeDelay=1e3/i.FPS,i.altBox!==null&&(e(i.altBox).css("display","block"),e(i.titleBox).css("display","block")),e(t).css({position:"relative",overflow:"hidden"}),e(i.buttonLeft).css("display","inline"),e(i.buttonRight).css("display","inline"),e(i.buttonLeft).bind("mouseup",this,function(e){return e.data.rotate(-1),!1}),e(i.buttonRight).bind("mouseup",this,function(e){return e.data.rotate(1),!1}),e(".new_topic").bind("keydown",this,function(e){(e.keyCode==9||e.keyCode==9&&e.shiftKey)&&e.preventDefault()}),e(".new_topic").bind("keyup",this,function(e){e.keyCode==9&&e.shiftKey?e.data.rotate(-1):e.keyCode==9&&e.data.rotate(1)}),i.mouseWheel&&e(t).bind("mousewheel",this,function(e,t){return e.data.rotate(t),!1}),e(t).bind("mouseover click",this,function(t){clearInterval(t.data.autoRotateTimer);var n=e(t.target).attr("alt");if(n!==undefined&&n!==null){clearTimeout(t.data.showFrontTextTimer),e(i.altBox).html(e(t.target).attr("alt"));if(i.bringToFront&&t.type=="click"){e(i.titleBox).html(e(t.target).attr("title")),e("#topic_metacode").val(e(t.target).attr("title"));var s=e(t.target).data("itemIndex"),o=t.data.frontIndex,u=(s-o)%r.length;Math.abs(u)>r.length/2&&(u+=u>0?-r.length:r.length),t.data.rotate(-u)}}}),e(t).bind("mouseout",this,function(e){var t=e.data;clearTimeout(t.showFrontTextTimer),t.showFrontTextTimer=setTimeout(function(){t.showFrontText()},1e3),t.autoRotate()}),e(t).bind("mousedown",this,function(e){return e.data.container.focus(),!1}),t.onselectstart=function(){return!1},this.innerWrapper=e(t).wrapInner('<div style="position:absolute;width:100%;height:100%;"/>').children()[0],this.showFrontText=function(){if(s[this.frontIndex]===undefined)return;e("#topic_metacode").val(e(s[this.frontIndex].image).attr("title")),e(i.titleBox).html(e(s[this.frontIndex].image).attr("title")),e(i.altBox).html(e(s[this.frontIndex].image).attr("alt"))},this.go=function(){if(this.controlTimer!==0)return;var e=this;this.controlTimer=setTimeout(function(){e.updateAll()},this.timeDelay)},this.stop=function(){clearTimeout(this.controlTimer),this.controlTimer=0},this.rotate=function(e){this.frontIndex-=e,this.frontIndex==-1&&(this.frontIndex=s.length-1),this.frontIndex%=s.length,this.destRotation+=Math.PI/s.length*2*e,this.showFrontText(),this.go()},this.autoRotate=function(){if(i.autoRotate!=="no"){var e=i.autoRotate==="right"?1:-1;this.autoRotateTimer=setInterval(function(){a.rotate(e)},i.autoRotateDelay)}},this.updateAll=function(){var t=i.minScale,n=(1-t)*.5,r,a,f,l,c,h,p,d=this.destRotation-this.rotation,v=Math.abs(d);this.rotation+=d*i.speed,v<.001&&(this.rotation=this.destRotation);var m=s.length,g=Math.PI/m*2,y=this.rotation,b=e.browser.msie;this.innerWrapper.style.display="none";var w,E="px",S,x=this;for(var T=0;T<m;T++){h=s[T],p=o(y),c=(p+1)*n+t,f=this.xCentre+(u(y)*this.xRadius-h.orgWidth*.5)*c,l=this.yCentre+p*this.yRadius*c;if(h.imageOK){var N=h.image;r=N.width=h.orgWidth*c,a=N.height=h.orgHeight*c,N.style.left=f+E,N.style.top=l+E,N.style.zIndex=""+c*100>>0,h.reflection!==null&&(S=i.reflHeight*c,w=h.reflection.element.style,w.left=f+E,w.top=l+a+i.reflGap*c+E,w.width=r+E,b?w.filter.finishy=S/a*100:w.height=S+E)}y+=g}this.innerWrapper.style.display="block",v>=.001?this.controlTimer=setTimeout(function(){x.updateAll()},this.timeDelay):this.stop()},this.checkImagesLoaded=function(){var t;for(t=0;t<r.length;t++)if(r[t].width===undefined||r[t].complete!==undefined&&!r[t].complete)return;for(t=0;t<r.length;t++)s.push(new n(r[t],i)),e(r[t]).data("itemIndex",t);clearInterval(this.tt),this.showFrontText(),this.autoRotate(),this.updateAll()},this.tt=setInterval(function(){a.checkImagesLoaded()},50)};e.fn.CloudCarousel=function(t){return this.each(function(){t=e.extend({},{reflHeight:0,reflOpacity:.5,reflGap:0,minScale:.5,xPos:0,yPos:0,xRadius:0,yRadius:0,altBox:null,titleBox:null,FPS:30,autoRotate:"no",autoRotateDelay:1500,speed:.2,mouseWheel:!1,bringToFront:!1},t),e(this).data("cloudcarousel",new r(this,e(".cloudcarousel",e(this)),t))}),this}}(jQuery),function(){}.call(this),function(){}.call(this),function(){}.call(this),function(e,t){function n(t,n){var i=t.nodeName.toLowerCase();if("area"===i){var s=t.parentNode,o=s.name,u;return!t.href||!o||s.nodeName.toLowerCase()!=="map"?!1:(u=e("img[usemap=#"+o+"]")[0],!!u&&r(u))}return(/input|select|textarea|button|object/.test(i)?!t.disabled:"a"==i?t.href||n:n)&&r(t)}function r(t){return!e(t).parents().andSelf().filter(function(){return e.curCSS(this,"visibility")==="hidden"||e.expr.filters.hidden(this)}).length}e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.8.23",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),e.fn.extend({propAttr:e.fn.prop||e.fn.attr,_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.curCSS(this,"position",1))&&/(auto|scroll)/.test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function i(t,n,r,i){return e.each(s,function(){n-=parseFloat(e.curCSS(t,"padding"+this,!0))||0,r&&(n-=parseFloat(e.curCSS(t,"border"+this+"Width",!0))||0),i&&(n-=parseFloat(e.curCSS(t,"margin"+this,!0))||0)}),n}var s=r==="Width"?["Left","Right"]:["Top","Bottom"],o=r.toLowerCase(),u={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?u["inner"+r].call(this):this.each(function(){e(this).css(o,i(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?u["outer"+r].call(this,t):this.each(function(){e(this).css(o,i(this,t,!0,n)+"px")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return n(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var r=e.attr(t,"tabindex"),i=isNaN(r);return(i||r>=0)&&n(t,!i)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),e.curCSS||(e.curCSS=e.css),e.extend(e.ui,{plugin:{add:function(t,n,r){var i=e.ui[t].prototype;for(var s in r)i.plugins[s]=i.plugins[s]||[],i.plugins[s].push([n,r[s]])},call:function(e,t,n){var r=e.plugins[t];if(!r||!e.element[0].parentNode)return;for(var i=0;i<r.length;i++)e.options[r[i][0]]&&r[i][1].apply(e.element,n)}},contains:function(e,t){return document.compareDocumentPosition?e.compareDocumentPosition(t)&16:e!==t&&e.contains(t)},hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e<t+n},isOver:function(t,n,r,i,s,o){return e.ui.isOverAxis(t,r,s)&&e.ui.isOverAxis(n,i,o)}})}(jQuery),function(e,t){if(e.cleanData){var n=e.cleanData;e.cleanData=function(t){for(var r=0,i;(i=t[r])!=null;r++)try{e(i).triggerHandler("remove")}catch(s){}n(t)}}else{var r=e.fn.remove;e.fn.remove=function(t,n){return this.each(function(){return n||(!t||e.filter(t,[this]).length)&&e("*",this).add([this]).each(function(){try{e(this).triggerHandler("remove")}catch(t){}}),r.call(e(this),t,n)})}}e.widget=function(t,n,r){var i=t.split(".")[0],s;t=t.split(".")[1],s=i+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][s]=function(n){return!!e.data(n,t)},e[i]=e[i]||{},e[i][t]=function(e,t){arguments.length&&this._createWidget(e,t)};var o=new n;o.options=e.extend(!0,{},o.options),e[i][t].prototype=e.extend(!0,o,{namespace:i,widgetName:t,widgetEventPrefix:e[i][t].prototype.widgetEventPrefix||t,widgetBaseClass:s},r),e.widget.bridge(t,e[i][t])},e.widget.bridge=function(n,r){e.fn[n]=function(i){var s=typeof i=="string",o=Array.prototype.slice.call(arguments,1),u=this;return i=!s&&o.length?e.extend.apply(null,[!0,i].concat(o)):i,s&&i.charAt(0)==="_"?u:(s?this.each(function(){var r=e.data(this,n),s=r&&e.isFunction(r[i])?r[i].apply(r,o):r;if(s!==r&&s!==t)return u=s,!1}):this.each(function(){var t=e.data(this,n);t?t.option(i||{})._init():e.data(this,n,new r(i,this))}),u)}},e.Widget=function(e,t){arguments.length&&this._createWidget(e,t)},e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(t,n){e.data(n,this.widgetName,this),this.element=e(n),this.options=e.extend(!0,{},this.options,this._getCreateOptions(),t);var r=this;this.element.bind("remove."+this.widgetName,function(){r.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(n,r){var i=n;if(arguments.length===0)return e.extend({},this.options);if(typeof n=="string"){if(r===t)return this.options[n];i={},i[n]=r}return this._setOptions(i),this},_setOptions:function(t){var n=this;return e.each(t,function(e,t){n._setOption(e,t)}),this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&this.widget()[t?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",t),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.call(this.element[0],n,r)===!1||n.isDefaultPrevented())}}}(jQuery),function(e,t){var n=!1;e(document).mouseup(function(e){n=!1}),e.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which==1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return!e.browser.msie||document.documentMode>=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target==this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})}(jQuery),function(e,t){e.ui=e.ui||{};var n=/left|center|right/,r=/top|center|bottom/,i="center",s={},o=e.fn.position,u=e.fn.offset;e.fn.position=function(t){if(!t||!t.of)return o.apply(this,arguments);t=e.extend({},t);var u=e(t.of),l=u[0],h=(t.collision||"flip").split(" "),p=t.offset?t.offset.split(" "):[0,0],v,m,y;return l.nodeType===9?(v=u.width(),m=u.height(),y={top:0,left:0}):l.setTimeout?(v=u.width(),m=u.height(),y={top:u.scrollTop(),left:u.scrollLeft()}):l.preventDefault?(t.at="left top",v=m=0,y={top:t.of.pageY,left:t.of.pageX}):(v=u.outerWidth(),m=u.outerHeight(),y=u.offset()),e.each(["my","at"],function(){var e=(t[this]||"").split(" ");e.length===1&&(e=n.test(e[0])?e.concat([i]):r.test(e[0])?[i].concat(e):[i,i]),e[0]=n.test(e[0])?e[0]:i,e[1]=r.test(e[1])?e[1]:i,t[this]=e}),h.length===1&&(h[1]=h[0]),p[0]=parseInt(p[0],10)||0,p.length===1&&(p[1]=p[0]),p[1]=parseInt(p[1],10)||0,t.at[0]==="right"?y.left+=v:t.at[0]===i&&(y.left+=v/2),t.at[1]==="bottom"?y.top+=m:t.at[1]===i&&(y.top+=m/2),y.left+=p[0],y.top+=p[1],this.each(function(){var n=e(this),r=n.outerWidth(),o=n.outerHeight(),u=parseInt(e.curCSS(this,"marginLeft",!0))||0,l=parseInt(e.curCSS(this,"marginTop",!0))||0,c=r+u+(parseInt(e.curCSS(this,"marginRight",!0))||0),d=o+l+(parseInt(e.curCSS(this,"marginBottom",!0))||0),g=e.extend({},y),w;t.my[0]==="right"?g.left-=r:t.my[0]===i&&(g.left-=r/2),t.my[1]==="bottom"?g.top-=o:t.my[1]===i&&(g.top-=o/2),s.fractions||(g.left=Math.round(g.left),g.top=Math.round(g.top)),w={left:g.left-u,top:g.top-l},e.each(["left","top"],function(n,i){e.ui.position[h[n]]&&e.ui.position[h[n]][i](g,{targetWidth:v,targetHeight:m,elemWidth:r,elemHeight:o,collisionPosition:w,collisionWidth:c,collisionHeight:d,offset:p,my:t.my,at:t.at})}),e.fn.bgiframe&&n.bgiframe(),n.offset(e.extend(g,{using:t.using}))})},e.ui.position={fit:{left:function(t,n){var r=e(window),i=n.collisionPosition.left+n.collisionWidth-r.width()-r.scrollLeft();t.left=i>0?t.left-i:Math.max(t.left-n.collisionPosition.left,t.left)},top:function(t,n){var r=e(window),i=n.collisionPosition.top+n.collisionHeight-r.height()-r.scrollTop();t.top=i>0?t.top-i:Math.max(t.top-n.collisionPosition.top,t.top)}},flip:{left:function(t,n){if(n.at[0]===i)return;var r=e(window),s=n.collisionPosition.left+n.collisionWidth-r.width()-r.scrollLeft(),o=n.my[0]==="left"?-n.elemWidth:n.my[0]==="right"?n.elemWidth:0,u=n.at[0]==="left"?n.targetWidth:-n.targetWidth,f=-2*n.offset[0];t.left+=n.collisionPosition.left<0?o+u+f:s>0?o+u+f:0},top:function(t,n){if(n.at[1]===i)return;var r=e(window),s=n.collisionPosition.top+n.collisionHeight-r.height()-r.scrollTop(),o=n.my[1]==="top"?-n.elemHeight:n.my[1]==="bottom"?n.elemHeight:0,u=n.at[1]==="top"?n.targetHeight:-n.targetHeight,f=-2*n.offset[1];t.top+=n.collisionPosition.top<0?o+u+f:s>0?o+u+f:0}}},e.offset.setOffset||(e.offset.setOffset=function(t,n){/static/.test(e.curCSS(t,"position"))&&(t.style.position="relative");var r=e(t),i=r.offset(),s=parseInt(e.curCSS(t,"top",!0),10)||0,o=parseInt(e.curCSS(t,"left",!0),10)||0,u={top:n.top-i.top+s,left:n.left-i.left+o};"using"in n?n.using.call(t,u):r.css(u)},e.fn.offset=function(t){var n=this[0];return!n||!n.ownerDocument?null:t?e.isFunction(t)?this.each(function(n){e(this).offset(t.call(this,n,e(this).offset()))}):this.each(function(){e.offset.setOffset(this,t)}):u.call(this)}),e.curCSS||(e.curCSS=e.css),function(){var t=document.getElementsByTagName("body")[0],n=document.createElement("div"),r,i,o,u,l;r=document.createElement(t?"div":"body"),o={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},t&&e.extend(o,{position:"absolute",left:"-1000px",top:"-1000px"});for(var c in o)r.style[c]=o[c];r.appendChild(n),i=t||document.documentElement,i.insertBefore(r,i.firstChild),n.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",u=e(n).offset(function(e,t){return t}).offset(),r.innerHTML="",i.removeChild(r),l=u.top+u.left+(t?2e3:0),s.fractions=l>21&&l<22}()}(jQuery),function(e,t){e.widget("ui.draggable",e.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css
|
||
("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(t),this.handle?(n.iframeFix&&e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1);var r=this.element[0],i=!1;while(r&&(r=r.parentNode))r==document&&(i=!0);if(!i&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!n||this.options.revert=="valid"&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)){var s=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){s._trigger("stop",t)!==!1&&s._clear()})}else this._trigger("stop",t)!==!1&&this._clear();return!1},_mouseUp:function(t){return this.options.iframeFix===!0&&e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){var n=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;return e(this.options.handle,this.element).find("*").andSelf().each(function(){this==t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):n.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo(n.appendTo=="parent"?this.element[0].parentNode:n.appendTo),r[0]!=this.element[0]&&!/(fixed|absolute)/.test(r.css("position"))&&r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.browser.msie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[t.containment=="document"?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t.containment=="document"?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(t.containment=="document"?0:e(window).scrollLeft())+e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(t.containment=="document"?0:e(window).scrollTop())+(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)&&t.containment.constructor!=Array){var n=e(t.containment),r=n[0];if(!r)return;var i=n.offset(),s=e(r).css("overflow")!="hidden";this.containment=[(parseInt(e(r).css("borderLeftWidth"),10)||0)+(parseInt(e(r).css("paddingLeft"),10)||0),(parseInt(e(r).css("borderTopWidth"),10)||0)+(parseInt(e(r).css("paddingTop"),10)||0),(s?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(e(r).css("borderLeftWidth"),10)||0)-(parseInt(e(r).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(s?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(e(r).css("borderTopWidth"),10)||0)-(parseInt(e(r).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}else t.containment.constructor==Array&&(this.containment=t.containment)},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r),left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r)}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName),s=t.pageX,o=t.pageY;if(this.originalPosition){var u;if(this.containment){if(this.relative_container){var f=this.relative_container.offset();u=[this.containment[0]+f.left,this.containment[1]+f.top,this.containment[2]+f.left,this.containment[3]+f.top]}else u=this.containment;t.pageX-this.offset.click.left<u[0]&&(s=u[0]+this.offset.click.left),t.pageY-this.offset.click.top<u[1]&&(o=u[1]+this.offset.click.top),t.pageX-this.offset.click.left>u[2]&&(s=u[2]+this.offset.click.left),t.pageY-this.offset.click.top>u[3]&&(o=u[3]+this.offset.click.top)}if(n.grid){var l=n.grid[1]?this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY;o=u?l-this.offset.click.top<u[1]||l-this.offset.click.top>u[3]?l-this.offset.click.top<u[1]?l+n.grid[1]:l-n.grid[1]:l:l;var c=n.grid[0]?this.originalPageX+Math.round((s-this.originalPageX)/n.grid[0])*n.grid[0]:this.originalPageX;s=u?c-this.offset.click.left<u[0]||c-this.offset.click.left>u[2]?c-this.offset.click.left<u[0]?c+n.grid[0]:c-n.grid[0]:c:c}}return{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():i?0:r.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:r.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r]),t=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(e){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.extend(e.ui.draggable,{version:"1.8.23"}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n){var r=e(this).data("draggable"),i=r.options,s=e.extend({},n,{item:r.element});r.sortables=[],e(i.connectToSortable).each(function(){var n=e.data(this,"sortable");n&&!n.options.disabled&&(r.sortables.push({instance:n,shouldRevert:n.options.revert}),n.refreshPositions(),n._trigger("activate",t,s))})},stop:function(t,n){var r=e(this).data("draggable"),i=e.extend({},n,{item:r.element});e.each(r.sortables,function(){this.instance.isOver?(this.instance.isOver=0,r.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,r.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,n){var r=e(this).data("draggable"),i=this,s=function(t){var n=this.offset.click.top,r=this.offset.click.left,i=this.positionAbs.top,s=this.positionAbs.left,o=t.height,u=t.width,f=t.top,l=t.left;return e.ui.isOver(i+n,s+r,f,l,o,u)};e.each(r.sortables,function(s){this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return n.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=r.offset.click.top,this.instance.offset.click.left=r.offset.click.left,this.instance.offset.parent.left-=r.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=r.offset.parent.top-this.instance.offset.parent.top,r._trigger("toSortable",t),r.dropped=this.instance.element,r.currentItem=r.element,this.instance.fromOutside=r),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n){var r=e("body"),i=e(this).data("draggable").options;r.css("cursor")&&(i._cursor=r.css("cursor")),r.css("cursor",i.cursor)},stop:function(t,n){var r=e(this).data("draggable").options;r._cursor&&e("body").css("cursor",r._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,n){var r=e(this).data("draggable").options;r._opacity&&e(n.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(t,n){var r=e(this).data("draggable");r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"&&(r.overflowOffset=r.scrollParent.offset())},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=!1;if(r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"){if(!i.axis||i.axis!="x")r.overflowOffset.top+r.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop-i.scrollSpeed);if(!i.axis||i.axis!="y")r.overflowOffset.left+r.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft-i.scrollSpeed)}else{if(!i.axis||i.axis!="x")t.pageY-e(document).scrollTop()<i.scrollSensitivity?s=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(s=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed));if(!i.axis||i.axis!="y")t.pageX-e(document).scrollLeft()<i.scrollSensitivity?s=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(s=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed))}s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n){var r=e(this).data("draggable"),i=r.options;r.snapElements=[],e(i.snap.constructor!=String?i.snap.items||":data(draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!=r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=i.snapTolerance,o=n.offset.left,u=o+r.helperProportions.width,f=n.offset.top,l=f+r.helperProportions.height;for(var c=r.snapElements.length-1;c>=0;c--){var h=r.snapElements[c].left,p=h+r.snapElements[c].width,d=r.snapElements[c].top,v=d+r.snapElements[c].height;if(!(h-s<o&&o<p+s&&d-s<f&&f<v+s||h-s<o&&o<p+s&&d-s<l&&l<v+s||h-s<u&&u<p+s&&d-s<f&&f<v+s||h-s<u&&u<p+s&&d-s<l&&l<v+s)){r.snapElements[c].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[c].item})),r.snapElements[c].snapping=!1;continue}if(i.snapMode!="inner"){var m=Math.abs(d-l)<=s,g=Math.abs(v-f)<=s,y=Math.abs(h-u)<=s,b=Math.abs(p-o)<=s;m&&(n.position.top=r._convertPositionTo("relative",{top:d-r.helperProportions.height,left:0}).top-r.margins.top),g&&(n.position.top=r._convertPositionTo("relative",{top:v,left:0}).top-r.margins.top),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h-r.helperProportions.width}).left-r.margins.left),b&&(n.position.left=r._convertPositionTo("relative",{top:0,left:p}).left-r.margins.left)}var w=m||g||y||b;if(i.snapMode!="outer"){var m=Math.abs(d-f)<=s,g=Math.abs(v-l)<=s,y=Math.abs(h-o)<=s,b=Math.abs(p-u)<=s;m&&(n.position.top=r._convertPositionTo("relative",{top:d,left:0}).top-r.margins.top),g&&(n.position.top=r._convertPositionTo("relative",{top:v-r.helperProportions.height,left:0}).top-r.margins.top),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h}).left-r.margins.left),b&&(n.position.left=r._convertPositionTo("relative",{top:0,left:p-r.helperProportions.width}).left-r.margins.left)}!r.snapElements[c].snapping&&(m||g||y||b||w)&&r.options.snap.snap&&r.options.snap.snap.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[c].item})),r.snapElements[c].snapping=m||g||y||b||w}}}),e.ui.plugin.add("draggable","stack",{start:function(t,n){var r=e(this).data("draggable").options,i=e.makeArray(e(r.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});if(!i.length)return;var s=parseInt(i[0].style.zIndex)||0;e(i).each(function(e){this.style.zIndex=s+e}),this[0].style.zIndex=s+i.length}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("zIndex")&&(i._zIndex=r.css("zIndex")),r.css("zIndex",i.zIndex)},stop:function(t,n){var r=e(this).data("draggable").options;r._zIndex&&e(n.helper).css("zIndex",r._zIndex)}})}(jQuery),jQuery.effects||function(e,t){function n(t){var n;return t&&t.constructor==Array&&t.length==3?t:(n=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(t))?[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10)]:(n=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(t))?[parseFloat(n[1])*2.55,parseFloat(n[2])*2.55,parseFloat(n[3])*2.55]:(n=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(t))?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:(n=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(t))?[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)]:(n=/rgba\(0, 0, 0, 0\)/.exec(t))?f.transparent:f[e.trim(t).toLowerCase()]}function r(t,r){var i;do{i=(e.curCSS||e.css)(t,r);if(i!=""&&i!="transparent"||e.nodeName(t,"body"))break;r="backgroundColor"}while(t=t.parentNode);return n(i)}function i(){var e=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,t={},n,r;if(e&&e.length&&e[0]&&e[e[0]]){var i=e.length;while(i--)n=e[i],typeof e[n]=="string"&&(r=n.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()}),t[r]=e[n])}else for(n in e)typeof e[n]=="string"&&(t[n]=e[n]);return t}function s(t){var n,r;for(n in t)r=t[n],(r==null||e.isFunction(r)||n in c||/scrollbar/.test(n)||!/color/i.test(n)&&isNaN(parseFloat(r)))&&delete t[n];return t}function o(e,t){var n={_:0},r;for(r in t)e[r]!=t[r]&&(n[r]=t[r]);return n}function u(t,n,r,i){typeof t=="object"&&(i=n,r=null,n=t,t=n.effect),e.isFunction(n)&&(i=n,r=null,n={});if(typeof n=="number"||e.fx.speeds[n])i=r,r=n,n={};return e.isFunction(r)&&(i=r,r=null),n=n||{},r=r||n.duration,r=e.fx.off?0:typeof r=="number"?r:r in e.fx.speeds?e.fx.speeds[r]:e.fx.speeds._default,i=i||n.complete,[t,n,r,i]}function a(t){return!t||typeof t=="number"||e.fx.speeds[t]?!0:typeof t=="string"&&!e.effects[t]?!0:!1}e.effects={},e.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(t,i){e.fx.step[i]=function(e){e.colorInit||(e.start=r(e.elem,i),e.end=n(e.end),e.colorInit=!0),e.elem.style[i]="rgb("+Math.max(Math.min(parseInt(e.pos*(e.end[0]-e.start[0])+e.start[0],10),255),0)+","+Math.max(Math.min(parseInt(e.pos*(e.end[1]-e.start[1])+e.start[1],10),255),0)+","+Math.max(Math.min(parseInt(e.pos*(e.end[2]-e.start[2])+e.start[2],10),255),0)+")"}});var f={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},l=["add","remove","toggle"],c={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.effects.animateClass=function(t,n,r,u){return e.isFunction(r)&&(u=r,r=null),this.queue(function(){var a=e(this),f=a.attr("style")||" ",c=s(i.call(this)),h,p=a.attr("class")||"";e.each(l,function(e,n){t[n]&&a[n+"Class"](t[n])}),h=s(i.call(this)),a.attr("class",p),a.animate(o(c,h),{queue:!1,duration:n,easing:r,complete:function(){e.each(l,function(e,n){t[n]&&a[n+"Class"](t[n])}),typeof a.attr("style")=="object"?(a.attr("style").cssText="",a.attr("style").cssText=f):a.attr("style",f),u&&u.apply(this,arguments),e.dequeue(this)}})})},e.fn.extend({_addClass:e.fn.addClass,addClass:function(t,n,r,i){return n?e.effects.animateClass.apply(this,[{add:t},n,r,i]):this._addClass(t)},_removeClass:e.fn.removeClass,removeClass:function(t,n,r,i){return n?e.effects.animateClass.apply(this,[{remove:t},n,r,i]):this._removeClass(t)},_toggleClass:e.fn.toggleClass,toggleClass:function(n,r,i,s,o){return typeof r=="boolean"||r===t?i?e.effects.animateClass.apply(this,[r?{add:n}:{remove:n},i,s,o]):this._toggleClass(n,r):e.effects.animateClass.apply(this,[{toggle:n},r,i,s])},switchClass:function(t,n,r,i,s){return e.effects.animateClass.apply(this,[{add:n,remove:t},r,i,s])}}),e.extend(e.effects,{version:"1.8.23",save:function(e,t){for(var n=0;n<t.length;n++)t[n]!==null&&e.data("ec.storage."+t[n],e[0].style[t[n]])},restore:function(e,t){for(var n=0;n<t.length;n++)t[n]!==null&&e.css(t[n],e.data("ec.storage."+t[n]))},setMode:function(e,t){return t=="toggle"&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var n,r;switch(e[0]){case"top":n=0;break;case"middle":n=.5;break;case"bottom":n=1;break;default:n=e[0]/t.height}switch(e[1]){case"left":r=0;break;case"center":r=.5;break;case"right":r=1;break;default:r=e[1]/t.width}return{x:r,y:n}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var n={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},r=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),i=document.activeElement;try{i.id}catch(s){i=document.body}return t.wrap(r),(t[0]===i||e.contains(t[0],i))&&e(i).focus(),r=t.parent(),t.css("position")=="static"?(r.css({position:"relative"}),t.css({position:"relative"})):(e.extend(n,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,r){n[r]=t.css(r),isNaN(parseInt(n[r],10))&&(n[r]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),r.css(n).show()},removeWrapper:function(t){var n,r=document.activeElement;return t.parent().is(".ui-effects-wrapper")?(n=t.parent().replaceWith(t),(t[0]===r||e.contains(t[0],r))&&e(r).focus(),n):t},setTransition:function(t,n,r,i){return i=i||{},e.each(n,function(e,n){var s=t.cssUnit(n);s[0]>0&&(i[n]=s[0]*r+s[1])}),i}}),e.fn.extend({effect:function(t,n,r,i){var s=u.apply(this,arguments),o={options:s[1],duration:s[2],callback:s[3]},a=o.options.mode,f=e.effects[t];return e.fx.off||!f?a?this[a](o.duration,o.callback):this.each(function(){o.callback&&o.callback.call(this)}):f.call(this,o)},_show:e.fn.show,show:function(e){if(a(e))return this._show.apply(this,arguments);var t=u.apply(this,arguments);return t[1].mode="show",this.effect.apply(this,t)},_hide:e.fn.hide,hide:function(e){if(a(e))return this._hide.apply(this,arguments);var t=u.apply(this,arguments);return t[1].mode="hide",this.effect.apply(this,t)},__toggle:e.fn.toggle,toggle:function(t){if(a(t)||typeof t=="boolean"||e.isFunction(t))return this.__toggle.apply(this,arguments);var n=u.apply(this,arguments);return n[1].mode="toggle",this.effect.apply(this,n)},cssUnit:function(t){var n=this.css(t),r=[];return e.each(["em","px","%","pt"],function(e,t){n.indexOf(t)>0&&(r=[parseFloat(n),t])}),r}});var h={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){h[t]=function(t){return Math.pow(t,e+2)}}),e.extend(h,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return e===0||e===1?e:-Math.pow(2,8*(e-1))*Math.sin(((e-1)*80-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){var t,n=4;while(e<((t=Math.pow(2,--n))-1)/11);return 1/Math.pow(4,3-n)-7.5625*Math.pow((t*3-2)/22-e,2)}}),e.each(h,function(t,n){e.easing["easeIn"+t]=n,e.easing["easeOut"+t]=function(e){return 1-n(1-e)},e.easing["easeInOut"+t]=function(e){return e<.5?n(e*2)/2:n(e*-2+2)/-2+1}})}(jQuery),function(e){var t={init:function(t){function r(){return"ontouchstart"in window?1:0}var n={set_width:!1,set_height:!1,horizontalScroll:!1,scrollInertia:550,scrollEasing:"easeOutCirc",mouseWheel:"auto",autoDraggerLength:!0,scrollButtons:{enable:!1,scrollType:"continuous",scrollSpeed:20,scrollAmount:40},advanced:{updateOnBrowserResize:!0,updateOnContentResize:!1,autoExpandHorizontalScroll:!1},callbacks:{onScroll:function(){},onTotalScroll:function(){},onTotalScrollOffset:0}},t=e.extend(!0,n,t);return e(document).data("mCS-is-touch-device",!1),r()&&e(document).data("mCS-is-touch-device",!0),this.each(function(){var n=e(this);t.set_width&&n.css("width",t.set_width),t.set_height&&n.css("height",t.set_height);if(!e(document).data("mCustomScrollbar-index"))e(document).data("mCustomScrollbar-index","1");else{var i=parseInt(e(document).data("mCustomScrollbar-index"));e(document).data("mCustomScrollbar-index",i+1)}n.wrapInner("<div class='mCustomScrollBox' id='mCSB_"+e(document).data("mCustomScrollbar-index")+"' style='position:relative; height:100%; overflow:hidden; max-width:100%;' />").addClass("mCustomScrollbar _mCS_"+e(document).data("mCustomScrollbar-index"));var s=n.children(".mCustomScrollBox");if(t.horizontalScroll){s.addClass("mCSB_horizontal").wrapInner("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />");var o=s.children(".mCSB_h_wrapper");o.wrapInner("<div class='mCSB_container' style='position:absolute; left:0;' />").children(".mCSB_container").css({width:o.children().outerWidth(),position:"relative"}).unwrap()}else s.wrapInner("<div class='mCSB_container' style='position:relative; top:0;' />");var u=s.children(".mCSB_container");if(!e(document).data("mCS-is-touch-device")){u.after("<div class='mCSB_scrollTools' style='position:absolute;'><div class='mCSB_draggerContainer' style='position:relative;'><div class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' style='position:relative;'></div></div><div class='mCSB_draggerRail'></div></div></div>");var a=s.children(".mCSB_scrollTools"),f=a.children(".mCSB_draggerContainer"),l=f.children(".mCSB_dragger");t.horizontalScroll?l.data("minDraggerWidth",l.width()):l.data("minDraggerHeight",l.height()),t.scrollButtons.enable&&(t.horizontalScroll?a.prepend("<a class='mCSB_buttonLeft' style='display:block; position:relative;'></a>").append("<a class='mCSB_buttonRight' style='display:block; position:relative;'></a>"):a.prepend("<a class='mCSB_buttonUp' style='display:block; position:relative;'></a>").append("<a class='mCSB_buttonDown' style='display:block; position:relative;'></a>")),s.bind("scroll",function(){s.scrollTop(0).scrollLeft(0)}),n.data({horizontalScroll:t.horizontalScroll,scrollInertia:t.scrollInertia,scrollEasing:t.scrollEasing,mouseWheel:t.mouseWheel,autoDraggerLength:t.autoDraggerLength,"scrollButtons-enable":t.scrollButtons.enable,"scrollButtons-scrollType":t.scrollButtons.scrollType,"scrollButtons-scrollSpeed":t.scrollButtons.scrollSpeed,"scrollButtons-scrollAmount":t.scrollButtons.scrollAmount,autoExpandHorizontalScroll:t.advanced.autoExpandHorizontalScroll,"onScroll-Callback":t.callbacks.onScroll,"onTotalScroll-Callback":t.callbacks.onTotalScroll,"onTotalScroll-Offset":t.callbacks.onTotalScrollOffset}).mCustomScrollbar("update");if(t.advanced.updateOnBrowserResize){var h;e(window).resize(function(){h&&clearTimeout(h),h=setTimeout(function(){n.mCustomScrollbar("update")},150)})}}else{var p=navigator.userAgent;if(p.indexOf("Android")!=-1){var v=parseFloat(p.slice(p.indexOf("Android")+8));v<3?m("mCSB_"+e(document).data("mCustomScrollbar-index")):s.css({overflow:"auto","-webkit-overflow-scrolling":"touch"})}else s.css({overflow:"auto","-webkit-overflow-scrolling":"touch"});u.addClass("mCS_no_scrollbar mCS_touch"),n.data({horizontalScroll:t.horizontalScroll,scrollInertia:t.scrollInertia,scrollEasing:t.scrollEasing,autoExpandHorizontalScroll:t.advanced.autoExpandHorizontalScroll,"onScroll-Callback":t.callbacks.onScroll,"onTotalScroll-Callback":t.callbacks.onTotalScroll,"onTotalScroll-Offset":t.callbacks.onTotalScrollOffset}),s.scroll(function(){n.mCustomScrollbar("callbacks",s,u)});function m(e){var t=document.getElementById(e),n=0,r=0;document.getElementById(e).addEventListener("touchstart",function(e){n=this.scrollTop+e.touches[0].pageY,r=this.scrollLeft+e.touches[0].pageX},!1),document.getElementById(e).addEventListener("touchmove",function(e){(this.scrollTop<this.scrollHeight-this.offsetHeight&&this.scrollTop+e.touches[0].pageY<n-5||this.scrollTop!=0&&this.scrollTop+e.touches[0].pageY>n+5)&&e.preventDefault(),(this.scrollLeft<this.scrollWidth-this.offsetWidth&&this.scrollLeft+e.touches[0].pageX<r-5||this.scrollLeft!=0&&this.scrollLeft+e.touches[0].pageX>r+5)&&e.preventDefault(),this.scrollTop=n-e.touches[0].pageY,this.scrollLeft=r-e.touches[0].pageX},!1)}}if(t.advanced.updateOnContentResize){var g;if(t.horizontalScroll){var y=u.outerWidth();r()&&s.css({"-webkit-overflow-scrolling":"auto"})}else var y=u.outerHeight();g=setInterval(function(){if(t.horizontalScroll){t.advanced.autoExpandHorizontalScroll&&u.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:u.outerWidth(),position:"relative"}).unwrap();var e=u.outerWidth()}else var e=u.outerHeight();e!=y&&(n.mCustomScrollbar("update"),y=e)},300)}})},update:function(){var t=e(this),n=t.children(".mCustomScrollBox"),r=n.children(".mCSB_container");e(document).data("mCS-is-touch-device")||r.removeClass("mCS_no_scrollbar");var i=n.children(".mCSB_scrollTools"),s=i.children(".mCSB_draggerContainer"),o=s.children(".mCSB_dragger");if(t.data("horizontalScroll")){var u=i.children(".mCSB_buttonLeft"),a=i.children(".mCSB_buttonRight"),f=n.width();t.data("autoExpandHorizontalScroll")&&r.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:r.outerWidth(),position:"relative"}).unwrap();var l=r.outerWidth()}else var c=i.children(".mCSB_buttonUp"),h=i.children(".mCSB_buttonDown"),p=n.height(),d=r.outerHeight();if(d>p&&!t.data("horizontalScroll")&&!e(document).data("mCS-is-touch-device")){i.css("display","block");var v=s.height();if(t.data("autoDraggerLength")){var m=Math.round(p/d*v),g=o.data("minDraggerHeight");if(m<=g)o.css({height:g});else if(m>=v-10){var y=v-10;o.css({height:y})}else o.css({height:m});o.children(".mCSB_dragger_bar").css({"line-height":o.height()+"px"})}var w=o.height(),E=(d-p)/(v-w);t.data("scrollAmount",E),t.mCustomScrollbar("scrolling",n,r,s,o,c,h,u,a);var S=Math.abs(Math.round(r.position().top));t.mCustomScrollbar("scrollTo",S,{callback:!1})}else if(l>f&&t.data("horizontalScroll")&&!e(document).data("mCS-is-touch-device")){i.css("display","block");var x=
|
||
s.width();if(t.data("autoDraggerLength")){var T=Math.round(f/l*x),N=o.data("minDraggerWidth");if(T<=N)o.css({width:N});else if(T>=x-10){var C=x-10;o.css({width:C})}else o.css({width:T})}var k=o.width(),E=(l-f)/(x-k);t.data("scrollAmount",E),t.mCustomScrollbar("scrolling",n,r,s,o,c,h,u,a);var S=Math.abs(Math.round(r.position().left));t.mCustomScrollbar("scrollTo",S,{callback:!1})}else n.unbind("mousewheel"),n.unbind("focusin"),t.data("horizontalScroll")?o.add(r).css("left",0):o.add(r).css("top",0),i.css("display","none"),r.addClass("mCS_no_scrollbar")},scrolling:function(t,n,r,i,s,o,u,a){var f=e(this);if(!i.hasClass("ui-draggable")){if(f.data("horizontalScroll"))var l="x";else var l="y";i.draggable({axis:l,containment:"parent",drag:function(e,t){f.mCustomScrollbar("scroll"),i.addClass("mCSB_dragger_onDrag")},stop:function(e,t){i.removeClass("mCSB_dragger_onDrag")}})}r.unbind("click").bind("click",function(e){if(f.data("horizontalScroll")){var t=e.pageX-r.offset().left;if(t<i.position().left||t>i.position().left+i.width()){var n=t;n>=r.width()-i.width()&&(n=r.width()-i.width()),i.css("left",n),f.mCustomScrollbar("scroll")}}else{var t=e.pageY-r.offset().top;if(t<i.position().top||t>i.position().top+i.height()){var n=t;n>=r.height()-i.height()&&(n=r.height()-i.height()),i.css("top",n),f.mCustomScrollbar("scroll")}}});if(f.data("mouseWheel")){var c=f.data("mouseWheel");if(f.data("mouseWheel")==="auto"){c=8;var h=navigator.userAgent;h.indexOf("Mac")!=-1&&h.indexOf("Safari")!=-1&&h.indexOf("AppleWebKit")!=-1&&h.indexOf("Chrome")==-1&&(c=1)}t.unbind("mousewheel").bind("mousewheel",function(e,t){e.preventDefault();var n=Math.abs(t*c);if(f.data("horizontalScroll")){var s=i.position().left-t*n;i.css("left",s),i.position().left<0&&i.css("left",0);var o=r.width(),u=i.width();i.position().left>o-u&&i.css("left",o-u)}else{var a=i.position().top-t*n;i.css("top",a),i.position().top<0&&i.css("top",0);var l=r.height(),h=i.height();i.position().top>l-h&&i.css("top",l-h)}f.mCustomScrollbar("scroll")})}if(f.data("scrollButtons-enable"))if(f.data("scrollButtons-scrollType")==="pixels"){var p;e.browser.msie&&parseInt(e.browser.version)<9&&f.data("scrollInertia",0),f.data("horizontalScroll")?(a.add(u).unbind("click mousedown mouseup mouseout",g,w),a.bind("click",function(e){e.preventDefault(),n.is(":animated")||(p=Math.abs(n.position().left)+f.data("scrollButtons-scrollAmount"),f.mCustomScrollbar("scrollTo",p))}),u.bind("click",function(e){e.preventDefault(),n.is(":animated")||(p=Math.abs(n.position().left)-f.data("scrollButtons-scrollAmount"),n.position().left>=-f.data("scrollButtons-scrollAmount")&&(p="left"),f.mCustomScrollbar("scrollTo",p))})):(o.add(s).unbind("click mousedown mouseup mouseout",T,C),o.bind("click",function(e){e.preventDefault(),n.is(":animated")||(p=Math.abs(n.position().top)+f.data("scrollButtons-scrollAmount"),f.mCustomScrollbar("scrollTo",p))}),s.bind("click",function(e){e.preventDefault(),n.is(":animated")||(p=Math.abs(n.position().top)-f.data("scrollButtons-scrollAmount"),n.position().top>=-f.data("scrollButtons-scrollAmount")&&(p="top"),f.mCustomScrollbar("scrollTo",p))}))}else if(f.data("horizontalScroll")){a.add(u).unbind("click mousedown mouseup mouseout",g,w);var d,v=r.width(),m=i.width();a.bind("mousedown",function(e){e.preventDefault();var t=v-m;d=setInterval(function(){var e=Math.abs(i.position().left-t)*(100/f.data("scrollButtons-scrollSpeed"));i.stop().animate({left:t},e,"linear"),f.mCustomScrollbar("scroll")},20)});var g=function(e){e.preventDefault(),clearInterval(d),i.stop()};a.bind("mouseup mouseout",g);var y;u.bind("mousedown",function(e){e.preventDefault();var t=0;y=setInterval(function(){var e=Math.abs(i.position().left-t)*(100/f.data("scrollButtons-scrollSpeed"));i.stop().animate({left:t},e,"linear"),f.mCustomScrollbar("scroll")},20)});var w=function(e){e.preventDefault(),clearInterval(y),i.stop()};u.bind("mouseup mouseout",w)}else{o.add(s).unbind("click mousedown mouseup mouseout",T,C);var E,S=r.height(),x=i.height();o.bind("mousedown",function(e){e.preventDefault();var t=S-x;E=setInterval(function(){var e=Math.abs(i.position().top-t)*(100/f.data("scrollButtons-scrollSpeed"));i.stop().animate({top:t},e,"linear"),f.mCustomScrollbar("scroll")},20)});var T=function(e){e.preventDefault(),clearInterval(E),i.stop()};o.bind("mouseup mouseout",T);var N;s.bind("mousedown",function(e){e.preventDefault();var t=0;N=setInterval(function(){var e=Math.abs(i.position().top-t)*(100/f.data("scrollButtons-scrollSpeed"));i.stop().animate({top:t},e,"linear"),f.mCustomScrollbar("scroll")},20)});var C=function(e){e.preventDefault(),clearInterval(N),i.stop()};s.bind("mouseup mouseout",C)}t.unbind("focusin").bind("focusin",function(){t.scrollTop(0).scrollLeft(0);var s=e(document.activeElement);if(s.is("input,textarea,select,button,a[tabindex],area,object"))if(f.data("horizontalScroll")){var o=n.position().left,u=s.position().left,a=t.width(),l=s.outerWidth();if(!(o+u>=0&&o+u<=a-l)){var c=u/f.data("scrollAmount");c>=r.width()-i.width()&&(c=r.width()-i.width()),i.css("left",c),f.mCustomScrollbar("scroll")}}else{var h=n.position().top,p=s.position().top,d=t.height(),v=s.outerHeight();if(!(h+p>=0&&h+p<=d-v)){var c=p/f.data("scrollAmount");c>=r.height()-i.height()&&(c=r.height()-i.height()),i.css("top",c),f.mCustomScrollbar("scroll")}}})},scroll:function(t){var n=e(this),r=n.find(".mCSB_dragger"),i=n.find(".mCSB_container"),s=n.find(".mCustomScrollBox");if(n.data("horizontalScroll"))var o=r.position().left,u=-o*n.data("scrollAmount"),a=i.position().left,f=Math.round(a-u);else var l=r.position().top,c=-l*n.data("scrollAmount"),h=i.position().top,p=Math.round(h-c);if(e.browser.webkit)var d=(window.outerWidth-8)/window.innerWidth,v=d<.98||d>1.02;n.data("scrollInertia")===0||v?(n.data("horizontalScroll")?i.css("left",u):i.css("top",c),t||n.mCustomScrollbar("callbacks",s,i)):n.data("horizontalScroll")?i.stop().animate({left:"-="+f},n.data("scrollInertia"),n.data("scrollEasing"),function(){t||n.mCustomScrollbar("callbacks",s,i)}):i.stop().animate({top:"-="+p},n.data("scrollInertia"),n.data("scrollEasing"),function(){t||n.mCustomScrollbar("callbacks",s,i)})},scrollTo:function(t,n){var r={moveDragger:!1,callback:!0},n=e.extend(r,n),i=e(this),s,o=i.find(".mCustomScrollBox"),u=o.children(".mCSB_container");if(!e(document).data("mCS-is-touch-device"))var a=i.find(".mCSB_draggerContainer"),f=a.children(".mCSB_dragger");var l;if(t){if(typeof t=="number")n.moveDragger?s=t:(l=t,s=Math.round(l/i.data("scrollAmount")));else if(typeof t=="string"){var c;t==="top"?c=0:t==="bottom"&&!i.data("horizontalScroll")?c=u.outerHeight()-o.height():t==="left"?c=0:t==="right"&&i.data("horizontalScroll")?c=u.outerWidth()-o.width():t==="first"?c=i.find(".mCSB_container").find(":first"):t==="last"?c=i.find(".mCSB_container").find(":last"):c=i.find(t),c.length===1?(i.data("horizontalScroll")?l=c.position().left:l=c.position().top,e(document).data("mCS-is-touch-device")?s=l:s=Math.ceil(l/i.data("scrollAmount"))):s=c}e(document).data("mCS-is-touch-device")?i.data("horizontalScroll")?o.stop().animate({scrollLeft:s},i.data("scrollInertia"),i.data("scrollEasing"),function(){n.callback&&i.mCustomScrollbar("callbacks",o,u)}):o.stop().animate({scrollTop:s},i.data("scrollInertia"),i.data("scrollEasing"),function(){n.callback&&i.mCustomScrollbar("callbacks",o,u)}):(i.data("horizontalScroll")?(s>=a.width()-f.width()&&(s=a.width()-f.width()),f.css("left",s)):(s>=a.height()-f.height()&&(s=a.height()-f.height()),f.css("top",s)),n.callback?i.mCustomScrollbar("scroll"):i.mCustomScrollbar("scroll",!0))}},callbacks:function(t,n){var r=e(this);if(!e(document).data("mCS-is-touch-device"))if(r.data("horizontalScroll")){var i=Math.round(n.position().left);i<0&&i<=t.width()-n.outerWidth()+r.data("onTotalScroll-Offset")?r.data("onTotalScroll-Callback").call():r.data("onScroll-Callback").call()}else{var s=Math.round(n.position().top);s<0&&s<=t.height()-n.outerHeight()+r.data("onTotalScroll-Offset")?r.data("onTotalScroll-Callback").call():r.data("onScroll-Callback").call()}else if(r.data("horizontalScroll")){var o=Math.round(t.scrollLeft());o>0&&o>=n.outerWidth()-r.width()-r.data("onTotalScroll-Offset")?r.data("onTotalScroll-Callback").call():r.data("onScroll-Callback").call()}else{var u=Math.round(t.scrollTop());u>0&&u>=n.outerHeight()-r.height()-r.data("onTotalScroll-Offset")?r.data("onTotalScroll-Callback").call():r.data("onScroll-Callback").call()}}};e.fn.mCustomScrollbar=function(n){if(t[n])return t[n].apply(this,Array.prototype.slice.call(arguments,1));if(typeof n=="object"||!n)return t.init.apply(this,arguments);e.error("Method "+n+" does not exist")}}(jQuery),function(e){function t(t){var n=t||window.event,r=[].slice.call(arguments,1),i=0,s=!0,o=0,u=0;return t=e.event.fix(n),t.type="mousewheel",n.wheelDelta&&(i=n.wheelDelta/120),n.detail&&(i=-n.detail/3),u=i,n.axis!==undefined&&n.axis===n.HORIZONTAL_AXIS&&(u=0,o=-1*i),n.wheelDeltaY!==undefined&&(u=n.wheelDeltaY/120),n.wheelDeltaX!==undefined&&(o=-1*n.wheelDeltaX/120),r.unshift(t,i,o,u),(e.event.dispatch||e.event.handle).apply(this,r)}var n=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var r=n.length;r;)e.event.fixHooks[n[--r]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=n.length;e;)this.addEventListener(n[--e],t,!1);else this.onmousewheel=t},teardown:function(){if(this.removeEventListener)for(var e=n.length;e;)this.removeEventListener(n[--e],t,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery),function(){}.call(this),function(){}.call(this),function(){jQuery(function(){return $(".authenticated div.permission.canEdit .best_in_place").best_in_place()})}.call(this),function(e){function t(t,n){function r(e){u||(u=!0,s.start&&s.start(e,o))}function i(e,t){u&&(clearTimeout(a),a=setTimeout(function(){u=!1,s.stop&&s.stop(e,o)},t>=0?t:s.delay))}var s=e.extend({start:null,stop:null,delay:400},n),o=e(t),u=!1,a;o.keypress(r),o.keydown(function(e){(e.keyCode===8||e.keyCode===46)&&r(e)}),o.keyup(i),o.blur(function(e){i(e,0)})}e.fn.typing=function(e){return this.each(function(n,r){t(r,e)})}}(jQuery),function(){}.call(this);var viewMode="list",labelType,useGradients,nativeTextSupport,animate,json,Mconsole=null,gType,tempNode=null,tempInit=!1,tempNode2=null,metacodeIMGinit=!1,findOpen=!1,analyzeOpen=!1,organizeOpen=!1,goRealtime=!1,mapid=null,mapperm=!1;$(document).ready(function(){$("#new_topic, #new_synapse").bind("contextmenu",function(e){return!1}),$("#topic_name").bind("railsAutocomplete.select",function(e,t){t.item.id!=undefined&&($("#topic_grabTopic").val(t.item.id),$(".new_topic").submit())}),$(".new_topic").bind("submit",function(e,t){e.preventDefault()}),$(".scroll").mCustomScrollbar();var e=!1,t;$(".logo").hover(function(){clearTimeout(t),e||(e=!0,userid!=null?$(".footer .menu").animate({height:"272px"},300,function(){e=!1}):$(".footer .menu").animate({height:"140px"},300,function(){e=!1}))},function(){t=setTimeout(function(){e||(e=!0,$(".footer .menu").animate({height:"0px"},300,function(){e=!1}))},800)}),addHoverForSettings(),$(".best_in_place_metacode").bind("ajax:success",function(){var e=$(this).html();$(this).parents(".CardOnGraph").find("img.icon").attr("alt",e),$(this).parents(".CardOnGraph").find("img.icon").attr("src",imgArray[e].src)}),$("#saveLayout").click(function(e){e.preventDefault(),saveLayoutAll()})}); |