var eaManageMyDashboards=eaManageMyDashboards||{renameDashboardReport:function(n,t){var i=t[0],r=t[1],u=".js-refresh-dashboard-report-name-"+i,f=$(u);f.html(r)},deleteDashboardReport:function(n,t){var f=t[0],e=t[1],a=t[2],v=".js-refresh-report-count",y=$(v),o,s,u,r,l;y.html(e),o=".js-refresh-instance-count",s=$(o),s.html(a);var i=$(".js-detailViewContainer .js-refresh-single-dashboard-report-"+f),p=i.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-refresh-single-dashboard-report-"+f),h=i.prev(),c=i.next();for(i.slideUp().detach(),p.detach(),e=="0 reports"?$(".js-no-results-message").show():(h.length>0&&eaAjax.refreshTargetContent(h.find(".js-refresh-single-dashboard-report-management")),c.length>0&&eaAjax.refreshTargetContent(c.find(".js-refresh-single-dashboard-report-management"))),u=[".js-refresh-filter-list-view"],r=0;r<u.length;r++)l=$(u[r]),eaAjax.refreshTargetContent(l)},renameDashboard:function(n,t){for(var e=t[0],o=t[1],s=t[2],h=".js-refresh-dashboard-name-"+e,r=[".js-breadcrumb",".gridView",".singleDashboard",".js-detailViewContainer",".js-summaryViewContainer",".emi-my-dashboards-menu"],u,f,i=0;i<r.length;i++)u=r[i]+" "+h,f=$(u),f.each(function(){var n=$(this);n.html(o)});eaManageMyDashboards.updateUrls(s)},editDescription:function(n,t){for(var e=t[0],o=t[1],s=".js-refresh-dashboard-description-"+e,r=[".gridview",".singleDashboard",".js-detailViewContainer",".js-summaryViewContainer"],u,f,i=0;i<r.length;i++)u=r[i]+" "+s,f=$(u),f.each(function(){var n=$(this);n.html(o)})},deleteDashboard:function(n,t){for(var l=t[0],v=t[1].split("|"),y=t[2].split("|"),d=t[3].split("|"),e,c,o,a,u=0;u<v.length;u++){var r=v[u],w=".js-refreshable-"+r+"-count",b=$(w);b.html(y[u]);var f=$(".js-refresh-single-dashboard-"+r+"-"+l),k=f.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-dashboard-id-"+l),s=f.parent(),i=s.next(".paginatedPage"),p=s.prev(".paginatedPage"),h=f.prev();for(h.length==0&&p.length>0&&(h=p.children().last()),e=f.next(),e.length==0&&i.lebgth>0&&(e=i.children().first()),c=!1;i.length>0;)o=i.children().first(),o.length>0?(c=o.next().length==0,o.detach(),s.append(o)):c=!0,s=i,i=i.next(".paginatedPage");c&&(i.detach(),$(".js-pagination-placeholder").data("items",parseInt($(".js-pagination-placeholder").data("items"))-1),eaPagination.wireUp()),f.slideUp().detach(),k.detach(),y[u]==="0"?$(".js-"+r+"-dashboards-no-results, .js-nav-"+r+"-dashboards-no-results").show():(h.length>0&&eaAjax.refreshTargetContent(h.find(".js-refresh-single-dashboard-management")),e.length>0&&eaAjax.refreshTargetContent(e.find(".js-refresh-single-dashboard-management"))),a=$(".js-refresh-navmenu-"+r+" .js-refresh-"+r+"-dashboard-"+l),a.length>0&&a.remove(),eaAjax.refreshTargetContent($(".js-refresh-mydashboards-filter-by-"+r))}},followDashboard:function(n,t){var i=t[0],e=t[1],o=".js-refreshable-Following-count",s=$(o),u,r,f;for(s.html(e),$(".js-follow-"+i+".Follow").hide(),$(".js-unfollow-"+i+".Unfollow").fadeIn(),u=[".js-refresh-Following-tab",".js-refresh-navmenu-Following",".js-refresh-single-dashboard-SharedWithYou-"+i,".js-refresh-single-dashboard-Public-"+i,".js-refresh-socials-row"],r=0;r<u.length;r++)f=$(u[r]),eaAjax.refreshTargetContent(f)},unfollowDashboard:function(n,t){var i=t[0],e=t[1],l=".js-refreshable-Following-count",a=$(l),h,f,u,c;a.html(e);var r=$(".js-refresh-single-dashboard-Following-"+i),v=r.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-dashboard-id-"+i),o=r.prev(),s=r.next();for(r.slideUp(1e3).detach(),v.detach(),e==="0"?$(".js-Following-dashboards-no-results, .js-nav-Following-dashboards-no-results").show():(o.length>0&&eaAjax.refreshTargetContent(o.find(".js-refresh-single-dashboard-management")),s.length>0&&eaAjax.refreshTargetContent(s.find(".js-refresh-single-dashboard-management"))),eaAjax.refreshTargetContent($(".js-refresh-Following-list-view-options")),h=$(".js-refresh-navmenu-Following .js-refresh-Following-dashboard-"+i),h.remove(),f=[".js-refresh-Following-tab",".js-refresh-single-dashboard-SharedWithYou-"+i,".js-refresh-single-dashboard-Public-"+i,".js-refresh-socials-row"],u=0;u<f.length;u++)c=$(f[u]),eaAjax.refreshTargetContent(c);$(".js-unfollow-"+i+".Unfollow").hide(),$(".js-follow-"+i+".Follow").show()},copyDashboard:function(n,t){var s=t[0],f=t[1],e=".js-refreshable-MyDashboards-count",o=$(e),r,i,u;for(o.html(f),r=[".js-refresh-navmenu-MyDashboards",".js-refresh-MyDashboards-tab"],i=0;i<r.length;i++)u=$(r[i]),eaAjax.refreshTargetContent(u)},shareDashboard:function(n,t){for(var h=t[0],c=t[1].split("|"),l=t[2].split("|"),u,f,e,o,s,i=0;i<c.length;i++){var r=c[i],a=".js-refreshable-"+r+"-count",v=$(a);v.html(l[i]),l[i]==="0"&&$(".js-"+r+"-dashboards-no-results, .js-nav-"+r+"-dashboards-no-results").show(),u=$(".js-refresh-"+r+"-tab"),u.length>0&&eaAjax.refreshTargetContent(u)}for(f=[".js-refresh-mydashboards-filter-by-MyDashboards",".js-refresh-mydashboards-filter-by-Public",".js-refresh-single-dashboard-MyDashboards-"+h,".js-refresh-socials-row"],i=0;i<f.length;i++)e=$(f[i]),e.length>0&&eaAjax.refreshTargetContent(e);for(o=[".js-refresh-share-my-dashboard-"+h],i=0;i<o.length;i++)s=$(o[i]),s.length>0&&eaAjax.refreshTargetContent(s,eaAjaxOptionsForModalRefresh)},swapInSubscribe:function(){$(".js-followunfollow-public").parent().fadeToggle()},updateUrls:function(n){var t=$(".js-refresh-dashboard-slug").data("slug"),i=document.location.href,r=i.replace(t,n),u;r!==i&&(window.history.replaceState("","",r),$(".js-refresh-dashboard-slug").data("slug",n)),u=$(".js-listview-link, .js-gridview-link, .tagWrapper .tag a, .js-breadcrumbWrapper a.js-breadcrumb-display"),u.each(function(){var i=$(this).attr("href").replace(t,n);$(this).attr("href",i)});var f=$(".js-has-paginated-redirect-urls[data-redirect-urls], .js-detailViewContainer[data-redirect-urls]").each(function(){var r=$(this).data("redirect-urls"),u={},i,f,e;if(r!=null){for(i=1;r[i]!=null;)f=r[i],e=f.replace(t,n),u[i]=e,i++;$(this).data("redirect-urls",u)}}),e=$(".js-has-paginated-redirect-urls[data-pagechange-urls], .js-detailViewContainer[data-pagechange-urls]").each(function(){var r=$(this).data("pagechange-urls"),u={},i,f,e;if(r!=null){for(i=1;r[i]!=null;)f=r[i],e=f.replace(t,n),u[i]=e,i++;$(this).data("redirect-urls",u)}}),o=$("form .js-submit[data-redirect-onsuccess]").each(function(){var i=$(this).data("redirect-onsuccess"),r;i!=null&&i!==""&&(r=i.replace(t,n),$(this).data("redirect-onsuccess",r))}),s=$(".emi-sortAndFilterOptions form #ListViewOptionsBaseUrl").each(function(){var i=$(this).val(),r;i!=null&&i!==""&&(r=i.replace(t,n),$(this).val(r))})},swapNodes:function(n,t){var i=n[0].parentNode,r=n[0].nextSibling===t[0]?n[0]:n[0].nextSibling;n.fadeOut().fadeIn(),t.fadeOut().fadeIn(),t[0].parentNode.insertBefore(n[0],t[0]),i.insertBefore(t[0],r)},moveNodeBefore:function(n){n.parent().prepend(n)},swapDashboards:function(n,t){n.length===1&&t.length===1&&(eaManageMyDashboards.swapNodes(n,t),eaAjax.refreshTargetContent(n.find(".js-refresh-single-dashboard-management")),eaAjax.refreshTargetContent(t.find(".js-refresh-single-dashboard-management")))},swapDashboardReports:function(n,t){n.length===1&&t.length===1&&(eaManageMyDashboards.swapNodes(n,t),eaAjax.refreshTargetContent(n.find(".js-refresh-single-dashboard-report-management")),eaAjax.refreshTargetContent(t.find(".js-refresh-single-dashboard-report-management")))},moveDashboardTop:function(n){var t=n.closest(".js-refresh-single-dashboard"),u=t.parent().parent().children().first(),i=u.children().first();i.parent().prepend(t),eaAjax.refreshTargetContent(t.find(".js-refresh-single-dashboard-management")),eaAjax.refreshTargetContent(i.find(".js-refresh-single-dashboard-management"));var f=t.data("model-key"),r=t.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-dashboard-id-"+f),e=r.parent().parent().children().first(),o=e.children().first();o.parent().prepend(r)},moveDashboardUp:function(n){var t=n.closest(".js-refresh-single-dashboard"),u=t.prev(),r;u.length==0&&(r=t.parent().prev(),u=r.children().last()),eaManageMyDashboards.swapDashboards(t,u);var e=t.data("model-key"),f=t.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-dashboard-id-"+e),i=f.prev();i.length==0&&(r=i.parent().prev(),i=r.children().last()),f.length===1&&i.length===1&&eaManageMyDashboards.swapNodes(f,i)},moveDashboardDown:function(n){var t=n.closest(".js-refresh-single-dashboard"),u=t.next(),r;u.length==0&&(r=t.parent().next(),u=r.children().first()),eaManageMyDashboards.swapDashboards(t,u);var e=t.data("model-key"),f=t.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-dashboard-id-"+e),i=f.next();i.length==0&&(r=i.parent().next(),i=r.children().first()),f.length===1&&i.length===1&&eaManageMyDashboards.swapNodes(f,i)},moveDashboardReportTop:function(n){var t=n.closest(".js-detailViewContainer .js-refresh-single-dashboard-report"),u=t.parent().parent().children().first(),i=u.children().first();i.parent().prepend(t),eaAjax.refreshTargetContent(t.find(".js-refresh-single-dashboard-report-management")),eaAjax.refreshTargetContent(i.find(".js-refresh-single-dashboard-report-management"));var f=t.data("model-key"),r=t.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-refresh-single-dashboard-report-"+f),e=r.parent().parent().children().first(),o=e.children().first();o.parent().prepend(r)},moveDashboardReportUp:function(n){var t=n.closest(".js-detailViewContainer .js-refresh-single-dashboard-report"),u=t.prev(),r;u.length==0&&(r=t.parent().prev(),u=r.children().last()),eaManageMyDashboards.swapDashboardReports(t,u);var e=t.data("model-key"),f=t.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-refresh-single-dashboard-report-"+e),i=f.prev();i.length==0&&(r=i.parent().prev(),i=r.children().last()),f.length===1&&i.length===1&&eaManageMyDashboards.swapNodes(f,i)},moveDashboardReportDown:function(n){var t=n.closest(".js-detailViewContainer .js-refresh-single-dashboard-report"),u=t.next(),r;u.length==0&&(r=t.parent().next(),u=r.children().first()),eaManageMyDashboards.swapDashboardReports(t,u);var e=t.data("model-key"),f=t.closest(".emi-wrapContent").find(".js-summaryViewContainer .js-refresh-single-dashboard-report-"+e),i=f.next();i.length==0&&(r=i.parent().next(),i=r.children().first()),f.length===1&&i.length===1&&eaManageMyDashboards.swapNodes(f,i)}};$().ready(function(){})