diff --git a/app/assets/images/MMCCicon_delete_black.png b/app/assets/images/MMCCicon_delete_black.png new file mode 100644 index 00000000..017a1adf Binary files /dev/null and b/app/assets/images/MMCCicon_delete_black.png differ diff --git a/app/assets/images/MMCCicon_delete_grey.png b/app/assets/images/MMCCicon_delete_grey.png new file mode 100644 index 00000000..4ba2b136 Binary files /dev/null and b/app/assets/images/MMCCicon_delete_grey.png differ diff --git a/app/assets/images/MMCCicon_hide.png b/app/assets/images/MMCCicon_hide.png new file mode 100644 index 00000000..80ea7276 Binary files /dev/null and b/app/assets/images/MMCCicon_hide.png differ diff --git a/app/assets/images/MMCCicon_pop-out_black.png b/app/assets/images/MMCCicon_pop-out_black.png new file mode 100644 index 00000000..7db39126 Binary files /dev/null and b/app/assets/images/MMCCicon_pop-out_black.png differ diff --git a/app/assets/images/MMCCicon_remove_from_map_black.png b/app/assets/images/MMCCicon_remove_from_map_black.png new file mode 100644 index 00000000..9ddc204f Binary files /dev/null and b/app/assets/images/MMCCicon_remove_from_map_black.png differ diff --git a/app/assets/images/MMCCicon_remove_from_map_grey.png b/app/assets/images/MMCCicon_remove_from_map_grey.png new file mode 100644 index 00000000..0e863158 Binary files /dev/null and b/app/assets/images/MMCCicon_remove_from_map_grey.png differ diff --git a/app/assets/javascripts/Jit/graphsettings-event-handlers.js b/app/assets/javascripts/Jit/graphsettings-event-handlers.js index a11fbaa7..defdd7bb 100644 --- a/app/assets/javascripts/Jit/graphsettings-event-handlers.js +++ b/app/assets/javascripts/Jit/graphsettings-event-handlers.js @@ -146,6 +146,8 @@ function selectNodeOnClickHandler(node, e) { if (Mconsole.busy) return; + selectNode(node); + // delete old right click menu $('.rightclickmenu').remove(); // create new menu for clicked on node @@ -155,8 +157,8 @@ function selectNodeOnClickHandler(node, e) { // add the proper options to the menu var menustring = '",n.innerHTML=r,$(n).css({left:t.clientX,top:t.clientY}),$("#wrapper").append(n),$(".rc-delete").click(function(){$(".rightclickmenu").remove();var e=MetamapsModel.selectedNodes.length,t=MetamapsModel.selectedEdges.length,n=e==1?"1 topic":e+" topics",r=t==1?"1 synapse":t+" synapses",i="You have "+n+" and "+r+" selected. ",s=confirm(i+"Are you sure you want to permanently delete them all? This will remove them from all maps they appear on.");s==1&&(deleteSelectedEdges(),deleteSelectedNodes())}),$(".rc-remove").click(function(){$(".rightclickmenu").remove(),hideSelectedEdges(),hideSelectedNodes()}),$(".rc-hide").click(function(){$(".rightclickmenu").remove(),hideSelectedEdges(),hideSelectedNodes()}),$(".rc-popout").click(function(){$(".rightclickmenu").remove();var t=window.open("/topics/"+e.id,"_blank");t.focus()})}function canvasDoubleClickHandler(e,t){var n=MetamapsModel.lastCanvasClick,r=Date.now();MetamapsModel.lastCanvasClick=r,r-n=Mconsole.canvas.scaleOffsetX*d&&Mconsole.canvas.scaleOffsetX*d>=1&&Mconsole.canvas.scale(d,d),Mconsole.canvas.scaleOffsetX<.5?Mconsole.canvas.viz.labels.hideLabels(!0):Mconsole.canvas.scaleOffsetX>.5&&Mconsole.canvas.viz.labels.hideLabels(!1),lastDist=p}}function graphSettings(e,t){var n={injectInto:"infovis",Navigation:{enable:!0,panning:"avoid nodes",zooming:28},Node:{overridable:!0,color:"#2D6A5D",type:"customNode",dim:25},Edge:{overridable:!0,color:"#222222",type:"customEdge",lineWidth:2,alpha:.4},Label:{type:"Native",size:20,family:"arial",textBaseline:"hanging",color:"#000"},Tips:{enable:!1,onShow:function(e,t){}},Events:{enable:!0,enableForEdges:!0,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)},onTouchStart:function(e,t,n){Mconsole.events.touched=!0,touchPos=t.getPos();var r=Mconsole.canvas,i=r.translateOffsetX;oy=r.translateOffsetY,sx=r.scaleOffsetX,sy=r.scaleOffsetY,touchPos.x*=sx,touchPos.y*=sy,touchPos.x+=i,touchPos.y+=oy,touchDragNode=e},onTouchMove:function(e,t,n){touchDragNode?onDragMoveTopicHandler(touchDragNode,t,n):(touchPanZoomHandler(t,n),Mconsole.labels.hideLabel(Mconsole.graph.getNode(MetamapsModel.showcardInUse)))},onTouchEnd:function(e,t,n){},onTouchCancel:function(e,t,n){},onClick:function(e,t,n){if(MetamapsModel.boxStartCoordinates){Mconsole.busy=!1,MetamapsModel.boxEndCoordinates=t.getPos(),selectNodesWithBox();return}if(n.target.id!="infovis-canvas")return!1;e.nodeFrom?selectEdgeOnClickHandler(e,n):e&&!e.nodeFrom?selectNodeOnClickHandler(e,n):(MetamapsModel.didPan||hideCards(),canvasDoubleClickHandler(t.getPos(),n))},onRightClick:function(e,t,n){n.preventDefault(),n.stopPropagation(),e&&!e.nodeFrom?selectNodeOnRightClickHandler(e,n):e&&e.nodeFrom}},iterations:200,levelDistance:200};return t&&(n.Edge.type="customEdgeEmbed"),e=="centered"&&(n.background={CanvasStyles:{strokeStyle:"#333",lineWidth:1.5}},n.levelDistance=400,n.Events.enableForEdges=!0,n.Events.onDragEnd=function(e,t,n){onDragEndTopicHandler(e,t,n,!1)},n.Events.onDragCancel=function(e,t,n){onDragCancelHandler(e,t,n,!0)}),n}function hideCards(){$("#edit_synapse").hide(),MetamapsModel.edgecardInUse=null,hideCurrentCard(),$(".rightclickmenu").remove()}function drawSelectBox(e,t){Mconsole.plot();var n=Mconsole.canvas.getCtx(),r=MetamapsModel.boxStartCoordinates.x,i=MetamapsModel.boxStartCoordinates.y,s=e.getPos().x,o=e.getPos().y;Mconsole.plot(),n.beginPath(),n.moveTo(r,i),n.lineTo(r,o),n.lineTo(s,o),n.lineTo(s,i),n.lineTo(r,i),n.strokeStyle="black",n.stroke()}function selectNodesWithBox(){var e=MetamapsModel.boxStartCoordinates.x,t=MetamapsModel.boxStartCoordinates.y,n=MetamapsModel.boxEndCoordinates.x,r=MetamapsModel.boxEndCoordinates.y;Mconsole.graph.eachNode(function(i){var s=gType=="centered"?i.pos.toComplex().x:i.pos.x,o=gType=="centered"?i.pos.toComplex().y:i.pos.y;if(es&&s>n&&t>o&&o>r||e>s&&s>n&&to&&o>r){var u=MetamapsModel.selectedNodes.indexOf(i);u==-1?selectNode(i):u!=-1&&deselectNode(i)}}),MetamapsModel.boxStartCoordinates=!1,MetamapsModel.boxEndCoordinates=!1,Mconsole.plot()}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=MetamapsModel.selectedEdges.indexOf(e);t==-1&&(e.setData("showDesc",!0,"current"),e.setDataset("end",{lineWidth:4,alpha:1}),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:100}),Mconsole.plot())}function onMouseLeave(e){$("canvas").css("cursor","default");var t=MetamapsModel.selectedEdges.indexOf(e);t==-1&&(e.setData("showDesc",!1,"current"),e.setDataset("end",{lineWidth:2,alpha:.4}),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:100})),Mconsole.plot()}function onDragEndTopicHandler(e,t,n,r){if(tempInit&&tempNode2==null)$("#topic_addSynapse").val("true"),$("#new_topic").fadeIn("fast"),addMetacode(),$("#topic_name").focus();else if(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;else if(dragged!=0&&goRealtime){saveLayout(dragged);for(var i=0;i

$_metacode_$

$_metacode_$
$_mk_permission_$
$_edit_permission_$
$_name_$
Added by: $_username_$
$_desc_$
'}function replaceVariables(e,t){var n,r,i;authorizeToEdit(t)?(n='[go]',r="",i=""):(n="",t.getData("link")!=""?(r='',i=""):(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="Click to add description.",l="Click to add link.",c="";userid==t.getData("userid")&&(c='
Permissions:  $_permission_$
');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),e=e.replace(/\$_link_nil_\$/g,l),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='
$_name_$
';return userid==null||mapid==null||!mapperm?t+=' ':mapperm&&(t+=' '),userid==e.getData("userid")&&(t+=' '),t+="
",t=t.replace(/\$_id_\$/g,e.id),t=t.replace(/\$_mapid_\$/g,mapid),t=t.replace(/\$_name_\$/g,e.name),t}function generateCenteredLittleHTML(e){var t='
$_name_$
';return t+=' ',t+="
",t=t.replace(/\$_id_\$/g,e.id),t=t.replace(/\$_name_\$/g,e.name),t}function hideCurrentCard(){if(MetamapsModel.showcardInUse){var e=Mconsole.graph.getNode(MetamapsModel.showcardInUse);hideCard(e)}}function hideCard(e){var t=".showcard";e!=null&&(t+=".topic_"+e.id),$(t).fadeOut("fast",function(){e.setData("dim",25,"current"),Mconsole.labels.hideLabel(Mconsole.graph.getNode(e.id),!0),Mconsole.plot()}),MetamapsModel.showcardInUse=null}function bindNameContainerCallbacks(e,t){e.onmouseover=function(){$(".name.topic_"+t.id+" .nodeOptions").css("display","block")},e.onmouseout=function(){$(".name.topic_"+t.id+" .nodeOptions").css("display","none")},$(e).find(".label").click(function(e){MetamapsModel.showcardInUse!=null&&(currentOpenNode=Mconsole.graph.getNode(MetamapsModel.showcardInUse),currentOpenNode.setData("dim",25,"current"),Mconsole.labels.hideLabel(currentOpenNode,!0),Mconsole.plot()),populateShowCard(t);var n=$("#"+t.id).css("top"),r=parseInt($("#"+t.id).css("left")),i=$("#topic_"+t.id+"_label").width();i/=2,r=r+i+"px",$("#showcard").css("top",n),$("#showcard").css("left",r),$(".showcard.topic_"+t.id).fadeIn("fast"),t.setData("dim",1,"current"),MetamapsModel.showcardInUse=t.id,Mconsole.plot(),Mconsole.labels.hideLabel(Mconsole.graph.getNode(t.id))})}function populateShowCard(e){var t=document.getElementById("showcard");t.innerHTML="";var n=generateShowcardHTML();n=replaceVariables(n,e),t.className="showcard topic_"+e.id;if(authorizeToEdit(e)){var r=document.createElement("div");r.className="permission canEdit",r.innerHTML=n,t.appendChild(r)}else t.innerHTML=n;$(t).find(".best_in_place_metacode").bind("ajax:success",function(){var n=$(this).html();$(t).find("img.icon").attr("alt",n),$(t).find("img.icon").attr("src",imgArray[n].src),e.setData("metacode",n),Mconsole.plot()}),$(t).find(".best_in_place_name").bind("ajax:success",function(){var t=$(this).html();$("#topic_"+e.id+"_label").find(".label").html(t),e.name=t}),$(t).find(".best_in_place_desc").bind("ajax:success",function(){$(t).find(".scroll").mCustomScrollbar("update");var n=$(this).html();e.setData("desc",n)}),$(t).find(".best_in_place_link").bind("ajax:success",function(){var n=$(this).html();$(t).find(".go-link").attr("href",n),e.setData("link",n)}),$(t).find(".permActivator").bind("mouseover",function(){clearTimeout(MetamapsModel.topicPermTimer2),that=this,MetamapsModel.topicPermTimer1=setTimeout(function(){MetamapsModel.topicPermSliding||(MetamapsModel.topicPermSliding=!0,$(that).animate({width:"203px",height:"37px"},300,function(){MetamapsModel.topicPermSliding=!1}))},300)}),$(t).find(".permActivator").bind("mouseout",function(){clearTimeout(MetamapsModel.topicPermTimer1),that=this,MetamapsModel.topicPermTimer2=setTimeout(function(){MetamapsModel.topicPermSliding||(MetamapsModel.topicPermSliding=!0,$(that).animate({height:"16px",width:"16px"},300,function(){MetamapsModel.topicPermSliding=!1}))},800)}),$(t).find(".best_in_place_permission").bind("ajax:success",function(){var t=$(this).html(),n=$(this).parents(".cardSettings").find(".mapPerm");n.attr("title",t),t=="commons"?n.html("co"):t=="public"?n.html("pu"):t=="private"&&n.html("pr"),e.setData("permission",t)}),$(".showcard.topic_"+e.id).find(".scroll").mCustomScrollbar(),$(".showcard").find("img.icon").click(function(){hideCard(e)})}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 centerOn(e){if(!Mconsole.busy){var t=Mconsole.graph.getNode(e);$("h1.index").html("Viewing Topic: "+t.name),window.history.pushState(t.name,"Metamaps","/topics/"+t.id),Mconsole.onClick(t.id,{hideLabels:!1,duration:1e3,onComplete:function(){fetchRelatives(t)}})}}function editEdge(e,t){if(authorizeToEdit(e)){var n=$("#edit_synapse").css("left"),r=$("#edit_synapse").css("top");$("#edit_synapse").remove(),deselectEdge(e);var i=document.createElement("div");i.setAttribute("id","edit_synapse"),i.className="permission canEdit",$(".main .wrapper").append(i),populateEditEdgeForm(e),$("#edit_synapse").css("position","absolute"),t?($("#edit_synapse").css("left",t.clientX),$("#edit_synapse").css("top",t.clientY)):($("#edit_synapse").css("left",n),$("#edit_synapse").css("top",r)),$("#edit_synapse").show(),MetamapsModel.edgecardInUse=e.data.$id}else!authorizeToEdit(e)&&userid&&alert("You don't have the permissions to edit this synapse.")}function populateEditEdgeForm(e){add_perms_form(e),add_direction_form(e),add_name_form(e)}function add_name_form(e){var t='Click to add description.';$("#edit_synapse").append('
'),$("#edit_synapse_name").attr("class","best_in_place best_in_place_desc"),$("#edit_synapse_name").attr("data-object","synapse"),$("#edit_synapse_name").attr("data-attribute","desc"),$("#edit_synapse_name").attr("data-type","input"),$("#edit_synapse_name").attr("data-nil",t),$("#edit_synapse_name").attr("data-url","/synapses/"+e.getData("id")),$("#edit_synapse_name").html(e.getData("desc")),$("#edit_synapse_name").html().trim()==""&&$("#edit_synapse_name").html(t),$("#edit_synapse_name").bind("ajax:success",function(){var n=$(this).html();n==t?e.setData("desc",""):e.setData("desc",n),selectEdge(e),Mconsole.plot()})}function add_perms_form(e){$("#edit_synapse").append('
'),$("#edit_synapse .mapPerm").html(mk_permission(e)),userid==e.getData("userid")&&($("#edit_synapse").append('
'),$("#edit_synapse .permActivator").append('
'),$("#edit_synapse .editSettings").append("Permissions:"),$("#edit_synapse .editSettings").append(''),$("#edit_synapse .click-to-edit").attr("title","Click to Edit"),$("#edit_synapse .click-to-edit").append(best_in_place_perms(e)),$("#edit_synapse .editSettings").append('
'),$("#edit_synapse").find(".best_in_place_permission").bind("ajax:success",function(){var e=$(this).html();switch(e){case"commons":$("#edit_synapse .mapPerm").html("co");break;case"public":$("#edit_synapse .mapPerm").html("pu");break;case"private":$("#edit_synapse .mapPerm").html("pr")}}),$("#edit_synapse .permActivator").bind("mouseover",function(){clearTimeout(MetamapsModel.edgePermTimer2),that=this,MetamapsModel.edgePermTimer1=setTimeout(function(){MetamapsModel.edgePermSliding||(MetamapsModel.edgePermSliding=!0,$(that).animate({width:"203px",height:"37px"},300,function(){MetamapsModel.edgePermSliding=!1}))},300)}),$("#edit_synapse .permActivator").bind("mouseout",function(){clearTimeout(MetamapsModel.edgePermTimer1),that=this,MetamapsModel.edgePermTimer2=setTimeout(function(){MetamapsModel.edgePermSliding||(MetamapsModel.edgePermSliding=!0,$(that).animate({height:"16px",width:"16px"},300,function(){MetamapsModel.edgePermSliding=!1}))},800)}))}function add_direction_form(e){$("#edit_synapse").append(''),$("#edit_synapse").append(''),$("#edit_synapse").append(''),$("#edit_synapse").append('');if(e.nodeFrom.pos.x=0;t-=1){var n=MetamapsModel.selectedEdges[t];deselectEdge(n)}}function deselectAllNodes(){var e=MetamapsModel.selectedNodes.length;for(var t=e-1;t>=0;t-=1){var n=MetamapsModel.selectedNodes[t];deselectNode(n)}}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(){var e=MetamapsModel.selectedEdges.length;for(var t=e-1;t>=0;t-=1){var n=MetamapsModel.selectedEdges[t];hideEdge(n)}MetamapsModel.selectedEdges=new Array}function removeSelectedEdges(){var e=MetamapsModel.selectedEdges.length;for(var t=e-1;t>=0;t-=1){if(mapid!=null){var n=MetamapsModel.selectedEdges[t],r=n.getData("id");$.ajax({type:"POST",url:"/synapses/"+mapid+"/"+r+"/removefrommap"})}hideEdge(n)}MetamapsModel.selectedEdges=new Array}function deleteSelectedEdges(){var e=MetamapsModel.selectedEdges.length;for(var t=e-1;t>=0;t-=1){var n=MetamapsModel.selectedEdges[t],r=n.getData("id");$.ajax({type:"DELETE",url:"/synapses/"+r}),hideEdge(n)}MetamapsModel.selectedEdges=new Array}function selectNode(e){if(MetamapsModel.selectedNodes.indexOf(e)!=-1)return;e.selected=!0,e.setData("dim",30,"current"),e.setData("whiteCircle",!0),e.eachAdjacency(function(e){selectEdge(e)}),MetamapsModel.selectedNodes.push(e)}function deselectNode(e){delete e.selected,e.setData("whiteCircle",!1),e.eachAdjacency(function(e){deselectEdge(e)}),e.setData("dim",25,"current"),MetamapsModel.selectedNodes.splice(MetamapsModel.selectedNodes.indexOf(e),1)}function selectEdge(e){if(MetamapsModel.selectedEdges.indexOf(e)!=-1)return;e.setData("showDesc",!0,"current"),MetamapsModel.embed?MetamapsModel.embed&&e.setDataset("end",{lineWidth:4,color:"#999",alpha:1}):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){e.setData("showDesc",!1,"current"),e.setDataset("end",{lineWidth:2,color:"#222222",alpha:.4}),MetamapsModel.edgeHoveringOver==e&&(e.setData("showDesc",!0,"current"),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}deselectNode(t),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)}function hideSelectedNodes(){var e=MetamapsModel.selectedNodes.length;for(var t=e-1;t>=0;t-=1){var n=MetamapsModel.selectedNodes[t];hideNode(n.id)}}function removeNode(e){var t=Mconsole.graph.getNode(e);deselectNode(t),mapperm&&$.ajax({type:"POST",url:"/topics/"+mapid+"/"+e+"/removefrommap"})}function removeSelectedNodes(){if(mapperm){var e=MetamapsModel.selectedNodes.length;for(var t=e-1;t>=0;t-=1){var n=MetamapsModel.selectedNodes[t];removeNode(n.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(){var e=MetamapsModel.selectedNodes.length;for(var t=e-1;t>=0;t-=1){var n=MetamapsModel.selectedNodes[t];deleteNode(n.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(){$(".wandSaveLayout").html("Saving...");var e="";if(gType=="arranged"||gType=="chaotic")Mconsole.graph.eachNode(function(t){e=e+t.getData("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.getData("mappingid")+"/"+t.pos.x+"/"+t.pos.y),$("#saveMapLayout").submit(),dragged=0,$(".wandSaveLayout").html("Saved!"),setTimeout(function(){$(".wandSaveLayout").html("Save Layout")},1500)}function saveToMap(){var e="",t="",n=new Array;Mconsole.graph.eachNode(function(t){if(categoryVisible[t.getData("metacode")]==0)return;var r,i;if(t.pos.x&&t.pos.y)r=t.pos.x,i=t.pos.y;else var r=Math.cos(t.pos.theta)*t.pos.rho,i=Math.sin(t.pos.theta)*t.pos.rho;e+=t.id+"/"+r+"/"+i+",",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),$("#fork_map").fadeIn("fast")}function createNewMap(){$("#new_map").fadeIn("fast")}function addMetacode(){metacodeIMGinit||($("#metacodeImg").CloudCarousel({titleBox:$("#metacodeImgTitle"),yRadius:40,xPos:150,yPos:40,speed:.3,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 openNodeShowcard(e){populateShowCard(e),$("#showcard").css("top","250px"),$("#showcard").css("left","100px"),$(".showcard.topic_"+e.id).fadeIn("fast"),MetamapsModel.showcardInUse=e.id}(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").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(""),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)[^>]*$|#([\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(;a0)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(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-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
a",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>",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="
t
",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="
",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;i1,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.length1)},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-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-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=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=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=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=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;r0?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?"":"")+e.replace(D,"$1"),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(;i0?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(;ec){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="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),J=X(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),K=X(function(e){return e.innerHTML="",!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="
",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",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="

",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+C+"*(?:\"\"|'')"),e.innerHTML="",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;l0})}(),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;t0)for(i=r;i=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-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=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_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
","
"]),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>");try{for(;r1&&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;a0?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>"),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]===""&&!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>/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("
").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-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){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='
'),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,"
"),t=r.html().replace(/
/ig,"
");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("
").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()s?n.height(r.height()):n.height(s))}),n.live("input paste",function(e){setTimeout(l,250)}),l()})}})}(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('
'),l='';a!==t&&u!==t&&(l+=''),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("')}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;_')}else if(s instanceof J){if(f&&l){var P=-r.x,H=-r.y;n.push("')}}else{var B=M(t.fillStyle),j=B.color,F=B.alpha*t.globalAlpha;n.push('')}}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','",""),this.element_.insertAdjacentHTML("BeforeEnd",w.join(""))},q.stroke=function(e){var n=[],r=!1,i=10,s=10;n.push("f.x)f.x=c.x;if(a.y==null||c.yf.y)f.y=c.y}}n.push(' ">'),e?z(this,n,a,f):U(this,n),n.push(""),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(''),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('','',''),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='';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){onCanvasChecked=$("#onCanvas").is(":checked"),inCommonsChecked=$("#inCommons").is(":checked"),clearFoundData(),onCanvasChecked&&inCommonsChecked?$("#topic_by_name_input").autocomplete("option","disabled",!0):onCanvasChecked?(setTimeout(function(){showAll()},0),$("#topic_by_name_input").autocomplete("option","disabled",!0)):inCommonsChecked?$("#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){onCanvasChecked=$("#onCanvas").is(":checked"),inCommonsChecked=$("#inCommons").is(":checked");var n=$("#topic_by_name_input").val();onCanvasChecked&&setTimeout(function(){onCanvasSearch(n,null,null)},0),inCommonsChecked&&($("#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 lastDist=0,MetamapsModel=new Object;MetamapsModel.embed=!1,MetamapsModel.selectedEdges=new Array,MetamapsModel.selectedNodes=new Array,MetamapsModel.didPan=!1,MetamapsModel.showcardInUse=null,MetamapsModel.widthOfLabel=null,MetamapsModel.edgecardInUse=null,MetamapsModel.edgeHoveringOver=!1,MetamapsModel.boxStartCoordinates=!1,MetamapsModel.boxEndCoordinates=!1,MetamapsModel.synapseStartCoord=!1,MetamapsModel.synapseEndCoord=!1,MetamapsModel.lastSynapseClick=0,MetamapsModel.lastNodeClick=0,MetamapsModel.lastCanvasClick=0,MetamapsModel.DOUBLE_CLICK_TOLERANCE=300,MetamapsModel.edgePermTimer1=null,MetamapsModel.edgePermTimer2=null,MetamapsModel.edgePermSliding=!1,MetamapsModel.topicPermTimer1=null,MetamapsModel.topicPermTimer2=null,MetamapsModel.topicPermSliding=!1;var renderMidArrow=function(e,t,n,r,i,s,o){var u=i.getCtx();if(r){var a=e;e=t,t=a}var f=new $jit.Complex(t.x-e.x,t.y-e.y);f.$scale(n/f.norm());var l=(t.x-e.x)*s+e.x,c=(t.y-e.y)*s+e.y,h=new $jit.Complex(l,c),p=new $jit.Complex(f.x/.7+h.x,f.y/.7+h.y),d=new $jit.Complex(p.x-f.x,p.y-f.y),v=new $jit.Complex(-f.y/2,f.x/2),m=d.add(v),g=d.$add(v.$scale(-1));o&&(u.strokeStyle="#222222",u.lineWidth=2,u.globalAlpha=.4),u.beginPath(),u.moveTo(e.x,e.y),u.lineTo(t.x,t.y),u.stroke(),u.beginPath(),u.moveTo(m.x,m.y),u.lineTo(p.x,p.y),u.lineTo(g.x,g.y),u.stroke()},nodeSettings={customNode:{render:function(e,t){var n=e.pos.getc(!0),r=e.getData("dim"),i=e.getData("metacode"),s=e.getData("greenCircle"),o=e.getData("whiteCircle"),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),MetamapsModel.embed||(u.strokeStyle="white"),MetamapsModel.embed&&(u.strokeStyle="#999"),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)}}},renderEdgeArrows=function(e,t){var n=Mconsole.canvas,r=t.getData("category"),i=t.getData("direction"),s=t.nodeFrom.pos.getc(!0),o=t.nodeTo.pos.getc(!0);if(r=="none")e.line.render({x:s.x,y:s.y},{x:o.x,y:o.y},n);else if(r=="both")renderMidArrow({x:s.x,y:s.y},{x:o.x,y:o.y},13,!0,n,.7),renderMidArrow({x:s.x,y:s.y},{x:o.x,y:o.y},13,!1,n,.7);else if(r=="from-to"){var i=t.data.$direction,u=i&&i.length>1&&i[0]!=t.nodeFrom.id;renderMidArrow({x:s.x,y:s.y},{x:o.x,y:o.y},13,u,n,.7),renderMidArrow({x:s.x,y:s.y},{x:o.x,y:o.y},13,u,n,.3)}},edgeSettings={customEdge:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("category");renderEdgeArrows(this.edgeHelper,e);var s=e.getData("desc"),o=e.getData("showDesc");if(s!=""&&o){s=decodeEntities(s);var u=t.getCtx(),a=t.getSize(),f=parseInt((n.x+r.x-s.length*5)/2),l=parseInt((n.y+r.y)/2);u.font="bold 14px arial",u.fillStyle="#FFF";var c=5,h=14+c,p=h/2,d=u.measureText(s).width+2*c-2*p,v=f-c+p,m=l-h+c;u.fillRect(v,m,d,h),u.beginPath(),u.arc(v,m+p,p,0,2*Math.PI,!1),u.arc(v+d,m+p,p,0,2*Math.PI,!1),u.fill(),u.fillStyle="#000",u.fillText(s,f,l)}},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)}}},edgeSettingsEmbed={customEdgeEmbed:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("category");renderEdgeArrows(this.edgeHelper,e);var s=e.getData("desc"),o=e.getData("showDesc");if(s!=""&&o){s=decodeEntities(s);var u=t.getCtx(),a=t.getSize(),f=parseInt((n.x+r.x-s.length*5)/2),l=parseInt((n.y+r.y)/2);u.font="bold 14px arial",u.fillStyle="#999";var c=5,h=14+c,p=h/2,d=u.measureText(s).width+2*c-2*p,v=f-c+p,m=l-h+c;u.fillRect(v,m,d,h),u.beginPath(),u.arc(v,m+p,p,0,2*Math.PI,!1),u.arc(v+d,m+p,p,0,2*Math.PI,!1),u.fill(),u.fillStyle="#000",u.fillText(s,f,l)}},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>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-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=(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(ti.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;no?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=t&&i<=n&&o(e)&&r(e,i),ii&&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-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 et?!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=.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;rf?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=u0?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=t._depth)});for(var i=0;i0&&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;fi?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=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._depth1&&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._depth0||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.xo+r||t.y>u||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;g0&&(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-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>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.xo+r||t.y>u+i||t.yo+r||t.y>u||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>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.xo+r||t.y>u+i||t.yo+r||t.y>u||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;m0&&(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;hs?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;uf[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;ld/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||oi&&o=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>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>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=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>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;pi?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;su?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;ro?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;s0){this.processChildrenLayout(e,r,t,n);for(var s=0,o=r.length;sa&&(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>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=r){n.onComplete();return}}n.onStep(Math.round(i/(r-1)*100)),setTimeout(o,1)})();else for(;i1&&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>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;i1&&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=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>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-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=(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(ti.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)},onMouseDown:function(e,t,n){if(!this.config.panning)return;if(this.config.panning=="avoid nodes"&&n.getNode()||n.getEdge())return;this.pressed=!0,!MetamapsModel.boxStartCoordinates&&e.shiftKey&&(MetamapsModel.boxStartCoordinates=n.getPos()),MetamapsModel.didPan=!1,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(!MetamapsModel.boxStartCoordinates&&e.shiftKey){Mconsole.busy=!0,MetamapsModel.boxStartCoordinates=n.getPos();return}if(MetamapsModel.boxStartCoordinates&&e.shiftKey){Mconsole.busy=!0,drawSelectBox(n,e);return}if(e.target.id!="infovis-canvas"){this.pressed=!1;return}MetamapsModel.didPan=!0;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;no?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=t&&i<=n&&o(e)&&r(e,i),ii&&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-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 et?!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=.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){function s(e,t){var n="",r=e;while(r.length>t){var i=r.substring(0,t),s=i.lastIndexOf(" "),o=i.lastIndexOf("\n");o!=-1&&(s=o),s==-1&&(s=t),n+=i.substring(0,s)+"\n",r=r.substring(s+1)}return n+r}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.textBaseline=t.getLabelData("textBaseline");var o=s(t.name,30).split("\n");r.fillStyle="rgba(255, 255, 255, 0.7)";var u=25*o.length,a,f=[];for(a=0;at){var i=r.substring(0,t),s=i.lastIndexOf(" "),o=i.lastIndexOf("\n");o!=-1&&(s=o),s==-1&&(s=t),n+=i.substring(0,s)+"\n",r=r.substring(s+1)}return n+r}var r=e.getCtx(),i=t.pos.getc(!0),o=s(t.name,30).split("\n"),u;for(u=0;u=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;rf?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=r){n.onComplete();return}}n.onStep(Math.round(i/(r-1)*100)),setTimeout(o,1)})();else for(;if[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;l1&&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;i1&&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").find(":last")[0];if(!i.getContext&&e.browser.msie)this.element=i=f.append("").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('
').children()[0],this.showFrontText=function(){if(s[this.frontIndex]===undefined)return;e("#topic_metacode").val(e(s[this.frontIndex].image).attr("title")),e("img.cloudcarousel").css({background:"none",width:"",height:""}),e(s[this.frontIndex].image).css({width:"45px",height:"45px"}),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>0,r=N.width=h.orgWidth*c,a=N.height=h.orgHeight*c,N.style.left=f+E,N.style.top=l+E,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=0;u--){s=t[u];if(s&&typeof s=="object"&&e in s){i=s[e],o=!0;break}}return o?(!r&&typeof i=="function"&&(i=this.lv(i,t,n)),i):r?!1:""},ho:function(e,t,n,r,i){var s=this.c,o=this.options;o.delimiters=i;var r=e.call(t,r);return r=r==null?String(r):r.toString(),this.b(s.compile(r,o).render(t,n)),!1},b:t?function(e){this.buf.push(e)}:function(e){this.buf+=e},fl:t?function(){var e=this.buf.join("");return this.buf=[],e}:function(){var e=this.buf;return this.buf="",e},ls:function(e,t,n,r,i,s,o){var u=t[t.length-1],a=null;if(!r&&this.c&&e.length>0)return this.ho(e,u,n,this.text.substring(i,s),o);a=e.call(u);if(typeof a=="function"){if(r)return!0;if(this.c)return this.ho(a,u, +n,this.text.substring(i,s),o)}return a},lv:function(e,t,n){var r=t[t.length-1],i=e.call(r);if(typeof i=="function"){i=a(i.call(r));if(this.c&&~i.indexOf("{{"))return this.c.compile(i,this.options).render(r,n)}return a(i)}};var n=/&/g,r=//g,s=/\'/g,o=/\"/g,u=/[&<>\"\']/,l=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(e){function u(e){e.n.substr(e.n.length-1)==="}"&&(e.n=e.n.substring(0,e.n.length-1))}function a(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function f(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var r=1,i=e.length;r0){o=e.shift();if(o.tag=="#"||o.tag=="^"||c(o,r))n.push(o),o.nodes=l(e,o.tag,n,r),i.push(o);else{if(o.tag=="/"){if(n.length===0)throw new Error("Closing tag without opener: /"+o.n);s=n.pop();if(o.n!=s.n&&!h(o.n,s.n,r))throw new Error("Nesting error: "+s.n+" vs. "+o.n);return s.end=o.i,i}i.push(o)}}if(n.length>0)throw new Error("missing closing tag: "+n.pop().n);return i}function c(e,t){for(var n=0,r=t.length;n"?t+=y(e[n]):i=="{"||i=="&"?t+=b(e[n].n,d(e[n].n)):i=="\n"?t+=E('"\\n"'+(e.length-1==n?"":" + i")):i=="_v"?t+=w(e[n].n,d(e[n].n)):i===undefined&&(t+=E('"'+p(e[n])+'"'))}return t}function m(e,t,n,r,i,s){return"if(_.s(_."+n+'("'+p(t)+'",c,p,1),'+"c,p,0,"+r+","+i+',"'+s+'")){'+"_.rs(c,p,"+"function(c,p,_){"+v(e)+"});c.pop();}"}function g(e,t,n){return"if(!_.s(_."+n+'("'+p(t)+'",c,p,1),c,p,1,0,0,"")){'+v(e)+"};"}function y(e){return'_.b(_.rp("'+p(e.n)+'",c,p,"'+(e.indent||"")+'"));'}function b(e,t){return"_.b(_.t(_."+t+'("'+p(e)+'",c,p,0)));'}function w(e,t){return"_.b(_.v(_."+t+'("'+p(e)+'",c,p,0)));'}function E(e){return"_.b("+e+");"}var t=/\S/,n=/\"/g,r=/\n/g,i=/\r/g,s=/\\/g,o={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};e.scan=function(n,r){function S(){v.length>0&&(m.push(new String(v)),v="")}function x(){var e=!0;for(var n=b;n"&&(r.indent=m[n].toString()),m.splice(n,1));else t||m.push({tag:"\n"});g=!1,b=m.length}function N(e,t){var n="="+E,r=e.indexOf(n,t),i=a(e.substring(e.indexOf("=",t)+1,r)).split(" ");return w=i[0],E=i[1],r+n.length-1}var i=n.length,s=0,l=1,c=2,h=s,p=null,d=null,v="",m=[],g=!1,y=0,b=0,w="{{",E="}}";r&&(r=r.split(" "),w=r[0],E=r[1]);for(y=0;y").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;i0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e=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('
').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.leftu[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.topu[3]?l-this.offset.click.topu[2]?c-this.offset.click.left=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
").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("
").addClass("mCustomScrollbar _mCS_"+e(document).data("mCustomScrollbar-index"));var s=n.children(".mCustomScrollBox");if(t.horizontalScroll){s.addClass("mCSB_horizontal").wrapInner("
");var o=s.children(".mCSB_h_wrapper");o.wrapInner("
").children(".mCSB_container").css({width:o.children().outerWidth(),position:"relative"}).unwrap()}else s.wrapInner("
");var u=s.children(".mCSB_container");if(!e(document).data("mCS-is-touch-device")){u.after("
");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("").append(""):a.prepend("").append("")),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.scrollTopn+5)&&e.preventDefault(),(this.scrollLeftr+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("
").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("
").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(ti.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(ti.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);var io="undefined"==typeof module?{}:module.exports;(function(){(function(e,t){var n=e;n.version="0.9.11",n.protocol=1,n.transports=[],n.j=[],n.sockets={},n.connect=function(e,r){var i=n.util.parseUri(e),s,o;t&&t.location&&(i.protocol=i.protocol||t.location.protocol.slice(0,-1),i.host=i.host||(t.document?t.document.domain:t.location.hostname),i.port=i.port||t.location.port),s=n.util.uniqueUri(i);var u={host:i.host,secure:"https"==i.protocol,port:i.port||("https"==i.protocol?443:80),query:i.query||""};n.util.merge(u,r);if(u["force new connection"]||!n.sockets[s])o=new n.Socket(u);return!u["force new connection"]&&o&&(n.sockets[s]=o),o=o||n.sockets[s],o.of(i.path.length>1?i.path:"")}})("object"==typeof module?module.exports:this.io={},this),function(e,t){var n=e.util={},r=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];n.parseUri=function(e){var t=r.exec(e||""),n={},s=14;while(s--)n[i[s]]=t[s]||"";return n},n.uniqueUri=function(e){var n=e.protocol,r=e.host,i=e.port;return"document"in t?(r=r||document.domain,i=i||(n=="https"&&document.location.protocol!=="https:"?443:document.location.port)):(r=r||"localhost",!i&&n=="https"&&(i=443)),(n||"http")+"://"+r+":"+(i||80)},n.query=function(e,t){var r=n.chunkQuery(e||""),i=[];n.merge(r,n.chunkQuery(t||""));for(var s in r)r.hasOwnProperty(s)&&i.push(s+"="+r[s]);return i.length?"?"+i.join("&"):""},n.chunkQuery=function(e){var t={},n=e.split("&"),r=0,i=n.length,s;for(;rt.length? +e:t,s=e.length>t.length?t:e;for(var o=0,u=s.length;o0&&e.splice(0,1)[0]!=n.transport.name);e.length?u(e):n.publish("connect_failed")}}},n.options["connect timeout"]))})}n.sessionid=r,n.closeTimeout=s*1e3,n.heartbeatTimeout=i*1e3,n.transports||(n.transports=n.origTransports=o?t.util.intersect(o.split(","),n.options.transports):n.options.transports),n.setHeartbeatTimeout(),u(n.transports),n.once("connect",function(){clearTimeout(n.connectTimeoutTimer),e&&typeof e=="function"&&e()})}),this},r.prototype.setHeartbeatTimeout=function(){clearTimeout(this.heartbeatTimeoutTimer);if(this.transport&&!this.transport.heartbeats())return;var e=this;this.heartbeatTimeoutTimer=setTimeout(function(){e.transport.onClose()},this.heartbeatTimeout)},r.prototype.packet=function(e){return this.connected&&!this.doBuffer?this.transport.packet(e):this.buffer.push(e),this},r.prototype.setBuffer=function(e){this.doBuffer=e,!e&&this.connected&&this.buffer.length&&(this.options.manualFlush||this.flushBuffer())},r.prototype.flushBuffer=function(){this.transport.payload(this.buffer),this.buffer=[]},r.prototype.disconnect=function(){if(this.connected||this.connecting)this.open&&this.of("").packet({type:"disconnect"}),this.onDisconnect("booted");return this},r.prototype.disconnectSync=function(){var e=t.util.request(),n=["http"+(this.options.secure?"s":"")+":/",this.options.host+":"+this.options.port,this.options.resource,t.protocol,"",this.sessionid].join("/")+"/?disconnect=1";e.open("GET",n,!1),e.send(null),this.onDisconnect("booted")},r.prototype.isXDomain=function(){var e=n.location.port||("https:"==n.location.protocol?443:80);return this.options.host!==n.location.hostname||this.options.port!=e},r.prototype.onConnect=function(){this.connected||(this.connected=!0,this.connecting=!1,this.doBuffer||this.setBuffer(!1),this.emit("connect"))},r.prototype.onOpen=function(){this.open=!0},r.prototype.onClose=function(){this.open=!1,clearTimeout(this.heartbeatTimeoutTimer)},r.prototype.onPacket=function(e){this.of(e.endpoint).onPacket(e)},r.prototype.onError=function(e){e&&e.advice&&e.advice==="reconnect"&&(this.connected||this.connecting)&&(this.disconnect(),this.options.reconnect&&this.reconnect()),this.publish("error",e&&e.reason?e.reason:e)},r.prototype.onDisconnect=function(e){var t=this.connected,n=this.connecting;this.connected=!1,this.connecting=!1,this.open=!1;if(t||n)this.transport.close(),this.transport.clearTimeouts(),t&&(this.publish("disconnect",e),"booted"!=e&&this.options.reconnect&&!this.reconnecting&&this.reconnect())},r.prototype.reconnect=function(){function i(){if(e.connected){for(var t in e.namespaces)e.namespaces.hasOwnProperty(t)&&""!==t&&e.namespaces[t].packet({type:"connect"});e.publish("reconnect",e.transport.name,e.reconnectionAttempts)}clearTimeout(e.reconnectionTimer),e.removeListener("connect_failed",s),e.removeListener("connect",s),e.reconnecting=!1,delete e.reconnectionAttempts,delete e.reconnectionDelay,delete e.reconnectionTimer,delete e.redoTransports,e.options["try multiple transports"]=n}function s(){if(!e.reconnecting)return;if(e.connected)return i();if(e.connecting&&e.reconnecting)return e.reconnectionTimer=setTimeout(s,1e3);e.reconnectionAttempts++>=t?e.redoTransports?(e.publish("reconnect_failed"),i()):(e.on("connect_failed",s),e.options["try multiple transports"]=!0,e.transports=e.origTransports,e.transport=e.getTransport(),e.redoTransports=!0,e.connect()):(e.reconnectionDelay=10:!1},n.xdomainCheck=function(){return!0},typeof window!="undefined"&&(WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0),t.transports.push("flashsocket")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);if("undefined"!=typeof window)var swfobject=function(){function C(){if(b)return;try{var e=a.getElementsByTagName("body")[0].appendChild(U("span"));e.parentNode.removeChild(e)}catch(t){return}b=!0;var n=c.length;for(var r=0;r0)for(var n=0;n0){var o=R(r);if(o)if(W(h[n].swfVersion)&&!(T.wk&&T.wk<312))V(r,!0),i&&(s.success=!0,s.ref=_(r),i(s));else if(h[n].expressInstall&&D()){var u={};u.data=h[n].expressInstall,u.width=o.getAttribute("width")||"0",u.height=o.getAttribute("height")||"0",o.getAttribute("class")&&(u.styleclass=o.getAttribute("class")),o.getAttribute("align")&&(u.align=o.getAttribute("align"));var a={},f=o.getElementsByTagName("param"),l=f.length;for(var c=0;c');u.outerHTML='"+l+"",p[p.length]=n.id,o=R(n.id)}else{var h=U(t);h.setAttribute("type",i);for(var d in n)n[d]!=Object.prototype[d]&&(d.toLowerCase()=="styleclass"?h.setAttribute("class",n[d]):d.toLowerCase()!="classid"&&h.setAttribute(d,n[d]));for(var v in r)r[v]!=Object.prototype[v]&&v.toLowerCase()!="movie"&&F(h,v,r[v]);u.parentNode.replaceChild(h,u),o=h}}return o}function F(e,t,n){var r=U("param");r.setAttribute("name",t),r.setAttribute("value",n),e.appendChild(r)}function I(e){var t=R(e);t&&t.nodeName=="OBJECT"&&(T.ie&&T.win?(t.style.display="none",function(){t.readyState==4?q(e):setTimeout(arguments.callee,10)}()):t.parentNode.removeChild(t))}function q(e){var t=R(e);if(t){for(var n in t)typeof t[n]=="function"&&(t[n]=null);t.parentNode.removeChild(t)}}function R(e){var t=null;try{t=a.getElementById(e)}catch(n){}return t}function U(e){return a.createElement(e)}function z(e,t,n){e.attachEvent(t,n),d[d.length]=[e,t,n]}function W(e){var t=T.pv,n=e.split(".");return n[0]=parseInt(n[0],10),n[1]=parseInt(n[1],10)||0,n[2]=parseInt(n[2],10)||0,t[0]>n[0]||t[0]==n[0]&&t[1]>n[1]||t[0]==n[0]&&t[1]==n[1]&&t[2]>=n[2]?!0:!1}function X(n,r,i,s){if(T.ie&&T.mac)return;var o=a.getElementsByTagName("head")[0];if(!o)return;var u=i&&typeof i=="string"?i:"screen";s&&(E=null,S=null);if(!E||S!=u){var f=U("style");f.setAttribute("type","text/css"),f.setAttribute("media",u),E=o.appendChild(f),T.ie&&T.win&&typeof a.styleSheets!=e&&a.styleSheets.length>0&&(E=a.styleSheets[a.styleSheets.length-1]),S=u}T.ie&&T.win?E&&typeof E.addRule==t&&E.addRule(n,r):E&&typeof a.createTextNode!=e&&E.appendChild(a.createTextNode(n+" {"+r+"}"))}function V(e,t){if(!x)return;var n=t?"visible":"hidden";b&&R(e)?R(e).style.visibility=n:X("#"+e,"visibility:"+n)}function $(t){var n=/[\\\"<>\.;]/,r=n.exec(t)!=null;return r&&typeof encodeURIComponent!=e?encodeURIComponent(t):t}var e="undefined",t="object",n="Shockwave Flash",r="ShockwaveFlash.ShockwaveFlash",i="application/x-shockwave-flash",s="SWFObjectExprInst",o="onreadystatechange",u=window,a=document,f=navigator,l=!1,c=[A],h=[],p=[],d=[],v,m,g,y,b=!1,w=!1,E,S,x=!0,T=function(){var s=typeof a.getElementById!=e&&typeof a.getElementsByTagName!=e&&typeof a.createElement!=e,o=f.userAgent.toLowerCase(),c=f.platform.toLowerCase(),h=c?/win/.test(c):/win/.test(o),p=c?/mac/.test(c):/mac/.test(o),d=/webkit/.test(o)?parseFloat(o.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,v=!1,m=[0,0,0],g=null;if(typeof f.plugins!=e&&typeof f.plugins[n]==t)g=f.plugins[n].description,g&&(typeof f.mimeTypes==e||!f.mimeTypes[i]||!!f.mimeTypes[i].enabledPlugin)&&(l=!0,v=!1,g=g.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),m[0]=parseInt(g.replace(/^(.*)\..*$/,"$1"),10),m[1]=parseInt(g.replace(/^.*\.(.*)\s.*$/,"$1"),10),m[2]=/[a-zA-Z]/.test(g)?parseInt(g.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof u[["Active"].concat("Object").join("X")]!=e)try{var y=new(window[["Active"].concat("Object").join("X")])(r);y&&(g=y.GetVariable("$version"),g&&(v=!0,g=g.split(" ")[1].split(","),m=[parseInt(g[0],10),parseInt(g[1],10),parseInt(g[2],10)]))}catch(b){}return{w3:s,pv:m,wk:d,ie:v,win:h,mac:p}}(),N=function(){if(!T.w3)return;(typeof a.readyState!=e&&a.readyState=="complete"||typeof a.readyState==e&&(a.getElementsByTagName("body")[0]||a.body))&&C(),b||(typeof a.addEventListener!=e&&a.addEventListener("DOMContentLoaded",C,!1),T.ie&&T.win&&(a.attachEvent(o,function(){a.readyState=="complete"&&(a.detachEvent(o,arguments.callee),C())}),u==top&&function(){if(b)return;try{a.documentElement.doScroll("left")}catch(e){setTimeout(arguments.callee,0);return}C()}()),T.wk&&function(){if(b)return;if(!/loaded|complete/.test(a.readyState)){setTimeout(arguments.callee,0);return}C()}(),L(C))}(),J=function(){T.ie&&T.win&&window.attachEvent("onunload",function(){var e=d.length;for(var t=0;t= 10.0.0 is required.");return}location.protocol=="file:"&&e.error("WARNING: web-socket-js doesn't work in file:///... URL unless you set Flash Security Settings properly. Open the page via Web server i.e. http://..."),WebSocket=function(e,t,n,r,i){var s=this;s.__id=WebSocket.__nextId++,WebSocket.__instances[s.__id]=s,s.readyState=WebSocket.CONNECTING,s.bufferedAmount=0,s.__events={},t?typeof t=="string"&&(t=[t]):t=[],setTimeout(function(){WebSocket.__addTask(function(){WebSocket.__flash.create(s.__id,e,t,n||null,r||0,i||null)})},0)},WebSocket.prototype.send=function(e){if(this.readyState==WebSocket.CONNECTING)throw"INVALID_STATE_ERR: Web Socket connection has not been established";var t=WebSocket.__flash.send(this.__id,encodeURIComponent(e));return t<0?!0:(this.bufferedAmount+=t,!1)},WebSocket.prototype.close=function(){if(this.readyState==WebSocket.CLOSED||this.readyState==WebSocket.CLOSING)return;this.readyState=WebSocket.CLOSING,WebSocket.__flash.close(this.__id)},WebSocket.prototype.addEventListener=function(e,t,n){e in this.__events||(this.__events[e]=[]),this.__events[e].push(t)},WebSocket.prototype.removeEventListener=function(e,t,n){if(!(e in this.__events))return;var r=this.__events[e];for(var i=r.length-1;i>=0;--i)if(r[i]===t){r.splice(i,1);break}},WebSocket.prototype.dispatchEvent=function(e){var t=this.__events[e.type]||[];for(var n=0;n"),this.doc.close(),this.doc.parentWindow.s=this;var e=this.doc.createElement("div");e.className="socketio",this.doc.body.appendChild(e),this.iframe=this.doc.createElement("iframe"),e.appendChild(this.iframe);var n=this,r=t.util.query(this.socket.options.query,"t="+ +(new Date));this.iframe.src=this.prepareUrl()+r,t.util.on(window,"unload",function(){n.destroy()})},n.prototype._=function(e,t){this.onData(e);try{var n=t.getElementsByTagName("script")[0];n.parentNode.removeChild(n)}catch(r){}},n.prototype.destroy=function(){if(this.iframe){try{this.iframe.src="about:blank"}catch(e){}this.doc=null,this.iframe.parentNode.removeChild(this.iframe),this.iframe=null,CollectGarbage()}},n.prototype.close=function(){return this.destroy(),t.Transport.XHR.prototype.close.call(this)},n.check=function(e){if(typeof window!="undefined"&&["Active"].concat("Object").join("X")in window)try{var n=new(window[["Active"].concat("Object").join("X")])("htmlfile");return n&&t.Transport.XHR.check(e)}catch(r){}return!1},n.xdomainCheck=function(){return!1},t.transports.push("htmlfile")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(e,t,n){function r(){t.Transport.XHR.apply(this,arguments)}function i(){}e["xhr-polling"]=r,t.util.inherit(r,t.Transport.XHR),t.util.merge(r,t.Transport.XHR),r.prototype.name="xhr-polling",r.prototype.heartbeats=function(){return!1},r.prototype.open=function(){var e=this;return t.Transport.XHR.prototype.open.call(e),!1},r.prototype.get=function(){function t(){this.readyState==4&&(this.onreadystatechange=i,this.status==200?(e.onData(this.responseText),e.get()):e.onClose())}function r(){this.onload=i,this.onerror=i,e.retryCounter=1,e.onData(this.responseText),e.get()}function s(){e.retryCounter++,!e.retryCounter||e.retryCounter>3?e.onClose():e.get()}if(!this.isOpen)return;var e=this;this.xhr=this.request(),n.XDomainRequest&&this.xhr instanceof XDomainRequest?(this.xhr.onload=r,this.xhr.onerror=s):this.xhr.onreadystatechange=t,this.xhr.send(null)},r.prototype.onClose=function(){t.Transport.XHR.prototype.onClose.call(this);if(this.xhr){this.xhr.onreadystatechange=this.xhr.onload=this.xhr.onerror=i;try{this.xhr.abort()}catch(e){}this.xhr=null}},r.prototype.ready=function(e,n){var r=this;t.util.defer(function(){n.call(r)})},t.transports.push("xhr-polling")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(e,t,n){function i(e){t.Transport["xhr-polling"].apply(this,arguments),this.index=t.j.length;var n=this;t.j.push(function(e){n._(e)})}var r=n.document&&"MozAppearance"in n.document.documentElement.style;e["jsonp-polling"]=i,t.util.inherit(i,t.Transport["xhr-polling"]),i.prototype.name="jsonp-polling",i.prototype.post=function(e){function a(){f(),n.socket.setBuffer(!1)}function f(){n.iframe&&n.form.removeChild(n.iframe);try{u=document.createElement('