From 49783c21e853467e18d997bfde869ac4bbfbb2af Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 5 Dec 2017 16:42:15 -0500 Subject: [PATCH] Make client --- static/scripts/bundled/extended.bundled.js | 2 +- static/scripts/mvc/toolshed/repository-view.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/scripts/bundled/extended.bundled.js b/static/scripts/bundled/extended.bundled.js index c28c457f6748..1a1738767a32 100644 --- a/static/scripts/bundled/extended.bundled.js +++ b/static/scripts/bundled/extended.bundled.js @@ -46,4 +46,4 @@ s=n,l=e("
",{css:{position:"absolute",top:"-200px",left:i?"0px":"-1000px", // the check will work anyway, as when moving the node will be loaded first and checked again if(v === 'i' && !ins.is_loaded(p)) { } */ -f=!0,p=0,_=o.data.nodes.length;p<_;p++)if(g=o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node",m=u,"move_node"===g&&"a"===j&&o.data.origin&&o.data.origin===w&&d===w.get_parent(o.data.nodes[p])&&(v=w.get_node(d),m>e.inArray(o.data.nodes[p],v.children)&&(m-=1)),!(f=f&&(w&&w.settings&&w.settings.dnd&&!1===w.settings.dnd.check_while_dragging||w.check(g,o.data.origin&&o.data.origin!==w?o.data.origin.get_node(o.data.nodes[p]):o.data.nodes[p],d,m,{dnd:!0,ref:w.get_node(x.parent()),pos:j,is_multi:o.data.origin&&o.data.origin!==w,is_foreign:!o.data.origin})))){w&&w.last_error&&(n=w.last_error());break}if(f)return"i"===j&&x.parent().is(".jstree-closed")&&w.settings.dnd.open_timeout&&(i=setTimeout(function(e,t){return function(){e.open_node(t)}}(w,x),w.settings.dnd.open_timeout)),t={ins:w,par:d,pos:"i"!==j||"last"!==y||0!==u||w.is_loaded(b)?u:"last"},r.css({left:s+"px",top:l+"px"}).show(),o.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),n={},h=!0,!1}),!0===h))return}else{for(f=!0,p=0,_=o.data.nodes.length;p<_&&(f=f&&w.check(o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node",o.data.origin&&o.data.origin!==w?o.data.origin.get_node(o.data.nodes[p]):o.data.nodes[p],"#","last",{dnd:!0,ref:w.get_node("#"),pos:"i",is_multi:o.data.origin&&o.data.origin!==w,is_foreign:!o.data.origin}));p++);if(f)return t={ins:w,par:"#",pos:"last"},r.hide(),void o.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok")}t=!1,o.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),r.hide()}}).bind("dnd_scroll.vakata",function(e,n){n&&n.data&&n.data.jstree&&(r.hide(),t=!1,n.helper.find(".jstree-icon:eq(0)").removeClass("jstree-ok").addClass("jstree-er"))}).bind("dnd_stop.vakata",function(a,o){if(i&&clearTimeout(i),o&&o.data&&o.data.jstree){r.hide();var s,l,c=[];if(t){for(s=0,l=o.data.nodes.length;s
").html(r).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(document).bind("mousemove touchmove",e.vakata.dnd.drag),e(document).bind("mouseup touchend",e.vakata.dnd.stop),!1},drag:function(n){if("touchmove"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),t.is_down){if(!t.is_drag){if(!(Math.abs(n.pageX-t.init_x)>(t.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(n.pageY-t.init_y)>(t.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;t.helper&&(t.helper.appendTo("body"),t.helper_w=t.helper.outerWidth()),t.is_drag=!0,e.vakata.dnd._trigger("start",n)}var i=!1,r=!1,a=!1,o=!1,s=!1,l=!1,c=!1,d=!1,u=!1,h=!1;return t.scroll_t=0,t.scroll_l=0,t.scroll_e=!1,e(e(n.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var i=e(this),r=i.offset();if(this.scrollHeight>this.offsetHeight&&(r.top+i.height()-n.pageYthis.offsetWidth&&(r.left+i.width()-n.pageXo&&n.pageY-co&&o-(n.pageY-c)l&&n.pageX-dl&&l-(n.pageX-d)a&&(u=a-50),s&&h+t.helper_w>s&&(h=s-(t.helper_w+2)),t.helper.css({left:h+"px",top:u+"px"})),e.vakata.dnd._trigger("move",n),!1}},stop:function(n){if("touchend"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),t.is_drag)e.vakata.dnd._trigger("stop",n);else if("touchend"===n.type&&n.target===t.target){var i=setTimeout(function(){e(n.target).click()},100);e(n.target).one("click",function(){i&&clearTimeout(i)})}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(t,n){this.bind=function(){n.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this.element.on("before_open.jstree",e.proxy(function(t,n){var i,r,a=this._data.search.res,o=[],s=e();if(a&&a.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(a,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search"),this.settings.search.show_only_matches&&this._data.search.res.length)){for(i=0,r=a.length;i32&&(n.fuzzy=!1),n.fuzzy&&(i=1<=p;l--)if(m=r[t.charAt(l-1)],g[l]=0===o?(g[l+1]<<1|1)&m:(g[l+1]<<1|1)&m|(f[l+1]|f[l])<<1|1|f[l+1],g[l]&i&&(x=a(o,l-1))<=y){if(y=x,b=l-1,k.push(b),!(b>s))break;p=Math.max(1,2*s-b)}if(a(o+1,s)>y)break;f=g}return{isMatch:b>=0,score:x}},!0===t?{search:o}:o(t)}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,n){var i,r;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),n))for(i=0,r=t.children_d.length;it.ttl)&&(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!!t&&(this.element.one("set_state.jstree",function(n,i){i.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={"#":{},default:{}},e.jstree.plugins.types=function(n,i){this.init=function(e,n){var r,a;if(n&&n.types&&n.types.default)for(r in n.types)if("default"!==r&&"#"!==r&&n.types.hasOwnProperty(r))for(a in n.types.default)n.types.default.hasOwnProperty(a)&&n.types[r][a]===t&&(n.types[r][a]=n.types.default[a]);i.init.call(this,e,n),this._model.data["#"].type="#"},this.refresh=function(e,t){i.refresh.call(this,e,t),this._model.data["#"].type="#"},this.bind=function(){this.element.on("model.jstree",e.proxy(function(e,n){var i,r,a=this._model.data,o=n.nodes,s=this.settings.types,l="default";for(i=0,r=o.length;i .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor:eq(0)").trigger(n).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),n.teardown.call(this)},this.redraw_node=function(t,i,r){if(t=n.redraw_node.call(this,t,i,r)){var a=p.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(a.className+=" jstree-wholerow-clicked"),t.insertBefore(a,t.childNodes[0])}return t}}}})},13:function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=n(297),r=function(e){return e&&e.__esModule?e:{default:e}}(i),a=e.Model.extend({urlRoot:Galaxy.root+"api/libraries/",isVisible:function(e){var t=!0;return!e&&this.get("deleted")&&(t=!1),t}}),o=e.Collection.extend({urlRoot:Galaxy.root+"api/libraries",model:a,initialize:function(e){e=e||{}},search:function(e){if(""==e)return this;var t=e.toLowerCase();return this.filter(function(e){return-1!==e.get("name").toLowerCase().indexOf(t)})},getVisible:function(e,t){return t=t||[],new o(this.filter(function(t){return t.isVisible(e)}))},sortLibraries:function(e,t){this.comparator=r.default.generateLibraryComparator(e,t),this.sort()}}),s=e.Model.extend({}),l=s.extend({urlRoot:Galaxy.root+"api/libraries/datasets/"}),c=s.extend({urlRoot:Galaxy.root+"api/folders/"}),d=e.Collection.extend({model:s,sortFolder:function(e,t){this.comparator=r.default.generateFolderComparator(e,t),this.sort()}}),u=e.Model.extend({defaults:{folder:new d,urlRoot:Galaxy.root+"api/folders/",id:"unknown"},parse:function(e){this.get("folder").reset();for(var t=0;t ').addClass(i);t.before(r)}}Object.defineProperty(t,"__esModule",{value:!0});var l=n(3),c=a(l),d=n(286),u=a(d),h=n(287),f=a(h),p=n(288),_=a(p),g=n(61),m=a(g),v=n(293),y=a(v),b=n(6),w=a(b),x=n(79),k=a(x),j=n(7);!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e}(j);n(20),window.workflow_globals=window.workflow_globals||{},t.default=i.View.extend({initialize:function(t){function n(){var t=e('

');window.show_modal("Save As a New Workflow",t,{OK:function(){var t=e("#workflow_rename").val().length>0?e("#workflow_rename").val():"SavedAs_"+l.workflow.name,n=e("#wf_annotation").val().length>0?e("#wf_annotation").val():"";e.ajax({url:l.urls.workflow_save_as,type:"POST",data:{workflow_name:t,workflow_annotation:n,workflow_data:function(){return JSON.stringify(l.workflow.to_simple())}}}).done(function(e){window.onbeforeunload=void 0,window.location=Galaxy.root+"workflow/editor?id="+e,hide_modal()}).fail(function(){hide_modal(),alert("Saving this workflow failed. Please contact this site's administrator.")})},Cancel:hide_modal})}function i(){l.workflow.layout(),l.workflow.fit_canvas_to_nodes(),l.scroll_to_nodes(),l.canvas_manager.draw_overview()}function a(){e.jStorage.set("overview-off",!1),e("#overview-border").css("right","0px"),e("#close-viewport").css("background-position","0px 0px")}function s(){e.jStorage.set("overview-off",!0),e("#overview-border").css("right","20000px"),e("#close-viewport").css("background-position","12px 0px")}var l=window.workflow_globals.app=this;this.options=t,this.urls=t&&t.urls||{};var d=function(){if(l.workflow.check_changes_in_active_form(),workflow&&l.workflow.has_changes){var e=function(){window.onbeforeunload=void 0,window.document.location=l.urls.workflow_index};window.show_modal("Close workflow editor","There are unsaved changes to your workflow which will be lost.",{Cancel:hide_modal,"Save Changes":function(){u(null,e)}},{"Don't Save":e})}else window.document.location=l.urls.workflow_index},u=function(t,n){if(show_message("Saving workflow","progress"),l.workflow.check_changes_in_active_form(),!l.workflow.has_changes)return hide_modal(),void(n&&n());l.workflow.rectify_workflow_outputs(),c.default.request({url:Galaxy.root+"api/workflows/"+l.options.id,type:"PUT",data:{workflow:l.workflow.to_simple()},success:function(t){var i=e("
").text(t.message);if(t.errors){i.addClass("warningmark");var r=e("
    ");e.each(t.errors,function(t,n){e("
  • ").text(n).appendTo(r)}),i.append(r)}else i.addClass("donemark");l.workflow.name=t.name,l.workflow.has_changes=!1,l.workflow.stored=!0,l.showWorkflowParameters(),t.errors?window.show_modal("Saving workflow",i,{Ok:hide_modal}):(n&&n(),hide_modal())},error:function(e){window.show_modal("Saving workflow failed.",e.err_msg,{Ok:hide_modal})}})};e("#tool-search-query").click(function(){e(this).focus(),e(this).select()}).keyup(function(){if(e(this).css("font-style","normal"),this.value.length<3)o(!1);else if(this.value!=this.lastValue){e(this).addClass("search_active");var t=this.value;this.timer&&clearTimeout(this.timer),e("#search-spinner").show(),this.timer=setTimeout(function(){e.get(l.urls.tool_search,{q:t},function(t){if(e("#search-no-results").hide(),e(".toolSectionWrapper").hide(),e(".toolSectionWrapper").find(".toolTitle").hide(),0!=t.length){var n=e.map(t,function(e,t){return"link-"+e});e(n).each(function(t,n){e("[id='"+n+"']").parent().addClass("search_match"),e("[id='"+n+"']").parent().show().parent().parent().show().parent().show()}),e(".toolPanelLabel").each(function(){for(var t=e(this),n=t.next(),i=!0;0!==n.length&&n.hasClass("toolTitle");){if(n.is(":visible")){i=!1;break}n=n.next()}i&&t.hide()})}else e("#search-no-results").show();e("#search-spinner").hide()},"json")},400)}this.lastValue=this.value}),this.canvas_manager=window.workflow_globals.canvas_manager=new f.default(this,e("#canvas-viewport"),e("#overview")),this.reset(),this.datatypes=JSON.parse(e.ajax({url:Galaxy.root+"api/datatypes",async:!1}).responseText),this.datatypes_mapping=JSON.parse(e.ajax({url:Galaxy.root+"api/datatypes/mapping",async:!1}).responseText),this.ext_to_type=this.datatypes_mapping.ext_to_class_name,this.type_to_type=this.datatypes_mapping.class_to_classes,this._workflowLoadAjax(l.options.id,{success:function(e){l.reset(),l.workflow.from_simple(e,!0),l.workflow.has_changes=!1,l.workflow.fit_canvas_to_nodes(),l.scroll_to_nodes(),l.canvas_manager.draw_overview();var t="";r.each(e.steps,function(n,i){var a="";n.errors&&(a+="
  • "+n.errors+"
  • "),r.each(e.upgrade_messages[i],function(e){a+="
  • "+e+"
  • "}),a&&(t+="
  • Step "+(parseInt(i,10)+1)+": "+l.workflow.nodes[i].name+"
      "+a+"
  • ")}),t?window.show_modal("Issues loading this workflow","Please review the following issues, possibly resulting from tool upgrades or changes.

      "+t+"

    ",{Continue:hide_modal}):hide_modal(),l.showWorkflowParameters()},beforeSubmit:function(e){show_message("Loading workflow","progress")}}),window.make_popupmenu&&make_popupmenu(e("#workflow-options-button"),{Save:u,"Save As":n,Run:function(){window.location=Galaxy.root+"workflows/run?id="+l.options.id},"Edit Attributes":function(){l.workflow.clear_active_node()},"Auto Re-layout":i,Close:d});var h=e.jStorage.get("overview-size");void 0!==h&&e("#overview-border").css({width:h,height:h}),e.jStorage.get("overview-off")?s():a(),e("#overview-border").bind("dragend",function(t,n){var i=e(this).offsetParent(),r=i.offset(),a=Math.max(i.width()-(n.offsetX-r.left),i.height()-(n.offsetY-r.top));e.jStorage.set("overview-size",a+"px")}),e("#close-viewport").click(function(){"0px"===e("#overview-border").css("right")?s():a()}),window.onbeforeunload=function(){if(workflow&&l.workflow.has_changes)return"There are unsaved changes to your workflow which will be lost."},this.options.workflows.length>0&&e("#left").find(".toolMenu").append(this._buildToolPanelWorkflows()),e("div.toolSectionBody").hide(),e("div.toolSectionTitle > span").wrap("");var p=null;e("div.toolSectionTitle").each(function(){var t=e(this).next("div.toolSectionBody");e(this).click(function(){t.is(":hidden")?(p&&p.slideUp("fast"),p=t,t.slideDown("fast")):(t.slideUp("fast"),p=null)})}),(0,k.default)("workflow-name","workflow-name",l.urls.rename_async,"new_name"),e("#workflow-tag").click(function(){return e(".tag-area").click(),!1}),(0,k.default)("workflow-annotation","workflow-annotation",l.urls.annotate_async,"new_annotation",25,!0,4)},_buildToolPanelWorkflows:function(){var t=this,n=e('
    ');return r.each(this.options.workflows,function(i){if(i.id!==t.options.id){var r=new w.default.ButtonIcon({icon:"fa fa-copy",cls:"ui-button-icon-plain",tooltip:"Copy and insert individual steps",onclick:function(){i.step_count<2?t.copy_into_workflow(i.id,i.name):Galaxy.modal.show({title:"Warning",body:"This will copy "+i.step_count+" new steps into your workflow.",buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:function(){Galaxy.modal.hide(),t.copy_into_workflow(i.id,i.name)}}})}}),a=e("").attr("href","#").html(i.name).on("click",function(){t.add_node_for_subworkflow(i.latest_id,i.name)});n.find(".toolSectionBg").append(e("
    ").addClass("toolTitle").append(a).append(r.$el))}}),n},copy_into_workflow:function(t){var n=this;this._workflowLoadAjax(t,{success:function(t){n.workflow.from_simple(t,!1);var i="";e.each(t.upgrade_messages,function(t,r){i+="
  • Step "+(parseInt(t,10)+1)+": "+n.workflow.nodes[t].name+"
      ",e.each(r,function(e,t){i+="
    • "+t+"
    • "}),i+="
  • "}),i?window.show_modal("Subworkflow embedded with changes","Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
      "+i+"
    ",{Continue:hide_modal}):hide_modal()},beforeSubmit:function(e){show_message("Importing workflow","progress")}})},reset:function(){this.workflow&&this.workflow.remove_all(),this.workflow=window.workflow_globals.workflow=new u.default(this,e("#canvas-container"))},scroll_to_nodes:function(){var t,n,i=e("#canvas-viewport"),r=e("#canvas-container");n=r.width()"+n+"";return t+=""},showWorkflowParameters:function(){var t=/\$\{.+?\}/g,n=[],i=e("#workflow-parameters-container"),r=e("#workflow-parameters-box"),a="",o=[];e.each(this.workflow.nodes,function(i,r){r.config_form&&r.config_form.inputs&&c.default.deepeach(r.config_form.inputs,function(e){if("string"==typeof e.value){var n=e.value.match(t);n&&(o=o.concat(n))}}),r.post_job_actions&&e.each(r.post_job_actions,function(n,i){i.action_arguments&&e.each(i.action_arguments,function(e,n){var i=n.match(t);i&&(o=o.concat(i))})}),o&&e.each(o,function(t,i){-1===e.inArray(i,n)&&n.push(i)})}),n&&0!==n.length?(e.each(n,function(e,t){a+="
    "+t.substring(2,t.length-1)+"
    "}),i.html(a),r.show()):(i.html(a),r.hide())},showAttributes:function(){e(".right-content").hide(),e("#edit-attributes").show()},showForm:function(t,n){var i="right-content",r=i+"-"+n.id,a=e("#"+i);if(t&&0==a.find("#"+r).length){var o=e('
    ');if(t.node=n,t.workflow=this.workflow,t.datatypes=this.datatypes,t.icon=m.default[n.type],t.cls="ui-portlet-narrow",n){var s="tool"==n.type?"Tool":"Default";o.append(new y.default[s](t).form.$el),a.append(o)}else Galaxy.emit.debug("workflow-view::initialize()","Node not found in workflow.")}e("."+i).hide(),a.find("#"+r).show(),a.show(),a.scrollTop()},isSubType:function(e,t){return e=this.ext_to_type[e],t=this.ext_to_type[t],this.type_to_type[e]&&t in this.type_to_type[e]},prebuildNode:function(t,n,i){var r=this,a=e("
    "),o=e("
    "+n+"
    ");s(o.find(".nodeTitle"),t),a.append(o),a.css("left",e(window).scrollLeft()+20),a.css("top",e(window).scrollTop()+20),a.append(e("
    "));var l=new _.default(this,{element:a});l.type=t,l.content_id=i;var c="
    loading tool info...
    ";a.find(".toolFormBody").append(c);var d=e("
    ");d.append(e("
    ").addClass("fa-icon-button fa fa-files-o").click(function(e){l.clone()})),d.append(e("
    ").addClass("fa-icon-button fa fa-times").click(function(e){l.destroy()})),a.appendTo("#canvas-container");var u=e("#canvas-container").position(),h=e("#canvas-container").parent(),f=a.width(),p=a.height();return a.css({left:-u.left+h.width()/2-f/2,top:-u.top+h.height()/2-p/2}),d.prependTo(a.find(".toolFormTitle")),f+=d.width()+10,a.css("width",f),a.bind("dragstart",function(){r.workflow.activate_node(l)}).bind("dragend",function(){r.workflow.node_changed(this),r.workflow.fit_canvas_to_nodes(),r.canvas_manager.draw_overview()}).bind("dragclickonly",function(){r.workflow.activate_node(l)}).bind("drag",function(t,n){var i=e(this).offsetParent().offset(),r=n.offsetX-i.left,a=n.offsetY-i.top;e(this).css({left:r,top:a}),e(this).find(".terminal").each(function(){this.terminal.redraw()})}),l}})}).call(t,n(0),n(2),n(1))},286:function(e,t,n){"use strict";(function(e){function i(e,t){this.app=e,this.canvas_container=t,this.id_counter=0,this.nodes={},this.name=null,this.has_changes=!1,this.active_form_has_changes=!1,this.workflowOutputLabels={}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(125),a=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(7),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(o);e.extend(i.prototype,{canLabelOutputWith:function(e){return!e||!(e in this.workflowOutputLabels)},registerOutputLabel:function(e){e&&(this.workflowOutputLabels[e]=!0)},unregisterOutputLabel:function(e){e&&delete this.workflowOutputLabels[e]},updateOutputLabel:function(e,t){e&&this.unregisterOutputLabel(e),this.canLabelOutputWith(t)||s.warning("Workflow contains duplicate workflow output labels "+t+". This must be fixed before it can be saved."),t&&this.registerOutputLabel(t)},attemptUpdateOutputLabel:function(e,t,n){return!!this.canLabelOutputWith(n)&&(e.labelWorkflowOutput(t,n),e.nodeView.redrawWorkflowOutputs(),!0)},create_node:function(e,t,n){var i=this.app.prebuildNode(e,t,n);return this.add_node(i),this.fit_canvas_to_nodes(),this.app.canvas_manager.draw_overview(),this.activate_node(i),i},add_node:function(e){e.id=this.id_counter,e.element.attr("id","wf-node-step-"+e.id),this.id_counter++,this.nodes[e.id]=e,this.has_changes=!0,e.workflow=this},remove_node:function(e){this.active_node==e&&this.clear_active_node(),delete this.nodes[e.id],this.has_changes=!0},remove_all:function(){var t=this;e.each(this.nodes,function(e,n){n.destroy(),t.remove_node(n)})},rectify_workflow_outputs:function(){var t=!1,n=!1;if(e.each(this.nodes,function(i,r){r.workflow_outputs&&r.workflow_outputs.length>0&&(t=!0),e.each(r.post_job_actions,function(e,t){"HideDatasetAction"===t.action_type&&(n=!0)})}),!1!==t||!1!==n){var i=this;e.each(this.nodes,function(n,r){if("tool"===r.type){var a=!1;null===r.post_job_actions&&(r.post_job_actions={},a=!0);var o=[];e.each(r.post_job_actions,function(e,t){"HideDatasetAction"==t.action_type&&o.push(e)}),o.length>0&&e.each(o,function(e,t){a=!0,delete r.post_job_actions[t]}),t&&e.each(r.output_terminals,function(e,t){if(!0==!r.isWorkflowOutput(t.name)){a=!0;var n={action_type:"HideDatasetAction",output_name:t.name,action_arguments:{}};r.post_job_actions["HideDatasetAction"+t.name]=null,r.post_job_actions["HideDatasetAction"+t.name]=n}}),i.active_node==r&&!0===a&&i.reload_active_node()}})}},to_simple:function(){var t={};return e.each(this.nodes,function(n,i){var r={};e.each(i.input_terminals,function(t,n){r[n.name]=null;var i=[];e.each(n.connectors,function(e,t){if(t.handle1){var a={id:t.handle1.node.id,output_name:t.handle1.name},o=n.attributes.input.input_subworkflow_step_id;void 0!==o&&(a.input_subworkflow_step_id=o),i[e]=a,r[n.name]=i}})});var a={};i.post_job_actions&&e.each(i.post_job_actions,function(e,t){var n={action_type:t.action_type,output_name:t.output_name,action_arguments:t.action_arguments};a[t.action_type+t.output_name]=null,a[t.action_type+t.output_name]=n}),i.workflow_outputs||(i.workflow_outputs=[]);var o={id:i.id,type:i.type,content_id:i.content_id,tool_version:i.config_form.version,tool_state:i.tool_state,errors:i.errors,input_connections:r,position:e(i.element).position(),annotation:i.annotation,post_job_actions:i.post_job_actions,uuid:i.uuid,label:i.label,workflow_outputs:i.workflow_outputs};t[i.id]=o}),{steps:t}},from_simple:function(t,n){var i=void 0===n||n,r=this,o=0;i?r.name=t.name:o=Object.keys(r.nodes).length;var s=o,l=!1;e.each(t.steps,function(t,n){var a=r.app.prebuildNode(n.type,n.name,n.content_id);i||(n.uuid=null,e.each(n.workflow_outputs,function(e,t){t.uuid=null})),a.init_field_data(n),n.position&&a.element.css({top:n.position.top,left:n.position.left}),a.id=parseInt(n.id)+o,r.nodes[a.id]=a,s=Math.max(s,parseInt(t)+o),l||(a.workflow_outputs.length>0?l=!0:e.each(a.post_job_actions||[],function(e,t){"HideDatasetAction"===t.action_type&&(l=!0)}))}),r.id_counter=s+1,e.each(t.steps,function(t,n){var i=r.nodes[parseInt(t)+o];e.each(n.input_connections,function(t,n){n&&(e.isArray(n)||(n=[n]),e.each(n,function(e,n){var s=r.nodes[parseInt(n.id)+o],l=new a.default;l.connect(s.output_terminals[n.output_name],i.input_terminals[t]),l.redraw()}))}),l&&e.each(i.output_terminals,function(t,n){if(void 0===i.post_job_actions["HideDatasetAction"+n.name]){i.addWorkflowOutput(n.name);e(i.element).find(".callout."+n.name).find("img").attr("src",Galaxy.root+"static/images/fugue/asterisk-small.png"),r.has_changes=!0}})})},check_changes_in_active_form:function(){this.active_form_has_changes&&(this.has_changes=!0,e("#right-content").find("form").submit(),this.active_form_has_changes=!1)},reload_active_node:function(){if(this.active_node){var e=this.active_node;this.clear_active_node(),this.activate_node(e)}},clear_active_node:function(){this.active_node&&(this.active_node.make_inactive(),this.active_node=null),document.activeElement.blur(),this.app.showAttributes()},activate_node:function(e){this.active_node!=e&&(this.check_changes_in_active_form(),this.clear_active_node(),this.app.showForm(e.config_form,e),e.make_active(),this.active_node=e)},node_changed:function(e,t){this.has_changes=!0,this.active_node==e&&t&&(this.check_changes_in_active_form(),this.app.showForm(e.config_form,e)),this.app.showWorkflowParameters()},layout:function(){this.check_changes_in_active_form(),this.has_changes=!0;var t={},n={};e.each(this.nodes,function(e,i){void 0===t[e]&&(t[e]=0),void 0===n[e]&&(n[e]=[])}),e.each(this.nodes,function(i,r){e.each(r.input_terminals,function(i,a){e.each(a.connectors,function(e,i){var a=i.handle1.node;t[r.id]+=1,n[a.id].push(r.id)})})});for(var i=[];;){var r=[];for(var a in t)0===t[a]&&r.push(a);if(0===r.length)break;i.push(r);for(var o in r){var s=r[o];delete t[s];for(var l in n[s])t[n[s][l]]-=1}}if(!t.length){var c=this.nodes,d=80;e.each(i,function(t,n){n.sort(function(t,n){return e(c[t].element).position().top-e(c[n].element).position().top});var i=0,r=30;e.each(n,function(t,n){var a=c[n],o=e(a.element);e(o).css({top:r,left:d}),i=Math.max(i,e(o).width()),r+=e(o).height()+30}),d+=i+80}),e.each(c,function(e,t){t.redraw()})}},bounds_for_all_nodes:function(){var t,n=1/0,i=-1/0,r=1/0,a=-1/0;return e.each(this.nodes,function(o,s){var l=e(s.element);t=l.position(),n=Math.min(n,t.left),i=Math.max(i,t.left+l.width()),r=Math.min(r,t.top),a=Math.max(a,t.top+l.width())}),{xmin:n,xmax:i,ymin:r,ymax:a}},fit_canvas_to_nodes:function(){function t(e,t){return Math.ceil(e/t)*t}function n(e,t){if(e3*t){return-(e-(Math.ceil(e%t/t)+1)*t)}return 0}var i=this.bounds_for_all_nodes(),r=this.canvas_container.position(),a=this.canvas_container.parent(),o=n(i.xmin,100),s=n(i.ymin,100);o=Math.max(o,r.left),s=Math.max(s,r.top);var l=r.left-o,c=r.top-s,d=t(i.xmax+100,100)+o,u=t(i.ymax+100,100)+s;d=Math.max(d,-l+a.width()),u=Math.max(u,-c+a.height()),this.canvas_container.css({left:l,top:c,width:d,height:u}),this.canvas_container.children().each(function(){var t=e(this).position();e(this).css("left",t.left+o),e(this).css("top",t.top+s)})}}),t.default=i}).call(t,n(0))},287:function(e,t,n){"use strict";(function(e){function n(e,t,n){this.app=e,this.cv=t,this.cc=this.cv.find("#canvas-container"),this.overview=n,this.oc=n.find("#overview-canvas"),this.ov=n.find("#overview-viewport"),this.init_drag(),this.init_copy_paste()}function i(e){this.panel=e}Object.defineProperty(t,"__esModule",{value:!0}),e.extend(n.prototype,{init_drag:function(){var t=this,n=function(e,n){e=Math.min(e,t.cv.width()/2),e=Math.max(e,-t.cc.width()+t.cv.width()/2),n=Math.min(n,t.cv.height()/2),n=Math.max(n,-t.cc.height()+t.cv.height()/2),t.cc.css({left:e,top:n}),t.cv.css({"background-position-x":e,"background-position-y":n}),t.update_viewport_overlay()};this.cc.each(function(){this.scroll_panel=new i(this)});var r,a;this.cv.bind("click",function(){document.activeElement.blur()}).bind("dragstart",function(){var n=e(this).offset(),i=t.cc.position();a=i.top-n.top,r=i.left-n.left}).bind("drag",function(e,t){n(t.offsetX+r,t.offsetY+a)}).bind("dragend",function(){t.app.workflow.fit_canvas_to_nodes(),t.draw_overview()}),this.overview.click(function(e){if(t.overview.hasClass("blockaclick"))t.overview.removeClass("blockaclick");else{var i=t.cc.width(),r=t.cc.height(),a=t.oc.width(),o=t.oc.height(),s=e.pageX-t.oc.offset().left-t.ov.width()/2,l=e.pageY-t.oc.offset().top-t.ov.height()/2;n(-s/a*i,-l/o*r),t.app.workflow.fit_canvas_to_nodes(),t.draw_overview()}}),this.ov.bind("drag",function(e,i){var r=t.cc.width(),a=t.cc.height(),o=t.oc.width(),s=t.oc.height(),l=i.offsetX-t.overview.offset().left,c=i.offsetY-t.overview.offset().top;n(-l/o*r,-c/s*a)}).bind("dragend",function(){t.overview.addClass("blockaclick"),t.app.workflow.fit_canvas_to_nodes(),t.draw_overview()}),e("#overview-border").bind("drag",function(n,i){var r=e(this).offsetParent(),a=r.offset(),o=Math.max(r.width()-(i.offsetX-a.left),r.height()-(i.offsetY-a.top));e(this).css({width:o,height:o}),t.draw_overview()}),e("#overview-border div").bind("drag",function(){})},init_copy_paste:function(){var e=this;document.addEventListener("copy",function(t){""===window.getSelection().toString()&&(e.app.workflow.active_node&&t.clipboardData.setData("application/json",JSON.stringify({nodeId:e.app.workflow.active_node.id})),t.preventDefault())}),document.addEventListener("paste",function(t){if(document.activeElement&&"textarea"!==document.activeElement.type&&"text"!==document.activeElement.type){var n;try{n=JSON.parse(t.clipboardData.getData("application/json")).nodeId}catch(e){}n&&e.app.workflow.nodes.hasOwnProperty(n)&&e.app.workflow.nodes[n].clone(),t.preventDefault()}})},update_viewport_overlay:function(){var e=this.cc,t=this.cv,n=this.oc,i=this.ov,r=e.width(),a=e.height(),o=n.width(),s=n.height(),l=e.position();i.css({left:-l.left/r*o,top:-l.top/a*s,width:t.width()/r*o-2,height:t.height()/a*s-2})},draw_overview:function(){var t,n,i,r,a=e("#overview-canvas"),o=a.parent().parent().width(),s=a.get(0).getContext("2d"),l=e("#canvas-container").width(),c=e("#canvas-container").height(),d=this.cv.width(),u=this.cv.height();l0&&(s.fillStyle="#E8A92D",s.strokeStyle="#E8A92D"),s.fillRect(d,u,h,f),s.strokeRect(d,u,h,f)}),this.update_viewport_overlay()}}),e.extend(i.prototype,{test:function(t,n){var i=this;clearTimeout(this.timeout);var r=t.pageX,a=t.pageY,o=e(this.panel),s=o.position(),l=o.width(),c=o.height(),d=o.parent(),u=d.width(),h=d.height(),f=d.offset(),p=f.left,_=f.top,g=p+d.width(),m=_+d.height(),v=-(l-u/2),y=-(c-h/2),b=u/2,w=h/2,x=!1,k=0;r-5g?s.left>v&&(k=Math.min(23,s.left-v),o.css("left",s.left-k),x=!0):a-5<_?s.topm&&s.top>y&&(k=Math.min(23,s.top-v),o.css("top",s.top-k+"px"),x=!0),x&&(n(),this.timeout=setTimeout(function(){i.test(t,n)},50))},stop:function(){clearTimeout(this.timeout)}}),t.default=n}).call(t,n(0))},288:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),s=a(o),l=n(289),c=a(l),d=e.Model.extend({initialize:function(e,t){this.app=e,this.element=t.element,this.input_terminals={},this.output_terminals={},this.errors={},this.workflow_outputs=[]},getWorkflowOutput:function(e){return i.findWhere(this.workflow_outputs,{output_name:e})},isWorkflowOutput:function(e){return void 0!==this.getWorkflowOutput(e)},removeWorkflowOutput:function(e){for(;this.isWorkflowOutput(e);)this.workflow_outputs.splice(this.getWorkflowOutput(e),1)},addWorkflowOutput:function(e,t){if(!this.isWorkflowOutput(e)){var n={output_name:e};return t&&(n.label=t),this.workflow_outputs.push(n),!0}return!1},labelWorkflowOutput:function(e,t){var n=!1,i=null;if(this.isWorkflowOutput(e)){var r=this.getWorkflowOutput(e);i=r.label,r.label=t,n=i!=t}else n=this.addWorkflowOutput(e,t);return n&&(this.app.workflow.updateOutputLabel(i,t),this.markChanged(),this.nodeView.redrawWorkflowOutputs()),n},connectedOutputTerminals:function(){return this._connectedTerminals(this.output_terminals)},_connectedTerminals:function(e){var t=[];return r.each(e,function(e,n){n.connectors.length>0&&t.push(n)}),t},hasConnectedOutputTerminals:function(){var e=this.output_terminals;for(var t in e)if(e[t].connectors.length>0)return!0;return!1},connectedMappedInputTerminals:function(){return this._connectedMappedTerminals(this.input_terminals)},hasConnectedMappedInputTerminals:function(){var e=this.input_terminals;for(var t in e){var n=e[t];if(n.connectors.length>0&&n.isMappedOver())return!0}return!1},_connectedMappedTerminals:function(e){var t=[];return r.each(e,function(e,n){n.mapOver().isCollection&&n.connectors.length>0&&t.push(n)}),t},mappedInputTerminals:function(){return this._mappedTerminals(this.input_terminals)},_mappedTerminals:function(e){var t=[];return r.each(e,function(e,n){n.mapOver().isCollection&&t.push(n)}),t},hasMappedOverInputTerminals:function(){var e=!1;return i.each(this.input_terminals,function(t){t.mapOver().isCollection&&(e=!0)}),e},redraw:function(){r.each(this.input_terminals,function(e,t){t.redraw()}),r.each(this.output_terminals,function(e,t){t.redraw()})},clone:function(){var e=this,t={name:this.name,label:this.label,annotation:this.annotation,post_job_actions:this.post_job_actions},n=this.app.workflow.create_node(this.type,this.name,this.content_id);s.default.request({type:"POST",url:Galaxy.root+"api/workflows/build_module",data:{type:this.type,tool_id:this.content_id,inputs:this.tool_state},success:function(i){var r=Object.assign({},i,t);n.init_field_data(r),n.update_field_data(r),e.app.workflow.activate_node(n)}})},destroy:function(){r.each(this.input_terminals,function(e,t){t.destroy()}),r.each(this.output_terminals,function(e,t){t.destroy()}),this.app.workflow.remove_node(this),r(this.element).remove()},make_active:function(){r(this.element).addClass("toolForm-active")},make_inactive:function(){var e=this.element.get(0);!function(t){t.removeChild(e),t.appendChild(e)}(e.parentNode),r(e).removeClass("toolForm-active")},init_field_data:function(e){e.type&&(this.type=e.type),this.name=e.name,this.config_form=e.config_form,this.tool_version=this.config_form&&this.config_form.version,this.tool_state=e.tool_state,this.errors=e.errors,this.tooltip=e.tooltip?e.tooltip:"",this.annotation=e.annotation,this.post_job_actions=e.post_job_actions?e.post_job_actions:{},this.label=e.label,this.uuid=e.uuid,this.workflow_outputs=e.workflow_outputs?e.workflow_outputs:[];var t=this,n=new c.default({el:this.element[0],node:t});t.nodeView=n,r.each(e.data_inputs,function(e,t){n.addDataInput(t)}),e.data_inputs.length>0&&e.data_outputs.length>0&&n.addRule(),r.each(e.data_outputs,function(e,t){n.addDataOutput(t)}),n.render(),this.app.workflow.node_changed(this,!0)},update_field_data:function(e){var t=this,n=t.nodeView,a=[];if(r.each(n.outputViews,function(t,n){var r=n.output.name,o=e.data_outputs,s=!1;i.each(o,function(e){e.name==r&&(s=!0)}),!1===s&&a.push(r)}),i.each(a,function(e){i.each(n.outputViews[e].terminalElement.terminal.connectors,function(e){e&&e.destroy()}),n.outputViews[e].remove(),delete n.outputViews[e],delete t.output_terminals[e]}),r.each(t.workflow_outputs,function(e,n){n&&!t.output_terminals[n.output_name]&&t.workflow_outputs.splice(e,1)}),r.each(e.data_outputs,function(e,i){n.outputViews[i.name]?(t.output_terminals[i.name].datatypes=i.extensions,t.output_terminals[i.name].destroyInvalidConnections()):n.addDataOutput(i)}),this.tool_state=e.tool_state,this.config_form=e.config_form,this.tool_version=this.config_form&&this.config_form.version,this.errors=e.errors,this.annotation=e.annotation,this.label=e.label,"post_job_actions"in e){var o=e.post_job_actions;this.post_job_actions=o||{}}t.nodeView.renderToolErrors();var s=n.$("div.inputs"),l=n.newInputsDiv(),c={};i.each(e.data_inputs,function(e){var n=t.nodeView.addDataInput(e,l);c[e.name]=n}),i.each(i.difference(i.values(n.terminalViews),i.values(c)),function(e){e.el.terminal.destroy()}),n.terminalViews=c,t.nodeView.render(),1==e.data_outputs.length&&"collection_type"in e.data_outputs[0]&&n.updateDataOutput(e.data_outputs[0]),s.replaceWith(l),"workflow_outputs"in e&&(this.workflow_outputs=e.workflow_outputs?e.workflow_outputs:[]),this.markChanged(),this.redraw()},error:function(e){var t=r(this.element).find(".toolFormBody");t.find("div").remove();var n="
    "+e+"
    ";this.config_form=n,t.html(n),this.app.workflow.node_changed(this)},markChanged:function(){this.app.workflow.node_changed(this)}});t.default=d}).call(t,n(2),n(1),n(0))},289:function(e,t,n){"use strict";(function(e,i){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(a),s=n(290),l=r(s),c=n(292),d=r(c);t.default=e.View.extend({initialize:function(e){this.node=e.node,this.output_width=Math.max(150,this.$el.width()),this.tool_body=this.$el.find(".toolFormBody"),this.tool_body.find("div").remove(),this.newInputsDiv().appendTo(this.tool_body),this.terminalViews={},this.outputViews={}},render:function(){this.renderToolLabel(),this.renderToolErrors(),this.$el.css("width",Math.min(250,Math.max(this.$el.width(),this.output_width)))},renderToolLabel:function(){this.$(".nodeTitle").text(this.node.label||this.node.name)},renderToolErrors:function(){this.node.errors?this.$el.addClass("tool-node-error"):this.$el.removeClass("tool-node-error")},newInputsDiv:function(){return i("
    ").addClass("inputs")},updateMaxWidth:function(e){this.output_width=Math.max(this.output_width,e)},addRule:function(){this.tool_body.append(i("
    ").addClass("rule"))},addDataInput:function(e,t){var n=!0;t||(t=this.$(".inputs"),n=!1);var i=this.terminalViews[e.name],r="dataset_collection"==e.input_type?l.default.InputCollectionTerminalView:l.default.InputTerminalView;if(!i||i instanceof r||(i.el.terminal.destroy(),i=null),i){var a=i.el.terminal;a.update(e),a.destroyInvalidConnections()}else i=new r({node:this.node,input:e});this.terminalViews[e.name]=i;var o=i.el,s=new d.default.DataInputView({terminalElement:o,input:e,nodeView:this,skipResize:n}),c=s.$el;return t.append(c.prepend(i.terminalElements())),i},addDataOutput:function(e){var t=e.collection?l.default.OutputCollectionTerminalView:l.default.OutputTerminalView,n=new t({node:this.node,output:e}),i=new d.default.DataOutputView({output:e,terminalElement:n.el,nodeView:this});this.outputViews[e.name]=i,this.tool_body.append(i.$el.append(n.terminalElements()))},redrawWorkflowOutputs:function(){o.each(this.outputViews,function(e){e.redrawWorkflowOutput()})},updateDataOutput:function(e){this.node.output_terminals[e.name].update(e)}})}).call(t,n(2),n(0))},290:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(291),s=a(o),l=n(125),c=a(l);window.workflow_globals=window.workflow_globals||{};var d=e.View.extend({tagName:"div",className:"fa-icon-button fa fa-folder-o",initialize:function(e){this.$el.tooltip({delay:500,title:"Run tool in parallel over collection"}),this.model.bind("change",i.bind(this.render,this))},render:function(){this.model.mapOver.isCollection?this.$el.show():this.$el.hide()}}),u=d.extend({events:{click:"onClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave"},onMouseEnter:function(e){var t=this.model;!t.terminal.connected()&&t.mapOver.isCollection&&this.$el.css("color","red")},onMouseLeave:function(e){this.$el.css("color","black")},onClick:function(e){var t=this.model;!t.terminal.connected()&&t.mapOver.isCollection&&t.terminal.resetMapping()}}),h=e.View.extend({setupMappingView:function(e){var t=new this.terminalMappingClass({terminal:e}),n=new this.terminalMappingViewClass({model:t});n.render(),e.terminalMappingView=n,this.terminalMappingView=n},terminalElements:function(){return this.terminalMappingView?[this.terminalMappingView.el,this.el]:[this.el]}}),f=h.extend({className:"terminal input-terminal",initialize:function(e){var t=e.node,n=e.input,i=n.name,r=this.terminalForInput(n);r.multiple||this.setupMappingView(r),this.el.terminal=r,r.node=t,r.name=i,t.input_terminals[i]=r},events:{dropinit:"onDropInit",dropstart:"onDropStart",dropend:"onDropEnd",drop:"onDrop",hover:"onHover"},onDropInit:function(e,t){var n=this.el.terminal;return r(t.drag).hasClass("output-terminal")&&n.canAccept(t.drag.terminal)},onDropStart:function(e,t){t.proxy.terminal&&(t.proxy.terminal.connectors[0].inner_color="#BBFFBB")},onDropEnd:function(e,t){t.proxy.terminal&&(t.proxy.terminal.connectors[0].inner_color="#FFFFFF")},onDrop:function(e,t){var n=this.el.terminal;new c.default(t.drag.terminal,n).redraw()},onHover:function(){var e=this.el,t=e.terminal;if(t.connectors.length>0){var n=r("
    ").css({display:"none"}).appendTo("body").append(r("
    ").append(r("
    ").addClass("fa-icon-button fa fa-times").click(function(){r.each(t.connectors,function(e,t){t&&t.destroy()}),n.remove()}))).bind("mouseleave",function(){r(this).remove()});n.css({top:r(e).offset().top-2,left:r(e).offset().left-n.width(),"padding-right":r(e).width()}).show()}}}),p=f.extend({terminalMappingClass:s.default.TerminalMapping,terminalMappingViewClass:u,terminalForInput:function(e){return new s.default.InputTerminal({element:this.el,input:e})}}),_=f.extend({terminalMappingClass:s.default.TerminalMapping,terminalMappingViewClass:u,terminalForInput:function(e){return new s.default.InputCollectionTerminal({element:this.el,input:e})}}),g=h.extend({className:"terminal output-terminal",initialize:function(e){var t=e.node,n=e.output,i=n.name,r=this.terminalForOutput(n);this.setupMappingView(r),this.el.terminal=r,r.node=t,r.name=i,t.output_terminals[i]=r},events:{drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd"},onDrag:function(e,t){var n=function(){var e=r(t.proxy).offsetParent().offset(),n=t.offsetX-e.left,i=t.offsetY-e.top;r(t.proxy).css({left:n,top:i}),t.proxy.terminal.redraw(),window.workflow_globals.canvas_manager.update_viewport_overlay()};n(),r("#canvas-container").get(0).scroll_panel.test(e,n)},onDragStart:function(e,t){r(t.available).addClass("input-terminal-active"),window.workflow_globals.workflow.check_changes_in_active_form();var n=r('
    ').appendTo("#canvas-container").get(0);n.terminal=new s.default.OutputTerminal({element:n});var i=new c.default;return i.dragging=!0,i.connect(this.el.terminal,n.terminal),n},onDragEnd:function(e,t){var n=t.proxy.terminal.connectors[0];n&&n.destroy(),r(t.proxy).remove(),r(t.available).removeClass("input-terminal-active"),r("#canvas-container").get(0).scroll_panel.stop()}}),m=g.extend({terminalMappingClass:s.default.TerminalMapping,terminalMappingViewClass:d,terminalForOutput:function(e){var t=e.extensions;return new s.default.OutputTerminal({element:this.el,datatypes:t})}}),v=g.extend({terminalMappingClass:s.default.TerminalMapping,terminalMappingViewClass:d,terminalForOutput:function(e){var t=e.collection_type,n=e.collection_type_source;return new s.default.OutputCollectionTerminal({element:this.el,collection_type:t,collection_type_source:n,datatypes:e.extensions})}});t.default={InputTerminalView:p,OutputTerminalView:m,InputCollectionTerminalView:_,OutputCollectionTerminalView:v}}).call(t,n(2),n(1),n(0))},291:function(e,t,n){"use strict";(function(e,n,i){function r(e){this.collectionType=e,this.isCollection=!0,this.rank=e.split(":").length}Object.defineProperty(t,"__esModule",{value:!0}),window.workflow_globals=window.workflow_globals||{};var a={isCollection:!1,canMatch:function(e){return!1},canMapOver:function(e){return!1},toString:function(){return"NullCollectionType[]"},append:function(e){return e},equal:function(e){return e===this}},o={isCollection:!0,canMatch:function(e){return a!==e},canMapOver:function(e){return!1},toString:function(){return"AnyCollectionType[]"},append:function(e){throw"Cannot append to ANY_COLLECTION_TYPE_DESCRIPTION"},equal:function(e){return e===this}};e.extend(r.prototype,{append:function(e){return e===a?this:e===o?otherCollectionType:new r(this.collectionType+":"+e.collectionType)},canMatch:function(e){return e!==a&&(e===o||e.collectionType==this.collectionType)},canMapOver:function(e){if(e===a)return!1;if(e===o)return!1;if(this.rank<=e.rank)return!1;var t=e.collectionType;return this._endsWith(this.collectionType,t)},effectiveMapOver:function(e){var t=e.collectionType;return new r(this.collectionType.substring(0,this.collectionType.length-t.length-1))},equal:function(e){return e.collectionType==this.collectionType},toString:function(){return"CollectionType["+this.collectionType+"]"},_endsWith:function(e,t){return-1!==e.indexOf(t,e.length-t.length)}});var s=n.Model.extend({initialize:function(e){this.mapOver=e.mapOver||a,this.terminal=e.terminal,this.terminal.terminalMapping=this},disableMapOver:function(){this.setMapOver(a)},setMapOver:function(e){this.mapOver=e,this.trigger("change")}}),l=n.Model.extend({initialize:function(e){this.element=e.element,this.connectors=[]},connect:function(e){this.connectors.push(e),this.node&&this.node.markChanged()},disconnect:function(t){this.connectors.splice(e.inArray(t,this.connectors),1),this.node&&(this.node.markChanged(),this.resetMappingIfNeeded())},redraw:function(){e.each(this.connectors,function(e,t){t.redraw()})},destroy:function(){e.each(this.connectors.slice(),function(e,t){t.destroy()})},destroyInvalidConnections:function(){i.each(this.connectors,function(e){e&&e.destroyIfInvalid()})},setMapOver:function(e){this.multiple||this.mapOver().equal(e)||(this.terminalMapping.setMapOver(e),i.each(this.node.output_terminals,function(t){t.setMapOver(e)}))},mapOver:function(){return this.terminalMapping?this.terminalMapping.mapOver:a},isMappedOver:function(){return this.terminalMapping&&this.terminalMapping.mapOver.isCollection},resetMapping:function(){this.terminalMapping.disableMapOver()},resetMappingIfNeeded:function(){}}),c=l.extend({initialize:function(e){l.prototype.initialize.call(this,e),this.datatypes=e.datatypes},resetMappingIfNeeded:function(){this.node.hasConnectedOutputTerminals()||this.node.hasConnectedMappedInputTerminals()||i.each(this.node.mappedInputTerminals(),function(e){e.resetMappingIfNeeded()}),!this.node.hasMappedOverInputTerminals()&&this.resetMapping()},resetMapping:function(){this.terminalMapping.disableMapOver(),i.each(this.connectors,function(e){var t=e.handle2;t&&(t.resetMappingIfNeeded(),e.destroyIfInvalid())})}}),d=l.extend({initialize:function(e){l.prototype.initialize.call(this,e),this.update(e.input)},canAccept:function(e){return!this._inputFilled()&&this.attachable(e)},resetMappingIfNeeded:function(){this.mapOver().isCollection&&((this.node.hasConnectedMappedInputTerminals()||!this.node.hasConnectedOutputTerminals())&&this.resetMapping())},resetMapping:function(){this.terminalMapping.disableMapOver(),this.node.hasMappedOverInputTerminals()||i.each(this.node.output_terminals,function(e){e.resetMapping()})},connected:function(){return 0!==this.connectors.length},_inputFilled:function(){var e;return this.connected()?this.multiple?this._collectionAttached()?inputsFilled=!0:e=!1:e=!0:e=!1,e},_collectionAttached:function(){if(this.connected()){var e=this.connectors[0].handle1;return!!e&&!!(e.isCollection||e.isMappedOver()||e.datatypes.indexOf("input_collection")>0)}return!1},_mappingConstraints:function(){if(!this.node)return[];var e=this.mapOver();if(e.isCollection)return[e];var t=[];return this.node.hasConnectedOutputTerminals()?t.push(i.first(i.values(this.node.output_terminals)).mapOver()):i.each(this.node.connectedMappedInputTerminals(),function(e){t.push(e.mapOver())}),t},_producesAcceptableDatatype:function(e){for(var t in this.datatypes){var n=this.datatypes[t];if("input"==n)return!0;var i=new Array;if(i=i.concat(e.datatypes),e.node.post_job_actions)for(var r in e.node.post_job_actions){var a=e.node.post_job_actions[r];"ChangeDatatypeAction"!=a.action_type||""!=a.output_name&&a.output_name!=e.name||!a.action_arguments||i.push(a.action_arguments.newtype)}for(var o in i){var s=i[o];if("input"==s||"_sniff_"==s||"input_collection"==s||window.workflow_globals.app.isSubType(i[o],n))return!0}}return!1},_otherCollectionType:function(e){var t=a;e.isCollection&&(t=e.collectionType);var n=e.mapOver();return n.isCollection&&(t=n.append(t)),t}}),u=d.extend({update:function(e){this.datatypes=e.extensions,this.multiple=e.multiple,this.collection=!1},connect:function(e){d.prototype.connect.call(this,e);var t=e.handle1;if(t){var n=this._otherCollectionType(t);n.isCollection&&this.setMapOver(n)}},attachable:function(e){var t=this._otherCollectionType(e),n=this.mapOver();if(t.isCollection){if(this.multiple)return!(this.connected()&&!this._collectionAttached())&&(1==t.rank&&this._producesAcceptableDatatype(e));if(n.isCollection&&n.canMatch(t))return this._producesAcceptableDatatype(e);return!!this._mappingConstraints().every(i.bind(t.canMatch,t))&&this._producesAcceptableDatatype(e)}return!n.isCollection&&this._producesAcceptableDatatype(e)}}),h=d.extend({update:function(e){this.multiple=!1,this.collection=!0,this.datatypes=e.extensions;var t=[];e.collection_types?i.each(e.collection_types,function(e){t.push(new r(e))}):t.push(o),this.collectionTypes=t},connect:function(e){d.prototype.connect.call(this,e);var t=e.handle1;if(t){var n=this._effectiveMapOver(t);this.setMapOver(n)}},_effectiveMapOver:function(e){var t=this.collectionTypes,n=this._otherCollectionType(e);if(!i.some(t,function(e){return e.canMatch(n)}))for(var r in t){var o=t[r];if(n.canMapOver(o)){var s=n.effectiveMapOver(o);if(s!=a)return s}}return a},_effectiveCollectionTypes:function(){var e=this.mapOver();return i.map(this.collectionTypes,function(t){return e.append(t)})},attachable:function(e){var t=this._otherCollectionType(e);if(t.isCollection){var n=this._effectiveCollectionTypes(),r=this.mapOver();if(i.some(n,function(e){return e.canMatch(t)}))return this._producesAcceptableDatatype(e);if(r.isCollection)return!1;if(i.some(this.collectionTypes,function(e){return t.canMapOver(e)})){var a=this._effectiveMapOver(e);if(!a.isCollection)return!1;if(this._mappingConstraints().every(a.canMatch))return this._producesAcceptableDatatype(e)}}return!1}}),f=l.extend({initialize:function(e){if(l.prototype.initialize.call(this,e),this.datatypes=e.datatypes,e.collection_type)this.collectionType=new r(e.collection_type);else{e.collection_type_source||console.log("Warning: No collection type or collection type source defined."),this.collectionType=o}this.isCollection=!0},update:function(e){var t;if(e.collection_type)t=new r(e.collection_type);else{e.collection_type_source||console.log("Warning: No collection type or collection type source defined."),t=o}t.collectionType!=this.collectionType.collectionType&&i.each(this.connectors,function(e){e.destroy()}),this.collectionType=t}});t.default={InputTerminal:u,OutputTerminal:c,InputCollectionTerminal:h,OutputCollectionTerminal:f,TerminalMapping:s,CollectionTypeDescription:r,NULL_COLLECTION_TYPE_DESCRIPTION:a,ANY_COLLECTION_TYPE_DESCRIPTION:o}}).call(t,n(0),n(2),n(1))},292:function(e,t,n){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0}),window.workflow_globals=window.workflow_globals||{};var i=e.View.extend({className:"form-row dataRow input-data-row",initialize:function(e){this.input=e.input,this.nodeView=e.nodeView,this.terminalElement=e.terminalElement,this.$el.attr("name",this.input.name).html(this.input.label),e.skipResize||(this.$el.css({position:"absolute",left:-1e3,top:-1e3,display:"none"}),n("body").append(this.el),this.nodeView.updateMaxWidth(this.$el.outerWidth()),this.$el.css({position:"",left:"",top:"",display:""}),this.$el.remove())}}),r=e.View.extend({className:"form-row dataRow",initialize:function(e){this.output=e.output,this.terminalElement=e.terminalElement,this.nodeView=e.nodeView;var t=this.output,i=t.name,r=this.nodeView.node;if(t.extensions.indexOf("input")>=0||t.extensions.indexOf("input_collection")>=0||(i=i+" ("+t.extensions.join(", ")+")"),this.$el.html(i),this.calloutView=null,["tool","subworkflow"].indexOf(r.type)>=0){var o=new a({label:i,output:t,node:r});this.calloutView=o,this.$el.append(o.el),this.$el.hover(function(){o.hoverImage()},function(){o.resetImage()})}this.$el.css({position:"absolute",left:-1e3,top:-1e3,display:"none"}),n("body").append(this.el),this.nodeView.updateMaxWidth(this.$el.outerWidth()+17),this.$el.css({position:"",left:"",top:"",display:""}).detach()},redrawWorkflowOutput:function(){this.calloutView&&this.calloutView.resetImage()}}),a=e.View.extend({tagName:"div",initialize:function(e){this.label=e.label,this.node=e.node,this.output=e.output;var t=this,i=this.node;this.$el.attr("class","callout "+this.label).css({display:"none"}).append(n("
    ").append(n("").attr("src",Galaxy.root+"static/images/fugue/asterisk-small-outline.png").click(function(){var e=t.output.name;i.isWorkflowOutput(e)?(i.removeWorkflowOutput(e),t.$("img").attr("src",Galaxy.root+"static/images/fugue/asterisk-small-outline.png")):(i.addWorkflowOutput(e),t.$("img").attr("src",Galaxy.root+"static/images/fugue/asterisk-small.png")),window.workflow_globals.workflow.has_changes=!0,window.workflow_globals.canvas_manager.draw_overview()}))).tooltip({delay:500,title:"Mark dataset as a workflow output. All unmarked datasets will be hidden."}),this.$el.css({top:"50%",margin:"-8px 0px 0px 0px",right:8}),this.$el.show(),this.resetImage()},resetImage:function(){this.node.isWorkflowOutput(this.output.name)?this.$("img").attr("src",Galaxy.root+"static/images/fugue/asterisk-small.png"):this.$("img").attr("src",Galaxy.root+"static/images/fugue/asterisk-small-outline.png")},hoverImage:function(){this.$("img").attr("src",Galaxy.root+"static/images/fugue/asterisk-small-yellow.png")}});t.default={DataInputView:i,DataOutputView:r}}).call(t,n(2),n(0))},293:function(e,t,n){"use strict";(function(e,i){function r(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.model.attributes,n=t.workflow,i=t.node;t.inputs.unshift({type:"text",name:"__annotation",label:"Annotation",fixed:!0,value:i.annotation,area:!0,help:"Add an annotation or notes to this step. Annotations are available when a workflow is viewed."}),t.inputs.unshift({type:"text",name:"__label",label:"Label",value:i.label,help:"Add a step label.",fixed:!0,onchange:function(t){var r=!1;for(var a in n.nodes){var o=n.nodes[a];if(o.label&&o.label==t&&o.id!=i.id){r=!0;break}}var s=e.data.match("__label");e.element_list[s].model.set("error_text",r&&"Duplicate label. Please fix this before saving the workflow."),e.trigger("change")}})}function o(e,t,n,i){var r=i.node.post_job_actions;t=t||[],t.push(e);for(var a in e.inputs){var s=e.inputs[a];if(s.action){if(s.name="pja__"+n+"__"+s.action,s.pja_arg&&(s.name+="__"+s.pja_arg),s.payload)for(var l in s.payload)s.payload[s.name+"__"+l]=s.payload[l],delete s.payload[l];var c=r[s.action+n];if(c){for(var d in t)t[d].expanded=!0;s.pja_arg?s.value=c.action_arguments&&c.action_arguments[s.pja_arg]||s.value:s.value="true"}}s.inputs&&o(s,t.slice(0),n,i)}}function s(e,t){var n=[],i=[],r=t.datatypes,a=t.node,s=t.workflow;for(var l in r)n.push({0:r[l],1:r[l]});for(l in a.input_terminals)i.push(a.input_terminals[l].name);n.sort(function(e,t){return e.label>t.label?1:e.labelhere
    for more information. Valid inputs are: '+i.join(", ")+"."},{action:"ChangeDatatypeAction",pja_arg:"newtype",label:"Change datatype",type:"select",ignore:"__empty__",value:"__empty__",options:n,help:"This action will change the datatype of the output to the indicated value."},{action:"TagDatasetAction",pja_arg:"tags",label:"Add Tags",type:"text",value:"",ignore:"",help:"This action will set tags for the dataset."},{action:"RemoveTagDatasetAction",pja_arg:"tags",label:"Remove Tags",type:"text",value:"",ignore:"",help:"This action will remove tags for the dataset."},{title:"Assign columns",type:"section",flat:!0,inputs:[{action:"ColumnSetAction",pja_arg:"chromCol",label:"Chrom column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",pja_arg:"startCol",label:"Start column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",pja_arg:"endCol",label:"End column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",pja_arg:"strandCol",label:"Strand column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",pja_arg:"nameCol",label:"Name column",type:"integer",value:"",ignore:""}],help:"This action will set column assignments in the output dataset. Blank fields are ignored."}]};return o(d,[],e,t),d}function l(e){var t=e.model.attributes,n=t.inputs,i=t.node,r=i.post_job_actions,a=i.output_terminals&&Object.keys(i.output_terminals)[0];if(a){n.push({name:"pja__"+a+"__EmailAction",label:"Email notification",type:"boolean",value:String(Boolean(r["EmailAction"+a])),ignore:"false",help:"An email notification will be sent when the job has completed.",payload:{host:window.location.host}}),n.push({name:"pja__"+a+"__DeleteIntermediatesAction",label:"Output cleanup",type:"boolean",value:String(Boolean(r["DeleteIntermediatesAction"+a])),ignore:"false",help:"Upon completion of this step, delete non-starred outputs from completed workflow steps if they are no longer required as inputs."});for(var o in i.output_terminals)n.push(s(o,t))}}Object.defineProperty(t,"__esModule",{value:!0});var c=n(3),d=r(c),u=n(11),h=r(u),f=n(45),p=r(f),_=e.View.extend({initialize:function(e){var t=this,n=e.node;this.form=new h.default(d.default.merge(e,{onchange:function(){d.default.request({type:"POST",url:Galaxy.root+"api/workflows/build_module",data:{id:n.id,type:n.type,content_id:n.content_id,inputs:t.form.data.create()},success:function(e){n.update_field_data(e)}})}})),a(this.form),this.form.render()}}),g=e.View.extend({initialize:function(e){var t=this,n=e.node;this.form=new p.default(d.default.merge(e,{text_enable:"Set in Advance",text_disable:"Set at Runtime",narrow:!0,initial_errors:!0,cls:"ui-portlet-narrow",initialmodel:function(e,n){t._customize(n),e.resolve()},buildmodel:function(e,t){t.model.get("postchange")(e,t)},postchange:function(e,r){var a=r.model.attributes,o={tool_id:a.id,tool_version:a.version,type:"tool",inputs:i.extend(!0,{},r.data.create())};Galaxy.emit.debug("tool-form-workflow::postchange()","Sending current state.",o),d.default.request({type:"POST",url:Galaxy.root+"api/workflows/build_module",data:o,success:function(i){r.model.set(i.config_form),t._customize(r),r.update(i.config_form),r.errors(i.config_form),n.update_field_data(i),Galaxy.emit.debug("tool-form-workflow::postchange()","Received new model.",i),e.resolve()},error:function(t){Galaxy.emit.debug("tool-form-workflow::postchange()","Refresh request failed.",t),e.reject()}})}}))},_customize:function(e){var t=e.model.attributes;d.default.deepeach(t.inputs,function(e){e.type&&(-1!=["data","data_collection"].indexOf(e.type)?(e.type="hidden",e.info="Data input '"+e.name+"' ("+d.default.textify(e.extensions)+")",e.value={__class__:"RuntimeValue"}):e.fixed||(e.collapsible_value={__class__:"RuntimeValue"},e.is_workflow=e.options&&0===e.options.length||-1!=["integer","float"].indexOf(e.type)))}),d.default.deepeach(t.inputs,function(e){"conditional"===e.type&&(e.test_param.collapsible_value=void 0)}),l(e),a(e)}});t.default={Default:_,Tool:g}}).call(t,n(2),n(0))},294:function(e,t,n){"use strict";(function(e,i){function r(e){return e&&e.__esModule?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),s=a(o),l=n(295),c=a(l),d=n(27),u=r(d),h=n(3),f=r(h),p=n(37),_=r(p),g=n(41),m=r(g);n(40);var v=e.Model.extend({is_visible:function(e,t){var n=e.getBoundingClientRect(),r=i("svg")[0].getBoundingClientRect();return!(n.right<0||n.left>r.right||n.bottom<0||n.top>r.bottom)}}),y={drawTicks:function(e,t,n,i,r){var a=e.append("g").selectAll("g").data(t).enter().append("g").selectAll("g").data(n).enter().append("g").attr("class","tick").attr("transform",function(e){return"rotate("+(180*e.angle/Math.PI-90)+")translate("+e.radius+",0)"}),o=[],s=[],l=function(e){return e.angle>Math.PI?"end":null};return r?(o=[0,0,0,-4],s=[4,0,"",".35em"],l=null):(o=[1,0,4,0],s=[0,4,".35em",""]),a.append("line").attr("x1",o[0]).attr("y1",o[1]).attr("x2",o[2]).attr("y1",o[3]).style("stroke","#000"),a.append("text").attr("x",s[0]).attr("y",s[1]).attr("dx",s[2]).attr("dy",s[3]).attr("text-anchor",l).attr("transform",i).text(function(e){return e.label})},formatNum:function(e,t){if(void 0===t&&(t=2),null===e)return null;var n=null;if(Math.abs(e)<1)n=e.toPrecision(t);else{var i=Math.round(e.toPrecision(t));e=Math.abs(e),e<1e3?n=i:e<1e6?n=Math.round((i/1e3).toPrecision(3)).toFixed(0)+"K":e<1e9&&(n=Math.round((i/1e6).toPrecision(3)).toFixed(0)+"M")}return n}},b=e.Model.extend({}),w=e.View.extend({className:"circster",initialize:function(e){this.genome=e.genome,this.label_arc_height=50,this.scale=1,this.circular_views=null,this.chords_views=null,this.model.get("drawables").on("add",this.add_track,this),this.model.get("drawables").on("remove",this.remove_track,this);var t=this.model.get("config");t.get("arc_dataset_height").on("change:value",this.update_track_bounds,this),t.get("track_gap").on("change:value",this.update_track_bounds,this)},get_circular_tracks:function(){return this.model.get("drawables").filter(function(e){return"DiagonalHeatmapTrack"!==e.get("track_type")})},get_chord_tracks:function(){return this.model.get("drawables").filter(function(e){return"DiagonalHeatmapTrack"===e.get("track_type")})},get_tracks_bounds:function(){var e=this.get_circular_tracks(),t=this.model.get("config").get_value("arc_dataset_height"),n=this.model.get("config").get_value("track_gap"),i=Math.min(this.$el.width(),this.$el.height())-20,r=i/2-e.length*(t+n)+n-this.label_arc_height,a=c.range(r,i/2,t+n);return s.map(a,function(e){return[e,e+t]})},render:function(){var e=this,t=e.$el.width(),n=e.$el.height(),i=this.get_circular_tracks(),r=this.get_chord_tracks(),a=e.model.get("config").get_value("total_gap"),o=this.get_tracks_bounds(),s=c.select(e.$el[0]).append("svg").attr("width",t).attr("height",n).attr("pointer-events","all").append("svg:g").call(c.behavior.zoom().on("zoom",function(){var t=c.event.scale;s.attr("transform","translate("+c.event.translate+") scale("+t+")"),e.scale!==t&&(e.zoom_drag_timeout&&clearTimeout(e.zoom_drag_timeout),e.zoom_drag_timeout=setTimeout(function(){},400))})).attr("transform","translate("+t/2+","+n/2+")").append("svg:g").attr("class","tracks");this.circular_views=i.map(function(t,n){var i=new M({el:s.append("g")[0],track:t,radius_bounds:o[n],genome:e.genome,total_gap:a});return i.render(),i}),this.chords_views=r.map(function(t){var n=new C({el:s.append("g")[0],track:t,radius_bounds:o[0],genome:e.genome,total_gap:a});return n.render(),n});var l=this.circular_views[this.circular_views.length-1].radius_bounds[1],d=[l,l+this.label_arc_height];this.label_track_view=new k({el:s.append("g")[0],track:new b,radius_bounds:d,genome:e.genome,total_gap:a}),this.label_track_view.render()},add_track:function(e){var t=this.model.get("config").get_value("total_gap");if("DiagonalHeatmapTrack"===e.get("track_type")){var n=this.circular_views[0].radius_bounds,i=new C({el:c.select("g.tracks").append("g")[0],track:e,radius_bounds:n,genome:this.genome,total_gap:t});i.render(),this.chords_views.push(i)}else{var r=this.get_tracks_bounds();s.each(this.circular_views,function(e,t){e.update_radius_bounds(r[t])}),s.each(this.chords_views,function(e){e.update_radius_bounds(r[0])});var a=this.circular_views.length,o=new M({el:c.select("g.tracks").append("g")[0],track:e,radius_bounds:r[a],genome:this.genome,total_gap:t});o.render(),this.circular_views.push(o)}},remove_track:function(e,t,n){var i=this.circular_views[n.index];this.circular_views.splice(n.index,1),i.$el.remove();var r=this.get_tracks_bounds();s.each(this.circular_views,function(e,t){e.update_radius_bounds(r[t])})},update_track_bounds:function(){var e=this.get_tracks_bounds();s.each(this.circular_views,function(t,n){t.update_radius_bounds(e[n])}),s.each(this.chords_views,function(t){t.update_radius_bounds(e[0])})}}),x=e.View.extend({tagName:"g",initialize:function(e){this.bg_stroke="#ddd",this.loading_bg_fill="#ffc",this.bg_fill="#ddd",this.total_gap=e.total_gap,this.track=e.track,this.radius_bounds=e.radius_bounds,this.genome=e.genome,this.chroms_layout=this._chroms_layout(),this.data_bounds=[],this.scale=1,this.parent_elt=c.select(this.$el[0])},get_fill_color:function(){var e=this.track.get("config").get_value("block_color");return e||(e=this.track.get("config").get_value("color")),e},render:function(){var e=this.parent_elt,t=this.chroms_layout,n=c.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]),r=e.selectAll("g").data(t).enter().append("svg:g"),a=r.append("path").attr("d",n).attr("class","chrom-background").style("stroke",this.bg_stroke).style("fill",this.loading_bg_fill);a.append("title").text(function(e){return e.data.chrom});var o=this,s=o.track.get("data_manager"),l=!s||s.data_is_ready();i.when(l).then(function(){i.when(o._render_data(e)).then(function(){a.style("fill",o.bg_fill),o.render_labels()})})},render_labels:function(){},update_radius_bounds:function(e){this.radius_bounds=e;var t=c.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]);this.parent_elt.selectAll("g>path.chrom-background").transition().duration(1e3).attr("d",t),this._transition_chrom_data(),this._transition_labels()},update_scale:function(e){var t=this.scale;if(this.scale=e,!(e<=t)){var n=this,r=new v;return this.parent_elt.selectAll("path.chrom-data").filter(function(e,t){return r.is_visible(this)}).each(function(t,r){var a,o=c.select(this),l=o.attr("chrom"),d=n.genome.get_chrom_region(l),u=n.track.get("data_manager");u.can_get_more_detailed_data(d)&&(a=n.track.get("data_manager").get_more_detailed_data(d,"Coverage",0,e),i.when(a).then(function(e){o.remove(),n._update_data_bounds();var t=s.find(n.chroms_layout,function(e){return e.data.chrom===l}),i=n.get_fill_color();n._render_chrom_data(n.parent_elt,t,e).style("stroke",i).style("fill",i)}))}),n}},_transition_chrom_data:function(){var e=this.track,t=this.chroms_layout,n=this.parent_elt.selectAll("g>path.chrom-data");if(n[0].length>0){var r=this;i.when(e.get("data_manager").get_genome_wide_data(this.genome)).then(function(i){var a=s.reject(s.map(i,function(e,n){var i=null,a=r._get_path_function(t[n],e);return a&&(i=a(e.data)),i}),function(e){return null===e}),o=e.get("config").get_value("color");n.each(function(e,t){c.select(this).transition().duration(1e3).style("stroke",o).style("fill",o).attr("d",a[t])})})}},_transition_labels:function(){},_update_data_bounds:function(e){this.data_bounds;this.data_bounds=e||this.get_data_bounds(this.track.get("data_manager").get_genome_wide_data(this.genome)),this._transition_chrom_data()},_render_data:function(e){var t=this,n=this.chroms_layout,r=this.track,a=i.Deferred();return i.when(r.get("data_manager").get_genome_wide_data(this.genome)).then(function(i){t.data_bounds=t.get_data_bounds(i),r.get("config").set_value("min_value",t.data_bounds[0],{silent:!0}),r.get("config").set_value("max_value",t.data_bounds[1],{silent:!0});var o=s.zip(n,i);s.each(o,function(n){var i=n[0],r=n[1];return t._render_chrom_data(e,i,r)});var l=t.get_fill_color();t.parent_elt.selectAll("path.chrom-data").style("stroke",l).style("fill",l),a.resolve(e)}),a},_render_chrom_data:function(e,t,n){},_get_path_function:function(e,t){},_chroms_layout:function(){var e=this.genome.get_chroms_info(),t=c.layout.pie().value(function(e){return e.len}).sort(null),n=t(e),i=2*Math.PI*this.total_gap/e.length;return s.map(n,function(e,t){var n=e.endAngle-i;return e.endAngle=n>e.startAngle?n:e.startAngle,e})}}),k=x.extend({initialize:function(e){x.prototype.initialize.call(this,e),this.innerRadius=this.radius_bounds[0],this.radius_bounds[0]=this.radius_bounds[1],this.bg_stroke="#fff",this.bg_fill="#fff",this.min_arc_len=.05},_render_data:function(e){var t=this,n=e.selectAll("g");n.selectAll("path").attr("id",function(e){return"label-"+e.data.chrom}),n.append("svg:text").filter(function(e){return e.endAngle-e.startAngle>t.min_arc_len}).attr("text-anchor","middle").append("svg:textPath").attr("class","chrom-label").attr("xlink:href",function(e){return"#label-"+e.data.chrom}).attr("startOffset","25%").text(function(e){return e.data.chrom});var i=function(e){var n=(e.endAngle-e.startAngle)/e.value,i=c.range(0,e.value,25e6).map(function(i,r){return{radius:t.innerRadius,angle:i*n+e.startAngle,label:0===r?0:r%3?null:t.formatNum(i)}});return i.length<4&&(i[i.length-1].label=t.formatNum(Math.round((i[i.length-1].angle-e.startAngle)/n))),i},r=function(e){return e.angle>Math.PI?"rotate(180)translate(-16)":null},a=s.filter(this.chroms_layout,function(e){return e.endAngle-e.startAngle>t.min_arc_len});this.drawTicks(this.parent_elt,a,i,r)}});s.extend(k.prototype,y);var j=x.extend({initialize:function(e){x.prototype.initialize.call(this,e);var t=this.track.get("config");t.get("min_value").on("change:value",this._update_min_max,this),t.get("max_value").on("change:value",this._update_min_max,this),t.get("color").on("change:value",this._transition_chrom_data,this)},_update_min_max:function(){var e=this.track.get("config"),t=[e.get_value("min_value"),e.get_value("max_value")];this._update_data_bounds(t),this.parent_elt.selectAll(".min_max").text(function(e,n){return t[n]})},_quantile:function(e,t){return e.sort(c.ascending),c.quantile(e,t)},_render_chrom_data:function(e,t,n){var i=this._get_path_function(t,n);return i?e.datum(n.data).append("path").attr("class","chrom-data").attr("chrom",t.data.chrom).attr("d",i):null},_get_path_function:function(e,t){if("string"==typeof t||!t.data||0===t.data.length)return null;var n=c.scale.linear().domain(this.data_bounds).range(this.radius_bounds).clamp(!0),i=c.scale.linear().domain([0,t.data.length]).range([e.startAngle,e.endAngle]),r=c.svg.line.radial().interpolate("linear").radius(function(e){return n(e[1])}).angle(function(e,t){return i(t)});return c.svg.area.radial().interpolate(r.interpolate()).innerRadius(n(0)).outerRadius(r.radius()).angle(r.angle())},render_labels:function(){var e=this,t=function(){return"rotate(90)"},n=this.drawTicks(this.parent_elt,[this.chroms_layout[0]],this._data_bounds_ticks_fn(),t,!0).classed("min_max",!0);s.each(n,function(t){i(t).click(function(){new _.default.ConfigSettingCollectionView({collection:e.track.get("config")}).render_in_modal("Configure Track")})})},_transition_labels:function(){if(0!==this.data_bounds.length){var e=this,t=s.filter(this.chroms_layout,function(e){return e.endAngle-e.startAngle>.08}),n=s.filter(t,function(e,t){return t%3==0}),i=s.flatten(s.map(n,function(t){return e._data_bounds_ticks_fn()(t)}));this.parent_elt.selectAll("g.tick").data(i).transition().attr("transform",function(e){return"rotate("+(180*e.angle/Math.PI-90)+")translate("+e.radius+",0)"})}},_data_bounds_ticks_fn:function(){var e=this;return visibleChroms=0,function(t){return[{radius:e.radius_bounds[0],angle:t.startAngle,label:e.formatNum(e.data_bounds[0])},{radius:e.radius_bounds[1],angle:t.startAngle,label:e.formatNum(e.data_bounds[1])}]}},get_data_bounds:function(e){}});s.extend(j.prototype,y);var M=j.extend({get_data_bounds:function(e){var t=s.flatten(s.map(e,function(e){return e?s.map(e.data,function(e){return parseInt(e[1],10)||0}):0}));return[s.min(t),this._quantile(t,.98)||s.max(t)]}}),C=x.extend({render:function(){var e=this;i.when(e.track.get("data_manager").data_is_ready()).then(function(){i.when(e.track.get("data_manager").get_genome_wide_data(e.genome)).then(function(t){var n=[],i=e.genome.get_chroms_info();s.each(t,function(t,r){var a=i[r].chrom,o=s.map(t.data,function(t){var n=e._get_region_angle(a,t[1]),i=e._get_region_angle(t[3],t[4]);return{source:{startAngle:n,endAngle:n+.01},target:{startAngle:i,endAngle:i+.01}}});n=n.concat(o)}),e.parent_elt.append("g").attr("class","chord").selectAll("path").data(n).enter().append("path").style("fill",e.get_fill_color()).attr("d",c.svg.chord().radius(e.radius_bounds[0])).style("opacity",1)})})},update_radius_bounds:function(e){this.radius_bounds=e,this.parent_elt.selectAll("path").transition().attr("d",c.svg.chord().radius(this.radius_bounds[0]))},_get_region_angle:function(e,t){var n=s.find(this.chroms_layout,function(t){return t.data.chrom===e});return n.endAngle-(n.endAngle-n.startAngle)*(n.data.len-t)/n.data.len}}),S=e.View.extend({initialize:function(){f.default.cssLoadFile("static/style/circster.css");var e=new u.default.Genome(galaxy_config.app.genome),t=new u.default.GenomeVisualization(galaxy_config.app.viz_config);t.get("config").add([{key:"arc_dataset_height",label:"Arc Dataset Height",type:"int",value:25,view:"circster"},{key:"track_gap",label:"Gap Between Tracks",type:"int",value:5,view:"circster"},{key:"total_gap",label:"Gap [0-1]",type:"float",value:.4,view:"circster",hidden:!0}]),new w({el:i("#center .unified-panel-body"),genome:e,model:t}).render(),i("#center .unified-panel-header-inner").append(galaxy_config.app.viz_config.title+" "+galaxy_config.app.viz_config.dbkey);var n=m.default.create_icon_buttons_menu([{icon_class:"plus-button",title:"Add tracks",on_click:function(){u.default.select_datasets({dbkey:t.get("dbkey")},function(e){t.add_tracks(e)})}},{icon_class:"gear",title:"Settings",on_click:function(){new _.default.ConfigSettingCollectionView({collection:t.get("config")}).render_in_modal("Configure Visualization")}},{icon_class:"disk--arrow",title:"Save",on_click:function(){Galaxy.modal.show({title:"Saving...",body:"progress"}),i.ajax({url:Galaxy.root+"visualization/save",type:"POST",dataType:"json",data:{id:t.get("vis_id"),title:t.get("title"),dbkey:t.get("dbkey"),type:"trackster",vis_json:JSON.stringify(t)}}).success(function(e){Galaxy.modal.hide(),t.set("vis_id",e.vis_id)}).error(function(){Galaxy.modal.show({title:"Could Not Save",body:"Could not save visualization. Please try again later.",buttons:{Cancel:function(){Galaxy.modal.hide()}}})})}},{icon_class:"cross-circle",title:"Close",on_click:function(){window.location=Galaxy.root+"visualizations/list"}}],{tooltip_config:{placement:"bottom"}});n.$el.attr("style","float: right"),i("#center .unified-panel-header-inner").append(n.$el),i(".menu-button").tooltip({placement:"bottom"})}});t.default={GalaxyApp:S}}).call(t,n(2),n(0))},295:function(e,t,n){var i,r;!function(){function a(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}function s(e,t){return et?1:e>=t?0:NaN}function l(e){return null===e?NaN:+e}function c(e){return!isNaN(e)}function d(e){return{left:function(t,n,i,r){for(arguments.length<3&&(i=0),arguments.length<4&&(r=t.length);i>>1;e(t[a],n)<0?i=a+1:r=a}return i},right:function(t,n,i,r){for(arguments.length<3&&(i=0),arguments.length<4&&(r=t.length);i>>1;e(t[a],n)>0?r=a:i=a+1}return i}}}function u(e){return e.length}function h(e){for(var t=1;e*t%1;)t*=10;return t}function f(e,t){for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}function p(){this._=Object.create(null)}function _(e){return(e+="")===jo||e[0]===Mo?Mo+e:e}function g(e){return(e+="")[0]===Mo?e.slice(1):e}function m(e){return _(e)in this._}function v(e){return(e=_(e))in this._&&delete this._[e]}function y(){var e=[];for(var t in this._)e.push(g(t));return e}function b(){var e=0;for(var t in this._)++e;return e}function w(){for(var e in this._)return!1;return!0}function x(){this._=Object.create(null)}function k(e){return e}function j(e,t,n){return function(){var i=n.apply(t,arguments);return i===t?e:i}}function M(e,t){if(t in e)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var n=0,i=Co.length;n=t&&(t=r+1);!(o=s[t])&&++t0&&(e=e.slice(0,s));var c=Po.get(e);return c&&(e=c,l=Z),s?t?r:i:t?C:a}function Q(e,t){return function(n){var i=fo.event;fo.event=n,t[0]=this.__data__;try{e.apply(this,t)}finally{fo.event=i}}}function Z(e,t){var n=Q(e,t);return function(e){var t=this,i=e.relatedTarget;i&&(i===t||8&i.compareDocumentPosition(t))||n.call(t,e)}}function ee(e){var t=".dragsuppress-"+ ++Vo,n="click"+t,i=fo.select(o(e)).on("touchmove"+t,O).on("dragstart"+t,O).on("selectstart"+t,O);if(null==Ro&&(Ro=!("onselectstart"in e)&&M(e.style,"userSelect")),Ro){var r=a(e).style,s=r[Ro];r[Ro]="none"}return function(e){if(i.on(t,null),Ro&&(r[Ro]=s),e){var a=function(){i.on(n,null)};i.on(n,function(){O(),a()},!0),setTimeout(a,0)}}}function te(e,t){t.changedTouches&&(t=t.changedTouches[0]);var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();if(Eo<0){var r=o(e);if(r.scrollX||r.scrollY){n=fo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=n[0][0].getScreenCTM();Eo=!(a.f||a.e),n.remove()}}return Eo?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function ne(){return fo.event.changedTouches[0].identifier}function ie(e){return e>0?1:e<0?-1:0}function re(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function ae(e){return e>1?0:e<-1?Fo:Math.acos(e)}function oe(e){return e>1?Uo:e<-1?-Uo:Math.asin(e)}function se(e){return((e=Math.exp(e))-1/e)/2}function le(e){return((e=Math.exp(e))+1/e)/2}function ce(e){return((e=Math.exp(2*e))-1)/(e+1)}function de(e){return(e=Math.sin(e/2))*e}function ue(){}function he(e,t,n){return this instanceof he?(this.h=+e,this.s=+t,void(this.l=+n)):arguments.length<2?e instanceof he?new he(e.h,e.s,e.l):Ce(""+e,Se,he):new he(e,t,n)}function fe(e,t,n){function i(e){return e>360?e-=360:e<0&&(e+=360),e<60?a+(o-a)*e/60:e<180?o:e<240?a+(o-a)*(240-e)/60:a}function r(e){return Math.round(255*i(e))}var a,o;return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)?0:t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+t):n+t-n*t,a=2*n-o,new xe(r(e+120),r(e),r(e-120))}function pe(e,t,n){return this instanceof pe?(this.h=+e,this.c=+t,void(this.l=+n)):arguments.length<2?e instanceof pe?new pe(e.h,e.c,e.l):e instanceof ge?ve(e.l,e.a,e.b):ve((e=Te((e=fo.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new pe(e,t,n)}function _e(e,t,n){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new ge(n,Math.cos(e*=Jo)*t,Math.sin(e)*t)}function ge(e,t,n){return this instanceof ge?(this.l=+e,this.a=+t,void(this.b=+n)):arguments.length<2?e instanceof ge?new ge(e.l,e.a,e.b):e instanceof pe?_e(e.h,e.c,e.l):Te((e=xe(e)).r,e.g,e.b):new ge(e,t,n)}function me(e,t,n){var i=(e+16)/116,r=i+t/500,a=i-n/200;return r=ye(r)*ts,i=ye(i)*ns,a=ye(a)*is,new xe(we(3.2404542*r-1.5371385*i-.4985314*a),we(-.969266*r+1.8760108*i+.041556*a),we(.0556434*r-.2040259*i+1.0572252*a))}function ve(e,t,n){return e>0?new pe(Math.atan2(n,t)*Bo,Math.sqrt(t*t+n*n),e):new pe(NaN,NaN,e)}function ye(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function be(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function we(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function xe(e,t,n){return this instanceof xe?(this.r=~~e,this.g=~~t,void(this.b=~~n)):arguments.length<2?e instanceof xe?new xe(e.r,e.g,e.b):Ce(""+e,xe,fe):new xe(e,t,n)}function ke(e){return new xe(e>>16,e>>8&255,255&e)}function je(e){return ke(e)+""}function Me(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Ce(e,t,n){var i,r,a,o=0,s=0,l=0;if(i=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(r=i[2].split(","),i[1]){case"hsl":return n(parseFloat(r[0]),parseFloat(r[1])/100,parseFloat(r[2])/100);case"rgb":return t(Ae(r[0]),Ae(r[1]),Ae(r[2]))}return(a=os.get(e))?t(a.r,a.g,a.b):(null==e||"#"!==e.charAt(0)||isNaN(a=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===e.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),t(o,s,l))}function Se(e,t,n){var i,r,a=Math.min(e/=255,t/=255,n/=255),o=Math.max(e,t,n),s=o-a,l=(o+a)/2;return s?(r=l<.5?s/(o+a):s/(2-o-a),i=e==o?(t-n)/s+(t0&&l<1?0:i),new he(i,r,l)}function Te(e,t,n){e=Oe(e),t=Oe(t),n=Oe(n);var i=be((.4124564*e+.3575761*t+.1804375*n)/ts),r=be((.2126729*e+.7151522*t+.072175*n)/ns);return ge(116*r-16,500*(i-r),200*(r-be((.0193339*e+.119192*t+.9503041*n)/is)))}function Oe(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ae(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}function Ne(e){return"function"==typeof e?e:function(){return e}}function Ge(e){return function(t,n,i){return 2===arguments.length&&"function"==typeof n&&(i=n,n=null),Le(t,n,e,i)}}function Le(e,t,n,i){function r(){var e,t=l.status;if(!t&&Ie(l)||t>=200&&t<300||304===t){try{e=n.call(a,l)}catch(e){return void o.error.call(a,e)}o.load.call(a,e)}else o.error.call(a,l)}var a={},o=fo.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(e)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=r:l.onreadystatechange=function(){l.readyState>3&&r()},l.onprogress=function(e){var t=fo.event;fo.event=e;try{o.progress.call(a,l)}finally{fo.event=t}},a.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",a)},a.mimeType=function(e){return arguments.length?(t=null==e?null:e+"",a):t},a.responseType=function(e){return arguments.length?(c=e,a):c},a.response=function(e){return n=e,a},["get","post"].forEach(function(e){a[e]=function(){return a.send.apply(a,[e].concat(_o(arguments)))}}),a.send=function(n,i,r){if(2===arguments.length&&"function"==typeof i&&(r=i,i=null),l.open(n,e,!0),null==t||"accept"in s||(s.accept=t+",*/*"),l.setRequestHeader)for(var d in s)l.setRequestHeader(d,s[d]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=c&&(l.responseType=c),null!=r&&a.on("error",r).on("load",function(e){r(null,e)}),o.beforesend.call(a,l),l.send(null==i?null:i),a},a.abort=function(){return l.abort(),a},fo.rebind(a,o,"on"),null==i?a:a.get(De(i))}function De(e){return 1===e.length?function(t,n){e(null==t?n:null)}:e}function Ie(e){var t=e.responseType;return t&&"text"!==t?e.response:e.responseText}function Pe(e,t,n){var i=arguments.length;i<2&&(t=0),i<3&&(n=Date.now());var r=n+t,a={c:e,t:r,n:null};return ls?ls.n=a:ss=a,ls=a,cs||(ds=clearTimeout(ds),cs=1,us(Re)),a}function Re(){var e=Ve(),t=Ee()-e;t>24?(isFinite(t)&&(clearTimeout(ds),ds=setTimeout(Re,t)),cs=0):(cs=1,us(Re))}function Ve(){for(var e=Date.now(),t=ss;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Ee(){for(var e,t=ss,n=1/0;t;)t.c?(t.t8?function(e){return e/n}:function(e){return e*n},symbol:e}}function Fe(e){var t=e.decimal,n=e.thousands,i=e.grouping,r=e.currency,a=i&&n?function(e,t){for(var r=e.length,a=[],o=0,s=i[0],l=0;r>0&&s>0&&(l+s+1>t&&(s=Math.max(1,t-l)),a.push(e.substring(r-=s,r+s)),!((l+=s+1)>t));)s=i[o=(o+1)%i.length];return a.reverse().join(n)}:k;return function(e){var n=fs.exec(e),i=n[1]||" ",o=n[2]||">",s=n[3]||"-",l=n[4]||"",c=n[5],d=+n[6],u=n[7],h=n[8],f=n[9],p=1,_="",g="",m=!1,v=!0;switch(h&&(h=+h.substring(1)),(c||"0"===i&&"="===o)&&(c=i="0",o="="),f){case"n":u=!0,f="g";break;case"%":p=100,g="%",f="f";break;case"p":p=100,g="%",f="r";break;case"b":case"o":case"x":case"X":"#"===l&&(_="0"+f.toLowerCase());case"c":v=!1;case"d":m=!0,h=0;break;case"s":p=-1,f="r"}"$"===l&&(_=r[0],g=r[1]),"r"!=f||h||(f="g"),null!=h&&("g"==f?h=Math.max(1,Math.min(21,h)):"e"!=f&&"f"!=f||(h=Math.max(0,Math.min(20,h)))),f=ps.get(f)||$e;var y=c&&u;return function(e){var n=g;if(m&&e%1)return"";var r=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===s?"":s;if(p<0){var l=fo.formatPrefix(e,h);e=l.scale(e),n=l.symbol+g}else e*=p;e=f(e,h);var b,w,x=e.lastIndexOf(".");if(x<0){var k=v?e.lastIndexOf("e"):-1;k<0?(b=e,w=""):(b=e.substring(0,k),w=e.substring(k))}else b=e.substring(0,x),w=t+e.substring(x+1);!c&&u&&(b=a(b,1/0));var j=_.length+b.length+w.length+(y?0:r.length),M=j"===o?M+r+e:"^"===o?M.substring(0,j>>=1)+r+e+M.substring(j):r+(y?e:M+e))+n}}}function $e(e){return e+""}function He(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ue(e,t,n){function i(t){var n=e(t),i=a(n,1);return t-n1)for(;o=c)return-1;if(37===(r=t.charCodeAt(s++))){if(o=t.charAt(s++),!(a=O[o in vs?t.charAt(s++):o])||(i=a(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}function i(e,t,n){x.lastIndex=0;var i=x.exec(t.slice(n));return i?(e.w=k.get(i[0].toLowerCase()),n+i[0].length):-1}function r(e,t,n){b.lastIndex=0;var i=b.exec(t.slice(n));return i?(e.w=w.get(i[0].toLowerCase()),n+i[0].length):-1}function a(e,t,n){C.lastIndex=0;var i=C.exec(t.slice(n));return i?(e.m=S.get(i[0].toLowerCase()),n+i[0].length):-1}function o(e,t,n){j.lastIndex=0;var i=j.exec(t.slice(n));return i?(e.m=M.get(i[0].toLowerCase()),n+i[0].length):-1}function s(e,t,i){return n(e,T.c.toString(),t,i)}function l(e,t,i){return n(e,T.x.toString(),t,i)}function c(e,t,i){return n(e,T.X.toString(),t,i)}function d(e,t,n){var i=y.get(t.slice(n,n+=2).toLowerCase());return null==i?-1:(e.p=i,n)}var u=e.dateTime,h=e.date,f=e.time,p=e.periods,_=e.days,g=e.shortDays,m=e.months,v=e.shortMonths;t.utc=function(e){function n(e){try{gs=He;var t=new gs;return t._=e,i(t)}finally{gs=Date}}var i=t(e);return n.parse=function(e){try{gs=He;var t=i.parse(e);return t&&t._}finally{gs=Date}},n.toString=i.toString,n},t.multi=t.utc.multi=ft;var y=fo.map(),b=Ye(_),w=Ke(_),x=Ye(g),k=Ke(g),j=Ye(m),M=Ke(m),C=Ye(v),S=Ke(v);p.forEach(function(e,t){y.set(e.toLowerCase(),t)});var T={a:function(e){return g[e.getDay()]},A:function(e){return _[e.getDay()]},b:function(e){return v[e.getMonth()]},B:function(e){return m[e.getMonth()]},c:t(u),d:function(e,t){return We(e.getDate(),t,2)},e:function(e,t){return We(e.getDate(),t,2)},H:function(e,t){return We(e.getHours(),t,2)},I:function(e,t){return We(e.getHours()%12||12,t,2)},j:function(e,t){return We(1+_s.dayOfYear(e),t,3)},L:function(e,t){return We(e.getMilliseconds(),t,3)},m:function(e,t){return We(e.getMonth()+1,t,2)},M:function(e,t){return We(e.getMinutes(),t,2)},p:function(e){return p[+(e.getHours()>=12)]},S:function(e,t){return We(e.getSeconds(),t,2)},U:function(e,t){return We(_s.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return We(_s.mondayOfYear(e),t,2)},x:t(h),X:t(f),y:function(e,t){return We(e.getFullYear()%100,t,2)},Y:function(e,t){return We(e.getFullYear()%1e4,t,4)},Z:ut,"%":function(){return"%"}},O={a:i,A:r,b:a,B:o,c:s,d:at,e:at,H:st,I:st,j:ot,L:dt,m:rt,M:lt,p:d,S:ct,U:Qe,w:Xe,W:Ze,x:l,X:c,y:tt,Y:et,Z:nt,"%":ht};return t}function We(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",a=r.length;return i+(a68?1900:2e3)}function rt(e,t,n){ys.lastIndex=0;var i=ys.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function at(e,t,n){ys.lastIndex=0;var i=ys.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function ot(e,t,n){ys.lastIndex=0;var i=ys.exec(t.slice(n,n+3));return i?(e.j=+i[0],n+i[0].length):-1}function st(e,t,n){ys.lastIndex=0;var i=ys.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function lt(e,t,n){ys.lastIndex=0;var i=ys.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function ct(e,t,n){ys.lastIndex=0;var i=ys.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function dt(e,t,n){ys.lastIndex=0;var i=ys.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function ut(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",i=ko(t)/60|0,r=ko(t)%60;return n+We(i,"0",2)+We(r,"0",2)}function ht(e,t,n){bs.lastIndex=0;var i=bs.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function ft(e){for(var t=e.length,n=-1;++n=0?1:-1,s=o*n,l=Math.cos(t),c=Math.sin(t),d=a*c,u=r*l+d*Math.cos(s),h=d*o*Math.sin(s);Cs.add(Math.atan2(h,u)),i=e,r=l,a=c}var t,n,i,r,a;Ss.point=function(o,s){Ss.point=e,i=(t=o)*Jo,r=Math.cos(s=(n=s)*Jo/2+Fo/4),a=Math.sin(s)},Ss.lineEnd=function(){e(t,n)}}function bt(e){var t=e[0],n=e[1],i=Math.cos(n);return[i*Math.cos(t),i*Math.sin(t),Math.sin(n)]}function wt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function xt(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function kt(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function jt(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Mt(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Ct(e){return[Math.atan2(e[1],e[0]),oe(e[2])]}function St(e,t){return ko(e[0]-t[0])=0;--s)r.point((u=d[s])[0],u[1])}else i(f.x,f.p.x,-1,r);f=f.p}f=f.o,d=f.z,p=!p}while(!f.v);r.lineEnd()}}}function Pt(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i0){for(w||(a.polygonStart(),w=!0),a.lineStart();++o1&&2&t&&n.push(n.pop().concat(n.shift())),f.push(n.filter(Et))}var f,p,_,g=t(a),m=r.invert(i[0],i[1]),v={point:o,lineStart:l,lineEnd:c,polygonStart:function(){v.point=d,v.lineStart=u,v.lineEnd=h,f=[],p=[]},polygonEnd:function(){v.point=o,v.lineStart=l,v.lineEnd=c,f=fo.merge(f);var e=Ut(m,p);f.length?(w||(a.polygonStart(),w=!0),It(f,qt,e,n,a)):e&&(w||(a.polygonStart(),w=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),w&&(a.polygonEnd(),w=!1),f=p=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}},y=zt(),b=t(y),w=!1;return v}}function Et(e){return e.length>1}function zt(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,n){e.push([t,n])},lineEnd:C,buffer:function(){var n=t;return t=[],e=null,n},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function qt(e,t){return((e=e.x)[0]<0?e[1]-Uo-zo:Uo-e[1])-((t=t.x)[0]<0?t[1]-Uo-zo:Uo-t[1])}function Ft(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(a,o){var s=a>0?Fo:-Fo,l=ko(a-n);ko(l-Fo)0?Uo:-Uo),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(a,i),t=0):r!==s&&l>=Fo&&(ko(n-r)zo?Math.atan((Math.sin(t)*(a=Math.cos(i))*Math.sin(n)-Math.sin(i)*(r=Math.cos(t))*Math.sin(e))/(r*a*o)):(t+i)/2}function Ht(e,t,n,i){var r;if(null==e)r=n*Uo,i.point(-Fo,r),i.point(0,r),i.point(Fo,r),i.point(Fo,0),i.point(Fo,-r),i.point(0,-r),i.point(-Fo,-r),i.point(-Fo,0),i.point(-Fo,r);else if(ko(e[0]-t[0])>zo){var a=e[0]=0?1:-1,k=x*w,j=k>Fo,M=p*y;if(Cs.add(Math.atan2(M*x*Math.sin(k),_*b+M*Math.cos(k))),a+=j?w+x*$o:w,j^h>=n^m>=n){var C=xt(bt(u),bt(e));Mt(C);var S=xt(r,C);Mt(S);var T=(j^w>=0?-1:1)*oe(S[2]);(i>T||i===T&&(C[0]||C[1]))&&(o+=j^w>=0?1:-1)}if(!g++)break;h=m,p=y,_=b,u=e}}return(a<-zo||aa}function n(e){var n,a,l,c,d;return{lineStart:function(){c=l=!1,d=1},point:function(u,h){var f,p=[u,h],_=t(u,h),g=o?_?0:r(u,h):_?r(u+(u<0?Fo:-Fo),h):0;if(!n&&(c=l=_)&&e.lineStart(),_!==l&&(f=i(n,p),(St(n,f)||St(p,f))&&(p[0]+=zo,p[1]+=zo,_=t(p[0],p[1]))),_!==l)d=0,_?(e.lineStart(),f=i(p,n),e.point(f[0],f[1])):(f=i(n,p),e.point(f[0],f[1]),e.lineEnd()),n=f;else if(s&&n&&o^_){var m;g&a||!(m=i(p,n,!0))||(d=0,o?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!_||n&&St(n,p)||e.point(p[0],p[1]),n=p,l=_,a=g},lineEnd:function(){l&&e.lineEnd(),n=null},clean:function(){return d|(c&&l)<<1}}}function i(e,t,n){var i=bt(e),r=bt(t),o=[1,0,0],s=xt(i,r),l=wt(s,s),c=s[0],d=l-c*c;if(!d)return!n&&e;var u=a*l/d,h=-a*c/d,f=xt(o,s),p=jt(o,u);kt(p,jt(s,h));var _=f,g=wt(p,_),m=wt(_,_),v=g*g-m*(wt(p,p)-1);if(!(v<0)){var y=Math.sqrt(v),b=jt(_,(-g-y)/m);if(kt(b,p),b=Ct(b),!n)return b;var w,x=e[0],k=t[0],j=e[1],M=t[1];k0^b[1]<(ko(b[0]-x)Fo^(x<=b[0]&&b[0]<=k)){var O=jt(_,(-g+y)/m);return kt(O,p),[b,Ct(O)]}}}function r(t,n){var i=o?e:Fo-e,r=0;return t<-i?r|=1:t>i&&(r|=2),n<-i?r|=4:n>i&&(r|=8),r}var a=Math.cos(e),o=a>0,s=ko(a)>zo;return Vt(t,n,bn(e,6*Jo),o?[0,-e]:[-Fo,e-Fo])}function Bt(e,t,n,i){return function(r){var a,o=r.a,s=r.b,l=o.x,c=o.y,d=s.x,u=s.y,h=0,f=1,p=d-l,_=u-c;if(a=e-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>f)return;a>h&&(h=a)}if(a=n-l,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>h&&(h=a)}else if(p>0){if(a0)){if(a/=_,_<0){if(a0){if(a>f)return;a>h&&(h=a)}if(a=i-c,_||!(a<0)){if(a/=_,_<0){if(a>f)return;a>h&&(h=a)}else if(_>0){if(a0&&(r.a={x:l+h*p,y:c+h*_}),f<1&&(r.b={x:l+f*p,y:c+f*_}),r}}}}}}function Wt(e,t,n,i){function r(i,r){return ko(i[0]-e)0?0:3:ko(i[0]-n)0?2:1:ko(i[1]-t)0?1:0:r>0?3:2}function a(e,t){return o(e.x,t.x)}function o(e,t){var n=r(e,1),i=r(t,1);return n!==i?n-i:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(s){function l(e){for(var t=0,n=g.length,i=e[1],r=0;ri&&re(c,a,e)>0&&++t:a[1]<=i&&re(c,a,e)<0&&--t,c=a;return 0!==t}function c(a,s,l,c){var d=0,u=0;if(null==a||(d=r(a,l))!==(u=r(s,l))||o(a,s)<0^l>0)do{c.point(0===d||3===d?e:n,d>1?i:t)}while((d=(d+l+4)%4)!==u);else c.point(s[0],s[1])}function d(r,a){return e<=r&&r<=n&&t<=a&&a<=i}function u(e,t){d(e,t)&&s.point(e,t)}function h(){O.point=p,g&&g.push(m=[]),j=!0,k=!1,w=x=NaN}function f(){_&&(p(v,y),b&&k&&S.rejoin(),_.push(S.buffer())),O.point=u,k&&s.lineEnd()}function p(e,t){e=Math.max(-qs,Math.min(qs,e)),t=Math.max(-qs,Math.min(qs,t));var n=d(e,t);if(g&&m.push([e,t]),j)v=e,y=t,b=n,j=!1,n&&(s.lineStart(),s.point(e,t));else if(n&&k)s.point(e,t);else{var i={a:{x:w,y:x},b:{x:e,y:t}};T(i)?(k||(s.lineStart(),s.point(i.a.x,i.a.y)),s.point(i.b.x,i.b.y),n||s.lineEnd(),M=!1):n&&(s.lineStart(),s.point(e,t),M=!1)}w=e,x=t,k=n}var _,g,m,v,y,b,w,x,k,j,M,C=s,S=zt(),T=Bt(e,t,n,i),O={point:u,lineStart:h,lineEnd:f,polygonStart:function(){s=S,_=[],g=[],M=!0},polygonEnd:function(){s=C,_=fo.merge(_);var t=l([e,i]),n=M&&t,r=_.length;(n||r)&&(s.polygonStart(),n&&(s.lineStart(),c(null,null,1,s),s.lineEnd()),r&&It(_,a,t,c,s),s.polygonEnd()),_=g=m=null}};return O}}function Yt(e){var t=0,n=Fo/3,i=hn(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*Fo/180,n=e[1]*Fo/180):[t/Fo*180,n/Fo*180]},r}function Kt(e,t){function n(e,t){var n=Math.sqrt(a-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),o-n*Math.cos(e)]}var i=Math.sin(e),r=(i+Math.sin(t))/2,a=1+i*(2*r-i),o=Math.sqrt(a)/r;return n.invert=function(e,t){var n=o-t;return[Math.atan2(e,n)/r,oe((a-(e*e+n*n)*r*r)/(2*r))]},n}function Xt(){function e(e,t){$s+=r*e-i*t,i=e,r=t}var t,n,i,r;Ws.point=function(a,o){Ws.point=e,t=i=a,n=r=o},Ws.lineEnd=function(){e(t,n)}}function Qt(e,t){eJs&&(Js=e),tBs&&(Bs=t)}function Zt(){function e(e,t){o.push("M",e,",",t,a)}function t(e,t){o.push("M",e,",",t),s.point=n}function n(e,t){o.push("L",e,",",t)}function i(){s.point=e}function r(){o.push("Z")}var a=en(4.5),o=[],s={point:e,lineStart:function(){s.point=t},lineEnd:i,polygonStart:function(){s.lineEnd=r},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(e){return a=en(e),s},result:function(){if(o.length){var e=o.join("");return o=[],e}}};return s}function en(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function tn(e,t){As+=e,Ns+=t,++Gs}function nn(){function e(e,i){var r=e-t,a=i-n,o=Math.sqrt(r*r+a*a);Ls+=o*(t+e)/2,Ds+=o*(n+i)/2,Is+=o,tn(t=e,n=i)}var t,n;Ks.point=function(i,r){Ks.point=e,tn(t=i,n=r)}}function rn(){Ks.point=tn}function an(){function e(e,t){var n=e-i,a=t-r,o=Math.sqrt(n*n+a*a);Ls+=o*(i+e)/2,Ds+=o*(r+t)/2,Is+=o,o=r*e-i*t,Ps+=o*(i+e),Rs+=o*(r+t),Vs+=3*o,tn(i=e,r=t)}var t,n,i,r;Ks.point=function(a,o){Ks.point=e,tn(t=i=a,n=r=o)},Ks.lineEnd=function(){e(t,n)}}function on(e){function t(t,n){e.moveTo(t+o,n),e.arc(t,n,o,0,$o)}function n(t,n){e.moveTo(t,n),s.point=i}function i(t,n){e.lineTo(t,n)}function r(){s.point=t}function a(){e.closePath()}var o=4.5,s={point:t,lineStart:function(){s.point=n},lineEnd:r,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=r,s.point=t},pointRadius:function(e){return o=e,s},result:C};return s}function sn(e){function t(e){return(s?i:n)(e)}function n(t){return dn(t,function(n,i){n=e(n,i),t.point(n[0],n[1])})}function i(t){function n(n,i){n=e(n,i),t.point(n[0],n[1])}function i(){y=NaN,j.point=a,t.lineStart()}function a(n,i){var a=bt([n,i]),o=e(n,i);r(y,b,v,w,x,k,y=o[0],b=o[1],v=n,w=a[0],x=a[1],k=a[2],s,t),t.point(y,b)}function o(){j.point=n,t.lineEnd()}function l(){i(),j.point=c,j.lineEnd=d}function c(e,t){a(u=e,h=t),f=y,p=b,_=w,g=x,m=k,j.point=a}function d(){r(y,b,v,w,x,k,f,p,u,_,g,m,s,t),j.lineEnd=o,o()}var u,h,f,p,_,g,m,v,y,b,w,x,k,j={point:n,lineStart:i,lineEnd:o,polygonStart:function(){t.polygonStart(),j.lineStart=l},polygonEnd:function(){t.polygonEnd(),j.lineStart=i}};return j}function r(t,n,i,s,l,c,d,u,h,f,p,_,g,m){var v=d-t,y=u-n,b=v*v+y*y;if(b>4*a&&g--){var w=s+f,x=l+p,k=c+_,j=Math.sqrt(w*w+x*x+k*k),M=Math.asin(k/=j),C=ko(ko(k)-1)a||ko((v*A+y*N)/b-.5)>.3||s*f+l*p+c*_0&&16,t):Math.sqrt(a)},t}function ln(e){var t=sn(function(t,n){return e([t*Bo,n*Bo])});return function(e){return fn(t(e))}}function cn(e){this.stream=e}function dn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function un(e){return hn(function(){return e})()}function hn(e){function t(e){return e=s(e[0]*Jo,e[1]*Jo),[e[0]*h+l,c-e[1]*h]}function n(e){return(e=s.invert((e[0]-l)/h,(c-e[1])/h))&&[e[0]*Bo,e[1]*Bo]}function i(){s=Lt(o=gn(m,v,y),a);var e=a(_,g);return l=f-e[0]*h,c=p+e[1]*h,r()}function r(){return d&&(d.valid=!1,d=null),t}var a,o,s,l,c,d,u=sn(function(e,t){return e=a(e,t),[e[0]*h+l,c-e[1]*h]}),h=150,f=480,p=250,_=0,g=0,m=0,v=0,y=0,b=zs,w=k,x=null,j=null;return t.stream=function(e){return d&&(d.valid=!1),d=fn(b(o,u(w(e)))),d.valid=!0,d},t.clipAngle=function(e){return arguments.length?(b=null==e?(x=e,zs):Jt((x=+e)*Jo),r()):x},t.clipExtent=function(e){return arguments.length?(j=e,w=e?Wt(e[0][0],e[0][1],e[1][0],e[1][1]):k,r()):j},t.scale=function(e){return arguments.length?(h=+e,i()):h},t.translate=function(e){return arguments.length?(f=+e[0],p=+e[1],i()):[f,p]},t.center=function(e){return arguments.length?(_=e[0]%360*Jo,g=e[1]%360*Jo,i()):[_*Bo,g*Bo]},t.rotate=function(e){return arguments.length?(m=e[0]%360*Jo,v=e[1]%360*Jo,y=e.length>2?e[2]%360*Jo:0,i()):[m*Bo,v*Bo,y*Bo]},fo.rebind(t,u,"precision"),function(){return a=e.apply(this,arguments),t.invert=a.invert&&n,i()}}function fn(e){return dn(e,function(t,n){e.point(t*Jo,n*Jo)})}function pn(e,t){return[e,t]}function _n(e,t){return[e>Fo?e-$o:e<-Fo?e+$o:e,t]}function gn(e,t,n){return e?t||n?Lt(vn(e),yn(t,n)):vn(e):t||n?yn(t,n):_n}function mn(e){return function(t,n){return t+=e,[t>Fo?t-$o:t<-Fo?t+$o:t,n]}}function vn(e){var t=mn(e);return t.invert=mn(-e),t}function yn(e,t){function n(e,t){var n=Math.cos(t),s=Math.cos(e)*n,l=Math.sin(e)*n,c=Math.sin(t),d=c*i+s*r;return[Math.atan2(l*a-d*o,s*i-c*r),oe(d*a+l*o)]}var i=Math.cos(e),r=Math.sin(e),a=Math.cos(t),o=Math.sin(t);return n.invert=function(e,t){var n=Math.cos(t),s=Math.cos(e)*n,l=Math.sin(e)*n,c=Math.sin(t),d=c*a-l*o;return[Math.atan2(l*a+c*o,s*i+d*r),oe(d*i-s*r)]},n}function bn(e,t){var n=Math.cos(e),i=Math.sin(e);return function(r,a,o,s){var l=o*t;null!=r?(r=wn(n,r),a=wn(n,a),(o>0?ra)&&(r+=o*$o)):(r=e+o*$o,a=e-.5*l);for(var c,d=r;o>0?d>a:d0?t<-Uo+zo&&(t=-Uo+zo):t>Uo-zo&&(t=Uo-zo);var n=o/Math.pow(r(t),a);return[n*Math.sin(a*e),o-n*Math.cos(a*e)]}var i=Math.cos(e),r=function(e){return Math.tan(Fo/4+e/2)},a=e===t?Math.sin(e):Math.log(i/Math.cos(t))/Math.log(r(t)/r(e)),o=i*Math.pow(r(e),a)/a;return a?(n.invert=function(e,t){var n=o-t,i=ie(a)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/a,2*Math.atan(Math.pow(o/i,1/a))-Uo]},n):Nn}function An(e,t){function n(e,t){var n=a-t;return[n*Math.sin(r*e),a-n*Math.cos(r*e)]}var i=Math.cos(e),r=e===t?Math.sin(e):(i-Math.cos(t))/(t-e),a=i/r+e;return ko(r)1&&re(e[n[i-2]],e[n[i-1]],e[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}function Rn(e,t){return e[0]-t[0]||e[1]-t[1]}function Vn(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function En(e,t,n,i){var r=e[0],a=n[0],o=t[0]-r,s=i[0]-a,l=e[1],c=n[1],d=t[1]-l,u=i[1]-c,h=(s*(l-c)-u*(r-a))/(u*o-s*d);return[r+h*o,l+h*d]}function zn(e){var t=e[0],n=e[e.length-1];return!(t[0]-n[0]||t[1]-n[1])}function qn(){li(this),this.edge=this.site=this.circle=null}function Fn(e){var t=dl.pop()||new qn;return t.site=e,t}function $n(e){Zn(e),sl.remove(e),dl.push(e),li(e)}function Hn(e){var t=e.circle,n=t.x,i=t.cy,r={x:n,y:i},a=e.P,o=e.N,s=[e];$n(e);for(var l=a;l.circle&&ko(n-l.circle.x)zo)s=s.L;else{if(!((r=a-Bn(s,o))>zo)){i>-zo?(t=s.P,n=s):r>-zo?(t=s,n=s.N):t=n=s;break}if(!s.R){t=s;break}s=s.R}var l=Fn(e);if(sl.insert(t,l),t||n){if(t===n)return Zn(t),n=Fn(t.site),sl.insert(l,n),l.edge=n.edge=ii(t.site,l.site),Qn(t),void Qn(n);if(!n)return void(l.edge=ii(t.site,l.site));Zn(t),Zn(n);var c=t.site,d=c.x,u=c.y,h=e.x-d,f=e.y-u,p=n.site,_=p.x-d,g=p.y-u,m=2*(h*g-f*_),v=h*h+f*f,y=_*_+g*g,b={x:(g*v-f*y)/m+d,y:(h*y-_*v)/m+u};ai(n.edge,c,p,b),l.edge=ii(c,e,null,b),n.edge=ii(e,p,null,b),Qn(t),Qn(n)}}function Jn(e,t){var n=e.site,i=n.x,r=n.y,a=r-t;if(!a)return i;var o=e.P;if(!o)return-1/0;n=o.site;var s=n.x,l=n.y,c=l-t;if(!c)return s;var d=s-i,u=1/a-1/c,h=d/c;return u?(-h+Math.sqrt(h*h-2*u*(d*d/(-2*c)-l+c/2+r-a/2)))/u+i:(i+s)/2}function Bn(e,t){var n=e.N;if(n)return Jn(n,t);var i=e.site;return i.y===t?i.x:1/0}function Wn(e){this.site=e,this.edges=[]}function Yn(e){for(var t,n,i,r,a,o,s,l,c,d,u=e[0][0],h=e[1][0],f=e[0][1],p=e[1][1],_=ol,g=_.length;g--;)if((a=_[g])&&a.prepare())for(s=a.edges,l=s.length,o=0;ozo||ko(r-n)>zo)&&(s.splice(o,0,new oi(ri(a.site,d,ko(i-u)zo?{x:u,y:ko(t-u)zo?{x:ko(n-p)zo?{x:h,y:ko(t-h)zo?{x:ko(n-f)=-qo)){var f=l*l+c*c,p=d*d+u*u,_=(u*f-c*p)/h,g=(l*p-d*f)/h,u=g+s,m=ul.pop()||new Xn;m.arc=e,m.site=r,m.x=_+o,m.y=u+Math.sqrt(_*_+g*g),m.cy=u,e.circle=m;for(var v=null,y=cl._;y;)if(m.y=s)return;if(h>p){if(a){if(a.y>=c)return}else a={x:g,y:l};n={x:g,y:c}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=c)return}else a={x:(l-r)/i,y:l};n={x:(c-r)/i,y:c}}else{if(a){if(a.y=s)return}else a={x:o,y:i*o+r};n={x:s,y:i*s+r}}else{if(a){if(a.xa||u>o||h=b,k=n>=w,j=k<<1|x,M=j+4;ja&&(r=t.slice(a,r),s[o]?s[o]+=r:s[++o]=r),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,l.push({i:o,x:xi(n,i)})),a=pl.lastIndex;return a=0&&!(n=fo.interpolators[i](e,t)););return n}function Mi(e,t){var n,i=[],r=[],a=e.length,o=t.length,s=Math.min(e.length,t.length);for(n=0;n=1?1:e(t)}}function Si(e){return function(t){return 1-e(1-t)}}function Ti(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function Oi(e){return e*e}function Ai(e){return e*e*e}function Ni(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function Gi(e){return function(t){return Math.pow(t,e)}}function Li(e){return 1-Math.cos(e*Uo)}function Di(e){return Math.pow(2,10*(e-1))}function Ii(e){return 1-Math.sqrt(1-e*e)}function Pi(e,t){var n;return arguments.length<2&&(t=.45),arguments.length?n=t/$o*Math.asin(1/e):(e=1,n=t/4),function(i){return 1+e*Math.pow(2,-10*i)*Math.sin((i-n)*$o/t)}}function Ri(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function Vi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function Ei(e,t){e=fo.hcl(e),t=fo.hcl(t);var n=e.h,i=e.c,r=e.l,a=t.h-n,o=t.c-i,s=t.l-r;return isNaN(o)&&(o=0,i=isNaN(i)?t.c:i),isNaN(a)?(a=0,n=isNaN(n)?t.h:n):a>180?a-=360:a<-180&&(a+=360),function(e){return _e(n+a*e,i+o*e,r+s*e)+""}}function zi(e,t){e=fo.hsl(e),t=fo.hsl(t);var n=e.h,i=e.s,r=e.l,a=t.h-n,o=t.s-i,s=t.l-r;return isNaN(o)&&(o=0,i=isNaN(i)?t.s:i),isNaN(a)?(a=0,n=isNaN(n)?t.h:n):a>180?a-=360:a<-180&&(a+=360),function(e){return fe(n+a*e,i+o*e,r+s*e)+""}}function qi(e,t){e=fo.lab(e),t=fo.lab(t);var n=e.l,i=e.a,r=e.b,a=t.l-n,o=t.a-i,s=t.b-r;return function(e){return me(n+a*e,i+o*e,r+s*e)+""}}function Fi(e,t){return t-=e,function(n){return Math.round(e+t*n)}}function $i(e){var t=[e.a,e.b],n=[e.c,e.d],i=Ui(t),r=Hi(t,n),a=Ui(Ji(n,t,-r))||0;t[0]*n[1]180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(Bi(n)+"rotate(",null,")")-2,x:xi(e,t)})):t&&n.push(Bi(n)+"rotate("+t+")")}function Ki(e,t,n,i){e!==t?i.push({i:n.push(Bi(n)+"skewX(",null,")")-2,x:xi(e,t)}):t&&n.push(Bi(n)+"skewX("+t+")")}function Xi(e,t,n,i){if(e[0]!==t[0]||e[1]!==t[1]){var r=n.push(Bi(n)+"scale(",null,",",null,")");i.push({i:r-4,x:xi(e[0],t[0])},{i:r-2,x:xi(e[1],t[1])})}else 1===t[0]&&1===t[1]||n.push(Bi(n)+"scale("+t+")")}function Qi(e,t){var n=[],i=[];return e=fo.transform(e),t=fo.transform(t),Wi(e.translate,t.translate,n,i),Yi(e.rotate,t.rotate,n,i),Ki(e.skew,t.skew,n,i),Xi(e.scale,t.scale,n,i),e=t=null,function(e){for(var t,r=-1,a=i.length;++r=0;)n.push(r[i])}function ur(e,t){for(var n=[e],i=[];null!=(e=n.pop());)if(i.push(e),(a=e.children)&&(r=a.length))for(var r,a,o=-1;++or&&(i=n,r=t);return i}function xr(e){return e.reduce(kr,0)}function kr(e,t){return e+t[1]}function jr(e,t){return Mr(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Mr(e,t){for(var n=-1,i=+e[0],r=(e[1]-i)/t,a=[];++n<=t;)a[n]=r*n+i;return a}function Cr(e){return[fo.min(e),fo.max(e)]}function Sr(e,t){return e.value-t.value}function Tr(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function Or(e,t){e._pack_next=t,t._pack_prev=e}function Ar(e,t){var n=t.x-e.x,i=t.y-e.y,r=e.r+t.r;return.999*r*r>n*n+i*i}function Nr(e){function t(e){d=Math.min(e.x-e.r,d),u=Math.max(e.x+e.r,u),h=Math.min(e.y-e.r,h),f=Math.max(e.y+e.r,f)}if((n=e.children)&&(c=n.length)){var n,i,r,a,o,s,l,c,d=1/0,u=-1/0,h=1/0,f=-1/0;if(n.forEach(Gr),i=n[0],i.x=-i.r,i.y=0,t(i),c>1&&(r=n[1],r.x=r.r,r.y=0,t(r),c>2))for(a=n[2],Ir(i,r,a),t(a),Tr(i,a),i._pack_prev=a,Tr(a,r),r=i._pack_next,o=3;o=0;)t=r[a],t.z+=n,t.m+=n,n+=t.s+(i+=t.c)}function qr(e,t,n){return e.a.parent===t.parent?e.a:n}function Fr(e){return 1+fo.max(e,function(e){return e.y})}function $r(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Hr(e){var t=e.children;return t&&t.length?Hr(t[0]):e}function Ur(e){var t,n=e.children;return n&&(t=n.length)?Ur(n[t-1]):e}function Jr(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Br(e,t){var n=e.x+t[3],i=e.y+t[0],r=e.dx-t[1]-t[3],a=e.dy-t[0]-t[2];return r<0&&(n+=r/2,r=0),a<0&&(i+=a/2,a=0),{x:n,y:i,dx:r,dy:a}}function Wr(e){var t=e[0],n=e[e.length-1];return t2?Zr:Kr,l=i?er:Zi;return o=r(e,t,l,n),s=r(t,e,l,ji),a}function a(e){return o(e)}var o,s;return a.invert=function(e){return s(e)},a.domain=function(t){return arguments.length?(e=t.map(Number),r()):e},a.range=function(e){return arguments.length?(t=e,r()):t},a.rangeRound=function(e){return a.range(e).interpolate(Fi)},a.clamp=function(e){return arguments.length?(i=e,r()):i},a.interpolate=function(e){return arguments.length?(n=e,r()):n},a.ticks=function(t){return ra(e,t)},a.tickFormat=function(t,n){return aa(e,t,n)},a.nice=function(t){return na(e,t),r()},a.copy=function(){return ea(e,t,n,i)},r()}function ta(e,t){return fo.rebind(e,t,"range","rangeRound","interpolate","clamp")}function na(e,t){return Xr(e,Qr(ia(e,t)[2])),Xr(e,Qr(ia(e,t)[2])),e}function ia(e,t){null==t&&(t=10);var n=Wr(e),i=n[1]-n[0],r=Math.pow(10,Math.floor(Math.log(i/t)/Math.LN10)),a=t/i*r;return a<=.15?r*=10:a<=.35?r*=5:a<=.75&&(r*=2),n[0]=Math.ceil(n[0]/r)*r,n[1]=Math.floor(n[1]/r)*r+.5*r,n[2]=r,n}function ra(e,t){return fo.range.apply(fo,ia(e,t))}function aa(e,t,n){var i=ia(e,t);if(n){var r=fs.exec(n);if(r.shift(),"s"===r[8]){var a=fo.formatPrefix(Math.max(ko(i[0]),ko(i[1])));return r[7]||(r[7]="."+oa(a.scale(i[2]))),r[8]="f",n=fo.format(r.join("")),function(e){return n(a.scale(e))+a.symbol}}r[7]||(r[7]="."+sa(r[8],i)),n=r.join("")}else n=",."+oa(i[2])+"f";return fo.format(n)}function oa(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}function sa(e,t){var n=oa(t[2]);return e in Cl?Math.abs(n-oa(Math.max(ko(t[0]),ko(t[1]))))+ +("e"!==e):n-2*("%"===e)}function la(e,t,n,i){function r(e){return(n?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(t)}function a(e){return n?Math.pow(t,e):-Math.pow(t,-e)}function o(t){return e(r(t))}return o.invert=function(t){return a(e.invert(t))},o.domain=function(t){return arguments.length?(n=t[0]>=0,e.domain((i=t.map(Number)).map(r)),o):i},o.base=function(n){return arguments.length?(t=+n,e.domain(i.map(r)),o):t},o.nice=function(){var t=Xr(i.map(r),n?Math:Tl);return e.domain(t),i=t.map(a),o},o.ticks=function(){var e=Wr(i),o=[],s=e[0],l=e[1],c=Math.floor(r(s)),d=Math.ceil(r(l)),u=t%1?2:t;if(isFinite(d-c)){if(n){for(;c0;h--)o.push(a(c)*h);for(c=0;o[c]l;d--);o=o.slice(c,d)}return o},o.tickFormat=function(e,n){if(!arguments.length)return Sl;arguments.length<2?n=Sl:"function"!=typeof n&&(n=fo.format(n));var i=Math.max(1,t*e/o.ticks().length);return function(e){var o=e/a(Math.round(r(e)));return o*t0?r[n-1]:e[0],n0?0:1}function ka(e,t,n,i,r){var a=e[0]-t[0],o=e[1]-t[1],s=(r?i:-i)/Math.sqrt(a*a+o*o),l=s*o,c=-s*a,d=e[0]+l,u=e[1]+c,h=t[0]+l,f=t[1]+c,p=(d+h)/2,_=(u+f)/2,g=h-d,m=f-u,v=g*g+m*m,y=n-i,b=d*f-h*u,w=(m<0?-1:1)*Math.sqrt(Math.max(0,y*y*v-b*b)),x=(b*m-g*w)/v,k=(-b*g-m*w)/v,j=(b*m+g*w)/v,M=(-b*g+m*w)/v,C=x-p,S=k-_,T=j-p,O=M-_;return C*C+S*S>T*T+O*O&&(x=j,k=M),[[x-l,k-c],[x*n/y,k*n/y]]}function ja(e){function t(t){function o(){c.push("M",a(e(d),s))}for(var l,c=[],d=[],u=-1,h=t.length,f=Ne(n),p=Ne(i);++u1?e.join("L"):e+"Z"}function Ca(e){return e.join("L")+"Z"}function Sa(e){for(var t=0,n=e.length,i=e[0],r=[i[0],",",i[1]];++t1&&r.push("H",i[0]),r.join("")}function Ta(e){for(var t=0,n=e.length,i=e[0],r=[i[0],",",i[1]];++t1){s=t[1],a=e[l],l++,i+="C"+(r[0]+o[0])+","+(r[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var c=2;c9&&(r=3*t/Math.sqrt(r),o[s]=r*n,o[s+1]=r*i));for(s=-1;++s<=l;)r=(e[Math.min(l,s+1)][0]-e[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([r||0,o[s]*r||0]);return a}function Ha(e){return e.length<3?Ma(e):e[0]+La(e,$a(e))}function Ua(e){for(var t,n,i,r=-1,a=e.length;++r0;)h[--s].call(e,o);if(a>=1)return _.event&&_.event.end.call(e,e.__data__,t),--f.count?delete f[i]:delete e[n],1}var l,c,d,u,h,f=e[n]||(e[n]={active:0,count:0}),_=f[i];_||(l=r.time,c=Pe(a,0,l),_=f[i]={tween:new p,time:l,timer:c,delay:r.delay,duration:r.duration,ease:r.ease,index:t},r=null,++f.count)}function ao(e,t,n){e.attr("transform",function(e){var i=t(e);return"translate("+(isFinite(i)?i:n(e))+",0)"})}function oo(e,t,n){e.attr("transform",function(e){var i=t(e);return"translate(0,"+(isFinite(i)?i:n(e))+")"})}function so(e){return e.toISOString()}function lo(e,t,n){function i(t){return e(t)}function r(e,n){var i=e[1]-e[0],r=i/n,a=fo.bisect(Zl,r);return a==Zl.length?[t.year,ia(e.map(function(e){return e/31536e6}),n)[2]]:a?t[r/Zl[a-1]1?{floor:function(t){for(;n(t=e.floor(t));)t=co(t-1);return t},ceil:function(t){for(;n(t=e.ceil(t));)t=co(+t+1);return t}}:e))},i.ticks=function(e,t){var n=Wr(i.domain()),a=null==e?r(n,10):"number"==typeof e?r(n,e):!e.range&&[{range:e},t];return a&&(e=a[0],t=a[1]),e.range(n[0],co(+n[1]+1),t<1?1:t)},i.tickFormat=function(){return n},i.copy=function(){return lo(e.copy(),t,n)},ta(i,e)}function co(e){return new Date(e)}function uo(e){return JSON.parse(e.responseText)}function ho(e){var t=go.createRange();return t.selectNode(go.body),t.createContextualFragment(e.responseText)}var fo={version:"3.5.17"},po=[].slice,_o=function(e){return po.call(e)},go=this.document;if(go)try{_o(go.documentElement.childNodes)[0].nodeType}catch(e){_o=function(e){for(var t=e.length,n=new Array(t);t--;)n[t]=e[t];return n}}if(Date.now||(Date.now=function(){return+new Date}),go)try{go.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var mo=this.Element.prototype,vo=mo.setAttribute,yo=mo.setAttributeNS,bo=this.CSSStyleDeclaration.prototype,wo=bo.setProperty;mo.setAttribute=function(e,t){vo.call(this,e,t+"")},mo.setAttributeNS=function(e,t,n){yo.call(this,e,t,n+"")},bo.setProperty=function(e,t,n){wo.call(this,e,t+"",n)}}fo.ascending=s,fo.descending=function(e,t){return te?1:t>=e?0:NaN},fo.min=function(e,t){var n,i,r=-1,a=e.length;if(1===arguments.length){for(;++r=i){n=i;break}for(;++ri&&(n=i)}else{for(;++r=i){n=i;break}for(;++ri&&(n=i)}return n},fo.max=function(e,t){var n,i,r=-1,a=e.length;if(1===arguments.length){for(;++r=i){n=i;break}for(;++rn&&(n=i)}else{for(;++r=i){n=i;break}for(;++rn&&(n=i)}return n},fo.extent=function(e,t){var n,i,r,a=-1,o=e.length;if(1===arguments.length){for(;++a=i){n=r=i;break}for(;++ai&&(n=i),r=i){n=r=i;break}for(;++ai&&(n=i),r1)return o/(d-1)},fo.deviation=function(){var e=fo.variance.apply(this,arguments);return e?Math.sqrt(e):e};var xo=d(s);fo.bisectLeft=xo.left,fo.bisect=fo.bisectRight=xo.right,fo.bisector=function(e){return d(1===e.length?function(t,n){return s(e(t),n)}:e)},fo.shuffle=function(e,t,n){(a=arguments.length)<3&&(n=e.length,a<2&&(t=0));for(var i,r,a=n-t;a;)r=Math.random()*a--|0,i=e[a+t],e[a+t]=e[r+t],e[r+t]=i;return e},fo.permute=function(e,t){for(var n=t.length,i=new Array(n);n--;)i[n]=e[t[n]];return i},fo.pairs=function(e){for(var t=0,n=e.length-1,i=e[0],r=new Array(n<0?0:n);t=0;)for(i=e[r],t=i.length;--t>=0;)n[--o]=i[t];return n};var ko=Math.abs;fo.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("infinite range");var i,r=[],a=h(ko(n)),o=-1;if(e*=a,t*=a,n*=a,n<0)for(;(i=e+n*++o)>t;)r.push(i/a);else for(;(i=e+n*++o)=a.length)return i?i.call(r,o):n?o.sort(n):o;for(var l,c,d,u,h=-1,f=o.length,_=a[s++],g=new p;++h=a.length)return e;var i=[],r=o[n++];return e.forEach(function(e,r){i.push({key:e,values:t(r,n)})}),r?i.sort(function(e,t){return r(e.key,t.key)}):i}var n,i,r={},a=[],o=[];return r.map=function(t,n){return e(n,t,0)},r.entries=function(n){return t(e(fo.map,n,0),0)},r.key=function(e){return a.push(e),r},r.sortKeys=function(e){return o[a.length-1]=e,r},r.sortValues=function(e){return n=e,r},r.rollup=function(e){return i=e,r},r},fo.set=function(e){var t=new x;if(e)for(var n=0,i=e.length;n=0&&(i=e.slice(n+1),e=e.slice(0,n)),e)return arguments.length<2?this[e].on(i):this[e].on(i,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(i,null);return this}},fo.event=null,fo.requote=function(e){return e.replace(So,"\\$&")};var So=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,To={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]},Oo=function(e,t){return t.querySelector(e)},Ao=function(e,t){return t.querySelectorAll(e)},No=function(e,t){var n=e.matches||e[M(e,"matchesSelector")];return(No=function(e,t){return n.call(e,t)})(e,t)};"function"==typeof Sizzle&&(Oo=function(e,t){return Sizzle(e,t)[0]||null},Ao=Sizzle,No=Sizzle.matchesSelector),fo.selection=function(){return fo.select(go.documentElement)};var Go=fo.selection.prototype=[];Go.select=function(e){var t,n,i,r,a=[];e=L(e);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),Do.hasOwnProperty(n)?{space:Do[n],local:e}:e}},Go.attr=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node();return e=fo.ns.qualify(e),e.local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(I(t,e[t]));return this}return this.each(I(e,t))},Go.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node(),i=(e=V(e)).length,r=-1;if(t=n.classList){for(;++r=0;)(n=i[r])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Go.sort=function(e){e=B.apply(this,arguments);for(var t=-1,n=this.length;++t0&&(t=t.transition().duration(S)),t.call(e.event)}function s(){w&&w.domain(b.range().map(function(e){return(e-j.x)/j.k}).map(b.invert)),k&&k.domain(x.range().map(function(e){return(e-j.y)/j.k}).map(x.invert))}function l(e){T++||e({type:"zoomstart"})}function c(e){s(),e({type:"zoom",scale:j.k,translate:[j.x,j.y]})}function d(e){--T||(e({type:"zoomend"}),g=null)}function u(){function e(){s=1,r(fo.mouse(i),h),c(a)}function n(){u.on(G,null).on(L,null),f(s),d(a)}var i=this,a=I.of(i,arguments),s=0,u=fo.select(o(i)).on(G,e).on(L,n),h=t(fo.mouse(i)),f=ee(i);$l.call(i),l(a)}function h(){function e(){var e=fo.touches(p);return f=j.k,e.forEach(function(e){e.identifier in g&&(g[e.identifier]=t(e))}),e}function n(){var t=fo.event.target;fo.select(t).on(b,o).on(w,s),x.push(t);for(var n=fo.event.changedTouches,i=0,r=n.length;i1){var d=l[0],u=l[1],h=d[0]-u[0],f=d[1]-u[1];m=h*h+f*f}}function o(){var e,t,n,a,o=fo.touches(p);$l.call(p);for(var s=0,l=o.length;s=c)return o;if(r)return r=!1,a;var t=d;if(34===e.charCodeAt(t)){for(var n=t;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ps=fo.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return(e=fo.round(e,ze(e,t))).toFixed(Math.max(0,Math.min(20,ze(e*(1+1e-15),t))))}}),_s=fo.time={},gs=Date;He.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ms.setUTCDate.apply(this._,arguments)},setDay:function(){ms.setUTCDay.apply(this._,arguments)},setFullYear:function(){ms.setUTCFullYear.apply(this._,arguments)},setHours:function(){ms.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ms.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ms.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ms.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ms.setUTCSeconds.apply(this._,arguments)},setTime:function(){ms.setTime.apply(this._,arguments)}};var ms=Date.prototype;_s.year=Ue(function(e){return e=_s.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),_s.years=_s.year.range,_s.years.utc=_s.year.utc.range,_s.day=Ue(function(e){var t=new gs(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),_s.days=_s.day.range,_s.days.utc=_s.day.utc.range,_s.dayOfYear=function(e){var t=_s.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,t){t=7-t;var n=_s[e]=Ue(function(e){return(e=_s.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+7*Math.floor(t))},function(e){var n=_s.year(e).getDay();return Math.floor((_s.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});_s[e+"s"]=n.range,_s[e+"s"].utc=n.utc.range,_s[e+"OfYear"]=function(e){var n=_s.year(e).getDay();return Math.floor((_s.dayOfYear(e)+(n+t)%7)/7)}}),_s.week=_s.sunday,_s.weeks=_s.sunday.range,_s.weeks.utc=_s.sunday.utc.range,_s.weekOfYear=_s.sundayOfYear;var vs={"-":"",_:" ",0:"0"},ys=/^\s*\d+/,bs=/^%/;fo.locale=function(e){return{numberFormat:Fe(e),timeFormat:Be(e)}};var ws=fo.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});fo.format=ws.numberFormat,fo.geo={},pt.prototype={s:0,t:0,add:function(e){_t(e,this.t,xs),_t(xs.s,this.s,this),this.s?this.t+=xs.t:this.s=xs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xs=new pt;fo.geo.stream=function(e,t){e&&ks.hasOwnProperty(e.type)?ks[e.type](e,t):gt(e,t)};var ks={Feature:function(e,t){gt(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++if&&(f=t)}function t(t,n){var i=bt([t*Jo,n*Jo]);if(m){var r=xt(m,i),a=[r[1],-r[0],0],o=xt(a,r);Mt(o),o=Ct(o);var l=t-p,c=l>0?1:-1,_=o[0]*Bo*c,g=ko(l)>180;if(g^(c*p<_&&_f&&(f=v)}else if(_=(_+360)%360-180,g^(c*p<_&&_f&&(f=n);g?ts(d,h)&&(h=t):s(t,h)>s(d,h)&&(d=t):h>=d?(th&&(h=t)):t>p?s(d,t)>s(d,h)&&(h=t):s(t,h)>s(d,h)&&(d=t)}else e(t,n);m=i,p=t}function n(){w.point=t}function i(){b[0]=d,b[1]=h,w.point=e,m=null}function r(e,n){if(m){var i=e-p;v+=ko(i)>180?i+(i>0?360:-360):i}else _=e,g=n;Ss.point(e,n),t(e,n)}function a(){Ss.lineStart()}function o(){r(_,g),Ss.lineEnd(),ko(v)>zo&&(d=-(h=180)),b[0]=d,b[1]=h,m=null}function s(e,t){return(t-=e)<0?t+360:t}function l(e,t){return e[0]-t[0]}function c(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ezo?f=90:v<-zo&&(u=-90),b[0]=d,b[1]=h}};return function(e){f=h=-(d=u=1/0),y=[],fo.geo.stream(e,w);var t=y.length;if(t){y.sort(l);for(var n,i=1,r=y[0],a=[r];is(r[0],r[1])&&(r[1]=n[1]),s(n[0],r[1])>s(r[0],r[1])&&(r[0]=n[0])):a.push(r=n);for(var o,n,p=-1/0,t=a.length-1,i=0,r=a[t];i<=t;r=n,++i)n=a[i],(o=s(r[1],n[0]))>p&&(p=o,d=n[0],h=r[1])}return y=b=null,d===1/0||u===1/0?[[NaN,NaN],[NaN,NaN]]:[[d,u],[h,f]]}}(),fo.geo.centroid=function(e){Ts=Os=As=Ns=Gs=Ls=Ds=Is=Ps=Rs=Vs=0,fo.geo.stream(e,Es);var t=Ps,n=Rs,i=Vs,r=t*t+n*n+i*i;return r=.12&&r<.234&&i>=-.425&&i<-.214?o:r>=.166&&r<.234&&i>=-.214&&i<-.115?s:a).invert(e)},e.stream=function(e){var t=a.stream(e),n=o.stream(e),i=s.stream(e);return{point:function(e,r){t.point(e,r),n.point(e,r),i.point(e,r)},sphere:function(){t.sphere(),n.sphere(),i.sphere()},lineStart:function(){t.lineStart(),n.lineStart(),i.lineStart()},lineEnd:function(){t.lineEnd(),n.lineEnd(),i.lineEnd()},polygonStart:function(){t.polygonStart(),n.polygonStart(),i.polygonStart()},polygonEnd:function(){t.polygonEnd(),n.polygonEnd(),i.polygonEnd()}}},e.precision=function(t){return arguments.length?(a.precision(t),o.precision(t),s.precision(t),e):a.precision()},e.scale=function(t){return arguments.length?(a.scale(t),o.scale(.35*t),s.scale(t),e.translate(a.translate())):a.scale()},e.translate=function(t){if(!arguments.length)return a.translate();var c=a.scale(),d=+t[0],u=+t[1];return n=a.translate(t).clipExtent([[d-.455*c,u-.238*c],[d+.455*c,u+.238*c]]).stream(l).point,i=o.translate([d-.307*c,u+.201*c]).clipExtent([[d-.425*c+zo,u+.12*c+zo],[d-.214*c-zo,u+.234*c-zo]]).stream(l).point,r=s.translate([d-.205*c,u+.212*c]).clipExtent([[d-.214*c+zo,u+.166*c+zo],[d-.115*c-zo,u+.234*c-zo]]).stream(l).point,e},e.scale(1070)};var Fs,$s,Hs,Us,Js,Bs,Ws={point:C,lineStart:C,lineEnd:C,polygonStart:function(){$s=0,Ws.lineStart=Xt},polygonEnd:function(){Ws.lineStart=Ws.lineEnd=Ws.point=C,Fs+=ko($s/2)}},Ys={point:Qt,lineStart:C,lineEnd:C,polygonStart:C,polygonEnd:C},Ks={point:tn,lineStart:nn,lineEnd:rn,polygonStart:function(){Ks.lineStart=an},polygonEnd:function(){Ks.point=tn,Ks.lineStart=nn,Ks.lineEnd=rn}};fo.geo.path=function(){function e(e){return e&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=r(a)),fo.geo.stream(e,o)),a.result()}function t(){return o=null,e}var n,i,r,a,o,s=4.5;return e.area=function(e){return Fs=0,fo.geo.stream(e,r(Ws)),Fs},e.centroid=function(e){return As=Ns=Gs=Ls=Ds=Is=Ps=Rs=Vs=0,fo.geo.stream(e,r(Ks)),Vs?[Ps/Vs,Rs/Vs]:Is?[Ls/Is,Ds/Is]:Gs?[As/Gs,Ns/Gs]:[NaN,NaN]},e.bounds=function(e){return Js=Bs=-(Hs=Us=1/0),fo.geo.stream(e,r(Ys)),[[Hs,Us],[Js,Bs]]},e.projection=function(e){return arguments.length?(r=(n=e)?e.stream||ln(e):k,t()):n},e.context=function(e){return arguments.length?(a=null==(i=e)?new Zt:new on(e),"function"!=typeof s&&a.pointRadius(s),t()):i},e.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(a.pointRadius(+t),+t),e):s},e.projection(fo.geo.albersUsa()).context(null)},fo.geo.transform=function(e){return{stream:function(t){var n=new cn(t);for(var i in e)n[i]=e[i];return n}}},cn.prototype={point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},fo.geo.projection=un,fo.geo.projectionMutator=hn,(fo.geo.equirectangular=function(){return un(pn)}).raw=pn.invert=pn,fo.geo.rotation=function(e){function t(t){return t=e(t[0]*Jo,t[1]*Jo),t[0]*=Bo,t[1]*=Bo,t}return e=gn(e[0]%360*Jo,e[1]*Jo,e.length>2?e[2]*Jo:0),t.invert=function(t){return t=e.invert(t[0]*Jo,t[1]*Jo),t[0]*=Bo,t[1]*=Bo,t},t},_n.invert=pn,fo.geo.circle=function(){function e(){var e="function"==typeof i?i.apply(this,arguments):i,t=gn(-e[0]*Jo,-e[1]*Jo,0).invert,r=[];return n(null,null,1,{point:function(e,n){r.push(e=t(e,n)),e[0]*=Bo,e[1]*=Bo}}),{type:"Polygon",coordinates:[r]}}var t,n,i=[0,0],r=6;return e.origin=function(t){return arguments.length?(i=t,e):i},e.angle=function(i){return arguments.length?(n=bn((t=+i)*Jo,r*Jo),e):t},e.precision=function(i){return arguments.length?(n=bn(t*Jo,(r=+i)*Jo),e):r},e.angle(90)},fo.geo.distance=function(e,t){var n,i=(t[0]-e[0])*Jo,r=e[1]*Jo,a=t[1]*Jo,o=Math.sin(i),s=Math.cos(i),l=Math.sin(r),c=Math.cos(r),d=Math.sin(a),u=Math.cos(a);return Math.atan2(Math.sqrt((n=u*o)*n+(n=c*d-l*u*s)*n),l*d+c*u*s)},fo.geo.graticule=function(){function e(){return{type:"MultiLineString",coordinates:t()}}function t(){return fo.range(Math.ceil(a/g)*g,r,g).map(h).concat(fo.range(Math.ceil(c/m)*m,l,m).map(f)).concat(fo.range(Math.ceil(i/p)*p,n,p).filter(function(e){return ko(e%g)>zo}).map(d)).concat(fo.range(Math.ceil(s/_)*_,o,_).filter(function(e){return ko(e%m)>zo}).map(u))}var n,i,r,a,o,s,l,c,d,u,h,f,p=10,_=p,g=90,m=360,v=2.5;return e.lines=function(){return t().map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(f(l).slice(1),h(r).reverse().slice(1),f(c).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.majorExtent(t).minorExtent(t):e.minorExtent()},e.majorExtent=function(t){return arguments.length?(a=+t[0][0],r=+t[1][0],c=+t[0][1],l=+t[1][1],a>r&&(t=a,a=r,r=t),c>l&&(t=c,c=l,l=t),e.precision(v)):[[a,c],[r,l]]},e.minorExtent=function(t){return arguments.length?(i=+t[0][0],n=+t[1][0],s=+t[0][1],o=+t[1][1],i>n&&(t=i,i=n,n=t),s>o&&(t=s,s=o,o=t),e.precision(v)):[[i,s],[n,o]]},e.step=function(t){return arguments.length?e.majorStep(t).minorStep(t):e.minorStep()},e.majorStep=function(t){return arguments.length?(g=+t[0],m=+t[1],e):[g,m]},e.minorStep=function(t){return arguments.length?(p=+t[0],_=+t[1],e):[p,_]},e.precision=function(t){return arguments.length?(v=+t,d=xn(s,o,90),u=kn(i,n,v),h=xn(c,l,90),f=kn(a,r,v),e):v},e.majorExtent([[-180,-90+zo],[180,90-zo]]).minorExtent([[-180,-80-zo],[180,80+zo]])},fo.geo.greatArc=function(){function e(){return{type:"LineString",coordinates:[t||i.apply(this,arguments),n||r.apply(this,arguments)]}}var t,n,i=jn,r=Mn;return e.distance=function(){return fo.geo.distance(t||i.apply(this,arguments),n||r.apply(this,arguments))},e.source=function(n){return arguments.length?(i=n,t="function"==typeof n?null:n,e):i},e.target=function(t){return arguments.length?(r=t,n="function"==typeof t?null:t,e):r},e.precision=function(){return arguments.length?e:0},e},fo.geo.interpolate=function(e,t){return Cn(e[0]*Jo,e[1]*Jo,t[0]*Jo,t[1]*Jo)},fo.geo.length=function(e){return Xs=0,fo.geo.stream(e,Qs),Xs};var Xs,Qs={sphere:C,point:C,lineStart:Sn,lineEnd:C,polygonStart:C,polygonEnd:C},Zs=Tn(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(fo.geo.azimuthalEqualArea=function(){return un(Zs)}).raw=Zs;var el=Tn(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},k);(fo.geo.azimuthalEquidistant=function(){return un(el)}).raw=el,(fo.geo.conicConformal=function(){return Yt(On)}).raw=On,(fo.geo.conicEquidistant=function(){return Yt(An)}).raw=An;var tl=Tn(function(e){return 1/e},Math.atan);(fo.geo.gnomonic=function(){return un(tl)}).raw=tl,Nn.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-Uo]},(fo.geo.mercator=function(){return Gn(Nn)}).raw=Nn;var nl=Tn(function(){return 1},Math.asin);(fo.geo.orthographic=function(){return un(nl)}).raw=nl;var il=Tn(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(fo.geo.stereographic=function(){return un(il)}).raw=il,Ln.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Uo]},(fo.geo.transverseMercator=function(){var e=Gn(Ln),t=e.center,n=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return e?n([e[0],e[1],e.length>2?e[2]+90:90]):(e=n(),[e[0],e[1],e[2]-90])},n([0,0,90])}).raw=Ln,fo.geom={},fo.geom.hull=function(e){function t(e){if(e.length<3)return[];var t,r=Ne(n),a=Ne(i),o=e.length,s=[],l=[];for(t=0;t=0;--t)f.push(e[s[c[t]][2]]);for(t=+u;t=i&&c.x<=a&&c.y>=r&&c.y<=o?[[i,o],[a,o],[a,r],[i,r]]:[]).point=e[s]}),t}function n(e){return e.map(function(e,t){return{x:Math.round(a(e,t)/zo)*zo,y:Math.round(o(e,t)/zo)*zo,i:t}})}var i=Dn,r=In,a=i,o=r,s=hl;return e?t(e):(t.links=function(e){return hi(n(e)).edges.filter(function(e){return e.l&&e.r}).map(function(t){return{source:e[t.l.i],target:e[t.r.i]}})},t.triangles=function(e){var t=[];return hi(n(e)).cells.forEach(function(n,i){for(var r,a=n.site,o=n.edges.sort(Kn),s=-1,l=o.length,c=o[l-1].edge,d=c.l===a?c.r:c.l;++s=c,h=i>=d,f=h<<1|u;e.leaf=!1,e=e.nodes[f]||(e.nodes[f]=mi()),u?r=c:s=c,h?o=d:l=d,a(e,t,n,i,r,o,s,l)}var d,u,h,f,p,_,g,m,v,y=Ne(s),b=Ne(l);if(null!=t)_=t,g=n,m=i,v=r;else if(m=v=-(_=g=1/0),u=[],h=[],p=e.length,o)for(f=0;fm&&(m=d.x),d.y>v&&(v=d.y),u.push(d.x),h.push(d.y);else for(f=0;fm&&(m=w),x>v&&(v=x),u.push(w),h.push(x)}var k=m-_,j=v-g;k>j?v=g+k:m=_+j;var M=mi();if(M.add=function(e){a(M,e,+y(e,++f),+b(e,f),_,g,m,v)},M.visit=function(e){vi(e,M,_,g,m,v)},M.find=function(e){return yi(M,e[0],e[1],_,g,m,v)},f=-1,null==t){for(;++f=0?e.slice(0,t):e,i=t>=0?e.slice(t+1):"in";return n=gl.get(n)||_l,i=ml.get(i)||k,Ci(i(n.apply(null,po.call(arguments,1))))},fo.interpolateHcl=Ei,fo.interpolateHsl=zi,fo.interpolateLab=qi,fo.interpolateRound=Fi,fo.transform=function(e){var t=go.createElementNS(fo.ns.prefix.svg,"g");return(fo.transform=function(e){if(null!=e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate()}return new $i(n?n.matrix:vl)})(e)},$i.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vl={a:1,b:0,c:0,d:1,e:0,f:0};fo.interpolateTransform=Qi,fo.layout={},fo.layout.bundle=function(){return function(e){for(var t=[],n=-1,i=e.length;++n0?r=e:(n.c=null,n.t=NaN,n=null,c.end({type:"end",alpha:r=0})):e>0&&(c.start({type:"start",alpha:r=e}),n=Pe(l.tick)),l):r},l.start=function(){function e(e,i){if(!n){for(n=new Array(r),l=0;l=0;)o.push(d=c[l]),d.parent=a,d.depth=a.depth+1;i&&(a.value=0),a.children=c}else i&&(a.value=+i.call(e,a,a.depth)||0),delete a.children;return ur(r,function(e){var n,r;t&&(n=e.children)&&n.sort(t),i&&(r=e.parent)&&(r.value+=e.value)}),s}var t=pr,n=hr,i=fr;return e.sort=function(n){return arguments.length?(t=n,e):t},e.children=function(t){return arguments.length?(n=t,e):n},e.value=function(t){return arguments.length?(i=t,e):i},e.revalue=function(t){return i&&(dr(t,function(e){e.children&&(e.value=0)}),ur(t,function(t){var n;t.children||(t.value=+i.call(e,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)})),t},e},fo.layout.partition=function(){function e(t,n,i,r){var a=t.children;if(t.x=n,t.y=t.depth*r,t.dx=i,t.dy=r,a&&(o=a.length)){var o,s,l,c=-1;for(i=t.value?i/t.value:0;++cs&&(s=i),o.push(i)}for(n=0;n0)for(a=-1;++a=d[0]&&s<=d[1]&&(o=l[fo.bisect(u,s,1,f)-1],o.y+=p,o.push(e[a]));return l}var t=!0,n=Number,i=Cr,r=jr;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(i=Ne(t),e):i},e.bins=function(t){return arguments.length?(r="number"==typeof t?function(e){return Mr(e,t)}:Ne(t),e):r},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},fo.layout.pack=function(){function e(e,a){var o=n.call(this,e,a),s=o[0],l=r[0],c=r[1],d=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,ur(s,function(e){e.r=+d(e.value)}),ur(s,Nr),i){var u=i*(t?1:Math.max(2*s.r/l,2*s.r/c))/2;ur(s,function(e){e.r+=u}),ur(s,Nr),ur(s,function(e){e.r-=u})}return Dr(s,l/2,c/2,t?1:1/Math.max(2*s.r/l,2*s.r/c)),o}var t,n=fo.layout.hierarchy().sort(Sr),i=0,r=[1,1];return e.size=function(t){return arguments.length?(r=t,e):r},e.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,e):t},e.padding=function(t){return arguments.length?(i=+t,e):i},cr(e,n)},fo.layout.tree=function(){function e(e,r){var d=o.call(this,e,r),u=d[0],h=t(u);if(ur(h,n),h.parent.m=-h.z,dr(h,i),c)dr(u,a);else{var f=u,p=u,_=u;dr(u,function(e){e.xp.x&&(p=e),e.depth>_.depth&&(_=e)});var g=s(f,p)/2-f.x,m=l[0]/(p.x+s(p,f)/2+g),v=l[1]/(_.depth||1);dr(u,function(e){e.x=(e.x+g)*m,e.y=e.depth*v})}return d}function t(e){for(var t,n={A:null,children:[e]},i=[n];null!=(t=i.pop());)for(var r,a=t.children,o=0,s=a.length;o0&&(Er(qr(o,e,n),e,i),c+=i,d+=i),u+=o.m,c+=r.m,h+=l.m,d+=a.m;o&&!Vr(a)&&(a.t=o,a.m+=u-d),r&&!Rr(l)&&(l.t=r,l.m+=c-h,n=e)}return n}function a(e){e.x*=l[0],e.y=e.depth*l[1]}var o=fo.layout.hierarchy().sort(null).value(null),s=Pr,l=[1,1],c=null;return e.separation=function(t){return arguments.length?(s=t,e):s},e.size=function(t){return arguments.length?(c=null==(l=t)?a:null,e):c?null:l},e.nodeSize=function(t){return arguments.length?(c=null==(l=t)?null:a,e):c?l:null},cr(e,o)},fo.layout.cluster=function(){function e(e,a){var o,s=t.call(this,e,a),l=s[0],c=0;ur(l,function(e){var t=e.children;t&&t.length?(e.x=$r(t),e.y=Fr(t)):(e.x=o?c+=n(e,o):0,e.y=0,o=e)});var d=Hr(l),u=Ur(l),h=d.x-n(d,u)/2,f=u.x+n(u,d)/2;return ur(l,r?function(e){e.x=(e.x-l.x)*i[0],e.y=(l.y-e.y)*i[1]}:function(e){e.x=(e.x-h)/(f-h)*i[0],e.y=(1-(l.y?e.y/l.y:1))*i[1]}),s}var t=fo.layout.hierarchy().sort(null).value(null),n=Pr,i=[1,1],r=!1;return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=null==(i=t),e):r?null:i},e.nodeSize=function(t){return arguments.length?(r=null!=(i=t),e):r?i:null},cr(e,t)},fo.layout.treemap=function(){function e(e,t){for(var n,i,r=-1,a=e.length;++r0;)d.push(o=h[l-1]),d.area+=o.area,"squarify"!==f||(s=i(d,_))<=p?(h.pop(),p=s):(d.area-=d.pop().area,r(d,_,c,!1),_=Math.min(c.dx,c.dy),d.length=d.area=0,p=1/0);d.length&&(r(d,_,c,!0),d.length=d.area=0),a.forEach(t)}}function n(t){var i=t.children;if(i&&i.length){var a,o=u(t),s=i.slice(),l=[];for(e(s,o.dx*o.dy/t.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(r(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);i.forEach(n)}}function i(e,t){for(var n,i=e.area,r=0,a=1/0,o=-1,s=e.length;++or&&(r=n));return i*=i,t*=t,i?Math.max(t*r*p/i,i/(t*a*p)):1/0}function r(e,t,n,i){var r,a=-1,o=e.length,s=n.x,c=n.y,d=t?l(e.area/t):0;if(t==n.dx){for((i||d>n.dy)&&(d=n.dy);++an.dx)&&(d=n.dx);++a1);return e+t*n*Math.sqrt(-2*Math.log(r)/r)}},logNormal:function(){var e=fo.random.normal.apply(fo,arguments);return function(){return Math.exp(e())}},bates:function(e){var t=fo.random.irwinHall(e);return function(){return t()/e}},irwinHall:function(e){return function(){for(var t=0,n=0;nu?0:1;if(c=Ho)return t(c,f)+(e?t(e,1-f):"")+"Z";var p,_,g,m,v,y,b,w,x,k,j,M,C=0,S=0,T=[];if((m=(+l.apply(this,arguments)||0)/2)&&(g=a===Ll?Math.sqrt(e*e+c*c):+a.apply(this,arguments),f||(S*=-1),c&&(S=oe(g/c*Math.sin(m))),e&&(C=oe(g/e*Math.sin(m)))),c){v=c*Math.cos(d+S),y=c*Math.sin(d+S),b=c*Math.cos(u-S),w=c*Math.sin(u-S);var O=Math.abs(u-d-2*S)<=Fo?0:1;if(S&&xa(v,y,b,w)===f^O){var A=(d+u)/2;v=c*Math.cos(A),y=c*Math.sin(A),b=w=null}}else v=y=0;if(e){x=e*Math.cos(u-C),k=e*Math.sin(u-C),j=e*Math.cos(d+C),M=e*Math.sin(d+C);var N=Math.abs(d-u+2*C)<=Fo?0:1;if(C&&xa(x,k,j,M)===1-f^N){var G=(d+u)/2;x=e*Math.cos(G),k=e*Math.sin(G),j=M=null}}else x=k=0;if(h>zo&&(p=Math.min(Math.abs(c-e)/2,+r.apply(this,arguments)))>.001){_=eFo)+",1 "+t}function r(e,t,n,i){return"Q 0,0 "+i}var a=jn,o=Mn,s=Ba,l=ya,c=ba;return e.radius=function(t){return arguments.length?(s=Ne(t),e):s},e.source=function(t){return arguments.length?(a=Ne(t),e):a},e.target=function(t){return arguments.length?(o=Ne(t),e):o},e.startAngle=function(t){return arguments.length?(l=Ne(t),e):l},e.endAngle=function(t){return arguments.length?(c=Ne(t),e):c},e},fo.svg.diagonal=function(){function e(e,r){var a=t.call(this,e,r),o=n.call(this,e,r),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return l=l.map(i),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var t=jn,n=Mn,i=Wa;return e.source=function(n){return arguments.length?(t=Ne(n),e):t},e.target=function(t){return arguments.length?(n=Ne(t),e):n},e.projection=function(t){return arguments.length?(i=t,e):i},e},fo.svg.diagonal.radial=function(){var e=fo.svg.diagonal(),t=Wa,n=e.projection;return e.projection=function(e){return arguments.length?n(Ya(t=e)):t},e},fo.svg.symbol=function(){function e(e,i){return(Vl.get(t.call(this,e,i))||Qa)(n.call(this,e,i))}var t=Xa,n=Ka;return e.type=function(n){return arguments.length?(t=Ne(n),e):t},e.size=function(t){return arguments.length?(n=Ne(t),e):n},e};var Vl=fo.map({circle:Qa,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*zl)),n=t*zl;return"M0,"+-t+"L"+n+",0 0,"+t+" "+-n+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/El),n=t*El/2;return"M0,"+n+"L"+t+","+-n+" "+-t+","+-n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/El),n=t*El/2;return"M0,"+-n+"L"+t+","+n+" "+-t+","+n+"Z"}});fo.svg.symbolTypes=Vl.keys();var El=Math.sqrt(3),zl=Math.tan(30*Jo);Go.transition=function(e){for(var t,n,i=ql||++Ul,r=io(e),a=[],o=Fl||{time:Date.now(),ease:Ni,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",u[1]-u[0])}function i(e){e.select(".extent").attr("y",h[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function r(){function r(){32==fo.event.keyCode&&(T||(y=null,N[0]-=u[1],N[1]-=h[1],T=2),O())}function _(){32==fo.event.keyCode&&2==T&&(N[0]+=u[1],N[1]+=h[1],T=0,O())}function g(){var e=fo.mouse(w),r=!1;b&&(e[0]+=b[0],e[1]+=b[1]),T||(fo.event.altKey?(y||(y=[(u[0]+u[1])/2,(h[0]+h[1])/2]),N[0]=u[+(e[0]1?window.history.back():this.navigate("#",{trigger:!0,replace:!0})},trackPageview:function(){var t=e.history.getFragment();/^\//.test(t)||""==t||(t="/"+t),"undefined"!=typeof ga&&ga("send","pageview",Galaxy.root+"library/list"+t)}}),C=c.default.SessionStorageModel.extend({defaults:{with_deleted:!1,without_restricted:!1,sort_order:"asc",sort_by:"name",library_page_size:20,folder_page_size:15}}),S=e.View.extend({libraryToolbarView:null,libraryListView:null,library_router:null,libraryView:null,folderToolbarView:null,folderListView:null,datasetView:null,initialize:function(){window.Galaxy.config.ga_code&&(!function(e,t,n,i,r,a,o){e.GoogleAnalyticsObject=r,e[r]=e[r]||function(){(e[r].q=e[r].q||[]).push(arguments)},e[r].l=1*new Date,a=t.createElement(n),o=t.getElementsByTagName(n)[0],a.async=1,a.src="//www.google-analytics.com/analytics.js",o.parentNode.insertBefore(a,o)}(window,document,"script",0,"ga"),ga("create",window.Galaxy.config.ga_code,"auto"),ga("send","pageview")),Galaxy.libraries=this,this.preferences=new C({id:"global-lib-prefs"}),this.library_router=new M,this.library_router.on("route:libraries",function(){Galaxy.libraries.libraryToolbarView&&Galaxy.libraries.libraryToolbarView.$el.unbind("click"),Galaxy.libraries.libraryToolbarView=new g.default.LibraryToolbarView,Galaxy.libraries.libraryListView=new p.default.LibraryListView}),this.library_router.on("route:libraries_page",function(e){null===Galaxy.libraries.libraryToolbarView?(Galaxy.libraries.libraryToolbarView=new g.default.LibraryToolbarView,Galaxy.libraries.libraryListView=new p.default.LibraryListView({show_page:e})):Galaxy.libraries.libraryListView.render({show_page:e})}),this.library_router.on("route:folder_content",function(e){Galaxy.libraries.folderToolbarView&&Galaxy.libraries.folderToolbarView.$el.unbind("click"),Galaxy.libraries.folderToolbarView=new v.default.FolderToolbarView({id:e}),Galaxy.libraries.folderListView=new h.default.FolderListView({id:e})}),this.library_router.on("route:folder_page",function(e,t){null===Galaxy.libraries.folderToolbarView?(Galaxy.libraries.folderToolbarView=new v.default.FolderToolbarView({id:e}),Galaxy.libraries.folderListView=new h.default.FolderListView({id:e,show_page:t})):Galaxy.libraries.folderListView.render({id:e,show_page:parseInt(t)})}),this.library_router.on("route:download",function(e,t){0===i("#folder_list_body").find(":checked").length?(s.default.info("You must select at least one dataset to download"),Galaxy.libraries.library_router.navigate("folders/"+e,{trigger:!0,replace:!0})):(Galaxy.libraries.folderToolbarView.download(e,t),Galaxy.libraries.library_router.navigate("folders/"+e,{trigger:!1,replace:!0}))}),this.library_router.on("route:dataset_detail",function(e,t){Galaxy.libraries.datasetView&&Galaxy.libraries.datasetView.$el.unbind("click"),Galaxy.libraries.datasetView=new b.default.LibraryDatasetView({id:t,show_version:!1,show_permissions:!1})}),this.library_router.on("route:dataset_version",function(e,t,n){Galaxy.libraries.datasetView&&Galaxy.libraries.datasetView.$el.unbind("click"),Galaxy.libraries.datasetView=new b.default.LibraryDatasetView({id:t,ldda_id:n,show_version:!0})}),this.library_router.on("route:dataset_permissions",function(e,t){Galaxy.libraries.datasetView&&Galaxy.libraries.datasetView.$el.unbind("click"),Galaxy.libraries.datasetView=new b.default.LibraryDatasetView({id:t,show_permissions:!0})}),this.library_router.on("route:library_permissions",function(e){Galaxy.libraries.libraryView&&Galaxy.libraries.libraryView.$el.unbind("click"),Galaxy.libraries.libraryView=new x.default.LibraryView({id:e,show_permissions:!0})}),this.library_router.on("route:folder_permissions",function(e){Galaxy.libraries.folderView&&Galaxy.libraries.folderView.$el.unbind("click"),Galaxy.libraries.folderView=new j.default.FolderView({id:e,show_permissions:!0})}),this.library_router.on("route:import_datasets",function(e,t){Galaxy.libraries.folderToolbarView&&Galaxy.libraries.folderListView?Galaxy.libraries.folderToolbarView.showImportModal({source:t}):(Galaxy.libraries.folderToolbarView=new v.default.FolderToolbarView({id:e}),Galaxy.libraries.folderListView=new h.default.FolderListView({id:e}),Galaxy.libraries.folderToolbarView.showImportModal({source:t}))}),e.history.start({pushState:!1})}});t.default={GalaxyApp:S}}).call(t,n(2),n(0))},297:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t){return function(n,i){return n.get("type")===i.get("type")?n.has(e)||i.has(e)?n.has(e)?i.has(e)?n.get(e).toLowerCase()>i.get(e).toLowerCase()?"asc"===t?1:-1:i.get(e).toLowerCase()>n.get(e).toLowerCase()?"asc"===t?-1:1:0:-1:1:0:"folder"===n.get("type")?-1:1}},r=function(e,t){return function(n,i){return n.get(e).toLowerCase()>i.get(e).toLowerCase()?"asc"===t?1:-1:i.get(e).toLowerCase()>n.get(e).toLowerCase()?"asc"===t?-1:1:0}};t.default={generateFolderComparator:i,generateLibraryComparator:r}},298:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(299),u=a(d),h=e.View.extend({el:"#folder_items_element",progress:0,progressStep:1,folderContainer:null,current_sort_order:"asc",current_sort_key:"name",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .folder_row":"selectClickedRow","click .sort-folder-name":"sortColumnClicked","click .sort-folder-file_ext":"sortColumnClicked","click .sort-folder-description":"sortColumnClicked","click .sort-folder-state":"sortColumnClicked"},collection:null,defaults:{include_deleted:!1,page_count:null,show_page:null},initialize:function(e){this.options=i.defaults(this.options||{},this.defaults,e),this.modal=null,this.rowViews={},this.collection=new c.default.Folder,this.listenTo(this.collection,"add",this.renderOne),this.listenTo(this.collection,"remove",this.removeOne),this.listenTo(this.collection,"sort",this.rePaint),this.listenTo(this.collection,"reset",this.rePaint),this.fetchFolder()},fetchFolder:function(e){var e=e||{};this.options.include_deleted=e.include_deleted;var t=this;this.folderContainer=new c.default.FolderContainer({id:this.options.id}),this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents",this.options.include_deleted&&(this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"),this.folderContainer.fetch({success:function(e){t.folder_container=e,t.render()},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):s.default.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},render:function(e){this.options=i.extend(this.options,e);var t=this.templateFolder();r(".tooltip").hide();var n,a=this.folderContainer.attributes.metadata.full_path;if(n=1===a.length?0:a[a.length-2][0],this.$el.html(t({path:this.folderContainer.attributes.metadata.full_path,parent_library_id:this.folderContainer.attributes.metadata.parent_library_id,id:this.options.id,upper_folder_id:n,order:this.current_sort_order})),this.options.dataset_id){var o=i.findWhere(self.rowViews,{id:this.options.dataset_id});o?o.showDatasetDetails():s.default.error("Requested dataset not found. Showing folder instead.")}else(null===this.options.show_page||this.options.show_page<1)&&(this.options.show_page=1),this.paginate();r("#center [data-toggle]").tooltip(),r("#center").css("overflow","auto")},paginate:function(e){this.options=i.extend(this.options,e),(null===this.options.show_page||this.options.show_page<1)&&(this.options.show_page=1),this.options.total_items_count=this.folder_container.get("folder").models.length,this.options.page_count=Math.ceil(this.options.total_items_count/Galaxy.libraries.preferences.get("folder_page_size"));var t=Galaxy.libraries.preferences.get("folder_page_size")*(this.options.show_page-1),n=null;n=this.folder_container.get("folder").models.slice(t,t+Galaxy.libraries.preferences.get("folder_page_size")),this.options.items_shown=n.length,Galaxy.libraries.preferences.get("folder_page_size")*this.options.show_page>this.options.total_items_count+Galaxy.libraries.preferences.get("folder_page_size")&&(n=[]),Galaxy.libraries.folderToolbarView.renderPaginator(this.options),this.collection.reset(n)},rePaint:function(e){this.options=i.extend(this.options,e),this.removeAllRows(),this.renderAll(),this.checkEmptiness()},addAll:function(e){i.each(e,function(e){Galaxy.libraries.folderListView.collection.add(e,{current_sort_order:!1})}),r("#center [data-toggle]").tooltip(),this.checkEmptiness(),this.postRender()},postRender:function(){var e=this.folderContainer.attributes.metadata;e.contains_file_or_folder=void 0!==this.collection.findWhere({type:"file"})||void 0!==this.collection.findWhere({type:"folder"}),Galaxy.libraries.folderToolbarView.configureElements(e)},renderAll:function(){var e=this;i.each(this.collection.models.reverse(),function(t){e.renderOne(t)}),this.postRender()},renderOne:function(e){this.options.contains_file_or_folder=!0,e.set("folder_id",this.id);var t=new u.default.FolderRowView({model:e});this.rowViews[e.get("id")]=t,this.$el.find("#first_folder_item").after(t.el)},removeOne:function(e){this.$el.find("tr").filter(function(){return r(this).data("id")&&r(this).data("id")===e.id}).remove()},removeAllRows:function(){r(".library-row").remove()},checkEmptiness:function(){0===this.$el.find(".dataset_row").length&&0===this.$el.find(".folder_row").length?this.$el.find(".empty-folder-message").show():this.$el.find(".empty-folder-message").hide()},sortColumnClicked:function(e){e.preventDefault(),this.current_sort_order="asc"===this.current_sort_order?"desc":"asc",this.current_sort_key=e.currentTarget.className.replace("sort-folder-",""),this.collection.sortFolder(this.current_sort_key,this.current_sort_order),this.renderSortIcon()},selectAll:function(e){var t=e.target.checked,n=this;r(":checkbox","#folder_list_body").each(function(){this.checked=t;var e=r(this).closest("tr");t?n.makeDarkRow(e):n.makeWhiteRow(e)})},selectClickedRow:function(e){var t,n,i="";t=r(e.target).closest("tr"),"input"===e.target.localName?(i=e.target,n="input"):"td"===e.target.localName&&(i=t.find(":checkbox")[0],n="td"),i.checked?"td"===n?(i.checked="",this.makeWhiteRow(t)):"input"===n&&this.makeDarkRow(t):"td"===n?(i.checked="selected",this.makeDarkRow(t)):"input"===n&&this.makeWhiteRow(t)},makeDarkRow:function(e){e.removeClass("light").addClass("dark"),e.find("a").removeClass("light").addClass("dark"),e.find(".fa-file-o").removeClass("fa-file-o").addClass("fa-file"),e.find(".fa-folder-o").removeClass("fa-folder-o").addClass("fa-folder")},makeWhiteRow:function(e){e.removeClass("dark").addClass("light"),e.find("a").removeClass("dark").addClass("light"),e.find(".fa-file").removeClass("fa-file").addClass("fa-file-o"),e.find(".fa-folder").removeClass("fa-folder").addClass("fa-folder-o")},renderSortIcon:function(){"asc"===this.current_sort_order?(r('[class*="sort-icon"]').removeClass("fa-sort-alpha-desc").removeClass("fa-sort-alpha-asc"),r(".sort-icon-"+this.current_sort_key).addClass("fa-sort-alpha-asc")):r(".sort-icon-"+this.current_sort_key).addClass("fa-sort-alpha-desc")},templateFolder:function(){return i.template(['",'',"",'','','','','','','','',' ',"",'','',"","","","","","","","","","","","
    name description data type sizetime updated (UTC)state
    ",'" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..',"
    ",'"].join(""))}});t.default={FolderListView:h}}).call(t,n(2),n(1),n(0))},299:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(126),u=a(d),h=e.View.extend({events:{"click .undelete_dataset_btn":"undeleteDataset","click .undelete_folder_btn":"undeleteFolder","click .edit_folder_btn":"startModifications","click .cancel_folder_btn":"cancelModifications","click .save_folder_btn":"saveModifications"},defaults:{type:null,visibility_config:{edit_folder_btn:!1,save_folder_btn:!1,cancel_folder_btn:!1,permission_folder_btn:!1},edit_mode:!1},initialize:function(e){this.options=i.defaults(e||{},this.defaults),this.render(this.options)},render:function(e){this.options=i.extend(this.options,e);var t=this.options.model,n=null;return"folder"===t.get("type")||"LibraryFolder"===t.get("model_class")?(this.options.type="folder",this.prepareButtons(t),n=t.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===t.get("type")||"LibraryDatasetDatasetAssociation"===t.get("model_class")||"LibraryDataset"===t.get("model_class")?(this.options.type="file",n=t.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(Galaxy.emit.error("Unknown library item type found."),Galaxy.emit.error(t.get("type")||t.get("model_class"))),this.setElement(n({content_item:t,edit_mode:this.options.edit_mode,button_config:this.options.visibility_config})),this.$el.show(),this},prepareButtons:function(e){var t=this.options.visibility_config;!1===this.options.edit_mode?(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("deleted")?(t.edit_folder_btn=!1,t.permission_folder_btn=!1):!1===e.get("deleted")&&(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("can_modify")&&(t.edit_folder_btn=!0),!0===e.get("can_manage")&&(t.permission_folder_btn=!0))):!0===this.options.edit_mode&&(t.edit_folder_btn=!1,t.permission_folder_btn=!1,t.save_folder_btn=!0,t.cancel_folder_btn=!0),this.options.visibility_config=t},showDatasetDetails:function(){Galaxy.libraries.datasetView=new u.default.LibraryDatasetView({id:this.id})},undeleteDataset:function(e){r(".tooltip").hide();var t=this,n=r(e.target).closest("tr").data("id"),i=Galaxy.libraries.folderListView.collection.get(n);i.url=i.urlRoot+i.id+"?undelete=true",i.destroy({success:function(e,i){Galaxy.libraries.folderListView.collection.remove(n);var r=new c.default.Item(i);Galaxy.libraries.folderListView.collection.add(r),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),s.default.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var e=t.model.get("folder_id");window.location=Galaxy.root+"library/list#folders/"+e+"/datasets/"+t.id}})},error:function(e,t){void 0!==t.responseJSON?s.default.error("Dataset was not undeleted. "+t.responseJSON.err_msg):s.default.error("An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(e){r(".tooltip").hide();var t=r(e.target).closest("tr").data("id"),n=Galaxy.libraries.folderListView.collection.get(t);n.url=n.urlRoot+n.id+"?undelete=true",n.destroy({success:function(e,n){Galaxy.libraries.folderListView.collection.remove(t);var i=new c.default.FolderAsModel(n);Galaxy.libraries.folderListView.collection.add(i),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),s.default.success("Folder undeleted.")},error:function(e,t){void 0!==t.responseJSON?s.default.error("Folder was not undeleted. "+t.responseJSON.err_msg):s.default.error("An error occured! Folder was not undeleted. Please try again.")}})},startModifications:function(){this.options.edit_mode=!0,this.repaint()},cancelModifications:function(){this.options.edit_mode=!1,this.repaint()},saveModifications:function(){var e=Galaxy.libraries.folderListView.collection.get(this.$el.data("id")),t=!1,n=this.$el.find(".input_folder_name").val();if(void 0!==n&&n!==e.get("name")){if(!(n.length>2))return void s.default.warning("Folder name has to be at least 3 characters long.");e.set("name",n),t=!0}var i=this.$el.find(".input_folder_description").val();if(void 0!==i&&i!==e.get("description")&&(e.set("description",i),t=!0),t){var r=this;e.save(null,{patch:!0,success:function(e){r.options.edit_mode=!1,r.repaint(e),s.default.success("Changes to folder saved.")},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg):s.default.error("An error occured while attempting to update the folder.")}})}else this.options.edit_mode=!1,this.repaint(e),s.default.info("Nothing has changed.")},repaint:function(){r(".tooltip").hide();var e=this.$el;this.render(),e.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},templateRowFolder:function(){return i.template(['',"",'',"",'',"<% if(!edit_mode) { %>","",'<%- content_item.get("name") %>',"","",'<%- content_item.get("description") %>',"","<% } else if(edit_mode){ %>",'','',"<% } %>","folder","","",'<%= _.escape(content_item.get("update_time")) %>',"","","","<% if(edit_mode) { %>",'",'","<% } else if (!edit_mode){%>",'",'','","","<% } %>","",""].join(""))},templateRowFile:function(){return i.template(['',"",'',"",'','',"","",'/datasets/<%- content_item.id %>" class="library-dataset">','<%- content_item.get("name") %>',"","",'<%- content_item.get("message") %>','<%= _.escape(content_item.get("file_ext")) %>','<%= _.escape(content_item.get("file_size")) %>','<%= _.escape(content_item.get("update_time")) %>',"",'<% if ( content_item.get("state") !== "ok" ) { %>','<%= _.escape(content_item.get("state")) %>',"<% } %>","","",'<% if (content_item.get("is_unrestricted")) { %>','',"<% } %>",'<% if (content_item.get("is_private")) { %>','',"<% } %>",'<% if ((content_item.get("is_unrestricted") === false) && (content_item.get("is_private") === false)) { %>','',"<% } %>",'<% if (content_item.get("can_manage")) { %>','/datasets/<%- content_item.id %>/permissions">','","","<% } %>","",""].join(""))},templateRowDeletedFile:function(){return i.template(['',"",'',"","",'','<%- content_item.get("name") %>',"","",'<%- content_item.get("message") %>',"","",'<%= _.escape(content_item.get("file_ext")) %>',"","",'<%= _.escape(content_item.get("file_size")) %>',"","",'<%= _.escape(content_item.get("update_time")) %>',"","",'<% if ( content_item.get("state") !== "ok" ) { %>','<%= _.escape(content_item.get("state")) %>',"<% } %>","","",'','","",""].join(""))},templateRowDeletedFolder:function(){return i.template(['',"",'',"","",'','<%- content_item.get("name") %>',"","",'<%- content_item.get("description") %>',"","","folder","","","",'<%= _.escape(content_item.get("update_time")) %>',"","","",'','","",""].join(""))}});t.default={FolderRowView:h}}).call(t,n(2),n(1),n(0))},300:function(e,t,n){"use strict";(function(e,i){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),o=r(a),s=n(13),l=r(s),c=n(301),d=r(c),u=n(1),h=r(u),f=e.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},defaults:{page_count:null,show_page:null,all_fetched:!1},initialize:function(e){this.options=h.default.defaults(this.options||{},e,this.defaults);var t=this;this.modal=null,this.collection=new l.default.Libraries,this.collection.url=this.collection.urlRoot+"?deleted=false",this.collection.fetch({success:function(){t.render()},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occurred.")}})},render:function(e){this.options=h.default.extend(this.options,e),this.setElement("#libraries_element");var t=this.templateLibraryList(),n=null,r=null,a=function(e){return!0===e.get("public")};if(i(".tooltip").hide(),void 0!==e&&(r=void 0!==e.models?e.models:null),null!==this.collection&&null===r)this.sortLibraries(),n=Galaxy.libraries.preferences.get("with_deleted")?this.collection.models:this.collection.where({deleted:!1}),Galaxy.libraries.preferences.get("without_restricted")&&(n=h.default.filter(n,a));else if(null!==r){if(Galaxy.libraries.preferences.get("with_deleted"))n=r;else{var o=function(e){return!1===e.get("deleted")};n=h.default.filter(r,o)}Galaxy.libraries.preferences.get("without_restricted")&&(n=h.default.filter(n,a))}else n=[];(null===this.options.show_page||this.options.show_page<1)&&(this.options.show_page=1),this.options.total_libraries_count=n.length;var s=Galaxy.libraries.preferences.get("library_page_size")*(this.options.show_page-1);this.options.page_count=Math.ceil(this.options.total_libraries_count/Galaxy.libraries.preferences.get("library_page_size")),this.options.total_libraries_count>0&&sthis.options.total_libraries_count+Galaxy.libraries.preferences.get("library_page_size")&&(n=[]),this.$el.html(t({length:1,order:Galaxy.libraries.preferences.get("sort_order"),search_term:Galaxy.libraries.libraryToolbarView.options.search_term})),Galaxy.libraries.libraryToolbarView.renderPaginator(this.options),this.renderRows(n)):(this.$el.html(t({length:0,order:Galaxy.libraries.preferences.get("sort_order"),search_term:Galaxy.libraries.libraryToolbarView.options.search_term})),Galaxy.libraries.libraryToolbarView.renderPaginator(this.options)),i("#center [data-toggle]").tooltip(),i("#center").css("overflow","auto")},fetchDeleted:function(){if(this.options.all_fetched)this.render();else{var e=this;this.collection.url=this.collection.urlRoot+"?deleted=true",this.collection.fetch({remove:!1,success:function(){e.options.all_fetched=!0,e.render()},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occurred.")}})}},renderRows:function(e){for(var t=0;t',"<% if(length === 0) { %>","<% if(search_term.length > 0) { %>","
    ","There are no libraries matching your search. Try different keyword.","
    ","<% } else{ %>","
    ","There are no libraries visible to you here. If you expected some to show up please consult the",' library security wikipage',' or visit the Galaxy support site.',"
    ","<% }%>","<% } else{ %>",'',"",'",'',' ','',"",'',"","
    ','',"name","",'',"descriptionsynopsis
    ","<% }%>","
    "].join(""))}});t.default={LibraryListView:f}}).call(t,n(2),n(0))},301:function(e,t,n){"use strict";(function(e,i,r){Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),o=function(e){return e&&e.__esModule?e:{default:e}}(a),s=e.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library"},edit_mode:!1,element_visibility_config:{upload_library_btn:!1,edit_library_btn:!1,permission_library_btn:!1,save_library_btn:!1,cancel_library_btn:!1,delete_library_btn:!1,undelete_library_btn:!1},initialize:function(e){this.render(e)},render:function(e){void 0===e&&(e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))),this.prepareButtons(e);var t=this.templateRow();return this.setElement(t({library:e,button_config:this.element_visibility_config,edit_mode:this.edit_mode})),this.$el.show(),this},repaint:function(e){i(".tooltip").hide();var t=this.$el;this.render(),t.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){var t=this.element_visibility_config;!1===this.edit_mode?(t.save_library_btn=!1,t.cancel_library_btn=!1,t.delete_library_btn=!1,!0===e.get("deleted")?(t.undelete_library_btn=!0,t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1):!1===e.get("deleted")&&(t.save_library_btn=!1,t.cancel_library_btn=!1,t.undelete_library_btn=!1,!0===e.get("can_user_add")&&(t.upload_library_btn=!0),!0===e.get("can_user_modify")&&(t.edit_library_btn=!0),!0===e.get("can_user_manage")&&(t.permission_library_btn=!0))):!0===this.edit_mode&&(t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1,t.save_library_btn=!0,t.cancel_library_btn=!0,t.delete_library_btn=!0,t.undelete_library_btn=!1),this.element_visibility_config=t},edit_button_clicked:function(){this.edit_mode=!0,this.repaint()},cancel_library_modification:function(){this.edit_mode=!1,this.repaint()},save_library_modification:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=!1,n=this.$el.find(".input_library_name").val();if(void 0!==n&&n!==e.get("name")){if(!(n.length>2))return void o.default.warning("Library name has to be at least 3 characters long.");e.set("name",n),t=!0}var i=this.$el.find(".input_library_description").val();void 0!==i&&i!==e.get("description")&&(e.set("description",i),t=!0);var r=this.$el.find(".input_library_synopsis").val();if(void 0!==r&&r!==e.get("synopsis")&&(e.set("synopsis",r),t=!0),t){var a=this;e.save(null,{patch:!0,success:function(e){a.edit_mode=!1,a.repaint(e),o.default.success("Changes to library saved.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while attempting to update the library.")}})}else this.edit_mode=!1,this.repaint(e),o.default.info("Nothing has changed.")},delete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.destroy({success:function(e){e.set("deleted",!0),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,!1===Galaxy.libraries.preferences.get("with_deleted")?(i(".tooltip").hide(),t.repaint(e),t.$el.remove()):!0===Galaxy.libraries.preferences.get("with_deleted")&&t.repaint(e),o.default.success("Library has been marked deleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured during deleting the library.")}})},undelete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.url=e.urlRoot+e.id+"?undelete=true",e.destroy({success:function(e){e.set("deleted",!1),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,t.repaint(e),o.default.success("Library has been undeleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while undeleting the library.")}})},templateRow:function(){return r.template(['" style="display:none;" data-id="<%- library.get("id") %>">',"<% if(!edit_mode) { %>",'<% if(library.get("deleted")) { %>','<%- library.get("name") %>',"<% } else { %>",'"><%- library.get("name") %>',"<% } %>",'<% if(library.get("description")) { %>','<% if( (library.get("description")).length> 80 ) { %>','"><%= _.escape(library.get("description")).substring(0, 80) + "..." %>',"<% } else { %>",'<%= _.escape(library.get("description"))%>',"<% } %>","<% } else { %>","","<% } %>",'<% if(library.get("synopsis")) { %>','<% if( (library.get("synopsis")).length> 120 ) { %>','"><%= _.escape(library.get("synopsis")).substring(0, 120) + "..." %>',"<% } else { %>",'<%= _.escape(library.get("synopsis"))%>',"<% } %>","<% } else { %>","","<% } %>","<% } else if(edit_mode){ %>",'','','',"<% } %>",'','<% if( (library.get("public")) && (library.get("deleted") === false) ) { %>',' ',"<% }%>",'','/permissions">','','','','" class="fa fa-ban fa-lg">','',"",""].join(""))}});t.default={LibraryRowView:s}}).call(t,n(2),n(0),n(1))},302:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=e.View.extend({el:"#center",defaults:{search_term:""},events:{"click #create_new_library_btn":"createLibraryFromModal","click #include_deleted_chk":"includeDeletedChecked","click #exclude_restricted_chk":"excludeRestrictedChecked","click .page_size_prompt":"showPageSizePrompt","keyup .library-search-input":"searchLibraries"},initialize:function(e){this.options=i.defaults(this.options||{},e,this.defaults),this.render()},render:function(){var e=this.templateToolBar(),t=!1,n=!0;Galaxy.user&&(t=Galaxy.user.isAdmin(),n=Galaxy.user.isAnonymous()),this.$el.html(e({admin_user:t,anon_user:n})),t&&(this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted"),this.$el.find("#exclude_restricted_chk")[0].checked=Galaxy.libraries.preferences.get("without_restricted"))},renderPaginator:function(e){this.options=i.extend(this.options,e);var t=this.templatePaginator();this.$el.find("#library_paginator").html(t({show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_libraries_count:this.options.total_libraries_count,libraries_shown:this.options.libraries_shown,library_page_size:Galaxy.libraries.preferences.get("library_page_size")}))},createLibraryFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this;this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){t.createNewLibrary()},Close:function(){t.modal.hide()}}})},createNewLibrary:function(){var e=this.serializeNewLibrary();if(this.validateNewLibrary(e)){var t=new c.default.Library,n=this;t.save(e,{success:function(e){Galaxy.libraries.libraryListView.collection.add(e),n.modal.hide(),n.clearLibraryModal(),Galaxy.libraries.libraryListView.render(),s.default.success("Library created.")},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg):s.default.error("An error occured.")}})}else s.default.error("Library's name is missing.");return!1},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({library_page_size:parseInt(t)}),Galaxy.libraries.libraryListView.render({show_page:1}))},clearLibraryModal:function(){r("input[name='Name']").val(""),r("input[name='Description']").val(""),r("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:r("input[name='Name']").val(),description:r("input[name='Description']").val(),synopsis:r("input[name='Synopsis']").val()}},validateNewLibrary:function(e){return""!==e.name},includeDeletedChecked:function(e){e.target.checked?(Galaxy.libraries.preferences.set({with_deleted:!0}),Galaxy.libraries.libraryListView.fetchDeleted()):(Galaxy.libraries.preferences.set({with_deleted:!1}),Galaxy.libraries.libraryListView.render())},excludeRestrictedChecked:function(e){e.target.checked?Galaxy.libraries.preferences.set({without_restricted:!0}):Galaxy.libraries.preferences.set({without_restricted:!1}),Galaxy.libraries.libraryListView.render()},searchLibraries:function(e){var t=r(".library-search-input").val();this.options.search_term=t,Galaxy.libraries.libraryListView.searchLibraries(t)},templateToolBar:function(){return i.template(['
    ','
    ','
    ','
    ','DATA LIBRARIES','',"",'
    ','',"
    ","<% if(admin_user === true) { %>",'
    ',"","","
    ",'','',"","<% } %>",'','','',"","","
    ","
    ","
    ",'
    ',"
    ","
    "].join(""))},templatePaginator:function(){return i.template(['","",' <%- libraries_shown %> libraries shown (change)',"",""," <%- total_libraries_count %> total",""].join(""))},templateNewLibraryInModal:function(){return i.template(['
    ',"
    ",'','','',"
    ","
    "].join(""))}});t.default={LibraryToolbarView:d}}).call(t,n(2),n(1),n(0))},303:function(e,t,n){"use strict";(function(e,i,r,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),l=o(s),c=n(7),d=o(c),u=n(13),h=o(u),f=n(10),p=o(f);n(127);var _=e.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedItems","click .toolbtn-show-locinfo":"showLocInfo","click .page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:!1,contains_file_or_folder:!1,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(e){this.options=i.defaults(e||{},this.defaults),this.fetchExtAndGenomes(),this.render()},render:function(e){this.options=i.extend(this.options,e);var t=this.templateToolBar(),n={id:this.options.id,is_admin:!1,is_anonym:!0,mutiple_add_dataset_options:!1};Galaxy.user&&(n.is_admin=Galaxy.user.isAdmin(),n.is_anonym=Galaxy.user.isAnonymous(),null===Galaxy.config.user_library_import_dir&&!1===Galaxy.config.allow_library_path_paste&&null===Galaxy.config.library_import_dir||(n.mutiple_add_dataset_options=!0)),this.$el.html(t(n))},renderPaginator:function(e){this.options=i.extend(this.options,e);var t=this.templatePaginator();r("body").find(".folder-paginator").html(t({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown,folder_page_size:Galaxy.libraries.preferences.get("folder_page_size")}))},configureElements:function(e){this.options=i.extend(this.options,e),!0===this.options.can_add_library_item?r(".add-library-items").show():r(".add-library-items").hide(),!0===this.options.contains_file_or_folder&&Galaxy.user?Galaxy.user.isAnonymous()?(r(".dataset-manipulation").show(),r(".logged-dataset-manipulation").hide()):(r(".logged-dataset-manipulation").show(),r(".dataset-manipulation").show()):(r(".logged-dataset-manipulation").hide(),r(".dataset-manipulation").hide()),this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this,n=this.templateNewFolderInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Folder",body:n(),buttons:{Create:function(){t.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var t=this.serialize_new_folder();if(this.validate_new_folder(t)){var n,i=new h.default.FolderAsModel,r=e.history.fragment.split("/");n=r.indexOf("page")>-1?r[r.length-3]:r[r.length-1],i.url=i.urlRoot+n,i.save(t,{success:function(e){Galaxy.modal.hide(),d.default.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}})}else d.default.error("Folder's name is missing.");return!1},serialize_new_folder:function(){return{name:r("input[name='Name']").val(),description:r("input[name='Description']").val()}},validate_new_folder:function(e){return""!==e.name},modalBulkImport:function(){if(0===this.findCheckedRows().length)d.default.info("You must select some datasets first.");else{var e=this;this.histories=new h.default.GalaxyHistories,this.histories.fetch().done(function(){var t=e.templateBulkImportInModal();e.modal=Galaxy.modal,e.modal.show({closing_events:!0,title:"Import into History",body:t({histories:e.histories.models}),buttons:{Import:function(){e.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})}).fail(function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")})}},importAllIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),t=this;if(""!==e)r.post(Galaxy.root+"api/histories",{name:e}).done(function(e){t.options.last_used_history_id=e.id,t.processImportToHistory(e.id,e.name)}).fail(function(e,t,n){d.default.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var n=r("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=n;var i=r("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(n,i),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var n=[],i=[];this.findCheckedRows().each(function(){var e=r(this).closest("tr").data("id");"F"==e.substring(0,1)?i.push(e):n.push(e)});for(var o=[],s=n.length-1;s>=0;s--){var l=n[s],c=new h.default.HistoryItem;c.url=c.urlRoot+e+"/contents",c.content=l,c.source="library",o.push(c)}for(var s=i.length-1;s>=0;s--){var d=i[s],c=new h.default.HistoryItem;c.url=c.urlRoot+e+"/contents",c.content=d,c.source="library_folder",o.push(c)}this.initChainCallControl({length:o.length,action:"to_history",history_name:t}),a.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(o,t)},updateProgress:function(){this.progress+=this.progressStep,r(".progress-bar-import").width(Math.round(this.progress)+"%");var e=Math.round(this.progress)+"% Complete";r(".completion_span").text(e)},download:function(e,t){var n=[],i=[];this.findCheckedRows().each(function(){var e=r(this).closest("tr").data("id");"F"==e.substring(0,1)?i.push(e):n.push(e)});var a=Galaxy.root+"api/libraries/datasets/download/"+t,o={ld_ids:n,folder_ids:i};this.processDownload(a,o,"get")},processDownload:function(e,t,n){if(e&&t){t="string"==typeof t?t:r.param(t);var i="";r.each(t.split("&"),function(){var e=this.split("=");i+=''}),r('
    '+i+"
    ").appendTo("body").submit().remove(),d.default.info("Your download will begin soon.")}else d.default.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new h.default.GalaxyHistories;var e=this;this.histories.fetch().done(function(){e.modal=Galaxy.modal;var t=e.templateAddFilesFromHistory();e.modal.show({closing_events:!0,title:"Adding datasets from your history",body:t({histories:e.histories.models}),buttons:{Add:function(){e.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),e.fetchAndDisplayHistoryContents(e.histories.models[0].id),r("#dataset_add_bulk").change(function(t){e.fetchAndDisplayHistoryContents(t.target.value)})}).fail(function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")})},importFilesFromPathModal:function(){var e=this;this.modal=Galaxy.modal;var t=this.templateImportPathModal();this.modal.show({closing_events:!0,title:"Please enter paths to import",body:t({}),buttons:{Import:function(){e.importFromPathsClicked(e)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),this.renderSelectBoxes()},fetchExtAndGenomes:function(){var e=this;l.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(t){e.list_extensions=[];for(var n in t)e.list_extensions.push({id:t[n].extension,text:t[n].extension,description:t[n].description,description_url:t[n].description_url});e.list_extensions.sort(function(e,t){return e.id>t.id?1:e.idt.id?1:e.id=0;u--){var h=l[u].trim();0!==h.length&&c.push(h)}this.initChainCallControl({length:c.length,action:"adding_datasets"}),this.chainCallImportingFolders({paths:c,preserve_dirs:e,link_data:t,space_to_tab:n,to_posix_lines:i,source:"admin_path",file_type:o,tag_using_filenames:a,dbkey:s})}else d.default.info("Please enter a path relative to Galaxy root.")},initChainCallControl:function(e){var t;switch(e.action){case"adding_datasets":t=this.templateAddingDatasetsProgressBar(),this.modal.$el.find(".modal-body").html(t({folder_name:this.options.folder_name}));break;case"deleting_datasets":t=this.templateDeletingItemsProgressBar(),this.modal.$el.find(".modal-body").html(t());break;case"to_history":t=this.templateImportIntoHistoryProgressBar(),this.modal.$el.find(".modal-body").html(t({history_name:e.history_name}));break;default:Galaxy.emit.error("Wrong action specified.","datalibs")}this.progress=0,this.progressStep=100/e.length,this.options.chain_call_control.total_number=e.length,this.options.chain_call_control.failed_number=0},importFromJstreePath:function(e,t){var n=r("#jstree_browser").jstree().get_selected(!0),a=i.filter(n,function(e){return 0==e.state.disabled}),o=this.modal.$el.find(".preserve-checkbox").is(":checked"),s=this.modal.$el.find(".link-checkbox").is(":checked"),l=this.modal.$el.find(".spacetab-checkbox").is(":checked"),c=this.modal.$el.find(".posix-checkbox").is(":checked"),u=this.select_extension.value(),h=this.select_genome.value(),f=this.modal.$el.find(".tag-files").is(":checked"),p=a[0].type,_=[];if(a.length<1)d.default.info("Please select some items first.");else{this.modal.disableButton("Import");for(var g=a.length-1;g>=0;g--)void 0!==a[g].li_attr.full_path&&_.push(a[g].li_attr.full_path);if(this.initChainCallControl({length:_.length,action:"adding_datasets"}),"folder"===p){var m=t.source+"_folder";this.chainCallImportingFolders({paths:_,preserve_dirs:o,link_data:s,space_to_tab:l,to_posix_lines:c,source:m,file_type:u,dbkey:h,tag_using_filenames:f})}else if("file"===p){var m=t.source+"_file";this.chainCallImportingUserdirFiles({paths:_,file_type:u,dbkey:h,link_data:s,space_to_tab:l,to_posix_lines:c,source:m,tag_using_filenames:f})}}},fetchAndDisplayHistoryContents:function(e){var t=new h.default.HistoryContents({id:e}),n=this;t.fetch({success:function(t){var i=n.templateHistoryContents();n.histories.get(e).set({contents:t}),n.modal.$el.find("#selected_history_content").html(i({history_contents:t.models.reverse()})),n.modal.$el.find(".history-import-select-all").bind("click",function(){r("#selected_history_content [type=checkbox]").prop("checked",!0)}),n.modal.$el.find(".history-import-unselect-all").bind("click",function(){r("#selected_history_content [type=checkbox]").prop("checked",!1)})},error:function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],n=[],i=[];if(e.length<1)d.default.info("You must select some datasets first.");else{this.modal.disableButton("Add"),e.each(function(){var e=r(this).closest("li").data("id");if(e){var i=r(this).closest("li").data("name");t.push(e),n.push(i)}});for(var a=t.length-1;a>=0;a--){var o=t[a],s=new h.default.Item;s.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===n[a]?s.set({from_hdca_id:o}):s.set({from_hda_id:o}),i.push(s)}this.initChainCallControl({length:i.length,action:"adding_datasets"}),this.chainCallAddingHdas(i)}},chainCallImportingIntoHistory:function(e,t){var n=this,i=e.pop();if(void 0===i)return 0===this.options.chain_call_control.failed_number?d.default.success("Selected datasets imported into history. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}}):this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number?d.default.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;s--){var l=new h.default.Item({id:e[s]});o.push(l)}for(var s=t.length-1;s>=0;s--){var c=new h.default.FolderAsModel({id:t[s]});o.push(c)}this.options.chain_call_control.total_number=a,this.chainCallDeletingItems(o)}},showLocInfo:function(){var e=null,t=this;null!==Galaxy.libraries.libraryListView?(e=Galaxy.libraries.libraryListView.collection.get(this.options.parent_library_id),this.showLocInfoModal(e)):(e=new h.default.Library({id:this.options.parent_library_id}),e.fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}}))},showLocInfoModal:function(e){var t=this,n=this.templateLocInfoInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Location Details",body:n({library:e,options:t.options}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(e){switch(e.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back(),d.default.error("Invalid import source.")}},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({folder_page_size:parseInt(t)}),Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1}))},findCheckedRows:function(){return r("#folder_list_body").find(":checked")},templateToolBar:function(){return i.template(['
    ','
    ','
    ',"DATA LIBRARIES",'','",'","<% if(mutiple_add_dataset_options) { %>",'","<% } else { %>",'","<% } %>",'",'",'','",'','','","","","
    ","",'
    ',"
    ",'
    ',"
    "].join(""))},templateLocInfoInModal:function(){return i.template(["
    ",'',"",'',"","","","","",'',"",'<% if(library.get("description") !== "") { %>',"","",'',"","<% } %>",'<% if(library.get("synopsis") !== "") { %>',"","",'',"","<% } %>",'<% if(library.get("create_time_pretty") !== "") { %>',"","",'',"","<% } %>","","",'',"","","
    library
    name<%- library.get("name") %>
    description<%- library.get("description") %>
    synopsis<%- library.get("synopsis") %>
    created"><%- library.get("create_time_pretty") %>
    id<%- library.get("id") %>
    ",'',"",'',"","","","","","","",'<% if(options.folder_description !== "") { %>',"","","","","<% } %>","","","","","","
    folder
    name<%- options.folder_name %>
    description<%- options.folder_description %>
    id<%- options.id %>
    ","
    "].join(""))},templateNewFolderInModal:function(){return i.template(['
    ',"
    ",'','',"
    ","
    "].join(""))},templateBulkImportInModal:function(){return i.template(["
    ",'
    ',"Select history: ",'","
    ",'
    ',"or create new: ",'',"","
    ","
    "].join(""))},templateImportIntoHistoryProgressBar:function(){return i.template(['
    ',"Importing selected items to history <%= _.escape(history_name) %>","
    ",'
    ','
    ','0% Complete',"
    ","
    "].join(""))},templateAddingDatasetsProgressBar:function(){return i.template(['
    ',"Adding selected datasets to library folder <%= _.escape(folder_name) %>","
    ",'
    ','
    ','0% Complete',"
    ","
    "].join(""))},templateDeletingItemsProgressBar:function(){return i.template(['
    ',"
    ",'
    ','
    ','0% Complete',"
    ","
    "].join(""))},templateBrowserModal:function(){return i.template(['
    ','
    All files you select will be imported into the current folder ignoring their folder structure.
    ','','
    ','",'","
    ",'
    ','",'",'",'","
    ",'",'","
    ",'
    ',"
    ","
    ","

    You can set extension type and genome for all imported datasets at once:

    ","
    ",'Type: ','Genome: ',"
    ","
    ","
    ",'","
    ","
    "].join(""))},templateImportPathModal:function(){return i.template(['
    ','
    All files within the given folders and their subfolders will be imported into the current folder.
    ','
    ','",'","
    ",'",'","
    ",'',"
    ","

    You can set extension type and genome for all imported datasets at once:

    ","
    ",'Type: ','Genome: ',"
    ","
    ",'","
    ","
    "].join(""))},templateAddFilesFromHistory:function(){return i.template(['
    ',"
    ","1. Select history: ",'","
    ","
    ",'
    ',"
    ","
    "].join(""))},templateHistoryContents:function(){return i.template(["

    2. Choose the datasets to import:

    ","
    ",'",'","
    ","
    ","
      ","<% _.each(history_contents, function(history_item) { %>",'<% if (history_item.get("deleted") != true ) { %>','<% var item_name = history_item.get("name") %>','<% if (history_item.get("type") === "collection") { %>','<% var collection_type = history_item.get("collection_type") %>','<% if (collection_type === "list") { %>','
    • " data-name="<%= _.escape(history_item.get("type")) %>">',"
    • ","<% } else { %>",'
    • ','','<%= _.escape(history_item.get("hid")) %>: ','<%= item_name.length > 75 ? _.escape("...".concat(item_name.substr(-75))) : _.escape(item_name) %> (Dataset Collection of type <%= _.escape(collection_type) %> not supported.)',"","
    • ","<% } %>",'<% } else if (history_item.get("visible") === true && history_item.get("state") === "ok") { %>','
    • " data-name="<%= _.escape(history_item.get("type")) %>">','","
    • ","<% } %>","<% } %>","<% }); %>","
    "].join(""))},templatePaginator:function(){return i.template(['","",' <%- items_shown %> items shown (change)',"",""," <%- total_items_count %> total",""].join(""))}});t.default={FolderToolbarView:_}}).call(t,n(2),n(1),n(0),n(0))},304:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(10),u=a(d),h=e.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=i.extend(this.options,e),this.options.id&&this.fetchLibrary()},fetchLibrary:function(e){this.options=i.extend(this.options,e),this.model=new c.default.Library({id:this.options.id});var t=this;this.model.fetch({success:function(){t.options.show_permissions&&t.showPermissions()},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):s.default.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},showPermissions:function(e){this.options=i.extend(this.options,e),r(".tooltip").remove(),void 0!==this.options.fetched_permissions&&(0===this.options.fetched_permissions.access_library_role_list.length?this.model.set({is_unrestricted:!0}):this.model.set({is_unrestricted:!1}));var t=!1;Galaxy.user&&(t=Galaxy.user.isAdmin());var n=this.templateLibraryPermissions();this.$el.html(n({library:this.model,is_admin:t}));var a=this;r.get(Galaxy.root+"api/libraries/"+a.id+"/permissions?scope=current").done(function(e){a.prepareSelectBoxes({fetched_permissions:e})}).fail(function(){s.default.error("An error occurred while attempting to fetch library permissions.")}),r("#center [data-toggle]").tooltip(),r("#center").css("overflow","auto")},_serializeRoles:function(e){for(var t=[],n=0;n=0;n--)t.push(e[n].id);return t},savePermissions:function(e){var t=this,n=this._extractIds(this.accessSelectObject.$el.select2("data")),i=this._extractIds(this.addSelectObject.$el.select2("data")),a=this._extractIds(this.manageSelectObject.$el.select2("data")),o=this._extractIds(this.modifySelectObject.$el.select2("data"));r.post(Galaxy.root+"api/libraries/"+t.id+"/permissions?action=set_permissions",{"access_ids[]":n,"add_ids[]":i,"manage_ids[]":a,"modify_ids[]":o}).done(function(e){t.showPermissions({fetched_permissions:e}),s.default.success("Permissions saved.")}).fail(function(){s.default.error("An error occurred while attempting to set library permissions.")})},templateLibraryPermissions:function(){return i.template(['
    ','","

    ",'Library: <%= _.escape(library.get("name")) %>',"

    ",'
    ',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any library on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
    ",'
    ',"

    Library permissions

    ","

    Roles that can access the library

    ",'
    ','
    ',"User with any of these roles can access this library. If there are no access roles set on the library it is considered unrestricted.","
    ","

    Roles that can manage permissions on this library

    ",'
    ','
    ',"User with any of these roles can manage permissions on this library (includes giving access).","
    ","

    Roles that can add items to this library

    ",'
    ','
    ',"User with any of these roles can add items to this library (folders and datasets).","
    ","

    Roles that can modify this library

    ",'
    ','
    ',"User with any of these roles can modify this library (name, synopsis, etc.).","
    ",'","
    ","
    "].join(""))}});t.default={LibraryView:h}}).call(t,n(2),n(1),n(0))},305:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(10),u=a(d),h=e.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=i.extend(this.options,e),this.options.id&&this.fetchFolder()},fetchFolder:function(e){this.options=i.extend(this.options,e),this.model=new c.default.FolderAsModel({id:this.options.id});var t=this;this.model.fetch({success:function(){t.options.show_permissions&&t.showPermissions()},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):s.default.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},showPermissions:function(e){this.options=i.extend(this.options,e),r(".tooltip").remove();var t=!1;Galaxy.user&&(t=Galaxy.user.isAdmin());var n=this.templateFolderPermissions();this.$el.html(n({folder:this.model,is_admin:t}));var a=this;r.get(Galaxy.root+"api/folders/"+a.id+"/permissions?scope=current").done(function(e){a.prepareSelectBoxes({fetched_permissions:e})}).fail(function(){s.default.error("An error occurred while attempting to fetch folder permissions.")}),r("#center [data-toggle]").tooltip(),r("#center").css("overflow","auto")},_serializeRoles:function(e){for(var t=[],n=0;n=0;n--)t.push(e[n].id);return t},savePermissions:function(e){var t=this,n=this._extractIds(this.addSelectObject.$el.select2("data")),i=this._extractIds(this.manageSelectObject.$el.select2("data")),a=this._extractIds(this.modifySelectObject.$el.select2("data"));r.post(Galaxy.root+"api/folders/"+t.id+"/permissions?action=set_permissions",{"add_ids[]":n,"manage_ids[]":i,"modify_ids[]":a}).done(function(e){t.showPermissions({fetched_permissions:e}),s.default.success("Permissions saved.")}).fail(function(){s.default.error("An error occurred while attempting to set folder permissions.")})},templateFolderPermissions:function(){return i.template(['
    ','","

    ",'Folder: <%= _.escape(folder.get("name")) %>',"

    ",'
    ',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
    ",'
    ',"

    Folder permissions

    ","

    ","Roles that can manage permissions on this folder","

    ",'
    ','
    ',"User with any of these roles can manage permissions on this folder.","
    ","

    ","Roles that can add items to this folder","

    ",'
    ','
    ',"User with any of these roles can add items to this folder (folders and datasets).","
    ","

    ","Roles that can modify this folder","

    ",'
    ','
    ',"User with any of these roles can modify this folder (name, etc.).","
    ",'","
    ","
    "].join(""))}});t.default={FolderView:h}}).call(t,n(2),n(1),n(0))},306:function(e,t,n){"use strict";(function(e){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(307),a=i(r),o=n(308),s=i(o),l=n(309),c=i(l),d=n(310),u=i(d),h=n(311),f=i(h),p=n(312),_=i(p),g=n(313),m=i(g),v=e.Router.extend({initialize:function(){this.routesHit=0,e.history.on("route",function(){this.routesHit++},this),this.bind("route",this.trackPageview)},routes:{"":"toolsheds",sheds:"toolsheds",queue:"queue",workflows:"workflows","status/r/:repositories":"status",status:"status","categories/s/:tool_shed":"categories","category/s/:tool_shed/c/:cateory_id":"repositories","repository/s/:tool_shed/r/:repository_id":"repository"},back:function(){this.routesHit>1?window.history.back():this.navigate("#",{trigger:!0,replace:!0})}}),y=e.View.extend({app_config:{known_views:["toolsheds","queue","status","categories","repositories","repoository"]},initialize:function(){Galaxy.admintoolshedapp=this,this.admin_toolshed_router=new v,this.admin_toolshed_router.on("route:queue",function(){Galaxy.admintoolshedapp.adminRepoQueueView?Galaxy.admintoolshedapp.adminRepoQueueView.reDraw():Galaxy.admintoolshedapp.adminRepoQueueView=new f.default.RepoQueueView}),this.admin_toolshed_router.on("route:toolsheds",function(){Galaxy.admintoolshedapp.adminShedListView?Galaxy.admintoolshedapp.adminShedListView.reDraw():Galaxy.admintoolshedapp.adminShedListView=new a.default.ShedListView}),this.admin_toolshed_router.on("route:categories",function(e){Galaxy.admintoolshedapp.adminShedCategoriesView?Galaxy.admintoolshedapp.adminShedCategoriesView.reDraw({tool_shed:e.replace(/\//g,"%2f")}):Galaxy.admintoolshedapp.adminShedCategoriesView=new s.default.CategoryView({tool_shed:e.replace(/\//g,"%2f")})}),this.admin_toolshed_router.on("route:repositories",function(e,t){Galaxy.admintoolshedapp.adminShedCategoryView?Galaxy.admintoolshedapp.adminShedCategoryView.reDraw({tool_shed:e.replace(/\//g,"%2f"),category_id:t}):Galaxy.admintoolshedapp.adminShedCategoryView=new c.default.Category({tool_shed:e.replace(/\//g,"%2f"),category_id:t})}),this.admin_toolshed_router.on("route:repository",function(e,t){Galaxy.admintoolshedapp.adminRepositoryView?Galaxy.admintoolshedapp.adminRepositoryView.reDraw({tool_shed:e.replace(/\//g,"%2f"),repository_id:t}):Galaxy.admintoolshedapp.adminRepositoryView=new u.default.RepoDetails({tool_shed:e.replace(/\//g,"%2f"),repository_id:t})}),this.admin_toolshed_router.on("route:status",function(e){Galaxy.admintoolshedapp.adminRepoStatusView?Galaxy.admintoolshedapp.adminRepoStatusView.reDraw({repositories:e.split("|")}):Galaxy.admintoolshedapp.adminRepoStatusView=new _.default.RepoStatus({repositories:e.split("|")})}),this.admin_toolshed_router.on("route:workflows",function(){Galaxy.admintoolshedapp.adminWorkflowsView?Galaxy.admintoolshedapp.adminWorkflowsView.reDraw():Galaxy.admintoolshedapp.adminWorkflowsView=new m.default.Workflows}),e.history.start({pushState:!1})}});t.default={GalaxyApp:y}}).call(t,n(2))},307:function(e,t,n){"use strict";(function(e,i){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(17),o=r(a),s=n(18),l=r(s),c=e.View.extend({defaults:{tool_sheds:[{url:"https://toolshed.g2.bx.psu.edu/",name:"Galaxy Main Tool Shed"}]},initialize:function(e){this.options=i.defaults(this.options||{},this.defaults),this.model=new o.default.ShedsCollection,this.listenTo(this.model,"sync",this.render),this.model.fetch()},el:"#center",render:function(e){this.options=i.defaults(this.options||{},e,this.defaults);var t=this.templateToolshedList;this.$el.html(t({title:"Configured Galaxy Tool Sheds",tool_sheds:this.model.models,queue:l.default.queueLength()}))},reDraw:function(e){this.$el.empty(),this.render(e)},templateToolshedList:i.template(['
    ','
    <%= title %>
    ','',"
    ",'
    ','
    ','',"<% _.each(tool_sheds, function(shed) { %>",'',"","","<% }); %>","
    ",'","
    ","
    ",'
    ',"
    "].join(""))});t.default={ShedListView:c}}).call(t,n(2),n(1))},308:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l);n(30);var d=e.View.extend({el:"#center",defaults:{tool_shed:"https://toolshed.g2.bx.psu.edu/"},initialize:function(e){var t=e.tool_shed.replace(/\//g,"%2f");this.options=i.defaults(this.options||e,this.defaults),this.model=new s.default.Categories,this.listenTo(this.model,"sync",this.render),this.model.url=this.model.url+"?tool_shed_url="+this.options.tool_shed,this.model.tool_shed=t,this.model.fetch()},render:function(e){this.options=i.extend(this.options,e),this.options.categories=this.model.models,this.options.queue=c.default.queueLength();var t=this.templateCategoryList;this.$el.html(t(this.options)),r("#center").css("overflow","auto"),this.bindEvents()},bindEvents:function(){var t=this;r("#search_box").autocomplete({source:function(e,n){var i=t.model.tool_shed.replace(/%2f/g,"/"),a=Galaxy.root+"api/tool_shed/search",o={term:e.term,tool_shed_url:i};r.post(a,o,function(e){console.log(e);var t=c.default.shedParser(e);n(t)})},minLength:3,select:function(n,i){var r=i.item.value,a=(Galaxy.root,t.model.tool_shed,"repository/s/"+t.model.tool_shed+"/r/"+r);e.history.navigate(a,{trigger:!0,replace:!0})}})},reDraw:function(e){this.$el.empty(),this.model.url=this.model.url+"?tool_shed_url="+this.options.tool_shed,this.initialize(e)},templateCategoryList:i.template(['",'
    ','
    Categories in <%= tool_shed.replace(/%2f/g, "/") %>
    ','',"
    ",'
    ','",'
    ','','',"","","","","","","<% _.each(categories, function(category) { %>","","",'','',"","<% }); %>","
    NameDescriptionRepositories
    ",'"><%= category.get("name") %>',"<%= category.get("description") %><%= category.get("repositories") %>
    ","
    ","
    "].join(""))});t.default={CategoryView:d}}).call(t,n(2),n(1),n(0))},309:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l);n(30);var d=e.View.extend({el:"#center",initialize:function(e){this.model=new s.default.CategoryCollection,this.listenTo(this.model,"sync",this.render);var t=e.tool_shed.replace(/\//g,"%2f");this.model.url+="?tool_shed_url="+t+"&category_id="+e.category_id,this.model.tool_shed=t,this.model.category=e.category_id,this.model.fetch()},render:function(e){this.options=i.extend(this.options,e);var t=this.templateCategoryContents;this.$el.html(t({category:this.model.models[0],tool_shed:this.model.tool_shed,queue:c.default.queueLength()})),r("#center").css("overflow","auto"),this.bindEvents()},bindEvents:function(){var t=this;r("#search_box").autocomplete({source:function(e,n){var i=t.model.tool_shed.replace(/%2f/g,"/"),a=Galaxy.root+"api/tool_shed/search",o={term:e.term,tool_shed_url:i};r.post(a,o,function(e){var t=c.default.shedParser(e);n(t)})},minLength:3,select:function(n,i){var r=i.item.value,a="repository/s/"+t.model.tool_shed+"/r/"+r;e.history.navigate(a,{trigger:!0,replace:!0})}})},reDraw:function(e){this.$el.empty(),this.initialize(e)},templateCategoryContents:i.template(['",'
    ','
    Repositories in <%= category.get("name") %>
    ','',"
    ",'
    ','",'
    ','','',"",'','',"",'',"","",'<% _.each(category.get("repositories"), function(repository) { %>',"","","","","","","<% }); %>","
    OwnerNameSynopsisType
    <%= repository.owner %>",'","<%= repository.description %><%= repository.type %>
    ","
    ","
    "].join(""))});t.default={Category:d}}).call(t,n(2),n(1),n(0))},310:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(127),c=(a(l),n(3)),d=a(c),u=n(8),h=a(u),f=n(11),p=a(f),_=n(18),g=a(_),m=e.View.extend({el:"#center",initialize:function(e){this.options=i.defaults(this.options||{},this.defaults),this.model=new s.default.RepositoryCollection,this.listenTo(this.model,"sync",this.render);var t=e.tool_shed.replace(/\//g,"%2f");this.model.url+="?tool_shed_url="+t+"&repository_id="+e.repository_id,this.model.tool_shed_url=e.tool_shed.replace(/%2f/g,"/"),this.model.tool_shed=t,this.model.category=e.repository_id,this.model.fetch()},render:function(e){var t=this.templateRepoDetails,n=this.model.models[0];this.options={repository:n.get("repository"),tool_shed:this.model.tool_shed,queue:g.default.queueLength()};var a=Object.keys(this.options.repository.metadata);this.options.current_changeset=this.options.current_changeset||a[a.length-1],this.options.current_metadata=this.options.repository.metadata[this.options.current_changeset],this.options.current_metadata.tool_shed_url=this.model.tool_shed_url,this.options.tools=this.options.current_metadata.tools,this.options.repository_dependencies_template=this.templateRepoDependencies,this.options.repository_dependency_template=this.templateRepoDependency,this.options.tps_template_global_select=this.templateGlobalSectionSelect,this.options.tps_template_tool_select=this.templateToolSectionSelect,this.options.tps_select_options=this.templatePanelSelectOptions,this.options.tool_dependencies=n.get("tool_dependencies"),this.options.shed_tool_conf=this.templateShedToolConf({shed_tool_confs:n.get("shed_conf")}),console.log(n.get("shed_conf")),this.options.panel_section_dict=n.get("panel_section_dict"),this.options.api_url=Galaxy.root+"api/tool_shed_repositories/install?async=True",this.options=i.extend(this.options,e),this.$el.html(t(this.options)),this.checkInstalled(this.options.current_metadata),this.bindEvents(),r("#center").css("overflow","auto")},bindEvents:function(){var e=this;r("#changeset").on("change",function(){e.options.current_changeset=r("#changeset").find("option:selected").text(),e.options.current_metadata=e.options.repository.metadata[e.options.current_changeset],e.checkInstalled(e.options.current_metadata),e.reDraw()}),r("#tool_panel_section_select").on("change",function(){e.tpsSelection()}),r("#install_repository").on("click",function(t){r("#repository_installation");t.preventDefault();var n={};n.repositories=JSON.stringify([[r("#install_repository").attr("data-tsrid"),r("#changeset").find("option:selected").val()]]),n.tool_shed_repository_ids=JSON.stringify([r("#install_repository").attr("data-tsrid")]),n.tool_shed_url=e.model.tool_shed_url,n.install_tool_dependencies=r("#install_tool_dependencies").val(),n.install_repository_dependencies=r("#install_repository_dependencies").val(),n.install_resolver_dependencies=r("#install_resolver_dependencies").val();e.panelSelect(n);n.tool_panel_section=JSON.stringify(e.panelSelect(n)),n.shed_tool_conf=r("select[name='shed_tool_conf']").find("option:selected").val(),n.changeset=r("#changeset").find("option:selected").val();var i=r("#repository_installation").attr("action");e.prepareInstall(n,i)}),r("#queue_install").on("click",function(t){e.options.current_changeset=r("#changeset").find("option:selected").text(),e.options.current_metadata=e.options.repository.metadata[e.options.current_changeset];var n=(e.options.current_changeset,{});i.each(Object.keys(e.options.current_metadata),function(t){n[t]||(n[t]=e.options.current_metadata[t])}),n.install_tool_dependencies=r("#install_tool_dependencies").val(),n.install_repository_dependencies=r("#install_repository_dependencies").val(),n.install_resolver_dependencies=r("#install_resolver_dependencies").val(),n.tool_panel_section=JSON.stringify(e.panelSelect({})),n.shed_tool_conf=r("select[name='shed_tool_conf']").find("option:selected").val(),n.tool_shed_url=e.model.tool_shed_url,"/"==n.tool_shed_url.substr(-1)&&(n.tool_shed_url=n.tool_shed_url.substr(0,n.tool_shed_url.length-1)),g.default.addToQueue(n),e.checkInstalled(n)}),r(".tool_panel_section_picker").on("change",function(){r(this).find("option:selected").val()==r("#tool_panel_section_select").find("option:selected").val()?r(this).attr("default","active"):r(this).removeAttr("default")}),r(function(){r("#repository_dependencies").jstree()}),r(".tool_form").on("click",function(){var t=r(this).attr("data-guid"),n=(r(this).attr("data-clean"),r(this).attr("data-name")),i=r(this).attr("data-desc"),a=e.model.tool_shed_url,o=r("#repository_details").attr("data-tsrid"),s=r("#changeset").find("option:selected").val(),l=Galaxy.root+"api/tool_shed/tool_json",c={guid:t,tool_shed_url:a,tsr_id:o,changeset:s};r.get(l,c,function(e){e.cls="ui-portlet-plain";var t=new p.default(e);d.default.deepeach(e.inputs,function(e){e.type&&-1!=["data","data_collection"].indexOf(e.type)&&(e.type="hidden",e.info="Data input '"+e.name+"' ("+d.default.textify(e.extensions)+")")});var r=new h.default.View,a=""+n+" "+i;r.show({closing_events:!0,title:a,body:t.$el,buttons:{Close:function(){r.hide()}}})})})},checkInstalled:function(e){var t=this,n={name:e.name,owner:e.owner},i=!1;t.repoQueued(e);r.get(Galaxy.root+"api/tool_shed_repositories",n,function(n){for(var a=0;a','
    Repository information for <%= repository.name %> from <%= repository.owner %>
    ','',"
    ",'
    ','
    ','','','
    ','
    Changeset
    ','
    ','",'','','
    Please select a revision and review the settings below before installing.
    ',"
    ","
    ","<%= shed_tool_conf %>","<% if (current_metadata.has_repository_dependencies) { %>",'
    Repository dependencies for <%= current_changeset %>
    ','
    ','

    ','','',"

    ","<% current_metadata.repository_dependency_template = repository_dependency_template; %>",'
    ','","<%= repository_dependencies_template(current_metadata) %>","
    ","
    ","<% } %>","<% if (current_metadata.includes_tool_dependencies) { %>",'
    Tool dependencies
    ','
    ','

    ','','',"

    ",'

    ','','',"

    ",'
    ','",'',"",'','',"","","","",'',"<% _.each(tool_dependencies[current_changeset], function(dependency) { %>",'','","","","","<% }); %>","","
    NameVersionType
    ',"<%= dependency.name %><%= dependency.version %><%= dependency.type %>
    ","
    ","
    ","<% } %>","<% if (current_metadata.includes_tools_for_display_in_tool_panel) { %>",'
    Tools – click the name to preview the tool and use the pop-up menu to inspect all metadata
    ','
    ','
    ','',"",'','',"","","","",'',"<% _.each(current_metadata.tools, function(tool) { %>",'','","",'','","","<% }); %>","","
    NameDescriptionVersion<%= tps_template_global_select({tps: panel_section_dict, tps_select_options: tps_select_options}) %>
    ','","<%= tool.description %><%= tool.version %>',"<%= tps_template_tool_select({tool: tool, tps: panel_section_dict, tps_select_options: tps_select_options}) %>","
    ","
    ","
    ","<% } %>","
    ","
    "].join("")),templateRepoDependencies:i.template(['
    Repository Dependencies
    ','
    ',"
      ","
    • Repository installation requires the following","<% if (has_repository_dependencies) { %>","<% _.each(repository_dependencies, function(dependency) { %>","<% dependency.repository_dependency_template = repository_dependency_template; %>","<%= repository_dependency_template(dependency) %>","<% }); %>","<% } %>","
    • ","
    ","
    "].join("")),templateRepoDependency:i.template(['
  • ',"Repository <%= repository.name %> revision <%= changeset_revision %> owned by <%= repository.owner %>","<% if (has_repository_dependencies) { %>",'
      ',"<% _.each(repository_dependencies, function(dependency) { %>","<% dependency.repository_dependency_template = repository_dependency_template; %>","<%= repository_dependency_template(dependency) %>","<% }); %>","
    ","<% } %>","
  • "].join("")),templateShedToolConf:i.template(['
    Shed tool configuration file:
    ','
    ','
    ','",'
    Select the file whose tool_path setting you want used for installing repositories.
    ',"
    ","
    "].join("")),templateToolDependency:i.template(["<% if (has_repository_dependencies) { %>","<% _.each(repository_dependencies, function(dependency) { %>","<% if (dependency.includes_tool_dependencies) { %>","<% dependency.tool_dependency_template = tool_dependency_template %>","<%= tool_dependency_template(dependency) %>","<% } %>","<% }); %>","<% } %>"].join("")),templateGlobalSectionCreate:i.template(['
    ','
    ','','','
    ',"Add a new tool panel section to contain the installed tools (optional).","
    ","
    ","
    "].join("")),templateGlobalSectionSelect:i.template(['
    ','
    Tool Panel Section
    ','
    ','
    ','",'','
    ',"Select an existing tool panel section to contain the installed tools (optional).","
    ","
    ","
    ","
    "].join("")),templateToolSectionCreate:i.template(['
    ','','',"
    "].join("")),templateToolSectionSelect:i.template(['
    ','",'','
    ',"
    "].join("")),templatePanelSelectOptions:i.template(["<% _.each(sections, function(section) { %>",'',"<% }); %>"].join(""))});t.default={RepoDetails:m}}).call(t,n(2),n(1),n(0))},311:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l),d=e.View.extend({el:"#center",defaults:[{}],initialize:function(e){var t=this;this.model=new s.default.RepoQueue,this.listenTo(this.model,"sync",this.render),this.model.fetch(),t.render()},render:function(e){var t=this,n=t.templateRepoQueue,r=t.model.models;t.$el.html(n({title:"Repository Installation Queue",repositories:r,queue:c.default.queueLength()})),i("#center").css("overflow","auto"),t.bindEvents()},bindEvents:function(){var t=this;i(".install_one").on("click",function(){var e=t.loadFromQueue(i(this).attr("data-repokey"));t.installFromQueue(e,i(this).attr("data-repokey"))}),i(".remove_one").on("click",function(){var e=i(this).attr("data-repokey"),t=JSON.parse(localStorage.repositories);if(t.hasOwnProperty(e)){var n=t[e].repository.id;delete t[e],i("#queued_repository_"+n).remove()}localStorage.repositories=JSON.stringify(t)}),i("#clear_queue").on("click",function(){localStorage.repositories="{}"}),i("#from_workflow").on("click",function(){e.history.navigate("workflows",{trigger:!0,replace:!0})})},installFromQueue:function(t,n){var r=Object();r.install_tool_dependencies=t.install_tool_dependencies,r.install_repository_dependencies=t.install_repository_dependencies,r.install_resolver_dependencies=t.install_resolver_dependencies,r.tool_panel_section=t.tool_panel_section,r.shed_tool_conf=t.shed_tool_conf,r.repositories=JSON.stringify([[t.repository.id,t.changeset_revision]]),r.tool_shed_repository_ids=JSON.stringify([t.repository.id]),r.tool_shed_url=n.split("|")[0],r.changeset=t.changeset_revision;var a=Galaxy.root+"api/tool_shed_repositories/install?async=True";if(i("#queued_repository_"+t.repository.id).remove(),localStorage.repositories){void 0===n&&(n=c.default.queueKey(t));var o=JSON.parse(localStorage.repositories);o.hasOwnProperty(n)&&(delete o[n],localStorage.repositories=JSON.stringify(o))}i.post(a,r,function(t){var n=JSON.parse(t),r=n.repositories,a="status/r/"+r.join("|");i.post(Galaxy.root+"admin_toolshed/install_repositories",n,function(e){console.log("Initializing repository installation succeeded")}),e.history.navigate(a,{trigger:!0,replace:!0})})},loadFromQueue:function(e){var t=JSON.parse(localStorage.repositories);if(t.hasOwnProperty(e))return t[e]},reDraw:function(e){this.$el.empty(),this.initialize(e),this.model.fetch(),this.render(e)},templateRepoQueue:r.template(['
    ','
    <%= title %>
    ','',"
    ",'
    ','','',"",'','','','','','',"","","","<% _.each(repositories, function(repository) { %>",'">','','','','','",'","","<% }); %>","","
    NameOwnerRevisionToolShedInstall
    <%= repository.get("repository").name %><%= repository.get("repository").owner %><%= repository.get("changeset_revision") %><%= repository.get("tool_shed_url") %>','" type="submit" id="install_repository_<%= repository.get("id") %>" name="install_repository" value="Install now" />',"','" type="submit" id="unqueue_repository_<%= repository.get("id") %>" name="unqueue_repository" value="Remove from queue" />',"
    ",'',"
    "].join(""))});t.default={RepoQueueView:d}}).call(t,n(2),n(0),n(1))},312:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l),d=e.View.extend({el:"#center",initialize:function(e){this.options=i.defaults(this.options||[{}],e,this.defaults),this.model=new s.default.RepoStatus,this.listenTo(this.model,"sync",this.render),this.model.url+="?repositories="+this.options.repositories.join("|"),this.model.fetch(),this.timer=setInterval(function(e){var t=["installed","error"],n=!0;i.some(e.model.models,function(e){repo_id=e.get("id");var i=e.get("status").toLowerCase();if(-1===t.indexOf(i))return n=!1,!0}),n?clearInterval(e.timer):e.model.fetch()},2e3,this)},close:function(){clearInterval(this.timer)},render:function(e){this.options=i.extend(this.options,e);var t=this.templateRepoStatus;this.$el.html(t({title:"Repository Status",repositories:this.model.models,queue:c.default.queueLength()})),r("#center").css("overflow","auto"),this.bindEvents()},bindEvents:function(){},reDraw:function(e){this.$el.empty(),this.initialize(e)},templateRepoStatus:i.template(['
    ','
    <%= title %>
    ','',"
    ",'",'','',"",'','','','','',"","",'',"<% _.each(repositories, function(repository) { %>","","","","","","","","<% }); %>","",'',"
    NameDescriptionOwnerRevisionInstallation Status
    ",'
    ','","
    ","
    ",'
    ','","
    ","
    ",'
    ','","
    ","
    ",'
    ','","
    ","
    ",'
    ','","
    ","
    "].join(""))});t.default={RepoStatus:d}}).call(t,n(2),n(1),n(0))},313:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l),d=e.View.extend({el:"#center",defaults:[{}],initialize:function(e){var t=this;this.model=new s.default.WorkflowTools,this.listenTo(this.model,"sync",this.render),this.model.fetch(),t.render()},render:function(e){var t=this,n=t.templateWorkflows,r=t.model.models;t.$el.html(n({title:"Workflows Missing Tools",workflows:r,queue:c.default.queueLength()})),i("#center").css("overflow","auto"),t.bindEvents()},bindEvents:function(){var t,n=this;i(".show_wf_repo").on("click",function(){var n=i(this).attr("data-toolids"),r=i(this).attr("data-shed"),a=Galaxy.root+"api/tool_shed/repository",o={tool_ids:n};i.get(a,o,function(n){t=n.repository.id;var i="repository/s/"+r.replace(/:/g,"%3a").replace(/\//g,"%2f")+"/r/"+n.repository.id;e.history.navigate(i,{trigger:!0,replace:!0})})}),i(".queue_wf_repo").on("click",function(){var e=i(this),n=e.attr("data-toolids"),r=e.attr("data-shed"),a=Galaxy.root+"api/tool_shed/repository",o={tool_ids:n};i.get(a,o,function(n){t=n.repository.id,o={tool_shed_url:r,repository_id:t},i.get(a,o,function(t){var n=Object.keys(t.repository.metadata),i=n[0],a=t.repository.metadata[i];a.tool_shed_url=r,c.default.addToQueue(a),e.remove()})})}),i("#from_workflow").on("click",n.loadWorkflows)},reDraw:function(e){this.$el.empty(),this.initialize(e)},templateWorkflows:r.template(['
    ','
    <%= title %>
    ','',"
    ",'",'','',"",'','','','','','',"","","","<% _.each(workflows, function(workflow) { %>","",'",'",'','','','","","<% }); %>","",""].join(""))});t.default={Workflows:d}}).call(t,n(2),n(0),n(1))},61:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={tool:"fa-wrench",data_input:"fa-file-o",data_collection_input:"fa-folder-o",subworkflow:"fa-sitemap fa-rotate-270",pause:"fa-pause"}}},[284]); \ No newline at end of file +f=!0,p=0,_=o.data.nodes.length;p<_;p++)if(g=o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node",m=u,"move_node"===g&&"a"===j&&o.data.origin&&o.data.origin===w&&d===w.get_parent(o.data.nodes[p])&&(v=w.get_node(d),m>e.inArray(o.data.nodes[p],v.children)&&(m-=1)),!(f=f&&(w&&w.settings&&w.settings.dnd&&!1===w.settings.dnd.check_while_dragging||w.check(g,o.data.origin&&o.data.origin!==w?o.data.origin.get_node(o.data.nodes[p]):o.data.nodes[p],d,m,{dnd:!0,ref:w.get_node(x.parent()),pos:j,is_multi:o.data.origin&&o.data.origin!==w,is_foreign:!o.data.origin})))){w&&w.last_error&&(n=w.last_error());break}if(f)return"i"===j&&x.parent().is(".jstree-closed")&&w.settings.dnd.open_timeout&&(i=setTimeout(function(e,t){return function(){e.open_node(t)}}(w,x),w.settings.dnd.open_timeout)),t={ins:w,par:d,pos:"i"!==j||"last"!==y||0!==u||w.is_loaded(b)?u:"last"},r.css({left:s+"px",top:l+"px"}).show(),o.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),n={},h=!0,!1}),!0===h))return}else{for(f=!0,p=0,_=o.data.nodes.length;p<_&&(f=f&&w.check(o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node",o.data.origin&&o.data.origin!==w?o.data.origin.get_node(o.data.nodes[p]):o.data.nodes[p],"#","last",{dnd:!0,ref:w.get_node("#"),pos:"i",is_multi:o.data.origin&&o.data.origin!==w,is_foreign:!o.data.origin}));p++);if(f)return t={ins:w,par:"#",pos:"last"},r.hide(),void o.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok")}t=!1,o.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),r.hide()}}).bind("dnd_scroll.vakata",function(e,n){n&&n.data&&n.data.jstree&&(r.hide(),t=!1,n.helper.find(".jstree-icon:eq(0)").removeClass("jstree-ok").addClass("jstree-er"))}).bind("dnd_stop.vakata",function(a,o){if(i&&clearTimeout(i),o&&o.data&&o.data.jstree){r.hide();var s,l,c=[];if(t){for(s=0,l=o.data.nodes.length;s").html(r).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(document).bind("mousemove touchmove",e.vakata.dnd.drag),e(document).bind("mouseup touchend",e.vakata.dnd.stop),!1},drag:function(n){if("touchmove"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),t.is_down){if(!t.is_drag){if(!(Math.abs(n.pageX-t.init_x)>(t.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(n.pageY-t.init_y)>(t.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;t.helper&&(t.helper.appendTo("body"),t.helper_w=t.helper.outerWidth()),t.is_drag=!0,e.vakata.dnd._trigger("start",n)}var i=!1,r=!1,a=!1,o=!1,s=!1,l=!1,c=!1,d=!1,u=!1,h=!1;return t.scroll_t=0,t.scroll_l=0,t.scroll_e=!1,e(e(n.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var i=e(this),r=i.offset();if(this.scrollHeight>this.offsetHeight&&(r.top+i.height()-n.pageYthis.offsetWidth&&(r.left+i.width()-n.pageXo&&n.pageY-co&&o-(n.pageY-c)l&&n.pageX-dl&&l-(n.pageX-d)a&&(u=a-50),s&&h+t.helper_w>s&&(h=s-(t.helper_w+2)),t.helper.css({left:h+"px",top:u+"px"})),e.vakata.dnd._trigger("move",n),!1}},stop:function(n){if("touchend"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),t.is_drag)e.vakata.dnd._trigger("stop",n);else if("touchend"===n.type&&n.target===t.target){var i=setTimeout(function(){e(n.target).click()},100);e(n.target).one("click",function(){i&&clearTimeout(i)})}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(t,n){this.bind=function(){n.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this.element.on("before_open.jstree",e.proxy(function(t,n){var i,r,a=this._data.search.res,o=[],s=e();if(a&&a.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(a,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search"),this.settings.search.show_only_matches&&this._data.search.res.length)){for(i=0,r=a.length;i32&&(n.fuzzy=!1),n.fuzzy&&(i=1<=p;l--)if(m=r[t.charAt(l-1)],g[l]=0===o?(g[l+1]<<1|1)&m:(g[l+1]<<1|1)&m|(f[l+1]|f[l])<<1|1|f[l+1],g[l]&i&&(x=a(o,l-1))<=y){if(y=x,b=l-1,k.push(b),!(b>s))break;p=Math.max(1,2*s-b)}if(a(o+1,s)>y)break;f=g}return{isMatch:b>=0,score:x}},!0===t?{search:o}:o(t)}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,n){var i,r;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),n))for(i=0,r=t.children_d.length;it.ttl)&&(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!!t&&(this.element.one("set_state.jstree",function(n,i){i.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={"#":{},default:{}},e.jstree.plugins.types=function(n,i){this.init=function(e,n){var r,a;if(n&&n.types&&n.types.default)for(r in n.types)if("default"!==r&&"#"!==r&&n.types.hasOwnProperty(r))for(a in n.types.default)n.types.default.hasOwnProperty(a)&&n.types[r][a]===t&&(n.types[r][a]=n.types.default[a]);i.init.call(this,e,n),this._model.data["#"].type="#"},this.refresh=function(e,t){i.refresh.call(this,e,t),this._model.data["#"].type="#"},this.bind=function(){this.element.on("model.jstree",e.proxy(function(e,n){var i,r,a=this._model.data,o=n.nodes,s=this.settings.types,l="default";for(i=0,r=o.length;i .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor:eq(0)").trigger(n).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),n.teardown.call(this)},this.redraw_node=function(t,i,r){if(t=n.redraw_node.call(this,t,i,r)){var a=p.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(a.className+=" jstree-wholerow-clicked"),t.insertBefore(a,t.childNodes[0])}return t}}}})},13:function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=n(297),r=function(e){return e&&e.__esModule?e:{default:e}}(i),a=e.Model.extend({urlRoot:Galaxy.root+"api/libraries/",isVisible:function(e){var t=!0;return!e&&this.get("deleted")&&(t=!1),t}}),o=e.Collection.extend({urlRoot:Galaxy.root+"api/libraries",model:a,initialize:function(e){e=e||{}},search:function(e){if(""==e)return this;var t=e.toLowerCase();return this.filter(function(e){return-1!==e.get("name").toLowerCase().indexOf(t)})},getVisible:function(e,t){return t=t||[],new o(this.filter(function(t){return t.isVisible(e)}))},sortLibraries:function(e,t){this.comparator=r.default.generateLibraryComparator(e,t),this.sort()}}),s=e.Model.extend({}),l=s.extend({urlRoot:Galaxy.root+"api/libraries/datasets/"}),c=s.extend({urlRoot:Galaxy.root+"api/folders/"}),d=e.Collection.extend({model:s,sortFolder:function(e,t){this.comparator=r.default.generateFolderComparator(e,t),this.sort()}}),u=e.Model.extend({defaults:{folder:new d,urlRoot:Galaxy.root+"api/folders/",id:"unknown"},parse:function(e){this.get("folder").reset();for(var t=0;t ').addClass(i);t.before(r)}}Object.defineProperty(t,"__esModule",{value:!0});var l=n(3),c=a(l),d=n(286),u=a(d),h=n(287),f=a(h),p=n(288),_=a(p),g=n(61),m=a(g),v=n(293),y=a(v),b=n(6),w=a(b),x=n(79),k=a(x),j=n(7);!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e}(j);n(20),window.workflow_globals=window.workflow_globals||{},t.default=i.View.extend({initialize:function(t){function n(){var t=e('

    ');window.show_modal("Save As a New Workflow",t,{OK:function(){var t=e("#workflow_rename").val().length>0?e("#workflow_rename").val():"SavedAs_"+l.workflow.name,n=e("#wf_annotation").val().length>0?e("#wf_annotation").val():"";e.ajax({url:l.urls.workflow_save_as,type:"POST",data:{workflow_name:t,workflow_annotation:n,workflow_data:function(){return JSON.stringify(l.workflow.to_simple())}}}).done(function(e){window.onbeforeunload=void 0,window.location=Galaxy.root+"workflow/editor?id="+e,hide_modal()}).fail(function(){hide_modal(),alert("Saving this workflow failed. Please contact this site's administrator.")})},Cancel:hide_modal})}function i(){l.workflow.layout(),l.workflow.fit_canvas_to_nodes(),l.scroll_to_nodes(),l.canvas_manager.draw_overview()}function a(){e.jStorage.set("overview-off",!1),e("#overview-border").css("right","0px"),e("#close-viewport").css("background-position","0px 0px")}function s(){e.jStorage.set("overview-off",!0),e("#overview-border").css("right","20000px"),e("#close-viewport").css("background-position","12px 0px")}var l=window.workflow_globals.app=this;this.options=t,this.urls=t&&t.urls||{};var d=function(){if(l.workflow.check_changes_in_active_form(),workflow&&l.workflow.has_changes){var e=function(){window.onbeforeunload=void 0,window.document.location=l.urls.workflow_index};window.show_modal("Close workflow editor","There are unsaved changes to your workflow which will be lost.",{Cancel:hide_modal,"Save Changes":function(){u(null,e)}},{"Don't Save":e})}else window.document.location=l.urls.workflow_index},u=function(t,n){if(show_message("Saving workflow","progress"),l.workflow.check_changes_in_active_form(),!l.workflow.has_changes)return hide_modal(),void(n&&n());l.workflow.rectify_workflow_outputs(),c.default.request({url:Galaxy.root+"api/workflows/"+l.options.id,type:"PUT",data:{workflow:l.workflow.to_simple()},success:function(t){var i=e("
    ").text(t.message);if(t.errors){i.addClass("warningmark");var r=e("
    WorkflowsTool IDsShedNameOwnerActions
    ','
      ','<% _.each(workflow.get("workflows"), function(name) { %>','
    • <%= name %>
    • ',"<% }); %>","
    ","
    ','
      ','<% _.each(workflow.get("tools"), function(tool) { %>','
    • <%= tool %>
    • ',"<% }); %>","
    ","
    <%= workflow.get("shed") %><%= workflow.get("repository") %><%= workflow.get("owner") %>','
      ','
    • ','" data-owner="<%= workflow.get("owner") %>" data-repo="<%= workflow.get("repository") %>" data-toolids="<%= workflow.get("tools").join(",") %>" value="Show Repository" />
    • ',"
    ","
    ',"",'','','','','','','','',' ',"",'','',"","","","","","","","","","","","
    name description data type sizetime updated (UTC)state
    ",'" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..',"
    ",'"].join(""))}});t.default={FolderListView:h}}).call(t,n(2),n(1),n(0))},299:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(126),u=a(d),h=e.View.extend({events:{"click .undelete_dataset_btn":"undeleteDataset","click .undelete_folder_btn":"undeleteFolder","click .edit_folder_btn":"startModifications","click .cancel_folder_btn":"cancelModifications","click .save_folder_btn":"saveModifications"},defaults:{type:null,visibility_config:{edit_folder_btn:!1,save_folder_btn:!1,cancel_folder_btn:!1,permission_folder_btn:!1},edit_mode:!1},initialize:function(e){this.options=i.defaults(e||{},this.defaults),this.render(this.options)},render:function(e){this.options=i.extend(this.options,e);var t=this.options.model,n=null;return"folder"===t.get("type")||"LibraryFolder"===t.get("model_class")?(this.options.type="folder",this.prepareButtons(t),n=t.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===t.get("type")||"LibraryDatasetDatasetAssociation"===t.get("model_class")||"LibraryDataset"===t.get("model_class")?(this.options.type="file",n=t.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(Galaxy.emit.error("Unknown library item type found."),Galaxy.emit.error(t.get("type")||t.get("model_class"))),this.setElement(n({content_item:t,edit_mode:this.options.edit_mode,button_config:this.options.visibility_config})),this.$el.show(),this},prepareButtons:function(e){var t=this.options.visibility_config;!1===this.options.edit_mode?(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("deleted")?(t.edit_folder_btn=!1,t.permission_folder_btn=!1):!1===e.get("deleted")&&(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("can_modify")&&(t.edit_folder_btn=!0),!0===e.get("can_manage")&&(t.permission_folder_btn=!0))):!0===this.options.edit_mode&&(t.edit_folder_btn=!1,t.permission_folder_btn=!1,t.save_folder_btn=!0,t.cancel_folder_btn=!0),this.options.visibility_config=t},showDatasetDetails:function(){Galaxy.libraries.datasetView=new u.default.LibraryDatasetView({id:this.id})},undeleteDataset:function(e){r(".tooltip").hide();var t=this,n=r(e.target).closest("tr").data("id"),i=Galaxy.libraries.folderListView.collection.get(n);i.url=i.urlRoot+i.id+"?undelete=true",i.destroy({success:function(e,i){Galaxy.libraries.folderListView.collection.remove(n);var r=new c.default.Item(i);Galaxy.libraries.folderListView.collection.add(r),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),s.default.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var e=t.model.get("folder_id");window.location=Galaxy.root+"library/list#folders/"+e+"/datasets/"+t.id}})},error:function(e,t){void 0!==t.responseJSON?s.default.error("Dataset was not undeleted. "+t.responseJSON.err_msg):s.default.error("An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(e){r(".tooltip").hide();var t=r(e.target).closest("tr").data("id"),n=Galaxy.libraries.folderListView.collection.get(t);n.url=n.urlRoot+n.id+"?undelete=true",n.destroy({success:function(e,n){Galaxy.libraries.folderListView.collection.remove(t);var i=new c.default.FolderAsModel(n);Galaxy.libraries.folderListView.collection.add(i),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),s.default.success("Folder undeleted.")},error:function(e,t){void 0!==t.responseJSON?s.default.error("Folder was not undeleted. "+t.responseJSON.err_msg):s.default.error("An error occured! Folder was not undeleted. Please try again.")}})},startModifications:function(){this.options.edit_mode=!0,this.repaint()},cancelModifications:function(){this.options.edit_mode=!1,this.repaint()},saveModifications:function(){var e=Galaxy.libraries.folderListView.collection.get(this.$el.data("id")),t=!1,n=this.$el.find(".input_folder_name").val();if(void 0!==n&&n!==e.get("name")){if(!(n.length>2))return void s.default.warning("Folder name has to be at least 3 characters long.");e.set("name",n),t=!0}var i=this.$el.find(".input_folder_description").val();if(void 0!==i&&i!==e.get("description")&&(e.set("description",i),t=!0),t){var r=this;e.save(null,{patch:!0,success:function(e){r.options.edit_mode=!1,r.repaint(e),s.default.success("Changes to folder saved.")},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg):s.default.error("An error occured while attempting to update the folder.")}})}else this.options.edit_mode=!1,this.repaint(e),s.default.info("Nothing has changed.")},repaint:function(){r(".tooltip").hide();var e=this.$el;this.render(),e.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},templateRowFolder:function(){return i.template(['',"",'',"",'',"<% if(!edit_mode) { %>","",'<%- content_item.get("name") %>',"","",'<%- content_item.get("description") %>',"","<% } else if(edit_mode){ %>",'','',"<% } %>","folder","","",'<%= _.escape(content_item.get("update_time")) %>',"","","","<% if(edit_mode) { %>",'",'","<% } else if (!edit_mode){%>",'",'','","","<% } %>","",""].join(""))},templateRowFile:function(){return i.template(['',"",'',"",'','',"","",'/datasets/<%- content_item.id %>" class="library-dataset">','<%- content_item.get("name") %>',"","",'<%- content_item.get("message") %>','<%= _.escape(content_item.get("file_ext")) %>','<%= _.escape(content_item.get("file_size")) %>','<%= _.escape(content_item.get("update_time")) %>',"",'<% if ( content_item.get("state") !== "ok" ) { %>','<%= _.escape(content_item.get("state")) %>',"<% } %>","","",'<% if (content_item.get("is_unrestricted")) { %>','',"<% } %>",'<% if (content_item.get("is_private")) { %>','',"<% } %>",'<% if ((content_item.get("is_unrestricted") === false) && (content_item.get("is_private") === false)) { %>','',"<% } %>",'<% if (content_item.get("can_manage")) { %>','/datasets/<%- content_item.id %>/permissions">','","","<% } %>","",""].join(""))},templateRowDeletedFile:function(){return i.template(['',"",'',"","",'','<%- content_item.get("name") %>',"","",'<%- content_item.get("message") %>',"","",'<%= _.escape(content_item.get("file_ext")) %>',"","",'<%= _.escape(content_item.get("file_size")) %>',"","",'<%= _.escape(content_item.get("update_time")) %>',"","",'<% if ( content_item.get("state") !== "ok" ) { %>','<%= _.escape(content_item.get("state")) %>',"<% } %>","","",'','","",""].join(""))},templateRowDeletedFolder:function(){return i.template(['',"",'',"","",'','<%- content_item.get("name") %>',"","",'<%- content_item.get("description") %>',"","","folder","","","",'<%= _.escape(content_item.get("update_time")) %>',"","","",'','","",""].join(""))}});t.default={FolderRowView:h}}).call(t,n(2),n(1),n(0))},300:function(e,t,n){"use strict";(function(e,i){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),o=r(a),s=n(13),l=r(s),c=n(301),d=r(c),u=n(1),h=r(u),f=e.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},defaults:{page_count:null,show_page:null,all_fetched:!1},initialize:function(e){this.options=h.default.defaults(this.options||{},e,this.defaults);var t=this;this.modal=null,this.collection=new l.default.Libraries,this.collection.url=this.collection.urlRoot+"?deleted=false",this.collection.fetch({success:function(){t.render()},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occurred.")}})},render:function(e){this.options=h.default.extend(this.options,e),this.setElement("#libraries_element");var t=this.templateLibraryList(),n=null,r=null,a=function(e){return!0===e.get("public")};if(i(".tooltip").hide(),void 0!==e&&(r=void 0!==e.models?e.models:null),null!==this.collection&&null===r)this.sortLibraries(),n=Galaxy.libraries.preferences.get("with_deleted")?this.collection.models:this.collection.where({deleted:!1}),Galaxy.libraries.preferences.get("without_restricted")&&(n=h.default.filter(n,a));else if(null!==r){if(Galaxy.libraries.preferences.get("with_deleted"))n=r;else{var o=function(e){return!1===e.get("deleted")};n=h.default.filter(r,o)}Galaxy.libraries.preferences.get("without_restricted")&&(n=h.default.filter(n,a))}else n=[];(null===this.options.show_page||this.options.show_page<1)&&(this.options.show_page=1),this.options.total_libraries_count=n.length;var s=Galaxy.libraries.preferences.get("library_page_size")*(this.options.show_page-1);this.options.page_count=Math.ceil(this.options.total_libraries_count/Galaxy.libraries.preferences.get("library_page_size")),this.options.total_libraries_count>0&&sthis.options.total_libraries_count+Galaxy.libraries.preferences.get("library_page_size")&&(n=[]),this.$el.html(t({length:1,order:Galaxy.libraries.preferences.get("sort_order"),search_term:Galaxy.libraries.libraryToolbarView.options.search_term})),Galaxy.libraries.libraryToolbarView.renderPaginator(this.options),this.renderRows(n)):(this.$el.html(t({length:0,order:Galaxy.libraries.preferences.get("sort_order"),search_term:Galaxy.libraries.libraryToolbarView.options.search_term})),Galaxy.libraries.libraryToolbarView.renderPaginator(this.options)),i("#center [data-toggle]").tooltip(),i("#center").css("overflow","auto")},fetchDeleted:function(){if(this.options.all_fetched)this.render();else{var e=this;this.collection.url=this.collection.urlRoot+"?deleted=true",this.collection.fetch({remove:!1,success:function(){e.options.all_fetched=!0,e.render()},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occurred.")}})}},renderRows:function(e){for(var t=0;t',"<% if(length === 0) { %>","<% if(search_term.length > 0) { %>","
    ","There are no libraries matching your search. Try different keyword.","
    ","<% } else{ %>","
    ","There are no libraries visible to you here. If you expected some to show up please consult the",' library security wikipage',' or visit the Galaxy support site.',"
    ","<% }%>","<% } else{ %>",'',"",'",'',' ','',"",'',"","
    ','',"name","",'',"descriptionsynopsis
    ","<% }%>","
    "].join(""))}});t.default={LibraryListView:f}}).call(t,n(2),n(0))},301:function(e,t,n){"use strict";(function(e,i,r){Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),o=function(e){return e&&e.__esModule?e:{default:e}}(a),s=e.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library"},edit_mode:!1,element_visibility_config:{upload_library_btn:!1,edit_library_btn:!1,permission_library_btn:!1,save_library_btn:!1,cancel_library_btn:!1,delete_library_btn:!1,undelete_library_btn:!1},initialize:function(e){this.render(e)},render:function(e){void 0===e&&(e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))),this.prepareButtons(e);var t=this.templateRow();return this.setElement(t({library:e,button_config:this.element_visibility_config,edit_mode:this.edit_mode})),this.$el.show(),this},repaint:function(e){i(".tooltip").hide();var t=this.$el;this.render(),t.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){var t=this.element_visibility_config;!1===this.edit_mode?(t.save_library_btn=!1,t.cancel_library_btn=!1,t.delete_library_btn=!1,!0===e.get("deleted")?(t.undelete_library_btn=!0,t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1):!1===e.get("deleted")&&(t.save_library_btn=!1,t.cancel_library_btn=!1,t.undelete_library_btn=!1,!0===e.get("can_user_add")&&(t.upload_library_btn=!0),!0===e.get("can_user_modify")&&(t.edit_library_btn=!0),!0===e.get("can_user_manage")&&(t.permission_library_btn=!0))):!0===this.edit_mode&&(t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1,t.save_library_btn=!0,t.cancel_library_btn=!0,t.delete_library_btn=!0,t.undelete_library_btn=!1),this.element_visibility_config=t},edit_button_clicked:function(){this.edit_mode=!0,this.repaint()},cancel_library_modification:function(){this.edit_mode=!1,this.repaint()},save_library_modification:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=!1,n=this.$el.find(".input_library_name").val();if(void 0!==n&&n!==e.get("name")){if(!(n.length>2))return void o.default.warning("Library name has to be at least 3 characters long.");e.set("name",n),t=!0}var i=this.$el.find(".input_library_description").val();void 0!==i&&i!==e.get("description")&&(e.set("description",i),t=!0);var r=this.$el.find(".input_library_synopsis").val();if(void 0!==r&&r!==e.get("synopsis")&&(e.set("synopsis",r),t=!0),t){var a=this;e.save(null,{patch:!0,success:function(e){a.edit_mode=!1,a.repaint(e),o.default.success("Changes to library saved.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while attempting to update the library.")}})}else this.edit_mode=!1,this.repaint(e),o.default.info("Nothing has changed.")},delete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.destroy({success:function(e){e.set("deleted",!0),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,!1===Galaxy.libraries.preferences.get("with_deleted")?(i(".tooltip").hide(),t.repaint(e),t.$el.remove()):!0===Galaxy.libraries.preferences.get("with_deleted")&&t.repaint(e),o.default.success("Library has been marked deleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured during deleting the library.")}})},undelete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.url=e.urlRoot+e.id+"?undelete=true",e.destroy({success:function(e){e.set("deleted",!1),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,t.repaint(e),o.default.success("Library has been undeleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while undeleting the library.")}})},templateRow:function(){return r.template(['" style="display:none;" data-id="<%- library.get("id") %>">',"<% if(!edit_mode) { %>",'<% if(library.get("deleted")) { %>','<%- library.get("name") %>',"<% } else { %>",'"><%- library.get("name") %>',"<% } %>",'<% if(library.get("description")) { %>','<% if( (library.get("description")).length> 80 ) { %>','"><%= _.escape(library.get("description")).substring(0, 80) + "..." %>',"<% } else { %>",'<%= _.escape(library.get("description"))%>',"<% } %>","<% } else { %>","","<% } %>",'<% if(library.get("synopsis")) { %>','<% if( (library.get("synopsis")).length> 120 ) { %>','"><%= _.escape(library.get("synopsis")).substring(0, 120) + "..." %>',"<% } else { %>",'<%= _.escape(library.get("synopsis"))%>',"<% } %>","<% } else { %>","","<% } %>","<% } else if(edit_mode){ %>",'','','',"<% } %>",'','<% if( (library.get("public")) && (library.get("deleted") === false) ) { %>',' ',"<% }%>",'','/permissions">','','','','" class="fa fa-ban fa-lg">','',"",""].join(""))}});t.default={LibraryRowView:s}}).call(t,n(2),n(0),n(1))},302:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=e.View.extend({el:"#center",defaults:{search_term:""},events:{"click #create_new_library_btn":"createLibraryFromModal","click #include_deleted_chk":"includeDeletedChecked","click #exclude_restricted_chk":"excludeRestrictedChecked","click .page_size_prompt":"showPageSizePrompt","keyup .library-search-input":"searchLibraries"},initialize:function(e){this.options=i.defaults(this.options||{},e,this.defaults),this.render()},render:function(){var e=this.templateToolBar(),t=!1,n=!0;Galaxy.user&&(t=Galaxy.user.isAdmin(),n=Galaxy.user.isAnonymous()),this.$el.html(e({admin_user:t,anon_user:n})),t&&(this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted"),this.$el.find("#exclude_restricted_chk")[0].checked=Galaxy.libraries.preferences.get("without_restricted"))},renderPaginator:function(e){this.options=i.extend(this.options,e);var t=this.templatePaginator();this.$el.find("#library_paginator").html(t({show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_libraries_count:this.options.total_libraries_count,libraries_shown:this.options.libraries_shown,library_page_size:Galaxy.libraries.preferences.get("library_page_size")}))},createLibraryFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this;this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){t.createNewLibrary()},Close:function(){t.modal.hide()}}})},createNewLibrary:function(){var e=this.serializeNewLibrary();if(this.validateNewLibrary(e)){var t=new c.default.Library,n=this;t.save(e,{success:function(e){Galaxy.libraries.libraryListView.collection.add(e),n.modal.hide(),n.clearLibraryModal(),Galaxy.libraries.libraryListView.render(),s.default.success("Library created.")},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg):s.default.error("An error occured.")}})}else s.default.error("Library's name is missing.");return!1},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({library_page_size:parseInt(t)}),Galaxy.libraries.libraryListView.render({show_page:1}))},clearLibraryModal:function(){r("input[name='Name']").val(""),r("input[name='Description']").val(""),r("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:r("input[name='Name']").val(),description:r("input[name='Description']").val(),synopsis:r("input[name='Synopsis']").val()}},validateNewLibrary:function(e){return""!==e.name},includeDeletedChecked:function(e){e.target.checked?(Galaxy.libraries.preferences.set({with_deleted:!0}),Galaxy.libraries.libraryListView.fetchDeleted()):(Galaxy.libraries.preferences.set({with_deleted:!1}),Galaxy.libraries.libraryListView.render())},excludeRestrictedChecked:function(e){e.target.checked?Galaxy.libraries.preferences.set({without_restricted:!0}):Galaxy.libraries.preferences.set({without_restricted:!1}),Galaxy.libraries.libraryListView.render()},searchLibraries:function(e){var t=r(".library-search-input").val();this.options.search_term=t,Galaxy.libraries.libraryListView.searchLibraries(t)},templateToolBar:function(){return i.template(['
    ','
    ','
    ','
    ','DATA LIBRARIES','',"",'
    ','',"
    ","<% if(admin_user === true) { %>",'
    ',"","","
    ",'','',"","<% } %>",'','','',"","","
    ","
    ","
    ",'
    ',"
    ","
    "].join(""))},templatePaginator:function(){return i.template(['","",' <%- libraries_shown %> libraries shown (change)',"",""," <%- total_libraries_count %> total",""].join(""))},templateNewLibraryInModal:function(){return i.template(['
    ',"
    ",'','','',"
    ","
    "].join(""))}});t.default={LibraryToolbarView:d}}).call(t,n(2),n(1),n(0))},303:function(e,t,n){"use strict";(function(e,i,r,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),l=o(s),c=n(7),d=o(c),u=n(13),h=o(u),f=n(10),p=o(f);n(127);var _=e.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedItems","click .toolbtn-show-locinfo":"showLocInfo","click .page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:!1,contains_file_or_folder:!1,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(e){this.options=i.defaults(e||{},this.defaults),this.fetchExtAndGenomes(),this.render()},render:function(e){this.options=i.extend(this.options,e);var t=this.templateToolBar(),n={id:this.options.id,is_admin:!1,is_anonym:!0,mutiple_add_dataset_options:!1};Galaxy.user&&(n.is_admin=Galaxy.user.isAdmin(),n.is_anonym=Galaxy.user.isAnonymous(),null===Galaxy.config.user_library_import_dir&&!1===Galaxy.config.allow_library_path_paste&&null===Galaxy.config.library_import_dir||(n.mutiple_add_dataset_options=!0)),this.$el.html(t(n))},renderPaginator:function(e){this.options=i.extend(this.options,e);var t=this.templatePaginator();r("body").find(".folder-paginator").html(t({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown,folder_page_size:Galaxy.libraries.preferences.get("folder_page_size")}))},configureElements:function(e){this.options=i.extend(this.options,e),!0===this.options.can_add_library_item?r(".add-library-items").show():r(".add-library-items").hide(),!0===this.options.contains_file_or_folder&&Galaxy.user?Galaxy.user.isAnonymous()?(r(".dataset-manipulation").show(),r(".logged-dataset-manipulation").hide()):(r(".logged-dataset-manipulation").show(),r(".dataset-manipulation").show()):(r(".logged-dataset-manipulation").hide(),r(".dataset-manipulation").hide()),this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this,n=this.templateNewFolderInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Folder",body:n(),buttons:{Create:function(){t.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var t=this.serialize_new_folder();if(this.validate_new_folder(t)){var n,i=new h.default.FolderAsModel,r=e.history.fragment.split("/");n=r.indexOf("page")>-1?r[r.length-3]:r[r.length-1],i.url=i.urlRoot+n,i.save(t,{success:function(e){Galaxy.modal.hide(),d.default.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}})}else d.default.error("Folder's name is missing.");return!1},serialize_new_folder:function(){return{name:r("input[name='Name']").val(),description:r("input[name='Description']").val()}},validate_new_folder:function(e){return""!==e.name},modalBulkImport:function(){if(0===this.findCheckedRows().length)d.default.info("You must select some datasets first.");else{var e=this;this.histories=new h.default.GalaxyHistories,this.histories.fetch().done(function(){var t=e.templateBulkImportInModal();e.modal=Galaxy.modal,e.modal.show({closing_events:!0,title:"Import into History",body:t({histories:e.histories.models}),buttons:{Import:function(){e.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})}).fail(function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")})}},importAllIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),t=this;if(""!==e)r.post(Galaxy.root+"api/histories",{name:e}).done(function(e){t.options.last_used_history_id=e.id,t.processImportToHistory(e.id,e.name)}).fail(function(e,t,n){d.default.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var n=r("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=n;var i=r("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(n,i),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var n=[],i=[];this.findCheckedRows().each(function(){var e=r(this).closest("tr").data("id");"F"==e.substring(0,1)?i.push(e):n.push(e)});for(var o=[],s=n.length-1;s>=0;s--){var l=n[s],c=new h.default.HistoryItem;c.url=c.urlRoot+e+"/contents",c.content=l,c.source="library",o.push(c)}for(var s=i.length-1;s>=0;s--){var d=i[s],c=new h.default.HistoryItem;c.url=c.urlRoot+e+"/contents",c.content=d,c.source="library_folder",o.push(c)}this.initChainCallControl({length:o.length,action:"to_history",history_name:t}),a.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(o,t)},updateProgress:function(){this.progress+=this.progressStep,r(".progress-bar-import").width(Math.round(this.progress)+"%");var e=Math.round(this.progress)+"% Complete";r(".completion_span").text(e)},download:function(e,t){var n=[],i=[];this.findCheckedRows().each(function(){var e=r(this).closest("tr").data("id");"F"==e.substring(0,1)?i.push(e):n.push(e)});var a=Galaxy.root+"api/libraries/datasets/download/"+t,o={ld_ids:n,folder_ids:i};this.processDownload(a,o,"get")},processDownload:function(e,t,n){if(e&&t){t="string"==typeof t?t:r.param(t);var i="";r.each(t.split("&"),function(){var e=this.split("=");i+=''}),r('
    '+i+"
    ").appendTo("body").submit().remove(),d.default.info("Your download will begin soon.")}else d.default.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new h.default.GalaxyHistories;var e=this;this.histories.fetch().done(function(){e.modal=Galaxy.modal;var t=e.templateAddFilesFromHistory();e.modal.show({closing_events:!0,title:"Adding datasets from your history",body:t({histories:e.histories.models}),buttons:{Add:function(){e.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),e.fetchAndDisplayHistoryContents(e.histories.models[0].id),r("#dataset_add_bulk").change(function(t){e.fetchAndDisplayHistoryContents(t.target.value)})}).fail(function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")})},importFilesFromPathModal:function(){var e=this;this.modal=Galaxy.modal;var t=this.templateImportPathModal();this.modal.show({closing_events:!0,title:"Please enter paths to import",body:t({}),buttons:{Import:function(){e.importFromPathsClicked(e)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),this.renderSelectBoxes()},fetchExtAndGenomes:function(){var e=this;l.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(t){e.list_extensions=[];for(var n in t)e.list_extensions.push({id:t[n].extension,text:t[n].extension,description:t[n].description,description_url:t[n].description_url});e.list_extensions.sort(function(e,t){return e.id>t.id?1:e.idt.id?1:e.id=0;u--){var h=l[u].trim();0!==h.length&&c.push(h)}this.initChainCallControl({length:c.length,action:"adding_datasets"}),this.chainCallImportingFolders({paths:c,preserve_dirs:e,link_data:t,space_to_tab:n,to_posix_lines:i,source:"admin_path",file_type:o,tag_using_filenames:a,dbkey:s})}else d.default.info("Please enter a path relative to Galaxy root.")},initChainCallControl:function(e){var t;switch(e.action){case"adding_datasets":t=this.templateAddingDatasetsProgressBar(),this.modal.$el.find(".modal-body").html(t({folder_name:this.options.folder_name}));break;case"deleting_datasets":t=this.templateDeletingItemsProgressBar(),this.modal.$el.find(".modal-body").html(t());break;case"to_history":t=this.templateImportIntoHistoryProgressBar(),this.modal.$el.find(".modal-body").html(t({history_name:e.history_name}));break;default:Galaxy.emit.error("Wrong action specified.","datalibs")}this.progress=0,this.progressStep=100/e.length,this.options.chain_call_control.total_number=e.length,this.options.chain_call_control.failed_number=0},importFromJstreePath:function(e,t){var n=r("#jstree_browser").jstree().get_selected(!0),a=i.filter(n,function(e){return 0==e.state.disabled}),o=this.modal.$el.find(".preserve-checkbox").is(":checked"),s=this.modal.$el.find(".link-checkbox").is(":checked"),l=this.modal.$el.find(".spacetab-checkbox").is(":checked"),c=this.modal.$el.find(".posix-checkbox").is(":checked"),u=this.select_extension.value(),h=this.select_genome.value(),f=this.modal.$el.find(".tag-files").is(":checked"),p=a[0].type,_=[];if(a.length<1)d.default.info("Please select some items first.");else{this.modal.disableButton("Import");for(var g=a.length-1;g>=0;g--)void 0!==a[g].li_attr.full_path&&_.push(a[g].li_attr.full_path);if(this.initChainCallControl({length:_.length,action:"adding_datasets"}),"folder"===p){var m=t.source+"_folder";this.chainCallImportingFolders({paths:_,preserve_dirs:o,link_data:s,space_to_tab:l,to_posix_lines:c,source:m,file_type:u,dbkey:h,tag_using_filenames:f})}else if("file"===p){var m=t.source+"_file";this.chainCallImportingUserdirFiles({paths:_,file_type:u,dbkey:h,link_data:s,space_to_tab:l,to_posix_lines:c,source:m,tag_using_filenames:f})}}},fetchAndDisplayHistoryContents:function(e){var t=new h.default.HistoryContents({id:e}),n=this;t.fetch({success:function(t){var i=n.templateHistoryContents();n.histories.get(e).set({contents:t}),n.modal.$el.find("#selected_history_content").html(i({history_contents:t.models.reverse()})),n.modal.$el.find(".history-import-select-all").bind("click",function(){r("#selected_history_content [type=checkbox]").prop("checked",!0)}),n.modal.$el.find(".history-import-unselect-all").bind("click",function(){r("#selected_history_content [type=checkbox]").prop("checked",!1)})},error:function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],n=[],i=[];if(e.length<1)d.default.info("You must select some datasets first.");else{this.modal.disableButton("Add"),e.each(function(){var e=r(this).closest("li").data("id");if(e){var i=r(this).closest("li").data("name");t.push(e),n.push(i)}});for(var a=t.length-1;a>=0;a--){var o=t[a],s=new h.default.Item;s.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===n[a]?s.set({from_hdca_id:o}):s.set({from_hda_id:o}),i.push(s)}this.initChainCallControl({length:i.length,action:"adding_datasets"}),this.chainCallAddingHdas(i)}},chainCallImportingIntoHistory:function(e,t){var n=this,i=e.pop();if(void 0===i)return 0===this.options.chain_call_control.failed_number?d.default.success("Selected datasets imported into history. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}}):this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number?d.default.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;s--){var l=new h.default.Item({id:e[s]});o.push(l)}for(var s=t.length-1;s>=0;s--){var c=new h.default.FolderAsModel({id:t[s]});o.push(c)}this.options.chain_call_control.total_number=a,this.chainCallDeletingItems(o)}},showLocInfo:function(){var e=null,t=this;null!==Galaxy.libraries.libraryListView?(e=Galaxy.libraries.libraryListView.collection.get(this.options.parent_library_id),this.showLocInfoModal(e)):(e=new h.default.Library({id:this.options.parent_library_id}),e.fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}}))},showLocInfoModal:function(e){var t=this,n=this.templateLocInfoInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Location Details",body:n({library:e,options:t.options}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(e){switch(e.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back(),d.default.error("Invalid import source.")}},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({folder_page_size:parseInt(t)}),Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1}))},findCheckedRows:function(){return r("#folder_list_body").find(":checked")},templateToolBar:function(){return i.template(['
    ','
    ','
    ',"DATA LIBRARIES",'','",'","<% if(mutiple_add_dataset_options) { %>",'","<% } else { %>",'","<% } %>",'",'",'','",'','','","","","
    ","",'
    ',"
    ",'
    ',"
    "].join(""))},templateLocInfoInModal:function(){return i.template(["
    ",'',"",'',"","","","","",'',"",'<% if(library.get("description") !== "") { %>',"","",'',"","<% } %>",'<% if(library.get("synopsis") !== "") { %>',"","",'',"","<% } %>",'<% if(library.get("create_time_pretty") !== "") { %>',"","",'',"","<% } %>","","",'',"","","
    library
    name<%- library.get("name") %>
    description<%- library.get("description") %>
    synopsis<%- library.get("synopsis") %>
    created"><%- library.get("create_time_pretty") %>
    id<%- library.get("id") %>
    ",'',"",'',"","","","","","","",'<% if(options.folder_description !== "") { %>',"","","","","<% } %>","","","","","","
    folder
    name<%- options.folder_name %>
    description<%- options.folder_description %>
    id<%- options.id %>
    ","
    "].join(""))},templateNewFolderInModal:function(){return i.template(['
    ',"
    ",'','',"
    ","
    "].join(""))},templateBulkImportInModal:function(){return i.template(["
    ",'
    ',"Select history: ",'","
    ",'
    ',"or create new: ",'',"","
    ","
    "].join(""))},templateImportIntoHistoryProgressBar:function(){return i.template(['
    ',"Importing selected items to history <%= _.escape(history_name) %>","
    ",'
    ','
    ','0% Complete',"
    ","
    "].join(""))},templateAddingDatasetsProgressBar:function(){return i.template(['
    ',"Adding selected datasets to library folder <%= _.escape(folder_name) %>","
    ",'
    ','
    ','0% Complete',"
    ","
    "].join(""))},templateDeletingItemsProgressBar:function(){return i.template(['
    ',"
    ",'
    ','
    ','0% Complete',"
    ","
    "].join(""))},templateBrowserModal:function(){return i.template(['
    ','
    All files you select will be imported into the current folder ignoring their folder structure.
    ','','
    ','",'","
    ",'
    ','",'",'",'","
    ",'",'","
    ",'
    ',"
    ","
    ","

    You can set extension type and genome for all imported datasets at once:

    ","
    ",'Type: ','Genome: ',"
    ","
    ","
    ",'","
    ","
    "].join(""))},templateImportPathModal:function(){return i.template(['
    ','
    All files within the given folders and their subfolders will be imported into the current folder.
    ','
    ','",'","
    ",'",'","
    ",'',"
    ","

    You can set extension type and genome for all imported datasets at once:

    ","
    ",'Type: ','Genome: ',"
    ","
    ",'","
    ","
    "].join(""))},templateAddFilesFromHistory:function(){return i.template(['
    ',"
    ","1. Select history: ",'","
    ","
    ",'
    ',"
    ","
    "].join(""))},templateHistoryContents:function(){return i.template(["

    2. Choose the datasets to import:

    ","
    ",'",'","
    ","
    ","
      ","<% _.each(history_contents, function(history_item) { %>",'<% if (history_item.get("deleted") != true ) { %>','<% var item_name = history_item.get("name") %>','<% if (history_item.get("type") === "collection") { %>','<% var collection_type = history_item.get("collection_type") %>','<% if (collection_type === "list") { %>','
    • " data-name="<%= _.escape(history_item.get("type")) %>">',"
    • ","<% } else { %>",'
    • ','','<%= _.escape(history_item.get("hid")) %>: ','<%= item_name.length > 75 ? _.escape("...".concat(item_name.substr(-75))) : _.escape(item_name) %> (Dataset Collection of type <%= _.escape(collection_type) %> not supported.)',"","
    • ","<% } %>",'<% } else if (history_item.get("visible") === true && history_item.get("state") === "ok") { %>','
    • " data-name="<%= _.escape(history_item.get("type")) %>">','","
    • ","<% } %>","<% } %>","<% }); %>","
    "].join(""))},templatePaginator:function(){return i.template(['","",' <%- items_shown %> items shown (change)',"",""," <%- total_items_count %> total",""].join(""))}});t.default={FolderToolbarView:_}}).call(t,n(2),n(1),n(0),n(0))},304:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(10),u=a(d),h=e.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=i.extend(this.options,e),this.options.id&&this.fetchLibrary()},fetchLibrary:function(e){this.options=i.extend(this.options,e),this.model=new c.default.Library({id:this.options.id});var t=this;this.model.fetch({success:function(){t.options.show_permissions&&t.showPermissions()},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):s.default.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},showPermissions:function(e){this.options=i.extend(this.options,e),r(".tooltip").remove(),void 0!==this.options.fetched_permissions&&(0===this.options.fetched_permissions.access_library_role_list.length?this.model.set({is_unrestricted:!0}):this.model.set({is_unrestricted:!1}));var t=!1;Galaxy.user&&(t=Galaxy.user.isAdmin());var n=this.templateLibraryPermissions();this.$el.html(n({library:this.model,is_admin:t}));var a=this;r.get(Galaxy.root+"api/libraries/"+a.id+"/permissions?scope=current").done(function(e){a.prepareSelectBoxes({fetched_permissions:e})}).fail(function(){s.default.error("An error occurred while attempting to fetch library permissions.")}),r("#center [data-toggle]").tooltip(),r("#center").css("overflow","auto")},_serializeRoles:function(e){for(var t=[],n=0;n=0;n--)t.push(e[n].id);return t},savePermissions:function(e){var t=this,n=this._extractIds(this.accessSelectObject.$el.select2("data")),i=this._extractIds(this.addSelectObject.$el.select2("data")),a=this._extractIds(this.manageSelectObject.$el.select2("data")),o=this._extractIds(this.modifySelectObject.$el.select2("data"));r.post(Galaxy.root+"api/libraries/"+t.id+"/permissions?action=set_permissions",{"access_ids[]":n,"add_ids[]":i,"manage_ids[]":a,"modify_ids[]":o}).done(function(e){t.showPermissions({fetched_permissions:e}),s.default.success("Permissions saved.")}).fail(function(){s.default.error("An error occurred while attempting to set library permissions.")})},templateLibraryPermissions:function(){return i.template(['
    ','","

    ",'Library: <%= _.escape(library.get("name")) %>',"

    ",'
    ',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any library on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
    ",'
    ',"

    Library permissions

    ","

    Roles that can access the library

    ",'
    ','
    ',"User with any of these roles can access this library. If there are no access roles set on the library it is considered unrestricted.","
    ","

    Roles that can manage permissions on this library

    ",'
    ','
    ',"User with any of these roles can manage permissions on this library (includes giving access).","
    ","

    Roles that can add items to this library

    ",'
    ','
    ',"User with any of these roles can add items to this library (folders and datasets).","
    ","

    Roles that can modify this library

    ",'
    ','
    ',"User with any of these roles can modify this library (name, synopsis, etc.).","
    ",'","
    ","
    "].join(""))}});t.default={LibraryView:h}}).call(t,n(2),n(1),n(0))},305:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(10),u=a(d),h=e.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=i.extend(this.options,e),this.options.id&&this.fetchFolder()},fetchFolder:function(e){this.options=i.extend(this.options,e),this.model=new c.default.FolderAsModel({id:this.options.id});var t=this;this.model.fetch({success:function(){t.options.show_permissions&&t.showPermissions()},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):s.default.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},showPermissions:function(e){this.options=i.extend(this.options,e),r(".tooltip").remove();var t=!1;Galaxy.user&&(t=Galaxy.user.isAdmin());var n=this.templateFolderPermissions();this.$el.html(n({folder:this.model,is_admin:t}));var a=this;r.get(Galaxy.root+"api/folders/"+a.id+"/permissions?scope=current").done(function(e){a.prepareSelectBoxes({fetched_permissions:e})}).fail(function(){s.default.error("An error occurred while attempting to fetch folder permissions.")}),r("#center [data-toggle]").tooltip(),r("#center").css("overflow","auto")},_serializeRoles:function(e){for(var t=[],n=0;n=0;n--)t.push(e[n].id);return t},savePermissions:function(e){var t=this,n=this._extractIds(this.addSelectObject.$el.select2("data")),i=this._extractIds(this.manageSelectObject.$el.select2("data")),a=this._extractIds(this.modifySelectObject.$el.select2("data"));r.post(Galaxy.root+"api/folders/"+t.id+"/permissions?action=set_permissions",{"add_ids[]":n,"manage_ids[]":i,"modify_ids[]":a}).done(function(e){t.showPermissions({fetched_permissions:e}),s.default.success("Permissions saved.")}).fail(function(){s.default.error("An error occurred while attempting to set folder permissions.")})},templateFolderPermissions:function(){return i.template(['
    ','","

    ",'Folder: <%= _.escape(folder.get("name")) %>',"

    ",'
    ',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
    ",'
    ',"

    Folder permissions

    ","

    ","Roles that can manage permissions on this folder","

    ",'
    ','
    ',"User with any of these roles can manage permissions on this folder.","
    ","

    ","Roles that can add items to this folder","

    ",'
    ','
    ',"User with any of these roles can add items to this folder (folders and datasets).","
    ","

    ","Roles that can modify this folder","

    ",'
    ','
    ',"User with any of these roles can modify this folder (name, etc.).","
    ",'","
    ","
    "].join(""))}});t.default={FolderView:h}}).call(t,n(2),n(1),n(0))},306:function(e,t,n){"use strict";(function(e){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(307),a=i(r),o=n(308),s=i(o),l=n(309),c=i(l),d=n(310),u=i(d),h=n(311),f=i(h),p=n(312),_=i(p),g=n(313),m=i(g),v=e.Router.extend({initialize:function(){this.routesHit=0,e.history.on("route",function(){this.routesHit++},this),this.bind("route",this.trackPageview)},routes:{"":"toolsheds",sheds:"toolsheds",queue:"queue",workflows:"workflows","status/r/:repositories":"status",status:"status","categories/s/:tool_shed":"categories","category/s/:tool_shed/c/:cateory_id":"repositories","repository/s/:tool_shed/r/:repository_id":"repository"},back:function(){this.routesHit>1?window.history.back():this.navigate("#",{trigger:!0,replace:!0})}}),y=e.View.extend({app_config:{known_views:["toolsheds","queue","status","categories","repositories","repoository"]},initialize:function(){Galaxy.admintoolshedapp=this,this.admin_toolshed_router=new v,this.admin_toolshed_router.on("route:queue",function(){Galaxy.admintoolshedapp.adminRepoQueueView?Galaxy.admintoolshedapp.adminRepoQueueView.reDraw():Galaxy.admintoolshedapp.adminRepoQueueView=new f.default.RepoQueueView}),this.admin_toolshed_router.on("route:toolsheds",function(){Galaxy.admintoolshedapp.adminShedListView?Galaxy.admintoolshedapp.adminShedListView.reDraw():Galaxy.admintoolshedapp.adminShedListView=new a.default.ShedListView}),this.admin_toolshed_router.on("route:categories",function(e){Galaxy.admintoolshedapp.adminShedCategoriesView?Galaxy.admintoolshedapp.adminShedCategoriesView.reDraw({tool_shed:e.replace(/\//g,"%2f")}):Galaxy.admintoolshedapp.adminShedCategoriesView=new s.default.CategoryView({tool_shed:e.replace(/\//g,"%2f")})}),this.admin_toolshed_router.on("route:repositories",function(e,t){Galaxy.admintoolshedapp.adminShedCategoryView?Galaxy.admintoolshedapp.adminShedCategoryView.reDraw({tool_shed:e.replace(/\//g,"%2f"),category_id:t}):Galaxy.admintoolshedapp.adminShedCategoryView=new c.default.Category({tool_shed:e.replace(/\//g,"%2f"),category_id:t})}),this.admin_toolshed_router.on("route:repository",function(e,t){Galaxy.admintoolshedapp.adminRepositoryView?Galaxy.admintoolshedapp.adminRepositoryView.reDraw({tool_shed:e.replace(/\//g,"%2f"),repository_id:t}):Galaxy.admintoolshedapp.adminRepositoryView=new u.default.RepoDetails({tool_shed:e.replace(/\//g,"%2f"),repository_id:t})}),this.admin_toolshed_router.on("route:status",function(e){Galaxy.admintoolshedapp.adminRepoStatusView?Galaxy.admintoolshedapp.adminRepoStatusView.reDraw({repositories:e.split("|")}):Galaxy.admintoolshedapp.adminRepoStatusView=new _.default.RepoStatus({repositories:e.split("|")})}),this.admin_toolshed_router.on("route:workflows",function(){Galaxy.admintoolshedapp.adminWorkflowsView?Galaxy.admintoolshedapp.adminWorkflowsView.reDraw():Galaxy.admintoolshedapp.adminWorkflowsView=new m.default.Workflows}),e.history.start({pushState:!1})}});t.default={GalaxyApp:y}}).call(t,n(2))},307:function(e,t,n){"use strict";(function(e,i){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(17),o=r(a),s=n(18),l=r(s),c=e.View.extend({defaults:{tool_sheds:[{url:"https://toolshed.g2.bx.psu.edu/",name:"Galaxy Main Tool Shed"}]},initialize:function(e){this.options=i.defaults(this.options||{},this.defaults),this.model=new o.default.ShedsCollection,this.listenTo(this.model,"sync",this.render),this.model.fetch()},el:"#center",render:function(e){this.options=i.defaults(this.options||{},e,this.defaults);var t=this.templateToolshedList;this.$el.html(t({title:"Configured Galaxy Tool Sheds",tool_sheds:this.model.models,queue:l.default.queueLength()}))},reDraw:function(e){this.$el.empty(),this.render(e)},templateToolshedList:i.template(['
    ','
    <%= title %>
    ','',"
    ",'
    ','
    ','',"<% _.each(tool_sheds, function(shed) { %>",'',"","","<% }); %>","
    ",'","
    ","
    ",'
    ',"
    "].join(""))});t.default={ShedListView:c}}).call(t,n(2),n(1))},308:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l);n(30);var d=e.View.extend({el:"#center",defaults:{tool_shed:"https://toolshed.g2.bx.psu.edu/"},initialize:function(e){var t=e.tool_shed.replace(/\//g,"%2f");this.options=i.defaults(this.options||e,this.defaults),this.model=new s.default.Categories,this.listenTo(this.model,"sync",this.render),this.model.url=this.model.url+"?tool_shed_url="+this.options.tool_shed,this.model.tool_shed=t,this.model.fetch()},render:function(e){this.options=i.extend(this.options,e),this.options.categories=this.model.models,this.options.queue=c.default.queueLength();var t=this.templateCategoryList;this.$el.html(t(this.options)),r("#center").css("overflow","auto"),this.bindEvents()},bindEvents:function(){var t=this;r("#search_box").autocomplete({source:function(e,n){var i=t.model.tool_shed.replace(/%2f/g,"/"),a=Galaxy.root+"api/tool_shed/search",o={term:e.term,tool_shed_url:i};r.post(a,o,function(e){console.log(e);var t=c.default.shedParser(e);n(t)})},minLength:3,select:function(n,i){var r=i.item.value,a=(Galaxy.root,t.model.tool_shed,"repository/s/"+t.model.tool_shed+"/r/"+r);e.history.navigate(a,{trigger:!0,replace:!0})}})},reDraw:function(e){this.$el.empty(),this.model.url=this.model.url+"?tool_shed_url="+this.options.tool_shed,this.initialize(e)},templateCategoryList:i.template(['",'
    ','
    Categories in <%= tool_shed.replace(/%2f/g, "/") %>
    ','',"
    ",'
    ','",'
    ','','',"","","","","","","<% _.each(categories, function(category) { %>","","",'','',"","<% }); %>","
    NameDescriptionRepositories
    ",'"><%= category.get("name") %>',"<%= category.get("description") %><%= category.get("repositories") %>
    ","
    ","
    "].join(""))});t.default={CategoryView:d}}).call(t,n(2),n(1),n(0))},309:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l);n(30);var d=e.View.extend({el:"#center",initialize:function(e){this.model=new s.default.CategoryCollection,this.listenTo(this.model,"sync",this.render);var t=e.tool_shed.replace(/\//g,"%2f");this.model.url+="?tool_shed_url="+t+"&category_id="+e.category_id,this.model.tool_shed=t,this.model.category=e.category_id,this.model.fetch()},render:function(e){this.options=i.extend(this.options,e);var t=this.templateCategoryContents;this.$el.html(t({category:this.model.models[0],tool_shed:this.model.tool_shed,queue:c.default.queueLength()})),r("#center").css("overflow","auto"),this.bindEvents()},bindEvents:function(){var t=this;r("#search_box").autocomplete({source:function(e,n){var i=t.model.tool_shed.replace(/%2f/g,"/"),a=Galaxy.root+"api/tool_shed/search",o={term:e.term,tool_shed_url:i};r.post(a,o,function(e){var t=c.default.shedParser(e);n(t)})},minLength:3,select:function(n,i){var r=i.item.value,a="repository/s/"+t.model.tool_shed+"/r/"+r;e.history.navigate(a,{trigger:!0,replace:!0})}})},reDraw:function(e){this.$el.empty(),this.initialize(e)},templateCategoryContents:i.template(['",'
    ','
    Repositories in <%= category.get("name") %>
    ','',"
    ",'
    ','",'
    ','','',"",'','',"",'',"","",'<% _.each(category.get("repositories"), function(repository) { %>',"","","","","","","<% }); %>","
    OwnerNameSynopsisType
    <%= repository.owner %>",'","<%= repository.description %><%= repository.type %>
    ","
    ","
    "].join(""))});t.default={Category:d}}).call(t,n(2),n(1),n(0))},310:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(127),c=(a(l),n(3)),d=a(c),u=n(8),h=a(u),f=n(11),p=a(f),_=n(18),g=a(_),m=e.View.extend({el:"#center",initialize:function(e){this.options=i.defaults(this.options||{},this.defaults),this.model=new s.default.RepositoryCollection,this.listenTo(this.model,"sync",this.render);var t=e.tool_shed.replace(/\//g,"%2f");this.model.url+="?tool_shed_url="+t+"&repository_id="+e.repository_id,this.model.tool_shed_url=e.tool_shed.replace(/%2f/g,"/"),this.model.tool_shed=t,this.model.category=e.repository_id,this.model.fetch()},render:function(e){var t=this.templateRepoDetails,n=this.model.models[0];this.options={repository:n.get("repository"),tool_shed:this.model.tool_shed,queue:g.default.queueLength()};var a=Object.keys(this.options.repository.metadata);this.options.current_changeset=this.options.current_changeset||a[a.length-1],this.options.current_metadata=this.options.repository.metadata[this.options.current_changeset],this.options.current_metadata.tool_shed_url=this.model.tool_shed_url,this.options.tools=this.options.current_metadata.tools,this.options.repository_dependencies_template=this.templateRepoDependencies,this.options.repository_dependency_template=this.templateRepoDependency,this.options.tps_template_global_select=this.templateGlobalSectionSelect,this.options.tps_template_tool_select=this.templateToolSectionSelect,this.options.tps_select_options=this.templatePanelSelectOptions,this.options.tool_dependencies=n.get("tool_dependencies"),this.options.shed_tool_conf=this.templateShedToolConf({shed_tool_confs:n.get("shed_conf")}),this.options.panel_section_dict=n.get("panel_section_dict"),this.options.api_url=Galaxy.root+"api/tool_shed_repositories/install?async=True",this.options=i.extend(this.options,e),this.$el.html(t(this.options)),this.checkInstalled(this.options.current_metadata),this.bindEvents(),r("#center").css("overflow","auto")},bindEvents:function(){var e=this;r("#changeset").on("change",function(){e.options.current_changeset=r("#changeset").find("option:selected").text(),e.options.current_metadata=e.options.repository.metadata[e.options.current_changeset],e.checkInstalled(e.options.current_metadata),e.reDraw()}),r("#tool_panel_section_select").on("change",function(){e.tpsSelection()}),r("#install_repository").on("click",function(t){r("#repository_installation");t.preventDefault();var n={};n.repositories=JSON.stringify([[r("#install_repository").attr("data-tsrid"),r("#changeset").find("option:selected").val()]]),n.tool_shed_repository_ids=JSON.stringify([r("#install_repository").attr("data-tsrid")]),n.tool_shed_url=e.model.tool_shed_url,n.install_tool_dependencies=r("#install_tool_dependencies").val(),n.install_repository_dependencies=r("#install_repository_dependencies").val(),n.install_resolver_dependencies=r("#install_resolver_dependencies").val();e.panelSelect(n);n.tool_panel_section=JSON.stringify(e.panelSelect(n)),n.shed_tool_conf=r("select[name='shed_tool_conf']").find("option:selected").val(),n.changeset=r("#changeset").find("option:selected").val();var i=r("#repository_installation").attr("action");e.prepareInstall(n,i)}),r("#queue_install").on("click",function(t){e.options.current_changeset=r("#changeset").find("option:selected").text(),e.options.current_metadata=e.options.repository.metadata[e.options.current_changeset];var n=(e.options.current_changeset,{});i.each(Object.keys(e.options.current_metadata),function(t){n[t]||(n[t]=e.options.current_metadata[t])}),n.install_tool_dependencies=r("#install_tool_dependencies").val(),n.install_repository_dependencies=r("#install_repository_dependencies").val(),n.install_resolver_dependencies=r("#install_resolver_dependencies").val(),n.tool_panel_section=JSON.stringify(e.panelSelect({})),n.shed_tool_conf=r("select[name='shed_tool_conf']").find("option:selected").val(),n.tool_shed_url=e.model.tool_shed_url,"/"==n.tool_shed_url.substr(-1)&&(n.tool_shed_url=n.tool_shed_url.substr(0,n.tool_shed_url.length-1)),g.default.addToQueue(n),e.checkInstalled(n)}),r(".tool_panel_section_picker").on("change",function(){r(this).find("option:selected").val()==r("#tool_panel_section_select").find("option:selected").val()?r(this).attr("default","active"):r(this).removeAttr("default")}),r(function(){r("#repository_dependencies").jstree()}),r(".tool_form").on("click",function(){var t=r(this).attr("data-guid"),n=(r(this).attr("data-clean"),r(this).attr("data-name")),i=r(this).attr("data-desc"),a=e.model.tool_shed_url,o=r("#repository_details").attr("data-tsrid"),s=r("#changeset").find("option:selected").val(),l=Galaxy.root+"api/tool_shed/tool_json",c={guid:t,tool_shed_url:a,tsr_id:o,changeset:s};r.get(l,c,function(e){e.cls="ui-portlet-plain";var t=new p.default(e);d.default.deepeach(e.inputs,function(e){e.type&&-1!=["data","data_collection"].indexOf(e.type)&&(e.type="hidden",e.info="Data input '"+e.name+"' ("+d.default.textify(e.extensions)+")")});var r=new h.default.View,a=""+n+" "+i;r.show({closing_events:!0,title:a,body:t.$el,buttons:{Close:function(){r.hide()}}})})})},checkInstalled:function(e){var t=this,n={name:e.name,owner:e.owner},i=!1;t.repoQueued(e);r.get(Galaxy.root+"api/tool_shed_repositories",n,function(n){for(var a=0;a','
    Repository information for <%= repository.name %> from <%= repository.owner %>
    ','',"
    ",'
    ','
    ','','','
    ','
    Changeset
    ','
    ','",'','','
    Please select a revision and review the settings below before installing.
    ',"
    ","
    ","<%= shed_tool_conf %>","<% if (current_metadata.has_repository_dependencies) { %>",'
    Repository dependencies for <%= current_changeset %>
    ','
    ','

    ','','',"

    ","<% current_metadata.repository_dependency_template = repository_dependency_template; %>",'
    ','","<%= repository_dependencies_template(current_metadata) %>","
    ","
    ","<% } %>","<% if (current_metadata.includes_tool_dependencies) { %>",'
    Tool dependencies
    ','
    ','

    ','','',"

    ",'

    ','','',"

    ",'
    ','",'',"",'','',"","","","",'',"<% _.each(tool_dependencies[current_changeset], function(dependency) { %>",'','","","","","<% }); %>","","
    NameVersionType
    ',"<%= dependency.name %><%= dependency.version %><%= dependency.type %>
    ","
    ","
    ","<% } %>","<% if (current_metadata.includes_tools_for_display_in_tool_panel) { %>",'
    Tools – click the name to preview the tool and use the pop-up menu to inspect all metadata
    ','
    ','
    ','',"",'','',"","","","",'',"<% _.each(current_metadata.tools, function(tool) { %>",'','","",'','","","<% }); %>","","
    NameDescriptionVersion<%= tps_template_global_select({tps: panel_section_dict, tps_select_options: tps_select_options}) %>
    ','","<%= tool.description %><%= tool.version %>',"<%= tps_template_tool_select({tool: tool, tps: panel_section_dict, tps_select_options: tps_select_options}) %>","
    ","
    ","
    ","<% } %>","
    ","
    "].join("")),templateRepoDependencies:i.template(['
    Repository Dependencies
    ','
    ',"
      ","
    • Repository installation requires the following","<% if (has_repository_dependencies) { %>","<% _.each(repository_dependencies, function(dependency) { %>","<% dependency.repository_dependency_template = repository_dependency_template; %>","<%= repository_dependency_template(dependency) %>","<% }); %>","<% } %>","
    • ","
    ","
    "].join("")),templateRepoDependency:i.template(['
  • ',"Repository <%= repository.name %> revision <%= changeset_revision %> owned by <%= repository.owner %>","<% if (has_repository_dependencies) { %>",'
      ',"<% _.each(repository_dependencies, function(dependency) { %>","<% dependency.repository_dependency_template = repository_dependency_template; %>","<%= repository_dependency_template(dependency) %>","<% }); %>","
    ","<% } %>","
  • "].join("")),templateShedToolConf:i.template(['
    Shed tool configuration file:
    ','
    ','
    ','",'
    Select the file whose tool_path setting you want used for installing repositories.
    ',"
    ","
    "].join("")),templateToolDependency:i.template(["<% if (has_repository_dependencies) { %>","<% _.each(repository_dependencies, function(dependency) { %>","<% if (dependency.includes_tool_dependencies) { %>","<% dependency.tool_dependency_template = tool_dependency_template %>","<%= tool_dependency_template(dependency) %>","<% } %>","<% }); %>","<% } %>"].join("")),templateGlobalSectionCreate:i.template(['
    ','
    ','','','
    ',"Add a new tool panel section to contain the installed tools (optional).","
    ","
    ","
    "].join("")),templateGlobalSectionSelect:i.template(['
    ','
    Tool Panel Section
    ','
    ','
    ','",'','
    ',"Select an existing tool panel section to contain the installed tools (optional).","
    ","
    ","
    ","
    "].join("")),templateToolSectionCreate:i.template(['
    ','','',"
    "].join("")),templateToolSectionSelect:i.template(['
    ','",'','
    ',"
    "].join("")),templatePanelSelectOptions:i.template(["<% _.each(sections, function(section) { %>",'',"<% }); %>"].join(""))});t.default={RepoDetails:m}}).call(t,n(2),n(1),n(0))},311:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l),d=e.View.extend({el:"#center",defaults:[{}],initialize:function(e){var t=this;this.model=new s.default.RepoQueue,this.listenTo(this.model,"sync",this.render),this.model.fetch(),t.render()},render:function(e){var t=this,n=t.templateRepoQueue,r=t.model.models;t.$el.html(n({title:"Repository Installation Queue",repositories:r,queue:c.default.queueLength()})),i("#center").css("overflow","auto"),t.bindEvents()},bindEvents:function(){var t=this;i(".install_one").on("click",function(){var e=t.loadFromQueue(i(this).attr("data-repokey"));t.installFromQueue(e,i(this).attr("data-repokey"))}),i(".remove_one").on("click",function(){var e=i(this).attr("data-repokey"),t=JSON.parse(localStorage.repositories);if(t.hasOwnProperty(e)){var n=t[e].repository.id;delete t[e],i("#queued_repository_"+n).remove()}localStorage.repositories=JSON.stringify(t)}),i("#clear_queue").on("click",function(){localStorage.repositories="{}"}),i("#from_workflow").on("click",function(){e.history.navigate("workflows",{trigger:!0,replace:!0})})},installFromQueue:function(t,n){var r=Object();r.install_tool_dependencies=t.install_tool_dependencies,r.install_repository_dependencies=t.install_repository_dependencies,r.install_resolver_dependencies=t.install_resolver_dependencies,r.tool_panel_section=t.tool_panel_section,r.shed_tool_conf=t.shed_tool_conf,r.repositories=JSON.stringify([[t.repository.id,t.changeset_revision]]),r.tool_shed_repository_ids=JSON.stringify([t.repository.id]),r.tool_shed_url=n.split("|")[0],r.changeset=t.changeset_revision;var a=Galaxy.root+"api/tool_shed_repositories/install?async=True";if(i("#queued_repository_"+t.repository.id).remove(),localStorage.repositories){void 0===n&&(n=c.default.queueKey(t));var o=JSON.parse(localStorage.repositories);o.hasOwnProperty(n)&&(delete o[n],localStorage.repositories=JSON.stringify(o))}i.post(a,r,function(t){var n=JSON.parse(t),r=n.repositories,a="status/r/"+r.join("|");i.post(Galaxy.root+"admin_toolshed/install_repositories",n,function(e){console.log("Initializing repository installation succeeded")}),e.history.navigate(a,{trigger:!0,replace:!0})})},loadFromQueue:function(e){var t=JSON.parse(localStorage.repositories);if(t.hasOwnProperty(e))return t[e]},reDraw:function(e){this.$el.empty(),this.initialize(e),this.model.fetch(),this.render(e)},templateRepoQueue:r.template(['
    ','
    <%= title %>
    ','',"
    ",'
    ','','',"",'','','','','','',"","","","<% _.each(repositories, function(repository) { %>",'">','','','','','",'","","<% }); %>","","
    NameOwnerRevisionToolShedInstall
    <%= repository.get("repository").name %><%= repository.get("repository").owner %><%= repository.get("changeset_revision") %><%= repository.get("tool_shed_url") %>','" type="submit" id="install_repository_<%= repository.get("id") %>" name="install_repository" value="Install now" />',"','" type="submit" id="unqueue_repository_<%= repository.get("id") %>" name="unqueue_repository" value="Remove from queue" />',"
    ",'',"
    "].join(""))});t.default={RepoQueueView:d}}).call(t,n(2),n(0),n(1))},312:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l),d=e.View.extend({el:"#center",initialize:function(e){this.options=i.defaults(this.options||[{}],e,this.defaults),this.model=new s.default.RepoStatus,this.listenTo(this.model,"sync",this.render),this.model.url+="?repositories="+this.options.repositories.join("|"),this.model.fetch(),this.timer=setInterval(function(e){var t=["installed","error"],n=!0;i.some(e.model.models,function(e){repo_id=e.get("id");var i=e.get("status").toLowerCase();if(-1===t.indexOf(i))return n=!1,!0}),n?clearInterval(e.timer):e.model.fetch()},2e3,this)},close:function(){clearInterval(this.timer)},render:function(e){this.options=i.extend(this.options,e);var t=this.templateRepoStatus;this.$el.html(t({title:"Repository Status",repositories:this.model.models,queue:c.default.queueLength()})),r("#center").css("overflow","auto"),this.bindEvents()},bindEvents:function(){},reDraw:function(e){this.$el.empty(),this.initialize(e)},templateRepoStatus:i.template(['
    ','
    <%= title %>
    ','',"
    ",'",'','',"",'','','','','',"","",'',"<% _.each(repositories, function(repository) { %>","","","","","","","","<% }); %>","",'',"
    NameDescriptionOwnerRevisionInstallation Status
    ",'
    ','","
    ","
    ",'
    ','","
    ","
    ",'
    ','","
    ","
    ",'
    ','","
    ","
    ",'
    ','","
    ","
    "].join(""))});t.default={RepoStatus:d}}).call(t,n(2),n(1),n(0))},313:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=a(o),l=n(18),c=a(l),d=e.View.extend({el:"#center",defaults:[{}],initialize:function(e){var t=this;this.model=new s.default.WorkflowTools,this.listenTo(this.model,"sync",this.render),this.model.fetch(),t.render()},render:function(e){var t=this,n=t.templateWorkflows,r=t.model.models;t.$el.html(n({title:"Workflows Missing Tools",workflows:r,queue:c.default.queueLength()})),i("#center").css("overflow","auto"),t.bindEvents()},bindEvents:function(){var t,n=this;i(".show_wf_repo").on("click",function(){var n=i(this).attr("data-toolids"),r=i(this).attr("data-shed"),a=Galaxy.root+"api/tool_shed/repository",o={tool_ids:n};i.get(a,o,function(n){t=n.repository.id;var i="repository/s/"+r.replace(/:/g,"%3a").replace(/\//g,"%2f")+"/r/"+n.repository.id;e.history.navigate(i,{trigger:!0,replace:!0})})}),i(".queue_wf_repo").on("click",function(){var e=i(this),n=e.attr("data-toolids"),r=e.attr("data-shed"),a=Galaxy.root+"api/tool_shed/repository",o={tool_ids:n};i.get(a,o,function(n){t=n.repository.id,o={tool_shed_url:r,repository_id:t},i.get(a,o,function(t){var n=Object.keys(t.repository.metadata),i=n[0],a=t.repository.metadata[i];a.tool_shed_url=r,c.default.addToQueue(a),e.remove()})})}),i("#from_workflow").on("click",n.loadWorkflows)},reDraw:function(e){this.$el.empty(),this.initialize(e)},templateWorkflows:r.template(['
    ','
    <%= title %>
    ','',"
    ",'",'','',"",'','','','','','',"","","","<% _.each(workflows, function(workflow) { %>","",'",'",'','','','","","<% }); %>","",""].join(""))});t.default={Workflows:d}}).call(t,n(2),n(0),n(1))},61:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={tool:"fa-wrench",data_input:"fa-file-o",data_collection_input:"fa-folder-o",subworkflow:"fa-sitemap fa-rotate-270",pause:"fa-pause"}}},[284]); \ No newline at end of file diff --git a/static/scripts/mvc/toolshed/repository-view.js b/static/scripts/mvc/toolshed/repository-view.js index c1c8e15e698e..f4d374e912ad 100644 --- a/static/scripts/mvc/toolshed/repository-view.js +++ b/static/scripts/mvc/toolshed/repository-view.js @@ -1 +1 @@ -define("mvc/toolshed/repository-view",["exports","mvc/toolshed/toolshed-model","libs/jquery/jstree","utils/utils","mvc/ui/ui-modal","mvc/form/form-view","mvc/toolshed/util"],function(e,t,o,i,n,l,s){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0});var d=a(t),r=(a(o),a(i)),c=a(n),p=a(l),h=a(s),u=Backbone.View.extend({el:"#center",initialize:function(e){this.options=_.defaults(this.options||{},this.defaults),this.model=new d.default.RepositoryCollection,this.listenTo(this.model,"sync",this.render);var t=e.tool_shed.replace(/\//g,"%2f");this.model.url+="?tool_shed_url="+t+"&repository_id="+e.repository_id,this.model.tool_shed_url=e.tool_shed.replace(/%2f/g,"/"),this.model.tool_shed=t,this.model.category=e.repository_id,this.model.fetch()},render:function(e){var t=this.templateRepoDetails,o=this.model.models[0];this.options={repository:o.get("repository"),tool_shed:this.model.tool_shed,queue:h.default.queueLength()};var i=Object.keys(this.options.repository.metadata);this.options.current_changeset=this.options.current_changeset||i[i.length-1],this.options.current_metadata=this.options.repository.metadata[this.options.current_changeset],this.options.current_metadata.tool_shed_url=this.model.tool_shed_url,this.options.tools=this.options.current_metadata.tools,this.options.repository_dependencies_template=this.templateRepoDependencies,this.options.repository_dependency_template=this.templateRepoDependency,this.options.tps_template_global_select=this.templateGlobalSectionSelect,this.options.tps_template_tool_select=this.templateToolSectionSelect,this.options.tps_select_options=this.templatePanelSelectOptions,this.options.tool_dependencies=o.get("tool_dependencies"),this.options.shed_tool_conf=this.templateShedToolConf({shed_tool_confs:o.get("shed_conf")}),console.log(o.get("shed_conf")),this.options.panel_section_dict=o.get("panel_section_dict"),this.options.api_url=Galaxy.root+"api/tool_shed_repositories/install?async=True",this.options=_.extend(this.options,e),this.$el.html(t(this.options)),this.checkInstalled(this.options.current_metadata),this.bindEvents(),$("#center").css("overflow","auto")},bindEvents:function(){var e=this;$("#changeset").on("change",function(){e.options.current_changeset=$("#changeset").find("option:selected").text(),e.options.current_metadata=e.options.repository.metadata[e.options.current_changeset],e.checkInstalled(e.options.current_metadata),e.reDraw()}),$("#tool_panel_section_select").on("change",function(){e.tpsSelection()}),$("#install_repository").on("click",function(t){$("#repository_installation");t.preventDefault();var o={};o.repositories=JSON.stringify([[$("#install_repository").attr("data-tsrid"),$("#changeset").find("option:selected").val()]]),o.tool_shed_repository_ids=JSON.stringify([$("#install_repository").attr("data-tsrid")]),o.tool_shed_url=e.model.tool_shed_url,o.install_tool_dependencies=$("#install_tool_dependencies").val(),o.install_repository_dependencies=$("#install_repository_dependencies").val(),o.install_resolver_dependencies=$("#install_resolver_dependencies").val();e.panelSelect(o);o.tool_panel_section=JSON.stringify(e.panelSelect(o)),o.shed_tool_conf=$("select[name='shed_tool_conf']").find("option:selected").val(),o.changeset=$("#changeset").find("option:selected").val();var i=$("#repository_installation").attr("action");e.prepareInstall(o,i)}),$("#queue_install").on("click",function(t){e.options.current_changeset=$("#changeset").find("option:selected").text(),e.options.current_metadata=e.options.repository.metadata[e.options.current_changeset];e.options.current_changeset;var o={};_.each(Object.keys(e.options.current_metadata),function(t){o[t]||(o[t]=e.options.current_metadata[t])}),o.install_tool_dependencies=$("#install_tool_dependencies").val(),o.install_repository_dependencies=$("#install_repository_dependencies").val(),o.install_resolver_dependencies=$("#install_resolver_dependencies").val(),o.tool_panel_section=JSON.stringify(e.panelSelect({})),o.shed_tool_conf=$("select[name='shed_tool_conf']").find("option:selected").val(),o.tool_shed_url=e.model.tool_shed_url,"/"==o.tool_shed_url.substr(-1)&&(o.tool_shed_url=o.tool_shed_url.substr(0,o.tool_shed_url.length-1)),h.default.addToQueue(o),e.checkInstalled(o)}),$(".tool_panel_section_picker").on("change",function(){$(this).find("option:selected").val()==$("#tool_panel_section_select").find("option:selected").val()?$(this).attr("default","active"):$(this).removeAttr("default")}),$(function(){$("#repository_dependencies").jstree()}),$(".tool_form").on("click",function(){var t=$(this).attr("data-guid"),o=($(this).attr("data-clean"),$(this).attr("data-name")),i=$(this).attr("data-desc"),n=e.model.tool_shed_url,l=$("#repository_details").attr("data-tsrid"),s=$("#changeset").find("option:selected").val(),a=Galaxy.root+"api/tool_shed/tool_json",d={guid:t,tool_shed_url:n,tsr_id:l,changeset:s};$.get(a,d,function(e){e.cls="ui-portlet-plain";var t=new p.default(e);r.default.deepeach(e.inputs,function(e){e.type&&-1!=["data","data_collection"].indexOf(e.type)&&(e.type="hidden",e.info="Data input '"+e.name+"' ("+r.default.textify(e.extensions)+")")});var n=new c.default.View,l=""+o+" "+i;n.show({closing_events:!0,title:l,body:t.$el,buttons:{Close:function(){n.hide()}}})})})},checkInstalled:function(e){var t=this,o={name:e.name,owner:e.owner},i=!1;t.repoQueued(e);$.get(Galaxy.root+"api/tool_shed_repositories",o,function(o){for(var n=0;n','
    Repository information for <%= repository.name %> from <%= repository.owner %>
    ','',"",'
    ','
    ','','','
    ','
    Changeset
    ','
    ','",'','','
    Please select a revision and review the settings below before installing.
    ',"
    ","
    ","<%= shed_tool_conf %>","<% if (current_metadata.has_repository_dependencies) { %>",'
    Repository dependencies for <%= current_changeset %>
    ','
    ','

    ','','',"

    ","<% current_metadata.repository_dependency_template = repository_dependency_template; %>",'
    ','","<%= repository_dependencies_template(current_metadata) %>","
    ","
    ","<% } %>","<% if (current_metadata.includes_tool_dependencies) { %>",'
    Tool dependencies
    ','
    ','

    ','','',"

    ",'

    ','','',"

    ",'
    WorkflowsTool IDsShedNameOwnerActions
    ','
      ','<% _.each(workflow.get("workflows"), function(name) { %>','
    • <%= name %>
    • ',"<% }); %>","
    ","
    ','
      ','<% _.each(workflow.get("tools"), function(tool) { %>','
    • <%= tool %>
    • ',"<% }); %>","
    ","
    <%= workflow.get("shed") %><%= workflow.get("repository") %><%= workflow.get("owner") %>','
      ','
    • ','" data-owner="<%= workflow.get("owner") %>" data-repo="<%= workflow.get("repository") %>" data-toolids="<%= workflow.get("tools").join(",") %>" value="Show Repository" />
    • ',"
    ","
    ',"",'','',"","","","",'',"<% _.each(tool_dependencies[current_changeset], function(dependency) { %>",'','","","","","<% }); %>","","
    NameVersionType
    ',"<%= dependency.name %><%= dependency.version %><%= dependency.type %>
    ","
    ","
    ","<% } %>","<% if (current_metadata.includes_tools_for_display_in_tool_panel) { %>",'
    Tools – click the name to preview the tool and use the pop-up menu to inspect all metadata
    ','
    ','
    ','',"",'','',"","","","",'',"<% _.each(current_metadata.tools, function(tool) { %>",'','","",'','","","<% }); %>","","
    NameDescriptionVersion<%= tps_template_global_select({tps: panel_section_dict, tps_select_options: tps_select_options}) %>
    ','","<%= tool.description %><%= tool.version %>',"<%= tps_template_tool_select({tool: tool, tps: panel_section_dict, tps_select_options: tps_select_options}) %>","
    ","
    ","
    ","<% } %>","","
    "].join("")),templateRepoDependencies:_.template(['
    Repository Dependencies
    ','
    ',"
      ","
    • Repository installation requires the following","<% if (has_repository_dependencies) { %>","<% _.each(repository_dependencies, function(dependency) { %>","<% dependency.repository_dependency_template = repository_dependency_template; %>","<%= repository_dependency_template(dependency) %>","<% }); %>","<% } %>","
    • ","
    ","
    "].join("")),templateRepoDependency:_.template(['
  • ',"Repository <%= repository.name %> revision <%= changeset_revision %> owned by <%= repository.owner %>","<% if (has_repository_dependencies) { %>",'
      ',"<% _.each(repository_dependencies, function(dependency) { %>","<% dependency.repository_dependency_template = repository_dependency_template; %>","<%= repository_dependency_template(dependency) %>","<% }); %>","
    ","<% } %>","
  • "].join("")),templateShedToolConf:_.template(['
    Shed tool configuration file:
    ','
    ','
    ','",'
    Select the file whose tool_path setting you want used for installing repositories.
    ',"
    ","
    "].join("")),templateToolDependency:_.template(["<% if (has_repository_dependencies) { %>","<% _.each(repository_dependencies, function(dependency) { %>","<% if (dependency.includes_tool_dependencies) { %>","<% dependency.tool_dependency_template = tool_dependency_template %>","<%= tool_dependency_template(dependency) %>","<% } %>","<% }); %>","<% } %>"].join("")),templateGlobalSectionCreate:_.template(['
    ','
    ','','','
    ',"Add a new tool panel section to contain the installed tools (optional).","
    ","
    ","
    "].join("")),templateGlobalSectionSelect:_.template(['
    ','
    Tool Panel Section
    ','
    ','
    ','",'','
    ',"Select an existing tool panel section to contain the installed tools (optional).","
    ","
    ","
    ","
    "].join("")),templateToolSectionCreate:_.template(['
    ','','',"
    "].join("")),templateToolSectionSelect:_.template(['
    ','",'','
    ',"
    "].join("")),templatePanelSelectOptions:_.template(["<% _.each(sections, function(section) { %>",'',"<% }); %>"].join(""))});e.default={RepoDetails:u}}); \ No newline at end of file +define("mvc/toolshed/repository-view",["exports","mvc/toolshed/toolshed-model","libs/jquery/jstree","utils/utils","mvc/ui/ui-modal","mvc/form/form-view","mvc/toolshed/util"],function(e,t,o,i,n,l,s){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0});var d=a(t),r=(a(o),a(i)),c=a(n),p=a(l),h=a(s),u=Backbone.View.extend({el:"#center",initialize:function(e){this.options=_.defaults(this.options||{},this.defaults),this.model=new d.default.RepositoryCollection,this.listenTo(this.model,"sync",this.render);var t=e.tool_shed.replace(/\//g,"%2f");this.model.url+="?tool_shed_url="+t+"&repository_id="+e.repository_id,this.model.tool_shed_url=e.tool_shed.replace(/%2f/g,"/"),this.model.tool_shed=t,this.model.category=e.repository_id,this.model.fetch()},render:function(e){var t=this.templateRepoDetails,o=this.model.models[0];this.options={repository:o.get("repository"),tool_shed:this.model.tool_shed,queue:h.default.queueLength()};var i=Object.keys(this.options.repository.metadata);this.options.current_changeset=this.options.current_changeset||i[i.length-1],this.options.current_metadata=this.options.repository.metadata[this.options.current_changeset],this.options.current_metadata.tool_shed_url=this.model.tool_shed_url,this.options.tools=this.options.current_metadata.tools,this.options.repository_dependencies_template=this.templateRepoDependencies,this.options.repository_dependency_template=this.templateRepoDependency,this.options.tps_template_global_select=this.templateGlobalSectionSelect,this.options.tps_template_tool_select=this.templateToolSectionSelect,this.options.tps_select_options=this.templatePanelSelectOptions,this.options.tool_dependencies=o.get("tool_dependencies"),this.options.shed_tool_conf=this.templateShedToolConf({shed_tool_confs:o.get("shed_conf")}),this.options.panel_section_dict=o.get("panel_section_dict"),this.options.api_url=Galaxy.root+"api/tool_shed_repositories/install?async=True",this.options=_.extend(this.options,e),this.$el.html(t(this.options)),this.checkInstalled(this.options.current_metadata),this.bindEvents(),$("#center").css("overflow","auto")},bindEvents:function(){var e=this;$("#changeset").on("change",function(){e.options.current_changeset=$("#changeset").find("option:selected").text(),e.options.current_metadata=e.options.repository.metadata[e.options.current_changeset],e.checkInstalled(e.options.current_metadata),e.reDraw()}),$("#tool_panel_section_select").on("change",function(){e.tpsSelection()}),$("#install_repository").on("click",function(t){$("#repository_installation");t.preventDefault();var o={};o.repositories=JSON.stringify([[$("#install_repository").attr("data-tsrid"),$("#changeset").find("option:selected").val()]]),o.tool_shed_repository_ids=JSON.stringify([$("#install_repository").attr("data-tsrid")]),o.tool_shed_url=e.model.tool_shed_url,o.install_tool_dependencies=$("#install_tool_dependencies").val(),o.install_repository_dependencies=$("#install_repository_dependencies").val(),o.install_resolver_dependencies=$("#install_resolver_dependencies").val();e.panelSelect(o);o.tool_panel_section=JSON.stringify(e.panelSelect(o)),o.shed_tool_conf=$("select[name='shed_tool_conf']").find("option:selected").val(),o.changeset=$("#changeset").find("option:selected").val();var i=$("#repository_installation").attr("action");e.prepareInstall(o,i)}),$("#queue_install").on("click",function(t){e.options.current_changeset=$("#changeset").find("option:selected").text(),e.options.current_metadata=e.options.repository.metadata[e.options.current_changeset];e.options.current_changeset;var o={};_.each(Object.keys(e.options.current_metadata),function(t){o[t]||(o[t]=e.options.current_metadata[t])}),o.install_tool_dependencies=$("#install_tool_dependencies").val(),o.install_repository_dependencies=$("#install_repository_dependencies").val(),o.install_resolver_dependencies=$("#install_resolver_dependencies").val(),o.tool_panel_section=JSON.stringify(e.panelSelect({})),o.shed_tool_conf=$("select[name='shed_tool_conf']").find("option:selected").val(),o.tool_shed_url=e.model.tool_shed_url,"/"==o.tool_shed_url.substr(-1)&&(o.tool_shed_url=o.tool_shed_url.substr(0,o.tool_shed_url.length-1)),h.default.addToQueue(o),e.checkInstalled(o)}),$(".tool_panel_section_picker").on("change",function(){$(this).find("option:selected").val()==$("#tool_panel_section_select").find("option:selected").val()?$(this).attr("default","active"):$(this).removeAttr("default")}),$(function(){$("#repository_dependencies").jstree()}),$(".tool_form").on("click",function(){var t=$(this).attr("data-guid"),o=($(this).attr("data-clean"),$(this).attr("data-name")),i=$(this).attr("data-desc"),n=e.model.tool_shed_url,l=$("#repository_details").attr("data-tsrid"),s=$("#changeset").find("option:selected").val(),a=Galaxy.root+"api/tool_shed/tool_json",d={guid:t,tool_shed_url:n,tsr_id:l,changeset:s};$.get(a,d,function(e){e.cls="ui-portlet-plain";var t=new p.default(e);r.default.deepeach(e.inputs,function(e){e.type&&-1!=["data","data_collection"].indexOf(e.type)&&(e.type="hidden",e.info="Data input '"+e.name+"' ("+r.default.textify(e.extensions)+")")});var n=new c.default.View,l=""+o+" "+i;n.show({closing_events:!0,title:l,body:t.$el,buttons:{Close:function(){n.hide()}}})})})},checkInstalled:function(e){var t=this,o={name:e.name,owner:e.owner},i=!1;t.repoQueued(e);$.get(Galaxy.root+"api/tool_shed_repositories",o,function(o){for(var n=0;n','
    Repository information for <%= repository.name %> from <%= repository.owner %>
    ','',"
    ",'
    ','
    ','','','
    ','
    Changeset
    ','
    ','",'','','
    Please select a revision and review the settings below before installing.
    ',"
    ","
    ","<%= shed_tool_conf %>","<% if (current_metadata.has_repository_dependencies) { %>",'
    Repository dependencies for <%= current_changeset %>
    ','
    ','

    ','','',"

    ","<% current_metadata.repository_dependency_template = repository_dependency_template; %>",'
    ','","<%= repository_dependencies_template(current_metadata) %>","
    ","
    ","<% } %>","<% if (current_metadata.includes_tool_dependencies) { %>",'
    Tool dependencies
    ','
    ','

    ','','',"

    ",'

    ','','',"

    ",'
    ','",'',"",'','',"","","","",'',"<% _.each(tool_dependencies[current_changeset], function(dependency) { %>",'','","","","","<% }); %>","","
    NameVersionType
    ',"<%= dependency.name %><%= dependency.version %><%= dependency.type %>
    ","
    ","
    ","<% } %>","<% if (current_metadata.includes_tools_for_display_in_tool_panel) { %>",'
    Tools – click the name to preview the tool and use the pop-up menu to inspect all metadata
    ','
    ','
    ','',"",'','',"","","","",'',"<% _.each(current_metadata.tools, function(tool) { %>",'','","",'','","","<% }); %>","","
    NameDescriptionVersion<%= tps_template_global_select({tps: panel_section_dict, tps_select_options: tps_select_options}) %>
    ','","<%= tool.description %><%= tool.version %>',"<%= tps_template_tool_select({tool: tool, tps: panel_section_dict, tps_select_options: tps_select_options}) %>","
    ","
    ","
    ","<% } %>","
    ","
    "].join("")),templateRepoDependencies:_.template(['
    Repository Dependencies
    ','
    ',"
      ","
    • Repository installation requires the following","<% if (has_repository_dependencies) { %>","<% _.each(repository_dependencies, function(dependency) { %>","<% dependency.repository_dependency_template = repository_dependency_template; %>","<%= repository_dependency_template(dependency) %>","<% }); %>","<% } %>","
    • ","
    ","
    "].join("")),templateRepoDependency:_.template(['
  • ',"Repository <%= repository.name %> revision <%= changeset_revision %> owned by <%= repository.owner %>","<% if (has_repository_dependencies) { %>",'
      ',"<% _.each(repository_dependencies, function(dependency) { %>","<% dependency.repository_dependency_template = repository_dependency_template; %>","<%= repository_dependency_template(dependency) %>","<% }); %>","
    ","<% } %>","
  • "].join("")),templateShedToolConf:_.template(['
    Shed tool configuration file:
    ','
    ','
    ','",'
    Select the file whose tool_path setting you want used for installing repositories.
    ',"
    ","
    "].join("")),templateToolDependency:_.template(["<% if (has_repository_dependencies) { %>","<% _.each(repository_dependencies, function(dependency) { %>","<% if (dependency.includes_tool_dependencies) { %>","<% dependency.tool_dependency_template = tool_dependency_template %>","<%= tool_dependency_template(dependency) %>","<% } %>","<% }); %>","<% } %>"].join("")),templateGlobalSectionCreate:_.template(['
    ','
    ','','','
    ',"Add a new tool panel section to contain the installed tools (optional).","
    ","
    ","
    "].join("")),templateGlobalSectionSelect:_.template(['
    ','
    Tool Panel Section
    ','
    ','
    ','",'','
    ',"Select an existing tool panel section to contain the installed tools (optional).","
    ","
    ","
    ","
    "].join("")),templateToolSectionCreate:_.template(['
    ','','',"
    "].join("")),templateToolSectionSelect:_.template(['
    ','",'','
    ',"
    "].join("")),templatePanelSelectOptions:_.template(["<% _.each(sections, function(section) { %>",'',"<% }); %>"].join(""))});e.default={RepoDetails:u}}); \ No newline at end of file